BootloaderDUJINLABS.COM

BOOTLOADER SOURCE SERIES

U-Boot · LK · Barebox

reset entry와 초기 메모리부터 storage, update, image 검증, kernel handoff까지 실제 원본 코드로 이어서 읽습니다.

Topics
57
U-Boot
v2026.07
LK
upstream + classic aboot
Barebox
v2026.06.1

세 Bootloader의 특징과 선택 기준

세 프로젝트는 모두 다음 stage를 실행할 수 있지만 설계의 중심이 다르다. 지원 보드 수만 비교하지 말고 초기 stage, driver model, 영속 설정, update 정책과 제품에서 유지할 downstream 코드의 양을 함께 본다.

01

U-Boot

범용 Embedded Linux bootloader

특징

SPL/TPL/U-Boot proper의 단계 구조, 넓은 SoC·board 지원, driver model, environment/CLI, bootstd, FIT, fastboot를 한 tree에서 제공한다.

장점

지원 hardware와 vendor BSP가 가장 넓고, storage·network·USB·filesystem·image format 도구가 풍부하다. 새 board bring-up 때 참고할 upstream 사례가 많다.

단점

오래된 board별 경로와 새 driver model이 공존해 설정 조합이 복잡하다. vendor fork의 변경량이 커지기 쉽고 environment script에 제품 정책이 과도하게 모이면 검증이 어려워진다.

잘 맞는 경우

일반 Embedded Linux 제품, 여러 boot media와 network boot가 필요한 board, SoC vendor BSP를 기반으로 빠르게 kernel까지 올려야 하는 프로젝트.

02

LK

작은 kernel 위에 boot app을 구성

특징

thread, scheduler, timer, heap, VM, init hook과 app framework가 중심이다. boot image, flash, recovery 정책은 LK core가 아니라 target 또는 별도 app에서 구성한다.

장점

구조가 작고 platform/target/app 경계가 분명하다. thread와 event를 이용해 USB, display, storage 초기화를 구성하기 좋고, 고정 hardware용 chainloader나 recovery firmware를 세밀하게 통제할 수 있다.

단점

범용 Linux bootloader 기능과 board 지원은 U-Boot보다 적다. 제품별 storage·update·보안 정책을 직접 작성할 부분이 많고 downstream 구현끼리 차이가 커서 다른 LK tree의 코드를 그대로 적용하기 어렵다.

잘 맞는 경우

hardware 구성이 고정된 제품, 작은 recovery/diagnostic firmware, 빠른 부팅과 자체 protocol이 중요하며 boot policy를 직접 소유할 수 있는 팀.

03

Barebox

Linux와 닮은 관리형 bootloader

특징

Linux식 device/driver model, Device Tree, VFS와 /dev, shell, environment/state, Boot Loader Specification, bootchooser와 BBU update framework를 사용한다.

장점

Linux kernel 개발자가 source를 따라가기 쉽고 장치를 file path와 command로 다룰 수 있다. typed state와 bootchooser를 이용한 A/B 정책, 파일 기반 environment와 self-update 구성이 명확하다.

단점

vendor BSP와 지원 board의 폭은 U-Boot보다 좁다. 새 SoC의 DDR/PBL/ROM image 지원은 직접 porting해야 할 수 있고, 최소 기능만 필요한 제품에서는 LK식 전용 loader보다 image와 subsystem이 커질 수 있다.

잘 맞는 경우

장기 유지보수, 현장 update, A/B rollback, 복잡한 storage 구성이 중요하고 Linux와 비슷한 API와 진단 환경을 선호하는 제품.

LK와 Android에 대한 주의

현재 upstream LK 자체를 Android의 현행 bootloader라고 부르면 안 된다. 이 시리즈의 Android boot image와 fastboot 글은 별도로 고정한 classic AOSP aboot commit을 다루며, 현대 Android의 A/B, AVB, GKI와 vendor boot 경로는 별도 주제다.

01 / U-Boot

U-Boot

SPL/TPL에서 U-Boot proper, driver model, storage, bootflow, 검증과 Linux handoff까지 이어지는 경로를 읽습니다.
01
v2026.07 · Makefile빌드 산출물과 단계별 이미지

Kconfig와 Makefile의 선택이 u-boot, SPL, TPL, DTB와 결합 이미지로 굳어지는 과정을 정리합니다.

