Building Embeded Linux System Chapter 9 Bootloader Creation

Source: Internet
Author: User

Different types of Bootlader


Generally, LILO or GRUB is used for x86 PC machines. These systems contain firmware (BIOS), which is used for programs of major system components, such as initializing a RAM controller, protecting the CPU in a specific State and providing a lot of information to the OS, for example, for traditional bios cils and ACPI table, these linux bootloaders only need to load the kernel image (which may also include the image of initrd/initramfs) from the storage medium and start to execute. In embedded operating systems, these firmware are usually not used and need to be completed by bootloader.

LILO appeared very early, in memory when reading Linux is lilo, and now some x86 systems are still in use, can be in the http://lilo.go.dyndns.org

To obtain the latest version and documentation. It can only be used on x86 systems with pc bios.

GRUB is maintained by GUN and can be in http://www.gun.org/software/grub

. GRUB is a friend of the x86 system, not U-boot. This is why moblin uses GRUB on netbook. GRUB is currently the most popular bootloader on x86.

Loadlin allows linux to be enabled in non-NT-series legacy windows systems, which is basically not used now. Coreboot (the original LinuxBIOS), supports x866 and PowerPC, starts Linux from ROM, Linux has system initialization, interrupt-routing allocation, device initialization, so it also becomes LinuxBIOS. This feature is quick start. RedBoot is based on eCos (Embedded writable able Operating System). In many small systems (as small as it cannot run the entire Linux kernel), when it can run other OS, such as Linux, later, Redhat used him. However, we recommend that you use U-boot for o'reilly.

U-Boot: the most widely used linux bootloader. It can be used in almost all common Linux embedded systems such as x86, PowerPC, ARM, and MIPS, o'reilly will detail the establishment of U-Boot in this chapter.

Create a Server started from the Network


For the development of Linux Embedded OS, It is very convenient to use network boot, because you do not need to change it to re-write flash. You can use BOOTP, DHCP, TFTP, and NFS to start the network. DHCP has replaced BOOTP, but it does not provide kernel img transfer. TFTP is required. NFS can share the entire directory tree between the NFS server and the client. It needs to start linux kernel to support it and mount the network directory (the directory on the host) to the target through the mount method, it can be used to test our applications.

We need to establish a dhcp server. The author reminds us that IT is important to establish a dhcp server. do not affect the dhcp server of other normal services. If necessary, contact the IT department first. I plan to set up a dhcp server on the host, and IT department issues, but to ensure security, I will limit IT to the lab network segment. DHCP is not dependent on other intel services (such as inetd) and is provided by itself. In addition, I want to read this chapter first. In combination with the previous and moblin situations, I hope to run a system on the MID and run it first.

We need to create a TFTP server and an NFS server. NFS is usually installed in rpm. We need to remind you of installation problems, especially when the target is accessed through intenet. We recommend that you use host. deny and host. allow to control permissions.

Uboot usage


U-boot is the most common bootloader in embedded operating systems. "For MID, the use of x86 motherboard, after re-brush BIOS, you can install GRUB linux, did not consider which to use, you can try" in the http://www.denx.de/wiki/U-Boot/WebHome

The documentation on is very powerful. This document uses the OpenMoko (GTA01) Board as an example.

1. Select the plate type: make gta01_config. We recommend that you take a look at the uboot REAMDE introduction. (Relatively long)

2. Make arch = xxx cross_compile = XXXX u-boot.udfu. The first two are self-explanatory. The last udfu parameter indicates the USB device frimware update, which can be used to upgrade the version (uboot upgrade) on the device ). It can also be a u-boot.map (symbol MAP), U-boot (ELF binary format), a u-boot.bin (raw binary IMG, which can be written to boot storage devices ).

I think it is hard to understand it deeply without practice. The book also introduces the uboot startup and other aspects. I will describe it in practice, and I will only make a few records here. We need to put uboot into the corresponding physical address of the flash memory of the device, and it needs to be started. You can view the output and input of uboot through the serial port. If we press any key to access the uboot command line, uboot provides many commands including cp, which are related to arch, platform, and Development Board, uboot provides help for each command, for example: # Help CP. If we do not press any one key, the uboot will be started according to the default configuration after X seconds. After startup, go to the command line. You can view, modify, and save the environment variable parameters through Printenv, setenv, and saveenv. Uboot environment variables can be used to generate boot scripts, which are composed of these environment variables and uboot commands (run and. If the flash memory is ikongb, It is not organized as a file system and does not include any file headers, then the binary IMG downloaded to the target must contain headers that can be understood by uboot and know how to load them. Mkimage provides this function. Although image headers are not required by a bootloader, these headers provide a lot of convenience during development and startup, so uboot uses them. You can use mkimage to create an IMG image and a RAM disk (initrd ).

Uboot has a command bootp, which uses DHCP to obtain the address, TFTP address, and the above file name from the DHCP server. Target obtains the img from tftp and prevents it from being in the configured RAM address (for example, the address is 0x30100000. We can use the iminfo command to obtain the img header information (imi 30100000 ). Img (bootm 30100000) can be started ). In this way, the panic appears during the startup process because there is no root file system. We need to use the uboot environment variable to generate a script and pass some boot options to the kernel. We added bootnfs so that the system can mount the root file system through NFS.

During the development process, we use tftp and nfs, but the final product needs to be loaded into the flash of the device. You can use uboot commands, including erasure and writing. You can also use tftpboot or loadb to download img to RAM and then use cp. B to write it into flash. After downloading, you can use the imi command to check the integrity with CRC.

For uboot upgrade, run the crc32 command because uboot does not run the mkimage command and does not have the img header. After the download, The NOR and NAND processes the same. First, disable flash protection, erase, cp. B, and reset the environment variables, such as the file size and save the configuration. (because the configuration has been erased, You Need To retained even if no changes are made)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.