U-Boot-2011.06 migration modification scheme supporting SD3 boot mode of S3C6410 processor

The general bootloader (Universal Bootloader, U-Boot) is the first piece of code executed after the system is powered on. Its functions mainly include initializing the hardware environment and loading and executing the operating system kernel. In the system installation, U-Boot usually needs to use special tools to write to FLASH. The kernel and file system are programmed by U-Boot command. This process is cumbersome and error-prone, and is not suitable for large-scale installation of the system.

The S3C6410 is a general-purpose embedded processor based on ARM11 architecture produced by Samsung. Its startup mode supports booting from the SD card in addition to the traditional Flash boot mode. Based on the S3C6410 processor, this paper analyzes the principle of booting the system from the SD card and modifies the U-Boot source code to support the boot mode. On this basis, the U-Boot function is further extended to support it. In the case of a host, the system can be installed with one click, which simplifies the installation and deployment of the embedded system.

1 U-Boot working principle

The startup process of U-Boot is divided into two phases. The first phase is implemented in assembly language and is related to the specific hardware platform; the second phase is implemented in C language with better readability and portability, and the main functions of U-Boot are completed. The advantage of this design is that the hardware-based code can be divided into the general code of the system, so that the porting work of the system is mainly modified for the first stage code, and the second stage code is not needed or needed, which simplifies the migration process. Improve system development efficiency.

The main functions of the U-Boot first-stage code implementation are:

(1) initialization of hardware devices;

(2) Prepare the RAM space for the second stage of loading the bootloader (ie, initialize the SDRAM);

(3) Copy the bootloader second stage code to RAM space (U-Boot copies all its code to RAM);

(4) setting the stack;

(5) Jump to the second stage C code entry.

When the system completes the code handling and sets up the environment used by the C language, it will jump to the second stage of the code C language entry in memory to continue running. The main functions of the second stage code completion are:

(1) continue to initialize related hardware devices (such as serial port, system clock and timer);

(2) detecting system memory mapping;

(3) loading the kernel image and the root file system image;

(4) setting the kernel boot parameters;

(5) Call the kernel.

The second stage U-Boot will stop waiting for a few seconds after setting the corresponding terminal device. If the serial port has input during this time period, U-Boot enters the interactive download mode, cyclically reads the serial port command and executes it; if the serial port Without input, U-Boot executes the boot load mode code, loads the operating system kernel into memory and starts the system.

2 S3C6410 U-Boot SD Card Boot Mode Analysis and Porting

2.1 S3C6410 SD Card Startup Principle

The S3C6410 supports multiple boot modes, including NOR FLASH boot, NAND FLASH boot, MODEM boot, and iROM boot. The iROM boot mode is started from the internal ROM, which provides support for the SD card. The startup process of the S3C6410 SD card is shown in Figure 1.

Boot SD card startup migration analysis and function

When the SD card boot mode is selected, after the processor is powered on, the firmware program in iROM will be run. This program is called BootLoader0 (BL0), which will read from the specified location on the SD card after performing some necessary initialization work. Take 8 KB of U-Boot code to run inside the internal StepPINgStone. This code is called BootLoader1 (BL1).

BL1 is the first 8 KB of U-Boot code. This code will then load BL2 (the entire U-Boot program) from the SD card into memory and jump to the corresponding address.

2.2 SD card device space layout

When booting from the SD card, the BL0 program will load the BL1 code from a specific location on the SD card after the system is powered up, so the BL1 code must be placed in a pre-agreed location.

The spatial layout of the SD card boot partition is shown in Figure 2.

Boot SD card startup migration analysis and function

As can be seen from the figure, we need to use the SD card to start the system. We must program the 8K code of BL1 to the starting address of the 18th block from the end of the SD card. It is also recommended to place BL2 next to BL1 in front of it. In the data block.

2.3 Adding U-Boot Support for SD Card Boot Mode From the above analysis, the key to system migration is to copy the code in BL2 from the SD card to the memory. Since U-Boot does not support SD card startup by default, you need to modify bnand_boot in the arch/arm/cpu/arm1176/start.S file to b mmc_boot_copy and define the mmc_boot_copy function as:

Boot SD card startup migration analysis and function

This code uses the firmware function provided by S3C6410 to copy the entire U-Boot in BL2 to memory and jump to the corresponding entry in the memory to continue running.

3 offline one-click installation system function realization

The U-Boot version ported in this document is U-Boot-2011.06. This version of U-Boot supports the FAT file system file loading command. The command format is:

Fatload

This command loads the file filename in the dev device using the interface interface into the memory address addr in binary form. Use this command to load the image file such as the kernel into the memory first by the SD card, and then use the FLASH command to program the system.

Horn Tweeter

Horn Tweeter,Voice Coil,Neodymium Magnet Tweeter,Voice Coil Compression Drive

NINGBO BOILINGSOUND ELECTRONICS CO.,LTD , https://www.tweeterspeaker.com