02
v2026.07 · arch/arm/lib/vectors.SARM64 reset entry와 예외 벡터

ROM이 넘긴 CPU가 `_start`에서 예외 벡터와 저수준 진입 경로를 어떻게 선택하는지 읽습니다.

03
v2026.07 · arch/arm/lib/crt0_64.Scrt0_64.S의 임시 stack과 global data

`_main`이 초기 stack과 `gd_t`를 만들고 C 초기화 루틴에 들어가는 경계를 추적합니다.

04
v2026.07 · common/board_f.cboard_init_f 초기화 배열

console 이전의 CPU, timer, DRAM, FDT, reservation 작업이 순서가 고정된 initcall 목록으로 실행되는 방식을 읽습니다.

05
v2026.07 · common/board_f.cDRAM 상단 예약과 relocation 주소

DRAM 상단에서 U-Boot, malloc, FDT, stack 영역을 차감해 relocation 목적지를 정하는 계산을 분석합니다.

06
v2026.07 · common/board_r.crelocation 이후 board_init_r

새 DRAM 주소로 코드와 global data를 옮긴 뒤 runtime 서비스와 main loop를 여는 과정을 읽습니다.

07
v2026.07 · common/spl/spl.cSPL의 image 선택과 적재

작은 SRAM 단계인 SPL이 boot device를 선택하고 U-Boot proper 또는 OS 이미지를 DRAM으로 적재하는 경로를 읽습니다.

08
v2026.07 · drivers/core/root.cDriver Model root와 uclass

driver model의 root device와 uclass 목록이 만들어지고 FDT scan의 부모가 되는 과정을 읽습니다.

09
v2026.07 · drivers/core/device.cdevice_bind와 장치 객체 생성

driver와 DT node를 `struct udevice`로 묶고 parent/uclass 목록에 연결하는 bind 단계를 읽습니다.

10
v2026.07 · drivers/core/device.cdevice_probe와 의존 장치 활성화

probe 시점에 parent, pinctrl, clock 등 의존 대상을 준비하고 driver의 probe callback을 호출하는 순서를 읽습니다.

11
v2026.07 · drivers/core/root.cFDT scan과 ofnode

control FDT의 node를 순회해 compatible driver에 bind하고 pre-relocation 제약을 적용하는 경로를 읽습니다.

12
v2026.07 · drivers/mmc/mmc.cMMC 초기화와 block device 연결

host controller 초기화에서 card 식별, 용량 설정, block descriptor 공개까지 내려갑니다.

13
v2026.07 · disk/part.cblock 장치와 partition 문자열 해석

`mmc 0:1` 같은 사용자 표현이 block descriptor와 실제 partition offset/size로 변환되는 과정을 읽습니다.

14
v2026.07 · env/common.cEnvironment import와 영속 저장

CRC가 붙은 저장 매체의 environment를 hash table로 가져오고 default 환경으로 fallback하는 경로를 읽습니다.

15
v2026.07 · boot/bootflow.cbootstd와 bootflow 탐색

boot method와 boot device를 조합해 부팅 가능한 항목을 찾고 상태를 갱신하는 iterator를 읽습니다.

16
v2026.07 · boot/image-fit.cFIT hash와 signature 검증

FIT image node의 hash/signature subnode를 순회해 payload 무결성과 서명을 확인하는 과정을 읽습니다.

17
v2026.07 · cmd/booti.cbooti에서 ARM64 Linux로 handoff

raw ARM64 Image header를 검사하고 initrd/FDT를 배치한 뒤 kernel entry로 분기하는 경로를 읽습니다.

18
v2026.07 · drivers/usb/gadget/f_fastboot.cFastboot USB function과 command dispatch

USB gadget configuration에 fastboot function을 붙이고 download/flash 명령으로 넘기는 경계를 읽습니다.

02 / LK

LK

현재 upstream LK 코어와 classic AOSP aboot를 기준 commit별로 분리해 읽습니다.
01
upstream 1eb9917 · make/module.mkLK의 project와 module 빌드 그래프

project 설정이 platform, target, arch, kernel, lib, app module을 모아 하나의 LK image로 연결되는 구조를 읽습니다.

02
upstream 1eb9917 · arch/arm64/start.SARM64 start.S와 초기 실행 환경

