mformat creating disk image with bad partition table.
Posted: Wed Apr 06, 2022 6:46 pm
Hey all,
I'm working on a simple bootloader, and I'm running into some issue with by build environment. To generate my bootable image, I have a Makefile that looks like
but when my MBR attempts to read the LBA of the active partition from the partition table, it just reads 0's. I have checked a hexdump of the disk image, and the relevant bytes are indeed 0. I was under the impression that these bytes should give me the LBA of the boot record of the partition, so I'm not sure why it's 0 in the generated disk image. I have also checked the image generated before my MBR is copied in, in case I was somehow overwriting it, and the same problem exists. I'm not really sure what the issue is here. Is there some utility that I have to use in order to properly initialize the partition table? Is these bytes being 0 actually correct? If so, how do I know which sectors to load from disk to get the boot record of the active partition?
I'm working on a simple bootloader, and I'm running into some issue with by build environment. To generate my bootable image, I have a Makefile that looks like
Code: Select all
all: target/bootloader target/disk.iso
target/bootloader:
mkdir -p target
nasm -o target/bootloader src/stage1.s
target/disk.iso: target/bootloader
mformat -FC -i target/disk.iso -T 66581
dd if=target/bootloader of=target/disk.iso bs=1 count=446 conv=notrunc
dd if=target/bootloader of=target/disk.iso bs=1 count=2 skip=510 seek=510 conv=notrunc