You cannot really tell which machine is going to do what.. the only option is to try and make them all happy at the same time
My first stage boot loader is even worse for me at the moment because i've effectively unified first stage loaders to deal with FDD,HDD,USB in both modes and native CDROM booting (eltorito) where the sector size is 2kb.
The idea for me was that i'd eventually land up with a single loader (code+bin) which could be applied to any device instead of having to select an appropriate one for each type of media.
I have it working on about 80% of machines so-far.. still not perfect!
Running a Bootloader from USB
Re: Running a Bootloader from USB
Thanks for all the replies !
Your Post has actually been more helpful than all the ones I've come across after searching for a couple of days
I've come across the code blocks at the start of a few bootloaders but never really paid attention to them :O
I would really appreciate it if someone could link me to some material online that would explain all the stuff about using and FINDING OUT the oem, sectors, bytes_sectors and what not . I didn't actually read up on finding all that stuff out
Your Post has actually been more helpful than all the ones I've come across after searching for a couple of days
I've come across the code blocks at the start of a few bootloaders but never really paid attention to them :O
I would really appreciate it if someone could link me to some material online that would explain all the stuff about using and FINDING OUT the oem, sectors, bytes_sectors and what not . I didn't actually read up on finding all that stuff out
Well 80% is pretty damn impressive considering all the problems I've run into trying to display a message!I have it working on about 80% of machines so-far.. still not perfect!
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Running a Bootloader from USB
Booting from a USB is *usually* just like booting from a hard disk. You need to use ORG 0x7C00 and properly set up your segments (DS, ES) and stack (SS, SP).
This code from my own OS might help (it boots from USB sticks and hard disks and it works on real hardware.) Notice that when the BIOS gives control to the bootloader, the state of registers are all undefined (except DL which *always* contains the BIOS drive number.
Here's the code of my own boot sector.
This code from my own OS might help (it boots from USB sticks and hard disks and it works on real hardware.) Notice that when the BIOS gives control to the bootloader, the state of registers are all undefined (except DL which *always* contains the BIOS drive number.
Here's the code of my own boot sector.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Running a Bootloader from USB
I can almost guarantee you that bootsector will not boot on my machines as a HDD style load. Firstly you've put a pseudo-BPB in, and it has no partition table structure, unless you're formatting the USB with a file system first, using a valid MBR and putting this loader in an actual partition ?
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Running a Bootloader from USB
My OS boots from USB sticks as HDD on two of my computers. Yes my boot sector is on a partition and of course I have an MBR (originally by Muazzam.) Here it is:johnsa wrote:I can almost guarantee you that bootsector will not boot on my machines as a HDD style load. Firstly you've put a pseudo-BPB in, and it has no partition table structure, unless you're formatting the USB with a file system first, using a valid MBR and putting this loader in an actual partition ?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
Re: Running a Bootloader from USB
In that case that's all good
Just wanted to make it clear so that MustLearn can see that the structure for the boot loader is very different if it's sitting in place of the MBR or on the bootable partition, and that you can't expect it to work if the machine boots as USB HDD and you've just written your 512b loader to sector 0 (because then it is replacing the MBR).
Just wanted to make it clear so that MustLearn can see that the structure for the boot loader is very different if it's sitting in place of the MBR or on the bootable partition, and that you can't expect it to work if the machine boots as USB HDD and you've just written your 512b loader to sector 0 (because then it is replacing the MBR).
Re: Running a Bootloader from USB
It is a really helpful solution. It can deal with most of BIOSes, just because they try to infer media type by reading some information from a USB stick and if the stick has valid file system, then it is most probable that most BIOSes are able to identify the media type properly.johnsa wrote:unless you're formatting the USB with a file system first, using a valid MBR and putting this loader in an actual partition
- BrightLight
- Member
- Posts: 901
- Joined: Sat Dec 27, 2014 9:11 am
- Location: Maadi, Cairo, Egypt
- Contact:
Re: Running a Bootloader from USB
Yes, I know how HDD booting works.johnsa wrote:In that case that's all good
You know your OS is advanced when you stop using the Intel programming guide as a reference.