Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is "MLO" needed in boot step?

Tags:

linux

I'm studying boot steps on a Pandaboard. According to this how-to, they have multiple boot steps (Boot rom > X-loader or SPL > U-boot > Linux kernel). Actually, I do not understand why they have such steps inefficiently. Can't I just load u-boot instead of using file called "MLO"? What does "MLO" actually do? Are there any important reasons that they have to put "MLO" instead of loading u-boot directly?

like image 782
chaoxifer Avatar asked Jan 15 '16 06:01

chaoxifer


2 Answers

From eLinux.org:

http://elinux.org/Panda_How_to_MLO_%26_u-boot

The first-stage bootloader runs directly on the board from power-up. I don't know the name of this bootloader(From TI official wiki, it called Boot Rom). This bootloader initializes a minimal amount of CPU and board hardware, then accesses the first partition of the SD card (which must be in FAT format), and loads a file called "MLO", and executes it. "MLO" is the second-stage bootloader.

The second-stage bootloader can apparently be one of either the X-loader or SPL. This bootloader apparently also just reads the first partition of the SD card, and loads a file called "u-boot.bin", and executes it. "u-boot.bin" is the third-stage bootloader.

The third-stage bootloader is U-boot, which is a popular bootloader for many different embedded boards and products. This bootloader has lots of different features, including an interactive shell, variables, ability to access the SD card and show its contents, etc. What happens next depends on the version of U-boot you have for the Panda board, and how it is configured. In a very simple configuration, U-Boot will look for the file "uImage" in the root of the first partition of the SD card (which, again, must be formatted as a FAT partition), and execute that. This is the Linux kernel. U-Boot passes the kernel a command line argument. Depending on how the kernel is configured it may accept the command line from U-Boot, or use one that was compiled into it when it was built.

This is a "Panda Board thing", not necessarily true of Linux in general.

However, most all systems have some kind of "multi-stage" boot like the one above. For example, booting a PC running Windows, you see:

  1. BIOS startup
  2. Boot sector is loaded from disk or USB; or a PXE boot record is read from the network
  3. The windows kernel starts (the stuff you see before/during the "splash screen")
  4. Finally, "Windows" itself starts

So it's neither "inefficient", nor unusual.

PS: This link also has a good description of the boot load sequence:

  • http://omappedia.org/wiki/Bootloader_Project

PPS: "MLO" stands for "Mmc LOader"

like image 177
paulsm4 Avatar answered Oct 09 '22 08:10

paulsm4


When the board comes up, the Memory Management Unit (MMU) still needs to be setup before the CPU can start using the SDRAM. The SoC has 56KB of SRAM which can be used at that point, but it is too small for u-boot to run from. The extra step is code running from SRAM will load and start u-boot.

like image 42
Frank Avatar answered Oct 09 '22 08:10

Frank