SlideShare a Scribd company logo
1 of 28
Universal Boot loaders (U-boot)
© Copyright 2013, wavedigitech.com.
Latest update: June 15, 2013,
http://www.wavedigitech.com/
Call us on 91-963283917
E-Mail : info@wavedigitech.com
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Boot loader
• What is boot loader ?
– A boot loader is the first program
which executes (before the main
program i.e. kernel ) whenever a
system is initialized.
– A boot loader is a computer program
that loads the main program (i.e.
operating system, kernel ) for the
board after completion of the self-
tests.
• Why boot loader is needed ?
– Gives a development environment
– Saves cost of flash writers
– Give flexibility to load any operating
system
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Types of Boot Loaders
• What are different types of boot loaders ?
– Boot-ROM ( or Pre-Boot Loader)
• Small code which loads First stage boot loader
– First Stage Boot Loader
• Small Piece of code that initialize the NAND/MMC & DRAM
controller.
– Second Stage Boot Loader
• Primary function of the second-stage boot loader is to Loading the
kernel into RAM or jumping directly to the start of the kernel.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Boot Loader Stages
 What is the responsibility of Boot-ROM, First, second stage boot loader ?
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-boot Porting
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
About U-Boot
• U-Boot (Universal Boot-loader) is an open source, multi platform boot-loader.
• U-Boot supports interactive commands, environment variables, command
scripting and booting from external media.
• U-Boot supports a large variety of popular CPUs and CPU families used
today, and a much larger collection of reference boards based on these
processors
• Generally, U-Boot resides in the beginning area of the flash. The exact sector or
block is defined by the processor.
• U-Boot initialize the CPU and several peripherals located on board, create
some critical data structures which will be used by kernel
• U-Boot is under GPLv2 License
• Refer below
– Wikipedia: http://en.wikipedia.org/wiki/Das_U-Boot
– Project: http://www.denx.de/wiki/U-Boot/WebHome
– Git: http://git.denx.de/u-boot.git
– FTP: http://ftp.denx.de/pub/u-boot/
– Mailing list: http://lists.denx.de/mailman/listinfo/u-boot
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-Boot Directory Structure
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-Boot Directory Structure
Before adding new board
• Look for an already supported board and SOC which
is as close as possible to yours.
• Identify the On-Chip and On-board peripherals
• Define physical memory map of board.
• Study of ARM Application Binary Interface (EABI)
• Study ARM assembly instruction
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-Boot: Porting to a LoganLTE board
• Choose an existing board which is most similar to the new board.
Say armadillo-800eva board
• Copy the ‘include/configs/armadillo-800eva.h’to
‘include/config/loganlte.h’.
• Create directory in ‘board/vendor/loganlte/’
• Update boards.cfg to add new entry for loganlte
• Create directory for SOC specific code ‘arch/arm/armv7/shmobile/’.
• Add corresponding header files in ‘arch/arm/include/asm/arch-shmobile’
• Modify the value of TEXT_BASE in ‘board/loganlte /config.mk’.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-boot: Build procedure
• export ARCH=arm
• export PATH=~/arm_eabi/bin/:$PATH
• export CROSS_COMPILE=arm-eabi-
• make distclean
• make <board>_config
• make
Output :
• u-boot is an ELF file of the code
• u-boot.bin is the binary image. (with ELF headers striped out) used
for download and debugging
• u-boot.srec is the S-Record image.
• u-boot.map has the global addresses for symbols, etc.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-boot : Linker script
OUTPUT_FORMAT("elf32-littlearm", "elf32-
littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
SECTIONS
{
. = 0x00000000;
. = ALIGN(4);
.text :
{
__image_copy_start = .;
CPUDIR/start.o (.text*)
*(.text*)
} /* Align */
.rodata : {
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
.data : {/* Align */
*(.data*)
} /* Align */
.u_boot_list : {
KEEP(*(SORT(.u_boot_list*)));
} /* Align */
__image_copy_end = .;
arch/arm/cpu/u-boot.lds
.dynsym : {
__dynsym_start = .;
*(.dynsym)
}
_end = .;
/*
* Compiler-generated __bss_start and __bss_end, see
arch/arm/lib/bss.c
* __bss_base and __bss_limit are for linker only (overlay
ordering)
*/
.bss_start __rel_dyn_start (OVERLAY) : {
KEEP(*(.__bss_start));
__bss_base = .;
}
.bss __bss_base (OVERLAY) : {
*(.bss*)
. = ALIGN(4);
__bss_limit = .;
}
.bss_end __bss_limit (OVERLAY) : {
KEEP(*(.__bss_end));
}
}
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-boot : Linker script location
• If explicitly specified LDSCRIPT in board/cpu directory.
• If CONFIG_SYS_LDSCRIPT, use that or fail if absent.
• Otherwise, it search for 'u-boot.lds' sequentially in below location
– board/<board_name>/u-boot.lds
– arch/$(ARCH)/cpu/<SOC>/u-boot.lds
– arch/$(ARCH)/cpu/u-boot.lds
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Global Data
typedef struct global_data {
bd_t *bd;
unsigned int baudrate;
unsigned long cpu_clk; /* CPU clock in Hz! */
unsigned long bus_clk;
unsigned long pci_clk;
unsigned long mem_clk;
#ifdef CONFIG_BOARD_TYPES
unsigned long board_type;
#endif
unsigned long have_console; /* serial_init() was called */
unsigned long env_addr; /* Address of Environment struct */
unsigned long env_valid; /* Checksum of Environment valid? */
/* TODO: is this the same as relocaddr, or something else? */
unsigned long dest_addr; /* Post-relocation address of U-Boot */
unsigned long dest_addr_sp;
unsigned long ram_top; /* Top address of RAM used by U-Boot */
unsigned long relocaddr; /* Start address of U-Boot in RAM */
phys_size_t ram_size; /* RAM size */
unsigned long mon_len; /* monitor len */
unsigned long irq_sp; /* irq stack pointer */
unsigned long start_addr_sp; /* start_addr_stackpointer */
unsigned long reloc_off; /* relocation offset */
struct global_data * new_gd; /* relocated global data */
const void * fdt_blob; /* Our device tree, NULL if none */
void * new_fdt; /* Relocated FDT */
unsigned long fdt_size; /* Space reserved for relocated FDT */
char env_buf[32]; /* buffer for getenv() before reloc. */
struct arch_global_data arch; /* architecture-specific data */
} gd_t;
include/asm-generic/global_data.h (DECLARE_GLOBAL_DATA_PTR)
.
typedef struct bd_info {
unsigned long bi_memstart; /* start of DRAM memory */
phys_size_t bi_memsize; /* size of DRAM memory in bytes */
unsigned long bi_flashstart; /* start of FLASH memory */
unsigned long bi_flashsize; /* size of FLASH memory */
unsigned long bi_flashoffset; /* reserved area for startup monitor */
unsigned long bi_sramstart; /* start of SRAM memory */
unsigned long bi_sramsize; /* size of SRAM memory */
#ifdef CONFIG_ARM
unsigned long bi_arm_freq; /* arm frequency */
unsigned long bi_ddr_freq; /* ddr frequency */
#endif
unsigned long bi_bootflags; /* boot / reboot flag (Unused) */
unsigned long bi_ip_addr; /* IP Address */
unsigned char bi_enetaddr[6]; /* OLD: see README.enetaddr */
unsigned short bi_ethspeed; /* Ethernet speed in Mbps */
unsigned long bi_intfreq; /* Internal Freq, in MHz */
unsigned long bi_busfreq; /* Bus Freq, in MHz */
unsigned int bi_baudrate; /* Console Baudrate */
unsigned int bi_procfreq; /* CPU (Internal) Freq, in Hz */
unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */
#endif
unsigned char bi_enetXaddr[6]; /* OLD: see README.enetaddr */
ulong bi_arch_number; /* unique id for this board */
ulong bi_boot_params; /* where this board expects params */
#ifdef CONFIG_NR_DRAM_BANKS
struct { /* RAM configuration */
ulong start;
ulong size;
} bi_dram[CONFIG_NR_DRAM_BANKS];
#endif /* CONFIG_NR_DRAM_BANKS */
} bd_t;
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
General bootstrapping Process
1. Disable all interrupts.
2. Copy any initialized data from ROM to RAM.
3. Zero the uninitialized data area.
4. Allocate space for and initialize the stack.
5. Initialize the processor’s stack pointer.
6. Create and initialize the heap.
7. Execute the initializers for all global data
8. Enable interrupts.
9. Call main loop.
 U-Boot relocates itself from ROM to RAM. Divided the boot-strapping
process into two phases:
 Pre-Relocation U-Boot Bootstrapping
 Post-Relocation U-Boot Bootstrapping
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Setup SP for
Early Board Setup
Environment (ASM->C)
Calculate Addresses
(SP, Dest, GD) for
Relocation
General Relocation
Copy Binary to RAM
Fix Relocation
Fix GOT
Clear BSS
Setup SP for
Common Board Setup
Setup GD and JUMP to
Final Board Setup
Low Level Initialization
Lowlevel_init
cpu_init_cp15
Disable MMU
Invalidate and disable
Instruction & data
Cache
Pre-Relocation bootstrapping
Disable IRQ &FIQ. Switch
to supervisor mode
cpu/armv7/star
t.S
Reset()
Reset CPU and Hardware
cpu/armv7/star
t.S
_start()
arm/lib/crt0.S
_main()
Early Board Setup
arm/lib/crt
0.S
board_init_
f()
arm/lib/crt
0.S
board_init_
r()
cpu/armv7/shmobile/lowl
evel_init.S
lowlevel_init()
cpu/armv7/start.S
relocate_code()
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Pre-relocation bootstrapping
 _start() /* Entry point function */
 call reset() /* Reset CPU configurations */
 save_boot_params() /* Save boot parameters */
 Disable the FIQ & IRQ
 Switch to supervisor mode
 cpu_init_cp15() /* Initialize the Coprocessor 15 if
!CONFIG_SKIP_LOWLEVEL_INIT */
 Invalidate I cache
 Invalidate D Cache
 Disable I cache if CONFIG_SYS_ICACHE_OFF
 Disable MMU
 cpu_init_crit() /* Call arch low level initialization if
!CONFIG_SKIP_LOWLEVEL_INIT */
 lowlevel_init()
 Call _main() /* setup initial stack & global data.
And jump to C routine for board initialization */
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Pre-relocation bootstrapping
 arch_cpu_init() // if CONFIG_ARCH_CPU_INIT
 mark_bootstage() // Set boot stage to pre-relocation boot
 board_early_init_f() // if CONFIG_BOARD_EARLY_INIT_F
 timer_init() // Initialize timer
 board_postclk_init() // if CONFIG_BOARD_POSTCLK_INIT
 env_init() // initialize mmc/sdcard environment
 init_baudrate() // set baudrate to CONFIG_BAUDRATE
 serial_init() // Initialize serial driver
 console_init_f() // Configure console from console.c
 display_banner() // Print U-Boot banner
 print_cpuinfo() // Print CPU information
 checkboard() //print board info
 init_func_i2c() // Initialize I2C if CONFIG_I2C
 dram_init() // configure available RAM banks
 board_init_f() calling sequence for arm
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Bootstrapping process
arm/lib/board.c
board_init_r()
Setup Memory for
malloc()
Setup Board Data
Setup Board
FLASH
Setup Environment
env_relocate();
Jump into Main
loop
Setup Board Specific
Devices Load
Default
Environment
s
board/rmi/loganlt
e/loganlte.c
board_init()
board/rmi/loganlte/l
oganlte.c
enable_cache()
Setup late Board
Data
Early
arch/platform
specific misc
initializations
Initialize and
Enable exceptions
Early arch
specific & power
management
specific
initialization
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
U-boot : Pre-relocation bootstrapping
 mark_bootstage() // Set boot stage to post-relocation boot
 enable_caches() // Enable cache
 board_init() // Setup board specific configuration (GPIO)
 mem_malloc_init() // Configure malloc area
 arch_early_init_r() // if CONFIG_ARCH_EARLY_INIT_R
 power_init_board() // PMIC initializations
 Flash/Nand/MMC initialization
 env_relocate() // Relocate environment or set NULL
 checkboard() //print board info
 arch_misc_init() // miscellaneous arch dependent init
 misc_init_r() // miscellaneous platform dependent init
 interrupt_init() // Initialize exceptions if CONFIG_IRQ
 enable_interrupts() // Enable Exceptions
 board_late_init() // Board late init
 eth_initialize() // Setup ethernet
 main_loop() // Jump to main loop & waiting for commands from console.
 board_init_r() calling sequence for arm
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Debugging
• Add DEBUG to configuration file to inspect stack and relocation address.
– include/configs/loganlte.h:
• #define DEBUG
• When U-Boot starts it is running from ROM space. Running from flash would
make it nearly impossible to read from flash while executing code.
• With GCC it is possible to use optimization in combination with the debugging
option -g. Many other compilers do not allow this.
• U-boot image can also used to generate the disassembly.
– $(CROSS_COMPILE)objdump -D u-boot > u-boot.dis
• Later U-Boot relocates itself to RAM. We therefore have two phases:
– Debugging of U-Boot Before Relocation
– Debugging of U-Boot After Relocation
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Debugging before Relocation
Debugging U-Boot in this phase with the BDI2000 is quite easy
bash[0]$ ${CROSS_COMPILE}gdb u-boot
(gdb) target remote bdi:2001
Remote debugging using bdi:2001
0xfffffffc in ?? ()
(gdb) b cpu_init_f
Breakpoint 1 at 0xfffd3310: file cpu_init.c, line 136.
(gdb) c
Continuing.
Breakpoint 1, cpu_init_f () at cpu_init.c:136
136 asm volatile(" bl 0f" ::: "lr");
(gdb) s
137 asm volatile("0: mflr 3" :::
"r3");
(gdb)
138 asm volatile(" addi 4, 0, 14" ::: "r4");
(gdb)
cpu_init_f is the first C function called from the code in start.C.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
Debugging after Relocation
struct global_data (register r8)‘relocaddr’ contains start address of u-boot in RAM
Relocation address = <MAXMEM> - CFG_MONITOR_LEN
= 16 MB – 192KB
= 0x1000000 - 0x30000 = 0xFD0000
(gdb) symbol-file
Discard symbol table from `/home/dzu/denx/cvs-trees/u-boot/u-boot'? (y or n) y
No symbol file now.
(gdb) add-symbol-file u-boot 0xfd0000
add symbol table from file "u-boot" at
.text_addr = 0xfd0000
(y or n) y
Reading symbols from u-boot...done.
(gdb) b board_init_r
Breakpoint 2 at 0xfd99ac: file board.c, line 533.
(gdb) c
Continuing.
Breakpoint 2, board_init_r (id=0xfbb1f0, dest_addr=16495088) at board.c:533
533 {
(gdb)
board_init_r is the first C routine running in the newly relocated C friendly
RAM environment.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
The 10 Golden Rules of U-Boot
design
1. Keep it Small
2. Keep it Fast
3. Keep it Simple
4. Keep it Portable
5. Keep it Configurable
6. Keep it Debug-able
7. Keep it Usable
8. Keep it Maintainable
9. Keep it Beautiful
10.Keep it Open
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
At the end…
• how to write optimized u-boot code ?
 Use inline functions whenever possible ? it increases code size but saves u the
overhead of stack push & pop operations
 Code all critical / frequently used code in assembly
 Store frequently used variables in register
 Use global variables it saves you push/pop stack operation during function
call.
 Don't use floating point calculations / variables.
 Enable GCC Optimization.
 -O1 = With this option the resulting executables should be smaller and
faster than with -O0
 -O2 = This option is generally the best choice for deployment of a program
 -O3 = This option may increase the speed of the resulting executable, but
can also increase its size
 -Os = his option selects optimizations which reduce the size of an
executable.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
At the end…
• Why U-boot relocate itself into RAM ?
– Memory access is faster from RAM than from ROM, this will matter
particularly if target has no instruction cache.
– Executing from RAM allows flash reprogramming; also (more minor) it
allows software breakpoints with "trap" instructions.
– Variable cannot be modified when it is stored in ROM.
• Boot loader must copy itself to RAM to update the variables correctly.
• Function calls relies on stack operation which is also should be stored
in RAM.
• Can U-Boot be configured such that it can be started in RAM?
– Yes, By enabling the CONFIG_SYS_RAMBOOT.
– But this feature is not tested with all the boards, refer
doc/README.mpc85xx.
– For u-boot builds switch CONFIG_SYS_TEXT_BASE between flash and ram
builds.
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
At the end…
• Can U-Boot be configured such that it can be started in RAM?
– Yes, By enabling the CONFIG_SYS_RAMBOOT.
– But this feature is not tested with all the boards, refer
doc/README.mpc85xx.
– For u-boot builds switch CONFIG_SYS_TEXT_BASE between flash and ram
builds if MMU is disabled.
• Why Linux hangs after uncompressing the kernel ?
Uncompressing Kernel Image ... OK
– Bad definition of the bd_info structure .
– Bad clock information
• setenv clocks_in_mhz 1; saveenv
• For more: Read U-Boot FAQ at http://www.denx.de/wiki/view/DULG/FaqUBoot
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
For more information visit
http://www.denx.de/wiki/U-Boot
Any Question ?
E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
© Copyright 2013, wavedigitech.com.
Latest update: Janl 30, 2013,
http://www.wavedigitech.com/
Call us on : +91-9632839173
E-Mail : info@wavedigitech.com
Thank You

More Related Content

What's hot

U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoCMacpaul Lin
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchlinuxlab_conf
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_BootingRashila Rr
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New HardwareRuggedBoardGroup
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBshimosawa
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device DriversNEEVEE Technologies
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelSUSE Labs Taipei
 

What's hot (20)

U boot porting guide for SoC
U boot porting guide for SoCU boot porting guide for SoC
U boot porting guide for SoC
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
Spi drivers
Spi driversSpi drivers
Spi drivers
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Linux device drivers
Linux device drivers Linux device drivers
Linux device drivers
 
I2c drivers
I2c driversI2c drivers
I2c drivers
 
Platform Drivers
Platform DriversPlatform Drivers
Platform Drivers
 
Embedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernelEmbedded Linux Kernel - Build your custom kernel
Embedded Linux Kernel - Build your custom kernel
 
Linux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKBLinux Kernel Booting Process (1) - For NLKB
Linux Kernel Booting Process (1) - For NLKB
 
A practical guide to buildroot
A practical guide to buildrootA practical guide to buildroot
A practical guide to buildroot
 
Character drivers
Character driversCharacter drivers
Character drivers
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
BeagleBone Black Bootloaders
BeagleBone Black BootloadersBeagleBone Black Bootloaders
BeagleBone Black Bootloaders
 
Introduction Linux Device Drivers
Introduction Linux Device DriversIntroduction Linux Device Drivers
Introduction Linux Device Drivers
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
ACPI Debugging from Linux Kernel
ACPI Debugging from Linux KernelACPI Debugging from Linux Kernel
ACPI Debugging from Linux Kernel
 
What is Bootloader???
What is Bootloader???What is Bootloader???
What is Bootloader???
 

Similar to U-Boot presentation 2013

Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android EmulatorSamael Wang
 
HKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting ReviewHKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting ReviewLinaro
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogicAleem Shariff
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card艾鍗科技
 
Bootstrap process boot loader
Bootstrap process boot loaderBootstrap process boot loader
Bootstrap process boot loaderidrajeev
 
Roll your own toy unix clone os
Roll your own toy unix clone osRoll your own toy unix clone os
Roll your own toy unix clone oseramax
 
망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7종인 전
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLinaro
 
ARM® Cortex™ M Bootup_CMSIS_Part_2_3
ARM® Cortex™ M Bootup_CMSIS_Part_2_3ARM® Cortex™ M Bootup_CMSIS_Part_2_3
ARM® Cortex™ M Bootup_CMSIS_Part_2_3Raahul Raghavan
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devicesMender.io
 
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Ron Munitz
 
DEF CON 23 - Phil Polstra - one device to pwn them all
DEF CON 23 - Phil Polstra - one device to pwn them allDEF CON 23 - Phil Polstra - one device to pwn them all
DEF CON 23 - Phil Polstra - one device to pwn them allFelipe Prado
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptxssuserb4d806
 
Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Stefano Babic
 
#include avrinterrupt.h The global interrupt flag is maintained.pdf
#include avrinterrupt.h The global interrupt flag is maintained.pdf#include avrinterrupt.h The global interrupt flag is maintained.pdf
#include avrinterrupt.h The global interrupt flag is maintained.pdfarasanlethers
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in indiaEdhole.com
 
Aftab_Alam_Resume2016
Aftab_Alam_Resume2016Aftab_Alam_Resume2016
Aftab_Alam_Resume2016AFTAB ALAM
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry PiLloydMoore
 
Kernel entrance to-geek-
Kernel entrance to-geek-Kernel entrance to-geek-
Kernel entrance to-geek-mao999
 

Similar to U-Boot presentation 2013 (20)

Study on Android Emulator
Study on Android EmulatorStudy on Android Emulator
Study on Android Emulator
 
HKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting ReviewHKG15-311: OP-TEE for Beginners and Porting Review
HKG15-311: OP-TEE for Beginners and Porting Review
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card
 
Bootstrap process boot loader
Bootstrap process boot loaderBootstrap process boot loader
Bootstrap process boot loader
 
Roll your own toy unix clone os
Roll your own toy unix clone osRoll your own toy unix clone os
Roll your own toy unix clone os
 
망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7망고100 보드로 놀아보자 7
망고100 보드로 놀아보자 7
 
LCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platformLCU14 302- How to port OP-TEE to another platform
LCU14 302- How to port OP-TEE to another platform
 
ARM® Cortex™ M Bootup_CMSIS_Part_2_3
ARM® Cortex™ M Bootup_CMSIS_Part_2_3ARM® Cortex™ M Bootup_CMSIS_Part_2_3
ARM® Cortex™ M Bootup_CMSIS_Part_2_3
 
A million ways to provision embedded linux devices
A million ways to provision embedded linux devicesA million ways to provision embedded linux devices
A million ways to provision embedded linux devices
 
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
 
DEF CON 23 - Phil Polstra - one device to pwn them all
DEF CON 23 - Phil Polstra - one device to pwn them allDEF CON 23 - Phil Polstra - one device to pwn them all
DEF CON 23 - Phil Polstra - one device to pwn them all
 
Labs_BT_20221017.pptx
Labs_BT_20221017.pptxLabs_BT_20221017.pptx
Labs_BT_20221017.pptx
 
Software update for embedded systems - elce2014
Software update for embedded systems - elce2014Software update for embedded systems - elce2014
Software update for embedded systems - elce2014
 
Motherboard
MotherboardMotherboard
Motherboard
 
#include avrinterrupt.h The global interrupt flag is maintained.pdf
#include avrinterrupt.h The global interrupt flag is maintained.pdf#include avrinterrupt.h The global interrupt flag is maintained.pdf
#include avrinterrupt.h The global interrupt flag is maintained.pdf
 
Mba admission in india
Mba admission in indiaMba admission in india
Mba admission in india
 
Aftab_Alam_Resume2016
Aftab_Alam_Resume2016Aftab_Alam_Resume2016
Aftab_Alam_Resume2016
 
Starting Raspberry Pi
Starting Raspberry PiStarting Raspberry Pi
Starting Raspberry Pi
 
Kernel entrance to-geek-
Kernel entrance to-geek-Kernel entrance to-geek-
Kernel entrance to-geek-
 

More from Wave Digitech

54 sms based irrigation system
54 sms based irrigation system54 sms based irrigation system
54 sms based irrigation systemWave Digitech
 
54 a automatic irrigation system
54 a automatic irrigation system54 a automatic irrigation system
54 a automatic irrigation systemWave Digitech
 
Implementation of solar illumination system with three-stage charging and dim...
Implementation of solar illumination system with three-stage charging and dim...Implementation of solar illumination system with three-stage charging and dim...
Implementation of solar illumination system with three-stage charging and dim...Wave Digitech
 
Zl embd045 wireless telemedia system based on arm and web server
Zl embd045 wireless telemedia system based on arm and web serverZl embd045 wireless telemedia system based on arm and web server
Zl embd045 wireless telemedia system based on arm and web serverWave Digitech
 
Zl embd029 arm and rfid based event management monitoring system
Zl embd029 arm and rfid based event management monitoring systemZl embd029 arm and rfid based event management monitoring system
Zl embd029 arm and rfid based event management monitoring systemWave Digitech
 
Projects wavedigitech-2013
Projects wavedigitech-2013Projects wavedigitech-2013
Projects wavedigitech-2013Wave Digitech
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Difference bw android4.2 to android 4.3
Difference bw android4.2 to android 4.3Difference bw android4.2 to android 4.3
Difference bw android4.2 to android 4.3Wave Digitech
 
Unix Process management
Unix Process managementUnix Process management
Unix Process managementWave Digitech
 
Android debug bridge
Android debug bridgeAndroid debug bridge
Android debug bridgeWave Digitech
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbookWave Digitech
 
Wavedigitech training-broucher-june2013
Wavedigitech training-broucher-june2013Wavedigitech training-broucher-june2013
Wavedigitech training-broucher-june2013Wave Digitech
 
Wavedigitech presentation-2013-v1
Wavedigitech presentation-2013-v1Wavedigitech presentation-2013-v1
Wavedigitech presentation-2013-v1Wave Digitech
 
Wavedigitech presentation-2013
Wavedigitech presentation-2013Wavedigitech presentation-2013
Wavedigitech presentation-2013Wave Digitech
 

More from Wave Digitech (17)

54 sms based irrigation system
54 sms based irrigation system54 sms based irrigation system
54 sms based irrigation system
 
54 a automatic irrigation system
54 a automatic irrigation system54 a automatic irrigation system
54 a automatic irrigation system
 
Implementation of solar illumination system with three-stage charging and dim...
Implementation of solar illumination system with three-stage charging and dim...Implementation of solar illumination system with three-stage charging and dim...
Implementation of solar illumination system with three-stage charging and dim...
 
Zl embd045 wireless telemedia system based on arm and web server
Zl embd045 wireless telemedia system based on arm and web serverZl embd045 wireless telemedia system based on arm and web server
Zl embd045 wireless telemedia system based on arm and web server
 
Zl embd029 arm and rfid based event management monitoring system
Zl embd029 arm and rfid based event management monitoring systemZl embd029 arm and rfid based event management monitoring system
Zl embd029 arm and rfid based event management monitoring system
 
Arm
ArmArm
Arm
 
8051
80518051
8051
 
Projects wavedigitech-2013
Projects wavedigitech-2013Projects wavedigitech-2013
Projects wavedigitech-2013
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Difference bw android4.2 to android 4.3
Difference bw android4.2 to android 4.3Difference bw android4.2 to android 4.3
Difference bw android4.2 to android 4.3
 
Unix Process management
Unix Process managementUnix Process management
Unix Process management
 
Android debug bridge
Android debug bridgeAndroid debug bridge
Android debug bridge
 
Useful Linux and Unix commands handbook
Useful Linux and Unix commands handbookUseful Linux and Unix commands handbook
Useful Linux and Unix commands handbook
 
Wavedigitech training-broucher-june2013
Wavedigitech training-broucher-june2013Wavedigitech training-broucher-june2013
Wavedigitech training-broucher-june2013
 
Wavedigitech presentation-2013-v1
Wavedigitech presentation-2013-v1Wavedigitech presentation-2013-v1
Wavedigitech presentation-2013-v1
 
Wavedigitech presentation-2013
Wavedigitech presentation-2013Wavedigitech presentation-2013
Wavedigitech presentation-2013
 
Wavedigitech gdb
Wavedigitech gdbWavedigitech gdb
Wavedigitech gdb
 

Recently uploaded

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

U-Boot presentation 2013

  • 1. Universal Boot loaders (U-boot) © Copyright 2013, wavedigitech.com. Latest update: June 15, 2013, http://www.wavedigitech.com/ Call us on 91-963283917 E-Mail : info@wavedigitech.com E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 2. Boot loader • What is boot loader ? – A boot loader is the first program which executes (before the main program i.e. kernel ) whenever a system is initialized. – A boot loader is a computer program that loads the main program (i.e. operating system, kernel ) for the board after completion of the self- tests. • Why boot loader is needed ? – Gives a development environment – Saves cost of flash writers – Give flexibility to load any operating system E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 3. Types of Boot Loaders • What are different types of boot loaders ? – Boot-ROM ( or Pre-Boot Loader) • Small code which loads First stage boot loader – First Stage Boot Loader • Small Piece of code that initialize the NAND/MMC & DRAM controller. – Second Stage Boot Loader • Primary function of the second-stage boot loader is to Loading the kernel into RAM or jumping directly to the start of the kernel. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 4. Boot Loader Stages  What is the responsibility of Boot-ROM, First, second stage boot loader ? E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 5. U-boot Porting E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 6. About U-Boot • U-Boot (Universal Boot-loader) is an open source, multi platform boot-loader. • U-Boot supports interactive commands, environment variables, command scripting and booting from external media. • U-Boot supports a large variety of popular CPUs and CPU families used today, and a much larger collection of reference boards based on these processors • Generally, U-Boot resides in the beginning area of the flash. The exact sector or block is defined by the processor. • U-Boot initialize the CPU and several peripherals located on board, create some critical data structures which will be used by kernel • U-Boot is under GPLv2 License • Refer below – Wikipedia: http://en.wikipedia.org/wiki/Das_U-Boot – Project: http://www.denx.de/wiki/U-Boot/WebHome – Git: http://git.denx.de/u-boot.git – FTP: http://ftp.denx.de/pub/u-boot/ – Mailing list: http://lists.denx.de/mailman/listinfo/u-boot E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 7. U-Boot Directory Structure E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 8. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173 U-Boot Directory Structure
  • 9. Before adding new board • Look for an already supported board and SOC which is as close as possible to yours. • Identify the On-Chip and On-board peripherals • Define physical memory map of board. • Study of ARM Application Binary Interface (EABI) • Study ARM assembly instruction E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 10. U-Boot: Porting to a LoganLTE board • Choose an existing board which is most similar to the new board. Say armadillo-800eva board • Copy the ‘include/configs/armadillo-800eva.h’to ‘include/config/loganlte.h’. • Create directory in ‘board/vendor/loganlte/’ • Update boards.cfg to add new entry for loganlte • Create directory for SOC specific code ‘arch/arm/armv7/shmobile/’. • Add corresponding header files in ‘arch/arm/include/asm/arch-shmobile’ • Modify the value of TEXT_BASE in ‘board/loganlte /config.mk’. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 11. U-boot: Build procedure • export ARCH=arm • export PATH=~/arm_eabi/bin/:$PATH • export CROSS_COMPILE=arm-eabi- • make distclean • make <board>_config • make Output : • u-boot is an ELF file of the code • u-boot.bin is the binary image. (with ELF headers striped out) used for download and debugging • u-boot.srec is the S-Record image. • u-boot.map has the global addresses for symbols, etc. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 12. U-boot : Linker script OUTPUT_FORMAT("elf32-littlearm", "elf32- littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { . = 0x00000000; . = ALIGN(4); .text : { __image_copy_start = .; CPUDIR/start.o (.text*) *(.text*) } /* Align */ .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } .data : {/* Align */ *(.data*) } /* Align */ .u_boot_list : { KEEP(*(SORT(.u_boot_list*))); } /* Align */ __image_copy_end = .; arch/arm/cpu/u-boot.lds .dynsym : { __dynsym_start = .; *(.dynsym) } _end = .; /* * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c * __bss_base and __bss_limit are for linker only (overlay ordering) */ .bss_start __rel_dyn_start (OVERLAY) : { KEEP(*(.__bss_start)); __bss_base = .; } .bss __bss_base (OVERLAY) : { *(.bss*) . = ALIGN(4); __bss_limit = .; } .bss_end __bss_limit (OVERLAY) : { KEEP(*(.__bss_end)); } } E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 13. U-boot : Linker script location • If explicitly specified LDSCRIPT in board/cpu directory. • If CONFIG_SYS_LDSCRIPT, use that or fail if absent. • Otherwise, it search for 'u-boot.lds' sequentially in below location – board/<board_name>/u-boot.lds – arch/$(ARCH)/cpu/<SOC>/u-boot.lds – arch/$(ARCH)/cpu/u-boot.lds E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 14. Global Data typedef struct global_data { bd_t *bd; unsigned int baudrate; unsigned long cpu_clk; /* CPU clock in Hz! */ unsigned long bus_clk; unsigned long pci_clk; unsigned long mem_clk; #ifdef CONFIG_BOARD_TYPES unsigned long board_type; #endif unsigned long have_console; /* serial_init() was called */ unsigned long env_addr; /* Address of Environment struct */ unsigned long env_valid; /* Checksum of Environment valid? */ /* TODO: is this the same as relocaddr, or something else? */ unsigned long dest_addr; /* Post-relocation address of U-Boot */ unsigned long dest_addr_sp; unsigned long ram_top; /* Top address of RAM used by U-Boot */ unsigned long relocaddr; /* Start address of U-Boot in RAM */ phys_size_t ram_size; /* RAM size */ unsigned long mon_len; /* monitor len */ unsigned long irq_sp; /* irq stack pointer */ unsigned long start_addr_sp; /* start_addr_stackpointer */ unsigned long reloc_off; /* relocation offset */ struct global_data * new_gd; /* relocated global data */ const void * fdt_blob; /* Our device tree, NULL if none */ void * new_fdt; /* Relocated FDT */ unsigned long fdt_size; /* Space reserved for relocated FDT */ char env_buf[32]; /* buffer for getenv() before reloc. */ struct arch_global_data arch; /* architecture-specific data */ } gd_t; include/asm-generic/global_data.h (DECLARE_GLOBAL_DATA_PTR) . typedef struct bd_info { unsigned long bi_memstart; /* start of DRAM memory */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */ unsigned long bi_flashstart; /* start of FLASH memory */ unsigned long bi_flashsize; /* size of FLASH memory */ unsigned long bi_flashoffset; /* reserved area for startup monitor */ unsigned long bi_sramstart; /* start of SRAM memory */ unsigned long bi_sramsize; /* size of SRAM memory */ #ifdef CONFIG_ARM unsigned long bi_arm_freq; /* arm frequency */ unsigned long bi_ddr_freq; /* ddr frequency */ #endif unsigned long bi_bootflags; /* boot / reboot flag (Unused) */ unsigned long bi_ip_addr; /* IP Address */ unsigned char bi_enetaddr[6]; /* OLD: see README.enetaddr */ unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ unsigned long bi_intfreq; /* Internal Freq, in MHz */ unsigned long bi_busfreq; /* Bus Freq, in MHz */ unsigned int bi_baudrate; /* Console Baudrate */ unsigned int bi_procfreq; /* CPU (Internal) Freq, in Hz */ unsigned char bi_pci_enetaddr[6]; /* PCI Ethernet MAC address */ #endif unsigned char bi_enetXaddr[6]; /* OLD: see README.enetaddr */ ulong bi_arch_number; /* unique id for this board */ ulong bi_boot_params; /* where this board expects params */ #ifdef CONFIG_NR_DRAM_BANKS struct { /* RAM configuration */ ulong start; ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; #endif /* CONFIG_NR_DRAM_BANKS */ } bd_t; E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 15. General bootstrapping Process 1. Disable all interrupts. 2. Copy any initialized data from ROM to RAM. 3. Zero the uninitialized data area. 4. Allocate space for and initialize the stack. 5. Initialize the processor’s stack pointer. 6. Create and initialize the heap. 7. Execute the initializers for all global data 8. Enable interrupts. 9. Call main loop.  U-Boot relocates itself from ROM to RAM. Divided the boot-strapping process into two phases:  Pre-Relocation U-Boot Bootstrapping  Post-Relocation U-Boot Bootstrapping E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 16. Setup SP for Early Board Setup Environment (ASM->C) Calculate Addresses (SP, Dest, GD) for Relocation General Relocation Copy Binary to RAM Fix Relocation Fix GOT Clear BSS Setup SP for Common Board Setup Setup GD and JUMP to Final Board Setup Low Level Initialization Lowlevel_init cpu_init_cp15 Disable MMU Invalidate and disable Instruction & data Cache Pre-Relocation bootstrapping Disable IRQ &FIQ. Switch to supervisor mode cpu/armv7/star t.S Reset() Reset CPU and Hardware cpu/armv7/star t.S _start() arm/lib/crt0.S _main() Early Board Setup arm/lib/crt 0.S board_init_ f() arm/lib/crt 0.S board_init_ r() cpu/armv7/shmobile/lowl evel_init.S lowlevel_init() cpu/armv7/start.S relocate_code() E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 17. Pre-relocation bootstrapping  _start() /* Entry point function */  call reset() /* Reset CPU configurations */  save_boot_params() /* Save boot parameters */  Disable the FIQ & IRQ  Switch to supervisor mode  cpu_init_cp15() /* Initialize the Coprocessor 15 if !CONFIG_SKIP_LOWLEVEL_INIT */  Invalidate I cache  Invalidate D Cache  Disable I cache if CONFIG_SYS_ICACHE_OFF  Disable MMU  cpu_init_crit() /* Call arch low level initialization if !CONFIG_SKIP_LOWLEVEL_INIT */  lowlevel_init()  Call _main() /* setup initial stack & global data. And jump to C routine for board initialization */ E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 18. Pre-relocation bootstrapping  arch_cpu_init() // if CONFIG_ARCH_CPU_INIT  mark_bootstage() // Set boot stage to pre-relocation boot  board_early_init_f() // if CONFIG_BOARD_EARLY_INIT_F  timer_init() // Initialize timer  board_postclk_init() // if CONFIG_BOARD_POSTCLK_INIT  env_init() // initialize mmc/sdcard environment  init_baudrate() // set baudrate to CONFIG_BAUDRATE  serial_init() // Initialize serial driver  console_init_f() // Configure console from console.c  display_banner() // Print U-Boot banner  print_cpuinfo() // Print CPU information  checkboard() //print board info  init_func_i2c() // Initialize I2C if CONFIG_I2C  dram_init() // configure available RAM banks  board_init_f() calling sequence for arm E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 19. Bootstrapping process arm/lib/board.c board_init_r() Setup Memory for malloc() Setup Board Data Setup Board FLASH Setup Environment env_relocate(); Jump into Main loop Setup Board Specific Devices Load Default Environment s board/rmi/loganlt e/loganlte.c board_init() board/rmi/loganlte/l oganlte.c enable_cache() Setup late Board Data Early arch/platform specific misc initializations Initialize and Enable exceptions Early arch specific & power management specific initialization E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 20. U-boot : Pre-relocation bootstrapping  mark_bootstage() // Set boot stage to post-relocation boot  enable_caches() // Enable cache  board_init() // Setup board specific configuration (GPIO)  mem_malloc_init() // Configure malloc area  arch_early_init_r() // if CONFIG_ARCH_EARLY_INIT_R  power_init_board() // PMIC initializations  Flash/Nand/MMC initialization  env_relocate() // Relocate environment or set NULL  checkboard() //print board info  arch_misc_init() // miscellaneous arch dependent init  misc_init_r() // miscellaneous platform dependent init  interrupt_init() // Initialize exceptions if CONFIG_IRQ  enable_interrupts() // Enable Exceptions  board_late_init() // Board late init  eth_initialize() // Setup ethernet  main_loop() // Jump to main loop & waiting for commands from console.  board_init_r() calling sequence for arm E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 21. Debugging • Add DEBUG to configuration file to inspect stack and relocation address. – include/configs/loganlte.h: • #define DEBUG • When U-Boot starts it is running from ROM space. Running from flash would make it nearly impossible to read from flash while executing code. • With GCC it is possible to use optimization in combination with the debugging option -g. Many other compilers do not allow this. • U-boot image can also used to generate the disassembly. – $(CROSS_COMPILE)objdump -D u-boot > u-boot.dis • Later U-Boot relocates itself to RAM. We therefore have two phases: – Debugging of U-Boot Before Relocation – Debugging of U-Boot After Relocation E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 22. Debugging before Relocation Debugging U-Boot in this phase with the BDI2000 is quite easy bash[0]$ ${CROSS_COMPILE}gdb u-boot (gdb) target remote bdi:2001 Remote debugging using bdi:2001 0xfffffffc in ?? () (gdb) b cpu_init_f Breakpoint 1 at 0xfffd3310: file cpu_init.c, line 136. (gdb) c Continuing. Breakpoint 1, cpu_init_f () at cpu_init.c:136 136 asm volatile(" bl 0f" ::: "lr"); (gdb) s 137 asm volatile("0: mflr 3" ::: "r3"); (gdb) 138 asm volatile(" addi 4, 0, 14" ::: "r4"); (gdb) cpu_init_f is the first C function called from the code in start.C. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 23. Debugging after Relocation struct global_data (register r8)‘relocaddr’ contains start address of u-boot in RAM Relocation address = <MAXMEM> - CFG_MONITOR_LEN = 16 MB – 192KB = 0x1000000 - 0x30000 = 0xFD0000 (gdb) symbol-file Discard symbol table from `/home/dzu/denx/cvs-trees/u-boot/u-boot'? (y or n) y No symbol file now. (gdb) add-symbol-file u-boot 0xfd0000 add symbol table from file "u-boot" at .text_addr = 0xfd0000 (y or n) y Reading symbols from u-boot...done. (gdb) b board_init_r Breakpoint 2 at 0xfd99ac: file board.c, line 533. (gdb) c Continuing. Breakpoint 2, board_init_r (id=0xfbb1f0, dest_addr=16495088) at board.c:533 533 { (gdb) board_init_r is the first C routine running in the newly relocated C friendly RAM environment. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 24. The 10 Golden Rules of U-Boot design 1. Keep it Small 2. Keep it Fast 3. Keep it Simple 4. Keep it Portable 5. Keep it Configurable 6. Keep it Debug-able 7. Keep it Usable 8. Keep it Maintainable 9. Keep it Beautiful 10.Keep it Open E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 25. At the end… • how to write optimized u-boot code ?  Use inline functions whenever possible ? it increases code size but saves u the overhead of stack push & pop operations  Code all critical / frequently used code in assembly  Store frequently used variables in register  Use global variables it saves you push/pop stack operation during function call.  Don't use floating point calculations / variables.  Enable GCC Optimization.  -O1 = With this option the resulting executables should be smaller and faster than with -O0  -O2 = This option is generally the best choice for deployment of a program  -O3 = This option may increase the speed of the resulting executable, but can also increase its size  -Os = his option selects optimizations which reduce the size of an executable. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 26. At the end… • Why U-boot relocate itself into RAM ? – Memory access is faster from RAM than from ROM, this will matter particularly if target has no instruction cache. – Executing from RAM allows flash reprogramming; also (more minor) it allows software breakpoints with "trap" instructions. – Variable cannot be modified when it is stored in ROM. • Boot loader must copy itself to RAM to update the variables correctly. • Function calls relies on stack operation which is also should be stored in RAM. • Can U-Boot be configured such that it can be started in RAM? – Yes, By enabling the CONFIG_SYS_RAMBOOT. – But this feature is not tested with all the boards, refer doc/README.mpc85xx. – For u-boot builds switch CONFIG_SYS_TEXT_BASE between flash and ram builds. E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 27. At the end… • Can U-Boot be configured such that it can be started in RAM? – Yes, By enabling the CONFIG_SYS_RAMBOOT. – But this feature is not tested with all the boards, refer doc/README.mpc85xx. – For u-boot builds switch CONFIG_SYS_TEXT_BASE between flash and ram builds if MMU is disabled. • Why Linux hangs after uncompressing the kernel ? Uncompressing Kernel Image ... OK – Bad definition of the bd_info structure . – Bad clock information • setenv clocks_in_mhz 1; saveenv • For more: Read U-Boot FAQ at http://www.denx.de/wiki/view/DULG/FaqUBoot E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173
  • 28. For more information visit http://www.denx.de/wiki/U-Boot Any Question ? E-mail: info@wavedigitech.com; http://www.wavedigitech.com Phone : 91-9632839173 © Copyright 2013, wavedigitech.com. Latest update: Janl 30, 2013, http://www.wavedigitech.com/ Call us on : +91-9632839173 E-Mail : info@wavedigitech.com Thank You