Raspberry Pi 2 Boot Process Overview

 
Linux Boot Process on the
Raspberry Pi 2
 
1
 
David Ferry, Chris Gill
CSE 522S - Advanced Operating Systems
Washington University in St. Louis
St. Louis, MO 63143
 
Raspberry Pi 2 Hardware
 
Broadcom BCM2836 system-on-a-chip (SoC)
VideoCore IV GPU
Cortex-A7 CPU
1GB RAM
 
At power on:
GPU enabled
CPU disabled
RAM disabled
Filesystem disabled
 
CSE 522S – Advanced Operating Systems
 
2
 
Bootstrap Process
 
The 
boot loader
 enables hardware:
 
 
At power on:
GPU loads and executes proprietary first stage from ROM
 
First stage:
GPU loads and executes 
/boot/bootcode.bin
 on SD card
Loads into L2 Cache
 
 
Second stage (bootcode.bin):
GPU loads and executes /boot/start.elf
Enables and loads into RAM
 
 
Third stage (start.elf):
GPU loads kernel7.img into RAM
Reads configuration files
Activates CPU 0
 
 
 
CSE 522S – Advanced Operating Systems
 
3
 
GPU Boot Loaders
 
The GPU Loaders (bootcode.bin and start.elf) are
proprietary:
Source code is unavailable
Compilers are unavailable
 
Low-level actions:
Enables low-level SD card access
Enables memory
Sets up kernel arguments and loads kernel image
Configures and enables CPU 0 to start executing kernel
 
CSE 522S – Advanced Operating Systems
 
4
 
System State After GPU Boot Loaders
 
Physical memory map:
 
 
CSE 522S – Advanced Operating Systems
 
5
 
Kernel arguments (ATAGS) usually loaded at 0x100
 Available RAM
 Where the kernel is located in physical memory
 Misc. low level info (display, terminal, etc.)
 Kernel command line arguments
 
To start kernel:
 CPU in supervisor mode
 Interrupts disabled
 MMU and address translation must be off
 Data cache must be off
 Register r1 holds machine type
 Register r2 holds address of kernel arguments
 Jump to starting address of kernel (usually 0x8000)
Kernel usually
loaded at
0x8000
Low 32KB
Extra Space
 
Kernel Entry Point
 
What happens after the boot loader jumps to 0x8000?
 
At compile time, the kernel was arranged so that
instructions at 0x8000 will start the kernel
/arch/arm/kernel/head.S 
is _the_ entry point
 
Actions:
Queries processor features
Manually builds initial page tables
Sets up and turns on memory management unit
 
CSE 522S – Advanced Operating Systems
 
6
 
Kernel Entry Point - Continued
 
Control moves to 
/arch/arm/kernel/head-common.S
 
Function 
__mmap_switched()
:
Saves important pointers in registers
Manages transition from physical to virtual memory
Jumps to 
start_kernel()
 
 
CSE 522S – Advanced Operating Systems
 
7
 
Transition to 
start_kernel()
 
At this point:
RAM is enabled
CPU 0 is enabled and executing kernel
Page table has been constructed
Memory management unit is active
 
But:
No kernel execution stack
No other services
 
CSE 522S – Advanced Operating Systems
 
8
 
start_kernel()
 
Function 
start_kernel() 
in 
/init/main.c
:
Initializes kernel lock protectors
Sets up stack protectors at top and bottom of
kernel stack memory region
Sets up timing and scheduling kernel
subsystems before enabling interrupts
Enables interrupts
Sets up other subsystems
Creates 
init
 and 
kthreadd
 threads
Starts other CPUs in system
Goes into CPU idle/scheduler loop
 
 
CSE 522S – Advanced Operating Systems
 
9
Slide Note
Embed
Share

Raspberry Pi 2's boot process involves a series of stages initiated by the GPU, loading essential firmware and enabling hardware components gradually, leading to the activation of the CPU and the kernel's entry point. The system transitions through various low-level processes before reaching a stable state for kernel execution.

  • Raspberry Pi
  • Boot Process
  • GPU Loaders
  • Kernel Entry Point
  • System State

Uploaded on Sep 14, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. Linux Boot Process on the Raspberry Pi 2 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO 63143 1

  2. Raspberry Pi 2 Hardware Broadcom BCM2836 system-on-a-chip (SoC) VideoCore IV GPU Cortex-A7 CPU 1GB RAM At power on: GPU enabled CPU disabled RAM disabled Filesystem disabled CSE 522S Advanced Operating Systems 2

  3. Bootstrap Process The boot loader enables hardware: At power on: GPU loads and executes proprietary first stage from ROM First stage: GPU loads and executes /boot/bootcode.bin on SD card Loads into L2 Cache Second stage (bootcode.bin): GPU loads and executes /boot/start.elf Enables and loads into RAM Third stage (start.elf): GPU loads kernel7.img into RAM Reads configuration files Activates CPU 0 CSE 522S Advanced Operating Systems 3

  4. GPU Boot Loaders The GPU Loaders (bootcode.bin and start.elf) are proprietary: Source code is unavailable Compilers are unavailable Low-level actions: Enables low-level SD card access Enables memory Sets up kernel arguments and loads kernel image Configures and enables CPU 0 to start executing kernel CSE 522S Advanced Operating Systems 4

  5. System State After GPU Boot Loaders Physical memory map: Kernel arguments (ATAGS) usually loaded at 0x100 Available RAM Where the kernel is located in physical memory Misc. low level info (display, terminal, etc.) Kernel command line arguments Low 32KB Kernel usually loaded at 0x8000 To start kernel: CPU in supervisor mode Interrupts disabled MMU and address translation must be off Data cache must be off Register r1 holds machine type Register r2 holds address of kernel arguments Jump to starting address of kernel (usually 0x8000) Extra Space CSE 522S Advanced Operating Systems 5

  6. Kernel Entry Point What happens after the boot loader jumps to 0x8000? At compile time, the kernel was arranged so that instructions at 0x8000 will start the kernel /arch/arm/kernel/head.S is _the_ entry point Actions: Queries processor features Manually builds initial page tables Sets up and turns on memory management unit CSE 522S Advanced Operating Systems 6

  7. Kernel Entry Point - Continued Control moves to /arch/arm/kernel/head-common.S Function __mmap_switched(): Saves important pointers in registers Manages transition from physical to virtual memory Jumps to start_kernel() CSE 522S Advanced Operating Systems 7

  8. Transition to start_kernel() At this point: RAM is enabled CPU 0 is enabled and executing kernel Page table has been constructed Memory management unit is active But: No kernel execution stack No other services CSE 522S Advanced Operating Systems 8

  9. start_kernel() Function start_kernel() in /init/main.c: Initializes kernel lock protectors Sets up stack protectors at top and bottom of kernel stack memory region Sets up timing and scheduling kernel subsystems before enabling interrupts Enables interrupts Sets up other subsystems Creates init and kthreadd threads Starts other CPUs in system Goes into CPU idle/scheduler loop CSE 522S Advanced Operating Systems 9

More Related Content

giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#giItT1WQy@!-/#