flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Loading Kernel? understanding the concepts... |
Author |
|
dosin 03 Feb 2013, 17:17
To begin I think your a little confused on Protected Mode and using Disk..
I would sugest using a usb if your bios suport booting from it.. You can make a floppy image and write it to the USB.. Then you can pitch the floppies.. On a Floppy: you have a MBR and then your kernel.. no need for stage 2 .. stage 2 of your boot is the kernel.. You could make a stage 2 but really no need.. Since floppies never have more than one portion.. On a HDD: You have a MBR that lists if there is more than one portion.. the MBR boot code reads these and looks for the active portion to boot.. Once it reads and gets the active portion data it jumps to that address -the 2nd stage bootloader is located at that address will load the kernel located in the file system.. The MBR also holds the size of the porttion data so the OS knows how much of the disk it can use. Start sector - last.. As for protected mode.. can happen anywere in the boot proccess were the writer wants it to take place.. can be in the MBR or the kernel.. |
|||
03 Feb 2013, 17:17 |
|
newport 04 Feb 2013, 03:54
Thanks dosin for clearing that up....that helps a lot!
|
|||
04 Feb 2013, 03:54 |
|
egos 04 Feb 2013, 08:58
Your kernel can be loaded from hard disk directly as well. Usually I use stage 2 boot loader only If I have different kernels/different system folders on the same disk/partition. I use same stage 1 boot loaders to load kernel and to load stage 2 boot loader just by changing the file name. Anyway my kernel starts in RM except when it was loaded by Multiboot compliant boot loader. In this case I switch back to RM to make some first initialization steps. Kernel takes folowing parameters from boot loader:
- BIOS drive number of boot disk; - number of boot partition or zero if booting occurs from whole boot device or from default boot partition; - size of the one additional file, which was loaded, or zero; - name of system folder (stored in kernel image, so stage 1 boot loaders can not give this parameter). If your kernel starts in PM you should use stage 2 in any case because to switch in PM within stage 1 is bad practice. |
|||
04 Feb 2013, 08:58 |
|
dosin 05 Feb 2013, 03:28
I would disagree there is nothing wrong with booting in protected mode..... Grub for example..
it realy depends on your overall goal.. you can always check in the start of the kernel to see if u need to enable it or not. The only reason to switch back would be to enable vesa graphics.. or needing bios.. other than that.. no need to at all.. |
|||
05 Feb 2013, 03:28 |
|
egos 05 Feb 2013, 08:59
Yes, I still need BIOS for many reasons. For example, to convert BIOS drive number into physical location of the disk. This also allows to have minimal size of routine at Multiboot entry point if the kernel usually starts in RM.
|
|||
05 Feb 2013, 08:59 |
|
dosin 05 Feb 2013, 11:52
CHS (cylinder/head/sector) tuples can be mapped to LBA address
Virtual 8086 mode provides a handy way of running 16-bit real mode code under a 32-bit OS. It may seem a bit of a hack on top of normal protected mode, but it was designed to be easy and non-disruptive to add to an existing kernel http://osdev.berlios.de/v86.html |
|||
05 Feb 2013, 11:52 |
|
egos 05 Feb 2013, 20:54
dosin wrote: CHS (cylinder/head/sector) tuples can be mapped to LBA address It's more easy for me to switch into RM one time, than to make and to use VM. _________________ If you have seen bad English in my words, tell me what's wrong, please. |
|||
05 Feb 2013, 20:54 |
|
baldr 05 Feb 2013, 20:55
dosin wrote: On a Floppy: Mapping CHS to LBA can be sufficiently complex if BIOS-induced geometry is not the same as the real (i.e. that was used to format). That's why we have dosen of translation methods. Or probably because of them. Goddamn, most of MBs you'll encounter will support int13/4x. Stick with IBM/MS int13 extensions and you'll be fine (unless some rare MB stumbles upon you). |
|||
05 Feb 2013, 20:55 |
|
egos 06 Feb 2013, 10:13
You are right. I think dosin meant boot sector/boot record when he told about MBR on floppy.
Usually I have support for both EDD service and legacy disk service in my boot loaders. Sometimes I have support only for EDD service. This depends on compilation key. Excuse me for my bad English, but when I said about converting BIOS drive number into physical location of the disk, I meant disk bus/controller/device detection. |
|||
06 Feb 2013, 10:13 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.