reset entry가 exception level, stack, BSS와 CPU별 진입 조건을 정리하고 `lk_main`으로 넘어가는 경계를 읽습니다.

03
upstream 1eb9917 · top/main.clk_main의 kernel 초기화 순서

heap, thread, dpc, timer와 platform early init이 bootstrap thread 생성 전 어떤 순서로 준비되는지 읽습니다.

04
upstream 1eb9917 · top/main.cbootstrap2와 init hook 단계

scheduler 문맥으로 들어온 bootstrap thread가 platform, target, app 초기화를 어떤 level 순서로 호출하는지 읽습니다.

05
upstream 1eb9917 · kernel/thread.cthread_create_etc와 stack 소유권

thread control block과 stack을 할당하고 초기 CPU context를 만드는 과정을 읽습니다.

06
upstream 1eb9917 · kernel/thread.crun queue와 thread_resched

현재 thread를 상태에 맞게 queue에 되돌리고 다음 runnable thread를 선택해 context switch하는 경로를 읽습니다.

07
upstream 1eb9917 · kernel/timer.ctimer queue와 tick 처리

정렬된 timer 목록에서 만료 항목을 꺼내 callback을 실행하고 reschedule 요청을 전달하는 과정을 읽습니다.

08
upstream 1eb9917 · arch/arm64/exceptions_c.cARM64 exception에서 C handler까지

exception vector가 register frame을 저장하고 syndrome을 해석하는 C handler로 전달하는 경계를 읽습니다.

09
upstream 1eb9917 · lib/heap/heap_wrapper.cheap_init과 allocator backend

초기 heap 영역이 선택한 allocator backend에 연결되고 malloc/free API로 노출되는 과정을 읽습니다.

10
upstream 1eb9917 · kernel/vm/pmm.cPMM과 VMM의 page 소유권

physical page를 arena에서 꺼내 virtual address space에 mapping하고 해제하는 두 계층을 분리해 읽습니다.

11
upstream 1eb9917 · platform/qemu-virt-arm/platform.cplatform과 target 초기화 경계

SoC 공통 platform 코드와 보드 정책인 target 코드가 어디서 나뉘는지 QEMU ARM 예로 읽습니다.

12
upstream 1eb9917 · app/app.cAPP_START descriptor와 app thread

linker section에 모인 app descriptor를 순회하고 별도 thread 또는 init callback으로 실행하는 구조를 읽습니다.

13
upstream 1eb9917 · lib/console/console.cconsole parser와 정적 command table

입력 line을 token으로 나누고 linker section의 command table에서 handler를 찾는 과정을 읽습니다.

14
upstream 1eb9917 · app/lkboot/lkboot.clkboot의 network image 수신과 chain loading

LK의 현재 lkboot app가 image를 수신하고 entry address로 제어권을 넘기는 경계를 읽습니다.

15
AOSP 9d6e28f · app/aboot/aboot.c현재 LK와 classic AOSP aboot의 범위

Android aboot가 존재하던 고정 AOSP LK snapshot의 app descriptor와 초기화 위치를 현재 upstream과 구분합니다.

16
AOSP 9d6e28f · app/aboot/aboot.cAndroid boot image의 kernel·ramdisk 적재

boot partition header를 읽고 page 단위 offset으로 kernel, ramdisk, second stage를 배치하는 고전 경로를 읽습니다.

17
AOSP 9d6e28f · app/aboot/aboot.cclassic aboot의 Linux 진입

ATAG 또는 DT 주소, machine type과 kernel entry를 준비하고 cache/MMU를 정리해 Linux로 분기하는 코드를 읽습니다.

18
AOSP 9d6e28f · app/aboot/fastboot.cclassic fastboot command loop

USB request를 `download`, `getvar`, 등록 command로 분기하고 응답을 전송하는 event loop를 읽습니다.

19
AOSP 9d6e28f · app/aboot/aboot.cfastboot boot의 임시 image 실행

download buffer의 Android boot image를 검사하고 flash 없이 RAM에서 kernel로 넘기는 경로를 읽습니다.

20
AOSP 9d6e28f · app/aboot/aboot.cfastboot flash와 partition write

partition 이름을 찾고 raw 또는 sparse image를 eMMC에 쓰며 성공 응답을 결정하는 경로를 읽습니다.

