Embedded linux boot


 

General booting sequence:


  • RBL (ROM Boot loader):
    • Provided By:  chip manufacture.
    • code location: ROM of the SOC.
    • code execution: ROM
    • Job: 
      • Load and execute 2nd stage boot loader(SPL/MLO) internal memory of SOC
      • Watchdog initialization (3 minutes). if it does not detect any 2nd stage Boot loader(memory booting or peripheral booting ). reset the soc.
      • System clock configuration using PLL.
      • Copy MLO/SPL into the internal SRAM of the chip from eMMC Memory
      • Execute SPL.
  • SPL Boot loader:
    • Provided by: open source 
    • code location: SD card (1st partition)
    • code execution: SRAM (64K) (internal RAM) 
    • Job:
      • load and execute the 3rd state boot loader such as Uboot.
      • UART console initialization to print out debug message.
      • Initializes the DDR registers to use DDR Memory.  
      • Mux configuration of boot peripherals pins.
      • Copy the Uboot in DRAM from eMMC Memory.
  • Uboot Boot loader:
    • Provided by:  Open 
    • code location: SD card (2nd partition) /boot
    • code execution:  DRAM(512KB)
    • Job:
      • load and execute the Linux kernel from DDR.
      • Initialize some of the peripherals like I2c, NAND, ethernet, UART, (kernel loading support peripheral).
      • Load Linux kernel image from various boot sources(USB, NAND flash, Network,eMMC, SD card, serial port)  to the DDR memory of the board. 
  • Kernel:
    • Provided by: open source
    • code location: SD card
    • code execution: DRAM  
    • Job: 
      • see below

Kernel booting:

    

File path:

  • linux/arch/arm/boot/compressed/head.S' --> boot startp staring point
  • linux/arch/arm/kernel/head.S       --> belongs linux kernel arch specific code most does cpu specifice initialization of SOC (arm cortex a8 CPU)
  • linux/arch/arm/kernel/head-common.S    --> all the architure specifice initlize 
  • linux/init/main.c -->  starting point of linux kernel,
    • linux banner --> linux version, date of build linux version
    • start_kernel will call the rest_kernel, which will again call the kernel_init thread. 
      • cgroup_init_early
      • boot cpu init
      • page alloc init
      • timer init 
      • profile init 
      • mmu init 
      • IRQ init
      • console init.
    • in that thread , it will check for the  /sbin/init 
  • /sbin/init sourece code, will be present in  uclinux-rootfs/user/busybox/init/init.c


Q & A:
  •  Can we avoid using the MLO/SPL by making RBL directly load the uboot into internal Memory SRAM? 
    • The Size of the internal RAM is 128Kbytes. (in that 128KB, some part is reserved for the STACK & Heap). uboot image is not possible to reduce < 128KB. 
  • Can we use RBL to load U-boot directly into DDR memory of the board and skip using MLO/SPL?
    • ROM code won't be having any idea about what kind of DDR RAM being used in the product to initialize it. 
    • DDR RAM is product specific. 

Comments

Popular posts from this blog

Overview of ISO/SAE 21434 Standard

Cryptography and Encryption Basics - I

ECU LIST