OS Dev Demo11

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

Moderator:Moderators

Post Reply
johnnyBB
Posts:4
Joined:Thu Aug 06, 2009 11:09 am
OS Dev Demo11

Post by johnnyBB » Thu Aug 06, 2009 11:32 am

Hi everyone, first time poster here!

Is there any reason why the Demos from the OS Dev series would only boot fully from floppy media and not USB/CF? Things seem to be getting stuck at the 2nd bootloader stage; it just seems to hang indefinitely after the 1st stage has loaded. Can anybody shed any light on why this might be happening? Everything works fine on floppies btw.

On a separate point regarding the code for demo11 itself, can someone confirm if when available free memory is allocated and initialized in 'main.c' that that the memory locations are actually set to some fixed(or random) value? Also if it doesn't work like this can anyone suggest how this might be achieved? For example setting all allocated memory to either '1' or '0'...

Thanks in advance for your help guys...

Cheers

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

Re: OS Dev Demo11

Post by Andyhhp » Thu Aug 06, 2009 1:30 pm

Is there any reason why the Demos from the OS Dev series would only boot fully from floppy media and not USB/CF?
How are you testing the code? The bootloader developed here makes many assuptions that it is on a floppy disk and nothing else so you will have to undo those assumptions when using other media.
can someone confirm if when available free memory is allocated and initialized
AFAIR, it is not initialised at all which means it will have whatever was last in memory in it. This is no different from programming C/C++ on any other platform (with the exception SymbianOS and certain debug libraries) but it means you MUST initialise your data to sane values before you try using them.

~Andrew
Image

johnnyBB
Posts:4
Joined:Thu Aug 06, 2009 11:09 am

Re: OS Dev Demo11

Post by johnnyBB » Thu Aug 06, 2009 2:08 pm

Hi Andy,

Thanx for the reply. Well up until I tried testing the code on my USB stick I was testing on both Bochs and a real PC, whereby Bochs struggled to fully boot but the real PC was just fine. So from what you're saying it looks like I'm gonna have to make some changes to the 1st stage boot code (so back to the tuts then...)

Cheers

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

Re: OS Dev Demo11

Post by Andyhhp » Thu Aug 06, 2009 6:18 pm

Well - the code in the bootloader exclusivly lookes for the 2nd stage on the first floppy disk present.

If you just copied the bootloader onto the first sector of a USB pen then that is most likely your problem.

Unfortunatly, without BIOS support (which is getting better these days), its impossble to boot directly from a USB pen.

There is now support for the BIOS to emulate USB devices as hard drive device (if supported) at which point you can index it using a different drive number on the int 13 call.

Luckily, to help you out, the OS gives you the boot drive in dl register when you enter your bootloader.

I suggest you store this value and re-load it for the int 13 call later on (rather than using 0).


If you are really lucky, this is the only change you need to make to make the bootloader able to be booted from any drive the int 13 interrupt can handle!

Good Luck!

~Andrew
Image

johnnyBB
Posts:4
Joined:Thu Aug 06, 2009 11:09 am

Re: OS Dev Demo11

Post by johnnyBB » Thu Aug 06, 2009 6:51 pm

Hi,

This sounds really promising then...thankfully my bios does support USB boot and I have already successfully booted very simple 'hello world' .asm bootcode from the usb stick. I realise that for all I want to do i.e. just allocate, initialze and erase some ram, the full blown kernel approach is definitely overkill and I could probably just do this in the 1st stage boot code however the full blown method seems a far more elegant way to implement the solution!

Cheers

johnnyBB
Posts:4
Joined:Thu Aug 06, 2009 11:09 am

Re: OS Dev Demo11

Post by johnnyBB » Fri Aug 07, 2009 3:43 pm

Hi Andrew,

Rather sadly I have not been that lucky! Either I didn't do things right or it wasn't meant to be that simple. I read somewhere that Mike had plans to extend the bootloader capability to include HDD, CDROM and even USB. Any idea if this has been implemented yet?

Cheers

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

Re: OS Dev Demo11

Post by Andyhhp » Mon Aug 17, 2009 9:00 am

The tutorials are going to be extended soon to include USB booting and alternate filesystems than just FAT12

~Andrew
Image

ehenkes
Posts:34
Joined:Fri Jul 24, 2009 5:35 pm

Re: OS Dev Demo11

Post by ehenkes » Mon Aug 17, 2009 9:57 am

to include USB booting
AFAIK, This would be a unique selling point. Great tutorial series! Please try to make it -Werror -Wall approved. Release Version of Demo15 could not be compiled error-free in MSVC++ 2008 Express, and a lot of errors appeared. :cry:

Post Reply