Changeset 20235a3 in mainline for tools/mkfat.py


Ignore:
Timestamp:
2010-09-02T20:55:28Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0c39b96
Parents:
0c61955 (diff), 3249673 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/mkfat.py

    r0c61955 r20235a3  
    343343def usage(prname):
    344344        "Print usage syntax"
    345         print prname + " <PATH> <IMAGE>"
     345        print prname + " <EXTRA_BYTES> <PATH> <IMAGE>"
    346346
    347347def main():
    348         if (len(sys.argv) < 3):
     348        if (len(sys.argv) < 4):
    349349                usage(sys.argv[0])
    350350                return
    351351       
    352         path = os.path.abspath(sys.argv[1])
     352        if (not sys.argv[1].isdigit()):
     353                print "<EXTRA_BYTES> must be a number"
     354                return
     355       
     356        extra_bytes = int(sys.argv[1])
     357       
     358        path = os.path.abspath(sys.argv[2])
    353359        if (not os.path.isdir(path)):
    354360                print "<PATH> must be a directory"
     
    365371       
    366372        # Make sure the filesystem is large enought for FAT16
    367         size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size
     373        size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
    368374        while (size / cluster_size < fat16_clusters):
    369375                if (cluster_size > sector_size):
    370376                        cluster_size /= 2
    371                         size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size
     377                        size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
    372378                else:
    373379                        size = fat16_clusters * cluster_size + reserved_clusters * cluster_size
     
    381387        data_start = root_start + root_size
    382388       
    383         outf = file(sys.argv[2], "w")
     389        outf = file(sys.argv[3], "w")
    384390       
    385391        boot_sector = xstruct.create(BOOT_SECTOR)
Note: See TracChangeset for help on using the changeset viewer.