boot device detection
boot device detection
hi all
well
simple:
is there any way to detect the boot device easy ( usb, floppy, cd, hdd, or what ever), and not just detect all drives, and then scan for after the boot device.
i have been searching for the answer, but was unable to finde a good solution.
so i would just hear you guys, if you have a good solution
Edit:
eh, i have thought about making a "boot" nr, when i write the img( so it self can detect the type), but i dont want to be limited to this( a usb build, cd build...)
i want it to self detect.
KMT dk
well
simple:
is there any way to detect the boot device easy ( usb, floppy, cd, hdd, or what ever), and not just detect all drives, and then scan for after the boot device.
i have been searching for the answer, but was unable to finde a good solution.
so i would just hear you guys, if you have a good solution
Edit:
eh, i have thought about making a "boot" nr, when i write the img( so it self can detect the type), but i dont want to be limited to this( a usb build, cd build...)
i want it to self detect.
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: boot device detection
When your boot-loader code starts the BIOS puts the boot-drive number in DL for you.
00h = floppy, 80h=first hard-drive etc... 81h would be second and so on.
With regards to a cd-rom or USB it depends how the bios/system decides to emulate it to allow boot. El-Torito CD-ROM booting for example would emulate a 1.44Mb floppy when booting from CD. So the boot-drive number will appear as 00h but thats sufficient for you to handle the various scenarios and continue to load sectors (<1.44Mb) via std bios functions.
The same applies for USB which could boot as a HDD (80h) or as a floppy (00h). HDD is more common I've found which is good as it allows you to access more than 1.44mb emulated storage at the beginning of the flash drive.
00h = floppy, 80h=first hard-drive etc... 81h would be second and so on.
With regards to a cd-rom or USB it depends how the bios/system decides to emulate it to allow boot. El-Torito CD-ROM booting for example would emulate a 1.44Mb floppy when booting from CD. So the boot-drive number will appear as 00h but thats sufficient for you to handle the various scenarios and continue to load sectors (<1.44Mb) via std bios functions.
The same applies for USB which could boot as a HDD (80h) or as a floppy (00h). HDD is more common I've found which is good as it allows you to access more than 1.44mb emulated storage at the beginning of the flash drive.
Re: boot device detection
well
the problem is still this:
i have to scan all deviceses, ( if we say the number is 00 ) i have to scan all usb, all floppy, and cd
this requires a lot of time, and drivers .
this is what i want to avoid
KMT dk
the problem is still this:
i have to scan all deviceses, ( if we say the number is 00 ) i have to scan all usb, all floppy, and cd
this requires a lot of time, and drivers .
this is what i want to avoid
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: boot device detection
Why do you need the boot device? I'd think the only reason would be to further load your OS, right? In that case, the only thing you need is the drive number to pass to the BIOS. Then, after everything is loaded and your drivers take control, you have to scan everything anyway, to build your VFS.kmtdk wrote:well
the problem is still this:
i have to scan all deviceses, ( if we say the number is 00 ) i have to scan all usb, all floppy, and cd
this requires a lot of time, and drivers .
this is what i want to avoid
JAL
Re: boot device detection
the reason why i want, is this:
USB ( the pain)
since some bios's are bugy so i need to know ( and use smalle space) if it is usb boot.
KMT dk
USB ( the pain)
since some bios's are bugy so i need to know ( and use smalle space) if it is usb boot.
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
-
- Member
- Posts: 116
- Joined: Wed Oct 22, 2008 2:21 am
- Location: Roma,Italy
Re: boot device detection
If your BIOS support BBS (bios boot spec.) then you can see
boot order,change boot order and so on....,
but note that many stupid bios are buggy, and you
don't get ever this information in a reliable manner
The specification is clear , ma idiot BIOS programmer
write buggy code.
To detect boot device you must invent your own method based on fantasy and
knowledge of the bios.
boot order,change boot order and so on....,
but note that many stupid bios are buggy, and you
don't get ever this information in a reliable manner
The specification is clear , ma idiot BIOS programmer
write buggy code.
To detect boot device you must invent your own method based on fantasy and
knowledge of the bios.
Re: boot device detection
As someone already commented, I think, the BIOS emulates a floppy or hdd when booting from a USB stick. So there's really no way to know whether you booted from a real floppy or an emulated one.kmtdk wrote:the reason why i want, is this: USB ( the pain) since some bios's are bugy so i need to know ( and use smalle space) if it is usb boot.
JAL
Re: boot device detection
my problem
my old computer support USB boot, but fail reading sectors above 100, so i would love to "currect" this error in a easy way, but as i feared that, as you say, that it requere me to make my own function...
so a little redesign of the FS( just file placement), has to be done :S
THX for the help
KMT dk
my old computer support USB boot, but fail reading sectors above 100, so i would love to "currect" this error in a easy way, but as i feared that, as you say, that it requere me to make my own function...
so a little redesign of the FS( just file placement), has to be done :S
THX for the help
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
-
- Member
- Posts: 116
- Joined: Wed Oct 22, 2008 2:21 am
- Location: Roma,Italy
Re: boot device detection
IF you use BIOS int 13h for read maybe you pass wrong CHS value to functionkmtdk wrote:my problem
my old computer support USB boot, but fail reading sectors above 100
Re: boot device detection
Um, yes and no. El-Torito booting CAN emulate a 1.44Mb floppy when told to. It can also emulate a 1.2MB floppy or a 2.88MB floppy, a HDD or even provide no emulation at all.johnsa wrote:El-Torito CD-ROM booting for example would emulate a 1.44Mb floppy when booting from CD.
In the case of floppy emulation, the BIOS will provide 00h for the drive number, and a REAL floppy would be 01h. In this way, booting from an El-Torito emulated floppy lets you still access a real floppy drive.
When using HDD emulation, the BIOS will provide a number of 80h. All other HDDs are increased by one, so what would normally be 80h is now 81h.
In the case of no emulation, the BIOS drive numbers are not changed at all. This is the only mode where using Int 13 Extensions to access data on the CD will be done in normal CD-sized sectors of 2048 bytes. No emulation booting also has some other nice advantages, such as the BIOS being able to load up to 0xFFFF sectors, and being able to specify the segment to load to. I wouldn't be surprised if there's many BIOS bugs to be found there, though.
In any case, with El-Torito booting, you can attempt to use Int 13 Function 48 to get the drive capabilities, and use that information to determine if you are really running from a CD or not. However, there are a lot of buggy BIOSes out there that do strange things like hang or return false information when you mix El-Torito and Int 13 Func. 48.
Re: boot device detection
well
so, ....
well
i read about the int 13 extension, and ralf browns int list says, the Drive nr has to be 0x80 or bigger...
and since the usb only get 0x00 ( even if it is real floppy), and cd too .... i dont think it would like it---
...
KMT dk
migh, but work for cd, and FDD, and other computers ( using usb)djmauretto
IF you use BIOS int 13h for read maybe you pass wrong CHS value to function
so, ....
well
i read about the int 13 extension, and ralf browns int list says, the Drive nr has to be 0x80 or bigger...
and since the usb only get 0x00 ( even if it is real floppy), and cd too .... i dont think it would like it---
...
KMT dk
well, what to say, to much to do in too little space.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
when it goes up hill, increase work, when it goes straight, test yourself but when going down, slow down.
Re: boot device detection
Use this int: http://www.ctyme.com/intr/rb-0719.htm
To see if you booted under-emulation
To see if you booted under-emulation