Page 1 of 1

Bare Bones tutorial , problem with kernel boot

Posted: Sat Jan 30, 2010 8:14 am
by rage
Hi

I'm really new to OS development , I have theoretic OS knowledge and I decided that I want to
start learning by doing.
I've read some of the tutorials out there and the Bare Bones tutorial was the best I've found.So I
decided to work according to it.

I'm working on a virtual box (Sun's virtual box) running Ubuntu,
I've compiled and linked all the needed files , installed qemu emulator and created the kernel image.
After running qemu with the given command: qemu -fda floppy.img the GRUB command prompt is displayed.
As instructed I've calculated the number of kernel blocks( kernel.bin size is 4976 --> 10 blocks)
but when I type kernel 200 + 10 I'm receiving an Error 13.

I've tried to read and look for similar problems here and on the net but couldn't find any.
I ran 'mbchk' as suggested in the tutorial but all checks passed.

BUT I did notice a strange thing , according to the tutorial I created a pad file (of length 750).
Quote: "Also create a file named pad with exactly 750 bytes (content does not matter; more precisely, the 750 is the result of 102400 - len(stage1)- len(stage2)). eg: 102400 - (512 + 101138) = 750"
I checked the size of stage1 file and it is indeed 512 , but the size of stage2 is NOT 101138 but
121468 , which gives a negative number according to the equation above.
I really don't know if this has something to do with my kernel not working.

I would really appreciate any help with this.
Thank you.

Re: Bare Bones tutorial , problem with kernel boot

Posted: Sat Jan 30, 2010 12:03 pm
by rage
I fixed the problem , the problem was in fact due to the incorrect size of stage2 which is assumed
in the tutorial to be 101138 (and it is NOT correct), I copied the stage1 and stage2 files from an older package and it worked.

I think you need to correct this in the tutorial , or at least explain what are you doing in this computation of the pad file size , and make a note that this computation is wrong for other versions of GRUB.

Re: Bare Bones tutorial , problem with kernel boot

Posted: Sat Jan 30, 2010 1:07 pm
by gravaera
Nah: I think that tutorial should remain just the same ;)

Re: Bare Bones tutorial , problem with kernel boot

Posted: Sun Jan 31, 2010 2:24 pm
by Selenic
The stage2 length is for the copy of GRUB linked to by the page it is mentioned on, which (IIRC) is 0.95; for 0.97 it is indeed a bit longer, specifically just under 208 sectors, so you could pad it out to that length, or just get the stage2 from the wiki...