Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
when bootloader in bios executes its code, it do POST and other things...then as I read from somewhere kernel does initrd to load some basic modules so as to mount the root file system and then removes initrd filesystem to make the space .....
1.how does kernel do initrd as the kernel(vmlinuz) itself is present on the harddisk ....i mean how the control is transferrred to the kernel(present in hdd) from the bios????
--at initial point drivers(i mean the protocol to access the harddisk) is not known then how the MBR is accessed ??
2.can we put the kernel (even though very small part of it) in the bios itself??
quite a sophisticated process that you're trying to understand!
The boot process is actually more complicated than you think. Your understanding is more or less correct, but incomplete.
BIOS does self-test and a basic initialization of hardware (HDD controller, display, keyboard)
BIOS looks for a valid boot media, usually the first HDD (could also be a USB storage device)
BIOS loads the first physical sector of the boot drive into memory (not knowing anything about file systems), assumes that it contains machine code, and executes that code. Usually this sector is the beginning of the bootloader (e.g. GRUB) which takes over now. GRUB contains file system drivers for the configured boot partitions.
The boot code usually loads more code (a few more sectors), as much as it takes
The bootloader analyzes the boot configuration, displays the boot menu and waits for the user to select an item
The bootloader loads the selected kernel plus the associated initrd (if any), and hands control to the loaded kernel
Quote:
Originally Posted by beyond
2.can we put the kernel (even though very small part of it) in the bios itself??
In theory, that's possible, and something like that is often done in embedded systems. But then the kernel is usually located in a Flash memory, which is mounted like it was a Readonly-HDD.
thanks Tinkster and Doc CPU,,,
one more question:
1.does the meaning of bootloader is limited to any code that cause the booting of os??
2.the bios also does a similar thing(not activating the OS,, a lot of initiallisation and other things),, is it also a (sort of)bootloader???
Ad 2)
The BIOS reads the first few bytes (I think 512) of the first sector
of the boot device into memory, and point the execution pointer of the
CPU at it.
Ad 1)
I don't really understand what you're saying, but:
The boot loader (part of which sits in those 512 bytes above) will then
try to load the kernel (or the "other OSes" equivalent), and have it
carry on with execution in the same way - setting the CPUs execution pointer
at the memory location into which it loaded whatever it slurped of the disk.
So sir,
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???
2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??
3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
So sir,
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???
You can say that, but it's wrong. =o)
Quote:
Originally Posted by beyond
2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??
No you can't. From BIOS you can access what's in MBR. Full stop. Period. End
of BIOS' responsibility.
Quote:
Originally Posted by beyond
3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
No. MBR is 512 bytes (unless you write your own BIOS and flash it to your motherboard),
that's all you get to play with. And no, I don't think you can write a replacement kernel
that will fit in there and do all the work.
1.can i say that after the initiallisation that the bios do, the bios code can access all the peripherals completely???
No, definitely not. The BIOS won't initialize and care for sound cards, TV cards, integrated modems, let alone special hardware like CAN cards or something. It initializes just a basic set of peripherals, like VGA, keyboard, HDD controller and disks, FDD controller (if present), serial and parallel ports (if present) and USB controllers. I may have forgotten something, but I think that's it more or less.
Quote:
Originally Posted by beyond
2.I mean that from the bios code only,, can i acess the harddisk completely..specifically the kernel bcz. If i have accessed the MBR!! which is in harddisk, so can i access the remaining part of it too ??
BIOS contains functions to access hard disks on a sector-by-sector basis, not knowing anything about file systems. So yes, basically it could also read any other part of the hard disk. But standard implementations just read the very first sector, which contains the boot record and the partition table. Usually they leave anything else to the operating system that's about to be started.
On newer computers that support GPT partitioning, the GUID partition table can be several sectors long, starting after the traditional MBR.
Quote:
Originally Posted by beyond
3.if not. Then is it possible to extend the size of MBR(just asking) so as to fit the kernel in it(it will initiallise all the peripherals and other things ) thus removing the bootloadr??
No. You're confusing hardware matters and software structures. The MBR (Master boot record) is a part of the very first sector. That's by definition. But well, one could, in theory, create a very specialized operating system that starts directly from the MBR. But I don't know any system that actually works this way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.