Code: Select all
mount disk.img disk_mount
dd conv=notrunc if=Boot/Bootloader/Stage2/stage2.bin of=disk_mount/stage2.sys
Sometimes (not always) Linux will move the file on the disk - examining the disk with a hex editor reveals that the old stage2.sys file contents are on the disk still and the new stage2.sys contents are also on the disk. But my boot sector, of course, isn't aware that the file has moved on disk.
The FAT file system has a feature where a file can be given the system flag which tells the operating system not to move the file contents on disk. Does EXT2 have a similar feature? I checked the wiki page and asked google but couldn't find anything there.
Alternatively, is there a way to reserve more than the first 1024 bytes of the partition so I can store my 20KB bootloader file there?
Any help / ideas are appreciated.