2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-12-24 12:11:52 +00:00

Fix geometry in dir2img

The geometry was incorrect in dir2img, ensure the file is
a multiple of 512 bytes.
This commit is contained in:
Jarrod Johnson 2020-03-16 14:47:21 -04:00
parent b3c49c532c
commit 451ff6b5a3

View File

@ -17,13 +17,13 @@ def create_image(directory, image):
filename = os.path.join(dir[0], filen)
currsz = os.path.getsize(filename)
# assuming up to 65k cluster
currsz = (currsz // 65536 +1) * 65536
currsz = (currsz // 512 +1) * 512
datasz += currsz
datasz += ents * 32768
datasz = datasz // 512 + 1
with open(image, 'wb') as imgfile:
imgfile.seek(datasz)
imgfile.seek(datasz * 512 - 1)
imgfile.write(b'\x00')
datasz = datasz // 512
subprocess.check_call(['mformat', '-i', image, '-d', '1', '-t',
str(datasz), '-s', '1','-h', '1', '::'])
cpycmd = ['mcopy', '-i', image, '-s']