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

The U-Boot, also known as the Universal Bootloader, is the first software executed when a system powers on. Its main responsibilities include initializing the hardware environment and loading the operating system kernel into memory. During system installation, U-Boot typically requires specialized tools to write its code to flash memory. The kernel and file system are usually programmed using U-Boot commands, which can be time-consuming and prone to errors, making it unsuitable for large-scale system deployments.

The S3C6410 is a general-purpose embedded processor based on the ARM11 architecture from Samsung. It supports booting from an SD card in addition to traditional Flash-based boot modes. This paper explores the process of booting the system from an SD card using the S3C6410 processor and modifies the U-Boot source code to support this feature. Based on this, additional functionalities are added to U-Boot, enabling one-click system installation from a host, significantly simplifying the deployment of embedded systems.

1. U-Boot Working Principle

The U-Boot startup process is divided into two stages. The first stage is written in assembly language and is closely tied to the specific hardware platform. The second stage is implemented in C, offering better readability and portability, and handles most of the core functions of U-Boot. This design allows hardware-specific code to be separated from general system code, making the porting process mainly focused on the first stage. This greatly reduces the effort required for migration and improves development efficiency.

The primary tasks of the first stage of U-Boot include:

(1) Hardware initialization;

(2) Preparing RAM space for the second stage;

(3) Copying the second-stage code into RAM;

(4) Setting up the stack;

(5) Jumping to the second stage C code entry point.

Once the code is set up and the C environment is ready, U-Boot jumps to the second stage C code. The second stage performs key tasks such as:

(1) Further hardware initialization (e.g., serial ports, clocks, timers);

(2) Detecting memory mapping;

(3) Loading the kernel and root file system images;

(4) Setting kernel boot parameters;

(5) Starting the operating system.

After setting up the terminal device, U-Boot waits for a few seconds. If there is input via the serial port during this time, it enters interactive mode, allowing users to issue commands. Otherwise, it proceeds with the default boot sequence, loading the kernel and starting the system.

2. Analysis and Porting of S3C6410 U-Boot for SD Card Boot Mode

2.1 S3C6410 SD Card Boot Principle

The S3C6410 supports multiple boot modes, including NOR Flash, NAND Flash, Modem, and iROM boot. The iROM boot mode starts from internal ROM and includes support for SD cards. The boot process of the S3C6410 from an SD card is illustrated in Figure 1.

SD Card Boot Process

When the SD card boot mode is selected, the iROM firmware runs after power-on. This program, called BootLoader0 (BL0), performs some necessary initializations and then reads 8 KB of U-Boot code from the SD card, executing it in the internal SRAM. This code is referred to as BootLoader1 (BL1).

BL1 is the first 8 KB of the U-Boot code. It then loads the full U-Boot (BL2) from the SD card into memory and jumps to the corresponding address to continue execution.

2.2 SD Card Device Space Layout

For the system to boot from an SD card, the BL1 code must be placed at a pre-defined location. The layout of the SD card's boot partition is shown in Figure 2.

SD Card Boot Partition Layout

As shown, to boot from the SD card, BL1 must be placed at the start of the 18th block from the end of the card. It is recommended that BL2 be placed directly after BL1 in the data area.

2.3 Adding U-Boot Support for SD Card Boot

To enable SD card booting, the key step is copying the BL2 code from the SD card into memory. Since U-Boot does not natively support this, modifications are needed. Specifically, the `bnand_boot` function in `arch/arm/cpu/arm1176/start.S` should be replaced with `mmc_boot_copy`, and the `mmc_boot_copy` function should be defined as follows:

MMC Boot Copy Function

This code uses the firmware functions provided by the S3C6410 to copy the entire U-Boot (BL2) into memory and then jump to the entry point to continue execution.

3. Realizing One-Click System Installation Offline

The U-Boot version used in this document is U-Boot-2011.06, which supports FAT file system loading commands. The command format is:

`fatload`

This command loads a file named `filename` from a specified device (`dev`) using a given interface (`interface`) into a memory address (`addr`). Using this command, the kernel image can be loaded from the SD card into memory, and then the `flash` command can be used to program the system onto the target device.

KW3-Special Function Micro Switch

✿Special Function

-High Current Micro Switch

-Light force Micro Switch

-High&Low Pressure Switch

-3mm Contact Clearence Micro Switch

-Tubular Motor Switch



✿ Material

Made of high quality plastic and metal, rust resistance and corrosion resistance, durable enough for you to hanging items, So the product appearance is exquisite, perfect workmanship.

✿ Rating

You can meet the different RATING daily needs. Please pay attention to the model of the switch before purchase, to ensure that you purchase the same as you need.

✿ Vairous Sizes

Actuator Action is momentary and Actuator Type is long straight hinge lever. Switch Body Size as shown in the picture.So different sizes can meet all your daily different needs.

✿ Wide Application

Home appliance: micro oven, electric cooker, washing machine, electric heater, warmer, water fountain and so on.

Commercial appliance: Vending machine, electric toy, electric tools, duplicating machine and so on.

Machinery: Transport machinery, printing machinery, textile machinery and so on.

Small Micro Switch,Micro On Off Switch,Micro Limit Switch Types,Special Function Micro Switch

Ningbo Jialin Electronics Co.,Ltd , https://www.donghai-switch.com