Finally I've just finished making bootloader, which is just print out a few texts..
I think I need kernnel at the moment...
But I have no idea where I should start...
Actually I studied about protected mode..
I have no idea how pmode is programmed and futhermore..How executable files use pmode. :
My book doesn't show me something like programming tips ???
One more thing..
When I digging into any others' bootloader source code.,
I saw that they load kernnel to memory and jump there..
But what I'm so curious about is that where we need to load kernnel in memory..
I know that BIOS load bootloader at address 0000h:7c00h,
where do I have to load kernnel stuff in memory..?
Is there some organized document about this..
All documents that I have just tell me I need to load kernnel or I can use some programming language or something like that....
But what I wanna know is that where/how to load kernnel..
Could you tell me next thing to do..?
Show me the way..
Thanks a lot
Show me the way..
Re:Show me the way..
Hi,
A) load a monlithic kernel or a kernel that contains all device drivers that may be needed to load in anything else the OS will need.
B) load a boot image. The boot image may contain 1 or more kernels, device drivers, a GUI and/or command line interpreter, utilities, boot scripts, etc.
C) load some more boot code, which might load the kernel and/or boot image and/or more boot code.
D) something else..
For example, my OS's boot loader/s load a boot image at 0x120000, find the 16 bit setup code within the boot image, copy the 16 bit setup code it's correct location in conventional memory and jumps to it.
The 16 bit setup code detects available memory, creates a list of usable video modes, finds addresses for the BIOS's 8*8 chracter font and 8*16 character font, parses ACPI tables, parses MP specification tables, starts other CPUs and detects what features they support. From all of this it builds a set of data structures that contain all details the OS needs later. Then it (optionally) starts a boot menu which allows the user to set some details (default video mode, etc). Finally it uses the information collected to decide what sort of kernel to boot (single CPU or multi-CPU, 32 bit or 64 bit), disables IRQ sources, finds the 32 bit (or 64 bit) setup code and copies it to it's correct location in conventional memory and starts it.
The 32 bit (or 64 bit) setup code sets up physical memory management and starts the paging system based on collected details. Then it finds an appropriate kernel setup driver and kernel in the boot image, copies them to where they should be and starts the kernel setup driver.
The kernel setup driver initializes the kernel until the kernel reaches it's normal working state, copies all files in the boot image into the virtual file system (think RAMdisk) then it starts the boot script and terminates. At this point the kernel is ready and working - the boot script loads device drivers, etc.
There's lot's of good stuff on the internet - do a search for "protected mode tutorial". Here's a good site you will want to check out:
http://www.osdev.org/osfaq2/
Also read through this thread:
http://www.mega-tokyo.com/forum/index.p ... eadid=3254
Cheers,
Brendan
If your boot loader doesn't actually load anything then it's not finished! ::)Johnny wrote: Finally I've just finished making bootloader, which is just print out a few texts..
The boot loader must load something, but should it be the kernel? IMHO probably not. The options you have are:Johnny wrote: I think I need kernnel at the moment...
But I have no idea where I should start...
A) load a monlithic kernel or a kernel that contains all device drivers that may be needed to load in anything else the OS will need.
B) load a boot image. The boot image may contain 1 or more kernels, device drivers, a GUI and/or command line interpreter, utilities, boot scripts, etc.
C) load some more boot code, which might load the kernel and/or boot image and/or more boot code.
D) something else..
For example, my OS's boot loader/s load a boot image at 0x120000, find the 16 bit setup code within the boot image, copy the 16 bit setup code it's correct location in conventional memory and jumps to it.
The 16 bit setup code detects available memory, creates a list of usable video modes, finds addresses for the BIOS's 8*8 chracter font and 8*16 character font, parses ACPI tables, parses MP specification tables, starts other CPUs and detects what features they support. From all of this it builds a set of data structures that contain all details the OS needs later. Then it (optionally) starts a boot menu which allows the user to set some details (default video mode, etc). Finally it uses the information collected to decide what sort of kernel to boot (single CPU or multi-CPU, 32 bit or 64 bit), disables IRQ sources, finds the 32 bit (or 64 bit) setup code and copies it to it's correct location in conventional memory and starts it.
The 32 bit (or 64 bit) setup code sets up physical memory management and starts the paging system based on collected details. Then it finds an appropriate kernel setup driver and kernel in the boot image, copies them to where they should be and starts the kernel setup driver.
The kernel setup driver initializes the kernel until the kernel reaches it's normal working state, copies all files in the boot image into the virtual file system (think RAMdisk) then it starts the boot script and terminates. At this point the kernel is ready and working - the boot script loads device drivers, etc.
Learning how to initialize protected mode (and protected mode programming) would be your first step. You can't really write a kernel unless you understand all of the options that protected mode offers.Johnny wrote: Actually I studied about protected mode..
I have no idea how pmode is programmed and futhermore..How executable files use pmode. :
My book doesn't show me something like programming tips ???
There's lot's of good stuff on the internet - do a search for "protected mode tutorial". Here's a good site you will want to check out:
http://www.osdev.org/osfaq2/
Also read through this thread:
http://www.mega-tokyo.com/forum/index.p ... eadid=3254
You can load the kernel (or what-ever you decide to load) anywhere you like, as long as you don't overwrite something that you need later.Johnny wrote: One more thing..
When I digging into any others' bootloader source code.,
I saw that they load kernnel to memory and jump there..
But what I'm so curious about is that where we need to load kernnel in memory..
I know that BIOS load bootloader at address 0000h:7c00h,
where do I have to load kernnel stuff in memory..?
Is there some organized document about this..
All documents that I have just tell me I need to load kernnel or I can use some programming language or something like that....
But what I wanna know is that where/how to load kernnel..
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.