SlideShare a Scribd company logo
1 of 27
© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
BeagleBone Black Bootloaders
2© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What to Expect?
BBB Memory Organization
Beagle Booting Process
W's of X-Loader
BSP in X-Loader
W's of U-Boot
BSP in U-Boot
3© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
BBB Memory Organization
DDR
512MB
ROM
Internal
RAM
64KB
SOC
BeagleBone Black
0x800000
00
0x402000
00
0x402F0400 EMMC
4GB
Ext.
MMC
4© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
General Booting of BeagleBoard
ROM
Code
Internal
ROM
X-Loader
Internal
SRAM
Internal
ROM
U-Boot
External
DDR
Kernel
External
DDR
5© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
BBB Images
ROM
Code
X-Loader
SOC
BeagleBone Black
ROM
Internal
RAM
DDR
u-boot
bbb.dtb
uImage
Ramdisk/initrd
(Ramdisk Boot)
6© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
X-Loader
7© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
W's of X-Loader
First stage bootloader for Beagle Board
Derived from u-boot – the second stage
bootloader
Named as MLO (Memory Loader) in
filesystem.
Runs in an internal SRAM
Loads the second stage bootloader i.e. U-
Boot
8© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Let's Get Down to Source Code
9© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
X-Loader Code Flow
cpu/armv7/start.S
reset()
Disable IRQ & FIQ.
Switch to
supervisor mode
Low Level Initialization
cpu_init_cp15()
Invalidate and
disable
Instruction & data
Cache
Disable MMU
cpu/armv7/lowlevel_i
nit.S
lowlevel_init()
arm/lib/crt0.S
_main()
C Runtime setup
arm/lib/spl.c
board_init_f()
Early Board Setup
Clear BSS and jump
to board_init_r()
Common/spl/spl.c
board_init_r()
Load the u-boot
10© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
X-Loader for BBB
Board configuration
include/configs/am335x_evm.h
CPU dependent code
arch/arm/cpu/armv7/*.c
arch/arm/cpu/armv7/lowlevel_init.S
arch/arm/lib/crt0.S
arch/arm/cpu/armv7/am33x/board.c
arch/arm/lib/spl.c
Board dependent code
Board/ti/am335x/board.*
Board independent code
common/spl/spl.c
11© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
X-loader Hands on
On which pin is the LED connected?
How is it connected – Active high/Active
low?
Pin muxing/Direction
Registers to manipulate the LED
12© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
X-loader Hands on...
Schematic (BBB SRM)
On which pin is the LED connected?
How is it connected - Active high/Active low?
Datasheet (TRM of AM33XX)
Pin muxing / Direction
Registers to manipulate the LED
13© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot
14© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
W's of U-Boot
Universal Bootloader (U-Boot)
An Open Source Bootloader
With minimal changes, can be ported for any
board
GRUB/LILO
Designed with x-86 in mind
Huge in Size
Needs to be changed drastically for porting on
other architecture
15© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Source Tree
arch – Architecture dependent Code
board – Board dependent Code
common – Environment & Command Line Code
doc – Documentation
drivers – Device specific Drivers
fs – File System support Code
include – Headers
lib – Compression, Encryption related Code
net – Minimal Network Stack
tools – U-Boot Utilities (mkimage is here)
16© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Initialization Details
Bootloader starts its execution from flash /RAM
Hardware Diagnostics, like POST, …
Configuring the CPU speed, MMU setting, etc
Memory setup & initialization
Setting up interfacing ports like serial, VGA, …
Sets up the address of the boot parameters
17© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Let's Get Down to Source Code
18© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Code Flow
cpu/armv7/start.S
reset()
Disable IRQ & FIQ.
Switch to
supervisor mode
Low Level Initialization
cpu_init_cp15()
Invalidate and
disable
Instruction & data
Cache
Disable MMU
cpu/armv7/lowlevel_i
nit.S
lowlevel_init()
arm/lib/crt0.S
_main()
C Runtime setup
arm/lib/board.c
board_init_f()
Early Board Setup
Calculate
Addresses (SP,
Dest, GD) for
Relocation
Call the board
initialization
functions
Arch/arm/lib/reloc
ate.S
relocate_code()
General Relocation
arm/lib/crt0.S
_main()
Clear BSS, Setup GD and jump
to board_init_r()
arm/lib/board.c
board_init_r()
Final Board Setup
Board/it/am335x/board.c
board_init()
Board specific device setup
env_relocate()
Setup Environment
common/main.c
main_loop()
Boot the kernel or give out
the u-boot shell
19© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Let's Check
What is the starting point of u-boot?
Where is the address of the Environmental Variables set?
Where is RAM initialized?
Which file is the interface between the architecture dependent code & board
dependent code?
Where is serial initialized?
From where is the kernel invoked? And what are the parameters passed to the
kernel?
Where is default environment defined?
where is the board dependent file for BBB?
Where is the configuration file for BBB?
Where is the architecture number set?
Where is the pin multiplexing done?
From where does the boot delay comes?
20© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot BSP
Board configuration
include/configs/am335x_evm.h
CPU dependent code
arch/arm/cpu/armv7/*.c
arch/arm/cpu/armv7/lowlevel_init.S
arch/arm/lib/crt0.S
arch/arm/lib/relocate.S
arch/arm/cpu/armv7/am33x/board.c
arch/arm/lib/board.c
Board dependent code
Board/ti/am335x/board.*
Board independent code
common/*
driver, fs, common(cmd, flash, env..)
21© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Configuration
Creating a configuration file for the board
Adding a Kconfig file in
'board/<vendor>/<board> with below
info:
Architecture
CPU
Board
Vendor (May be NULL)
SoC (May be NULL)
22© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Configuration Output
Configuration files for use in C Sources
include/generated/autoconf.h
spl/include/generated/autoconf.h (For SPL)
include/config.h
include/configs/<board>.h
Configuration files for Makefile
include/config/auto.conf
spl/include/config/auto.conf (For SPL)
include/autoconf.mk
23© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Porting
Implies adding a new Board to U-Boot
That entails
Adding board specific code at the right places
Adding the new board directory under board/ with
Makefile
Initialization Code for the Board
Kconfig file
Adding the new board header under include/configs/
with
Configuration for the Board
24© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
U-Boot Porting Hands On
Add the configuration file .h in include/configs
Add the Kconfig file at board/<vendor>/<soc>/
Modify the arch/arm/Kconfig to add the menu item for the
board and source the board dependent Kconfig file
Add the board dependent file at board/<vendor>/<soc>/
Modify the path for linker script at
include/configs/<config_name.h>
In the linker script, add the path for built_in.o for the board.
Add the defconfig file in configs folder. Add atleast
CONFIG_ARM and CONFIG_TARGET_<BOARD>
25© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Env in I2C eeprom
Configure for Env is in eeprom
I2C EEPROM Slave Address
Env offset in eeprom
Page write delay
Page write bits
26© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
What all have learnt?
BBB Memory Organization
Beagle Booting Process
W's of X-Loader
BSP in X-Loader
W's of U-Boot
BSP in U-Boot
27© 2015-18 SysPlay Workshops <workshop@sysplay.in>
All Rights Reserved.
Any Queries?

More Related Content

What's hot (20)

Basic Linux Internals
Basic Linux InternalsBasic Linux Internals
Basic Linux Internals
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
Platform Drivers
Platform DriversPlatform Drivers
Platform Drivers
 
Bootloaders (U-Boot)
Bootloaders (U-Boot) Bootloaders (U-Boot)
Bootloaders (U-Boot)
 
Embedded_Linux_Booting
Embedded_Linux_BootingEmbedded_Linux_Booting
Embedded_Linux_Booting
 
Network Drivers
Network DriversNetwork Drivers
Network Drivers
 
Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)
 
Linux kernel tracing
Linux kernel tracingLinux kernel tracing
Linux kernel tracing
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Linux Porting
Linux PortingLinux Porting
Linux Porting
 
U-Boot - An universal bootloader
U-Boot - An universal bootloader U-Boot - An universal bootloader
U-Boot - An universal bootloader
 
Board Bringup
Board BringupBoard Bringup
Board Bringup
 
Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)Embedded Linux BSP Training (Intro)
Embedded Linux BSP Training (Intro)
 
Qemu Pcie
Qemu PcieQemu Pcie
Qemu Pcie
 
linux device driver
linux device driverlinux device driver
linux device driver
 
Bootloaders
BootloadersBootloaders
Bootloaders
 
Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Launch the First Process in Linux System
Launch the First Process in Linux SystemLaunch the First Process in Linux System
Launch the First Process in Linux System
 
U boot-boot-flow
U boot-boot-flowU boot-boot-flow
U boot-boot-flow
 
Introduction to SELinux Part-I
Introduction to SELinux Part-IIntroduction to SELinux Part-I
Introduction to SELinux Part-I
 

Similar to BeagleBone Black Bootloaders

Similar to BeagleBone Black Bootloaders (20)

BeagleBoard-xM Bootloaders
BeagleBoard-xM BootloadersBeagleBoard-xM Bootloaders
BeagleBoard-xM Bootloaders
 
BeagleBoard-xM Booting Process
BeagleBoard-xM Booting ProcessBeagleBoard-xM Booting Process
BeagleBoard-xM Booting Process
 
PCI Drivers
PCI DriversPCI Drivers
PCI Drivers
 
U-Boot Porting on New Hardware
U-Boot Porting on New HardwareU-Boot Porting on New Hardware
U-Boot Porting on New Hardware
 
Ch4 v70 system_configuration_en
Ch4 v70 system_configuration_enCh4 v70 system_configuration_en
Ch4 v70 system_configuration_en
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
PowerAI Deep Dive ( key points )
PowerAI Deep Dive ( key points )PowerAI Deep Dive ( key points )
PowerAI Deep Dive ( key points )
 
SPI Drivers
SPI DriversSPI Drivers
SPI Drivers
 
Jagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratchJagan Teki - U-boot from scratch
Jagan Teki - U-boot from scratch
 
my Windows 7 info
my Windows 7 infomy Windows 7 info
my Windows 7 info
 
建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card建構嵌入式Linux系統於SD Card
建構嵌入式Linux系統於SD Card
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
Motherboard
MotherboardMotherboard
Motherboard
 
101 1.1 hardware settings
101 1.1 hardware settings101 1.1 hardware settings
101 1.1 hardware settings
 
The Motherboard Parts and their Function
The Motherboard Parts and their FunctionThe Motherboard Parts and their Function
The Motherboard Parts and their Function
 
Understanding the BBB
Understanding the BBBUnderstanding the BBB
Understanding the BBB
 
ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220ChromePad - Chromium OS ThinkPad X220
ChromePad - Chromium OS ThinkPad X220
 
ChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPadChromePad - Chromium OS for ThinkPad
ChromePad - Chromium OS for ThinkPad
 
Hypervisor and VDI security
Hypervisor and VDI securityHypervisor and VDI security
Hypervisor and VDI security
 
Aplus essentials-exam-cram
Aplus essentials-exam-cramAplus essentials-exam-cram
Aplus essentials-exam-cram
 

More from SysPlay eLearning Academy for You (12)

Linux Internals Part - 3
Linux Internals Part - 3Linux Internals Part - 3
Linux Internals Part - 3
 
Linux Internals Part - 2
Linux Internals Part - 2Linux Internals Part - 2
Linux Internals Part - 2
 
Linux Internals Part - 1
Linux Internals Part - 1Linux Internals Part - 1
Linux Internals Part - 1
 
Kernel Timing Management
Kernel Timing ManagementKernel Timing Management
Kernel Timing Management
 
POSIX Threads
POSIX ThreadsPOSIX Threads
POSIX Threads
 
Linux DMA Engine
Linux DMA EngineLinux DMA Engine
Linux DMA Engine
 
Cache Management
Cache ManagementCache Management
Cache Management
 
Introduction to BeagleBone Black
Introduction to BeagleBone BlackIntroduction to BeagleBone Black
Introduction to BeagleBone Black
 
Introduction to BeagleBoard-xM
Introduction to BeagleBoard-xMIntroduction to BeagleBoard-xM
Introduction to BeagleBoard-xM
 
Serial Drivers
Serial DriversSerial Drivers
Serial Drivers
 
I2C Drivers
I2C DriversI2C Drivers
I2C Drivers
 
Linux System
Linux SystemLinux System
Linux System
 

Recently uploaded

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
"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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Recently uploaded (20)

CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
"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
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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?
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

BeagleBone Black Bootloaders

  • 1. © 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. BeagleBone Black Bootloaders
  • 2. 2© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What to Expect? BBB Memory Organization Beagle Booting Process W's of X-Loader BSP in X-Loader W's of U-Boot BSP in U-Boot
  • 3. 3© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. BBB Memory Organization DDR 512MB ROM Internal RAM 64KB SOC BeagleBone Black 0x800000 00 0x402000 00 0x402F0400 EMMC 4GB Ext. MMC
  • 4. 4© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. General Booting of BeagleBoard ROM Code Internal ROM X-Loader Internal SRAM Internal ROM U-Boot External DDR Kernel External DDR
  • 5. 5© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. BBB Images ROM Code X-Loader SOC BeagleBone Black ROM Internal RAM DDR u-boot bbb.dtb uImage Ramdisk/initrd (Ramdisk Boot)
  • 6. 6© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. X-Loader
  • 7. 7© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. W's of X-Loader First stage bootloader for Beagle Board Derived from u-boot – the second stage bootloader Named as MLO (Memory Loader) in filesystem. Runs in an internal SRAM Loads the second stage bootloader i.e. U- Boot
  • 8. 8© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Let's Get Down to Source Code
  • 9. 9© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. X-Loader Code Flow cpu/armv7/start.S reset() Disable IRQ & FIQ. Switch to supervisor mode Low Level Initialization cpu_init_cp15() Invalidate and disable Instruction & data Cache Disable MMU cpu/armv7/lowlevel_i nit.S lowlevel_init() arm/lib/crt0.S _main() C Runtime setup arm/lib/spl.c board_init_f() Early Board Setup Clear BSS and jump to board_init_r() Common/spl/spl.c board_init_r() Load the u-boot
  • 10. 10© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. X-Loader for BBB Board configuration include/configs/am335x_evm.h CPU dependent code arch/arm/cpu/armv7/*.c arch/arm/cpu/armv7/lowlevel_init.S arch/arm/lib/crt0.S arch/arm/cpu/armv7/am33x/board.c arch/arm/lib/spl.c Board dependent code Board/ti/am335x/board.* Board independent code common/spl/spl.c
  • 11. 11© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. X-loader Hands on On which pin is the LED connected? How is it connected – Active high/Active low? Pin muxing/Direction Registers to manipulate the LED
  • 12. 12© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. X-loader Hands on... Schematic (BBB SRM) On which pin is the LED connected? How is it connected - Active high/Active low? Datasheet (TRM of AM33XX) Pin muxing / Direction Registers to manipulate the LED
  • 13. 13© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot
  • 14. 14© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. W's of U-Boot Universal Bootloader (U-Boot) An Open Source Bootloader With minimal changes, can be ported for any board GRUB/LILO Designed with x-86 in mind Huge in Size Needs to be changed drastically for porting on other architecture
  • 15. 15© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Source Tree arch – Architecture dependent Code board – Board dependent Code common – Environment & Command Line Code doc – Documentation drivers – Device specific Drivers fs – File System support Code include – Headers lib – Compression, Encryption related Code net – Minimal Network Stack tools – U-Boot Utilities (mkimage is here)
  • 16. 16© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Initialization Details Bootloader starts its execution from flash /RAM Hardware Diagnostics, like POST, … Configuring the CPU speed, MMU setting, etc Memory setup & initialization Setting up interfacing ports like serial, VGA, … Sets up the address of the boot parameters
  • 17. 17© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Let's Get Down to Source Code
  • 18. 18© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Code Flow cpu/armv7/start.S reset() Disable IRQ & FIQ. Switch to supervisor mode Low Level Initialization cpu_init_cp15() Invalidate and disable Instruction & data Cache Disable MMU cpu/armv7/lowlevel_i nit.S lowlevel_init() arm/lib/crt0.S _main() C Runtime setup arm/lib/board.c board_init_f() Early Board Setup Calculate Addresses (SP, Dest, GD) for Relocation Call the board initialization functions Arch/arm/lib/reloc ate.S relocate_code() General Relocation arm/lib/crt0.S _main() Clear BSS, Setup GD and jump to board_init_r() arm/lib/board.c board_init_r() Final Board Setup Board/it/am335x/board.c board_init() Board specific device setup env_relocate() Setup Environment common/main.c main_loop() Boot the kernel or give out the u-boot shell
  • 19. 19© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Let's Check What is the starting point of u-boot? Where is the address of the Environmental Variables set? Where is RAM initialized? Which file is the interface between the architecture dependent code & board dependent code? Where is serial initialized? From where is the kernel invoked? And what are the parameters passed to the kernel? Where is default environment defined? where is the board dependent file for BBB? Where is the configuration file for BBB? Where is the architecture number set? Where is the pin multiplexing done? From where does the boot delay comes?
  • 20. 20© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot BSP Board configuration include/configs/am335x_evm.h CPU dependent code arch/arm/cpu/armv7/*.c arch/arm/cpu/armv7/lowlevel_init.S arch/arm/lib/crt0.S arch/arm/lib/relocate.S arch/arm/cpu/armv7/am33x/board.c arch/arm/lib/board.c Board dependent code Board/ti/am335x/board.* Board independent code common/* driver, fs, common(cmd, flash, env..)
  • 21. 21© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Configuration Creating a configuration file for the board Adding a Kconfig file in 'board/<vendor>/<board> with below info: Architecture CPU Board Vendor (May be NULL) SoC (May be NULL)
  • 22. 22© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Configuration Output Configuration files for use in C Sources include/generated/autoconf.h spl/include/generated/autoconf.h (For SPL) include/config.h include/configs/<board>.h Configuration files for Makefile include/config/auto.conf spl/include/config/auto.conf (For SPL) include/autoconf.mk
  • 23. 23© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Porting Implies adding a new Board to U-Boot That entails Adding board specific code at the right places Adding the new board directory under board/ with Makefile Initialization Code for the Board Kconfig file Adding the new board header under include/configs/ with Configuration for the Board
  • 24. 24© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. U-Boot Porting Hands On Add the configuration file .h in include/configs Add the Kconfig file at board/<vendor>/<soc>/ Modify the arch/arm/Kconfig to add the menu item for the board and source the board dependent Kconfig file Add the board dependent file at board/<vendor>/<soc>/ Modify the path for linker script at include/configs/<config_name.h> In the linker script, add the path for built_in.o for the board. Add the defconfig file in configs folder. Add atleast CONFIG_ARM and CONFIG_TARGET_<BOARD>
  • 25. 25© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Env in I2C eeprom Configure for Env is in eeprom I2C EEPROM Slave Address Env offset in eeprom Page write delay Page write bits
  • 26. 26© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. What all have learnt? BBB Memory Organization Beagle Booting Process W's of X-Loader BSP in X-Loader W's of U-Boot BSP in U-Boot
  • 27. 27© 2015-18 SysPlay Workshops <workshop@sysplay.in> All Rights Reserved. Any Queries?