03 / Barebox

Barebox

PBL, initcall, Linux식 device model과 VFS, environment/state, bootchooser, bootm과 BBU를 읽습니다.
01
v2026.06.1 · MakefileBarebox 빌드 산출물과 PBL image

Kconfig와 linker 단계가 barebox ELF, PBL, DTB와 보드별 images를 만드는 구조를 정리합니다.

02
v2026.06.1 · arch/arm/cpu/entry.cARM PBL과 barebox_arm_entry

SRAM 또는 초기 DRAM의 PBL이 RAM 정보를 확정하고 main Barebox를 풀어 실행하는 경계를 읽습니다.

03
v2026.06.1 · common/startup.cstart_barebox와 초기 runtime

BSS, heap, device tree, console과 initcall 실행 준비가 shell 이전에 어떤 순서로 이루어지는지 읽습니다.

04
v2026.06.1 · common/startup.cinitcall level과 run_init

링커 section에 모인 initcall을 level 순서대로 실행하고 오류를 기록하는 방식을 읽습니다.

05
v2026.06.1 · arch/arm/cpu/mmu-common.cARM memory area와 MMU 초기화

등록된 memory bank와 reserved area를 page table로 옮기고 cacheable mapping을 만드는 과정을 읽습니다.

06
v2026.06.1 · drivers/base/driver.cregister_device와 device tree 객체

새 `struct device`를 device list와 bus에 연결하고 이름, parent, resource를 공개하는 등록 단계를 읽습니다.

07
v2026.06.1 · drivers/base/driver.cdevice_probe와 Linux식 driver binding

bus match 결과를 바탕으로 probe callback을 호출하고 dependency 오류와 deferred probe를 다루는 경로를 읽습니다.

08
v2026.06.1 · drivers/of/platform.cDevice Tree population과 deep probe

root DT의 node를 platform device로 만들고 필요 시점까지 probe를 늦추는 Barebox 방식을 읽습니다.

09
v2026.06.1 · fs/devfs.ccdev와 /dev 파일 경계

character device가 devfs inode로 노출되고 read/write가 driver operation으로 전달되는 구조를 읽습니다.

10
v2026.06.1 · common/partitions.cblock cache와 partition 등록

block device read/write cache 위에 GPT/DOS parser가 child cdev를 등록하는 과정을 읽습니다.

11
v2026.06.1 · common/environment.cenvfs load와 default environment

영속 envfs image를 검증해 디렉터리로 펼치고 default environment와 합치는 과정을 읽습니다.

12
v2026.06.1 · common/state/state.cState framework와 영속 변수

DT로 정의한 typed variable을 storage backend에서 읽고 atomic하게 저장하는 state framework를 분석합니다.

13
v2026.06.1 · commands/boot.cBAREBOX_CMD_START와 shell 명령 등록

command descriptor가 linker section에 배치되고 hush parser가 이름으로 handler를 찾는 구조를 읽습니다.

14
v2026.06.1 · common/boot.cboot entry provider와 boot 명령

문자열, cdev, directory에서 boot entry를 수집하고 우선순위에 따라 실행하는 공통 boot framework를 읽습니다.

15
v2026.06.1 · common/blspec.cBoot Loader Specification entry 해석

loader/entries 파일의 key-value를 읽어 kernel, initrd, options와 devicetree를 boot entry로 만드는 과정을 읽습니다.

16
v2026.06.1 · common/bootchooser.cBootchooser의 A/B 시도 횟수와 우선순위

state에 저장한 priority와 remaining attempts로 target을 선택하고 실패 시 다음 slot으로 이동하는 정책을 읽습니다.

17
v2026.06.1 · common/bootm.cbootm image handler와 실행 단계

image type을 감지하고 OS별 handler를 선택해 kernel, initrd, FDT를 배치하는 공통 bootm 경로를 읽습니다.

18
v2026.06.1 · common/image-fit.cBarebox FIT configuration과 검증

FIT configuration에서 kernel, FDT, ramdisk를 선택하고 hash/signature 정책을 적용하는 handler를 읽습니다.

19
v2026.06.1 · common/bbu.cBBU update handler와 self-update

보드가 등록한 update handler를 선택하고 새 Barebox image를 검증해 boot medium에 기록하는 흐름을 읽습니다.