Step by step to play the bootloader under pcduino3 -- mmc

Source: Internet
Author: User
Tags spl

Mmc startup is supported under pcDuino3. The official Uboot is implemented using the SPL framework because the internal SRAM space reaches 32 KB, we can write a complete and small bootloader in this 32 K space to guide Linux kernel.

First, let's introduce the SPL framework. First, let's take a look at gnu arm assembly -- (18th) u-boot-how to start with nand_spl and gnu arm assembly -- (19th) u-boot-nand-spl Startup Process Analysis, NAND_SPL is also a Mode Under the SPL framework.

When using Nand flash or MMC as the boot mode, we need to use the ROM or other mechanisms in the chip to load the firmware to the SRAM.

In this case, SPL is required because SPL is short and suitable for 4 K or even smaller SRAM environments. At this time, the boot process becomes, SPL guides Uboot, and Uboot guides the system kernel.

In fact, as the SPL of pcDuino3, it can directly guide the kernel function, if you do not need to use the additional powerful features provided by uboot.

Here we will introduce the idea of writing bootloader:

Use the read driver function of mmc to read the kernel image at the specified location to the memory, and then complete the parameter list transmission and MMU and cache configuration according to Linux requirements, you can complete the jump action.

The code for the last step is as follows:

void boot_linux(void){uart_printf("boot linux\n");void (*kernel_entry)(int zero, int arch, uint params);unsigned long r2;unsigned long machid;setup_linux_param(0x40000000 + 0x100);cleanup_before_linux();kernel_entry = (void (*)(int, int, uint))0x48000000;machid = 4283;r2= 0x40000100;kernel_entry(0, machid, r2);}
This function completes the description of booting arm Linux in the kernel Documentation/ARM/booting.

In this way, a bootloader with only 18 K size can guide the kernel.

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.