diff --git a/scripts/dbgblock.py b/scripts/dbgblock.py index b29814d1..a6358345 100755 --- a/scripts/dbgblock.py +++ b/scripts/dbgblock.py @@ -124,26 +124,25 @@ def main(disk, block=None, *, else off[1] - off[0] if isinstance(off, tuple) and len(off) > 1 else block_size) - # print the header - print('block %s, size %d' % ( - '0x%x.%x' % (block, off) - if off is not None - else '0x%x' % block, - size)) - # read the block f.seek((block * block_size) + (off or 0)) data = f.read(size) + # calculate checksum + cksum = crc32c(data) + + # print the header + print('block %s, size %d, cksum %08x' % ( + '0x%x.%x' % (block, off) + if off is not None + else '0x%x' % block, + size, + cksum)) + # render the hex view for o, line in enumerate(xxd(data)): print('%08x: %s' % ((off or 0) + 16*o, line)) - # render the checksum if requested - if cksum: - cksum = crc32c(data) - print('%8s: %08x' % ('crc32c', cksum)) - if __name__ == "__main__": import argparse import sys @@ -178,10 +177,6 @@ if __name__ == "__main__": int(x, 0) if x.strip() else None for x in x.split(',')), help="Show this many bytes, may be a range.") - parser.add_argument( - '-c', '--cksum', '--crc32c', - action='store_true', - help="Calculate and show the crc32c of the data.") sys.exit(main(**{k: v for k, v in vars(parser.parse_intermixed_args()).items() if v is not None}))