Page 1 of 1

tutorial - bootloaders4

Posted: Tue Jan 15, 2008 12:38 am
by phoboss
hi, i gotta a little problem deploying code from bootloaders4 tutorial. i'm working under linux so there is no partcopy or floppy imaging software for me so i use following technique:
1. i mount an image of an empty floppy disk (i don't have FDD - notebook)
2. i copy the stage 2 binary to the disk
3. i umount the image
4. i copy raw binary data to the bootsector using

Code: Select all

dd if=stage1.bin of=floppy.img
but the stage1 complains that it can't locate the file on the floppy. when i reverse the process (i.e. first dd stage1, then try to mount & copy stage2), shell complains that it can't copy the file to the mounted disk because of the lack of free space (which is nonsense). i suppose the problem will be in the dd tool. did anyone here met this problem?[/code]

Posted: Tue Jan 15, 2008 5:01 pm
by Andyhhp
I have no experience with linux but I do have a couple of suggestions.

Firstly, is the floppy.img file 1.44meg? That sometimes results in a problem under windows.

Secondly, Are you sure you got the BPB correct at the start of the bootloader. If you had the totalsectors entry set to something less than 25 or so, there would not be space for stage2 after the root directory.

Does this help?

Andrew

Posted: Tue Jan 15, 2008 7:38 pm
by phoboss
i solved the problem so there it is:
the right syntax of the dd command for this situation is

Code: Select all

dd if=boot.bin of=floppy.img conv=notrunc
the last directive makes the tool behave as we'd expect: just write the bootsector to the image and leave. the default behavior is to copy the data and truncate the output file to the size of that data (which caused the no-space-left problem)[/code]