From 451ff6b5a3e75f872cf650a8d05fe326a8893c36 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 16 Mar 2020 14:47:21 -0400 Subject: [PATCH] Fix geometry in dir2img The geometry was incorrect in dir2img, ensure the file is a multiple of 512 bytes. --- confluent_client/bin/dir2img | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confluent_client/bin/dir2img b/confluent_client/bin/dir2img index e54f86ad..233f4e55 100644 --- a/confluent_client/bin/dir2img +++ b/confluent_client/bin/dir2img @@ -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']