tutorial - bootloaders4

If you are new to OS Development, plan on spending some time here first before going into the other forums.

Moderator:Moderators

Post Reply
phoboss
Posts:2
Joined:Tue Jan 15, 2008 12:30 am
tutorial - bootloaders4

Post by phoboss » Tue Jan 15, 2008 12:38 am

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]
bad guys always have better technology

Andyhhp
Moderator
Posts:387
Joined:Tue Oct 23, 2007 10:05 am
Location:127.0.0.1
Contact:

Post by Andyhhp » Tue Jan 15, 2008 5:01 pm

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
Image

phoboss
Posts:2
Joined:Tue Jan 15, 2008 12:30 am

Post by phoboss » Tue Jan 15, 2008 7:38 pm

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]
bad guys always have better technology

Post Reply