LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Embedded & Single-board computer (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/)
-   -   How the bootloader gets called by machine (https://www.linuxquestions.org/questions/linux-embedded-and-single-board-computer-78/how-the-bootloader-gets-called-by-machine-921543/)

anandg111 01-01-2012 07:55 PM

How the bootloader gets called by machine
 
Hi everyone,

I want to know that how the bootloader gets called by when we start the machine and what happens next.
what is the initial progam that runs when machine gets start?
I heard that linux loads the programs which needs at that time so at the initial stage of booting system how that program works without having any compiler to compile it ?

fukawi1 01-01-2012 08:19 PM

http://en.wikipedia.org/wiki/Linux_startup_process
Google is your friend.

blue_print 01-01-2012 08:24 PM

There is a booting process link in IBM website and it is well good to learn in detail about Linux Booting process.

http://www.ibm.com/developerworks/library/l-linuxboot/

anandg111 01-01-2012 08:24 PM

Thanks.

grahamatlq 01-03-2012 05:05 AM

Vectors to instructions starting at zero
 
The simple answer is that that machine runs instructions starting at zero in the RAM or ROM.

I deal with embedded systems and have dealt with this many times.

Usually a section of FLASH ROM gets mapped to be addressed from 0x00000000.
The machine then sets the PC to 0x00000000 and loads this instruction into the processor pipeline which gets executed.
This is incremented and the next instruction is loaded and so on.

At some point in the bootloader code the bootloader is swapped out and the linux kernel is loaded into RAM.

I believe in Von Neuman architecture (standard PC) the bootloader is the "BIOS" which then loads the "bootloader" from whichever medium to RAM, runs it then swaps out of the low address space to leave this running.

This loaded "bootloader" then loads the kernel, etc and runs it.

HTH, Graham.

theNbomr 01-03-2012 10:32 AM

Since you haven't specified the architecture, and since you've posted in the Embedded forum where we expect many different architectures, it is impossible to provide specific details. On some architectures, the bootloader is read from bootable spinning media, while on other architectures it will be started directly from ROM mapped to the CPU's reset vector. Other variations also exist, among which is the possibility of direct-loading linux kernels.
--- rod.

syko4MT@gmx.com 01-03-2012 03:59 PM

If I get what your asking...

Linux on PC's:
distro's vary but the basics are:
BIOS loads the bootloader (ex. GRUB v?). Grub then looks for file init.conf, which then becomes process #1. init.conf contains the "list" of processes required for Linux to then "boot up". (Ubuntu is changing the init.conf file to a 'newer/more options' system called upstart.)

For more specifics, blue_print's comment to check out IBM devWorks is terrific. They have great Linux info on wide variety of subjects, as well as LPIC study aids that should be read by all users.

Hope This Helps,

TobiSGD 01-03-2012 04:13 PM

Quote:

Originally Posted by syko4MT@gmx.com (Post 4565083)
If I get what your asking...

Linux on PC's:
distro's vary but the basics are:
BIOS loads the bootloader (ex. GRUB v?). Grub then looks for file init.conf, which then becomes process #1. init.conf contains the "list" of processes required for Linux to then "boot up". (Ubuntu is changing the init.conf file to a 'newer/more options' system called upstart.)

Sorry, but this is horribly wrong. The BIOS invokes the basic hardware functions and the loads the bootloader from disk and starts it. The bootloader will load the kernel (according to its configuration or after displaying a menu for choice) and if needed/configured so the initial ramdisk (initrd) from the disk. After this is done the bootloader starts the kernel and handles control to it. The kernel initializes the hardware (which has inbuilt drivers) and then starts the init process (which actually doesn't have to be init, it can also be something like systemd or upstart, IIRC), either from the initrd or from the specified root partition. The init process then handles thinks like loading kernel modules, mounting disks, starting services and login shells and, if configured that way, the graphical system.

theNbomr 01-03-2012 06:42 PM

Just to confirm what TobiSGD has said, there is a lot of misinformation being propagated here.

And, to add to his comment, in most cases on PC architecture, the bootloader is loaded by the BIOS from spinning media or other local media (such as USB flash disk). It may also be loaded via a network using a DHCP extension (PXE), and once the PXE bootloader starts, typically loads the kernel & initrd from a TFTP server. The bootloader gets loaded into memory by the BIOS running in real mode. The real-mode bootloader then (optionally) loads an initrd into memory, loads the a Linux kernel into memory, and then jumps to the Linux ELF format kernel entry point. Early in the kernel's initialization, the CPU is switched to protected mode, drivers are initialized, filesystems are mounted, and the init process, as specified as an argument to the kernel or built into the kernel, is loaded and launched as PID #1. The init process can be any statically linked executable in the filesystem. A bootloader may also load another bootloader; a process known as chainloading, and Grub and Lilo use this method to load Windows bootloaders.

If this is about PC's, it probably doesn't belong in the Embedded forum.

--- rod.


All times are GMT -5. The time now is 02:24 AM.