-
Notifications
You must be signed in to change notification settings - Fork 161
Expand file tree
/
Copy pathcm4_emmc_linux.config
More file actions
90 lines (87 loc) · 4.41 KB
/
Copy pathcm4_emmc_linux.config
File metadata and controls
90 lines (87 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Raspberry Pi CM4 (BCM2711) - onboard eMMC A/B disk boot of a REAL Linux kernel
# (FIT), as opposed to cm4_emmc.config which boots the disk_app prove-out stub.
#
# Chain: RPi VideoCore firmware -> wolfBoot (kernel8.img @ 0x200000) -> reads a
# signed FIT (hal/cm4.its: kernel + bcm2711-rpi-cm4.dtb) from the eMMC A/B image
# partition -> verifies the outer ECDSA384/SHA384 signature -> loads + gzip-
# decompresses the kernel to 0x10000000, copies the DTB to WOLFBOOT_LOAD_DTS_
# ADDRESS -> drops EL2->EL1 (el2_to_el1_boot) handing the DTB in x0 -> Linux.
# The kernel mounts its rootfs from a separate eMMC ext4 partition (root= on the
# cmdline, injected via the FIT bootargs / hal_dts_fixup).
#
# Target: GCX "iron-butterfly" Yocto Scarthgap, kernel 6.6.63, raspberrypi4-64.
# GCX's UBOOT_LOADADDRESS is also 0x10000000, so their kernel loads identically.
#
# Hardware-validated: booted a GCX Yocto (Scarthgap, kernel 6.6) rootfs on real
# CM4 eMMC end-to-end. The disk-driver half is identical to cm4_emmc.config; the
# Linux-handoff half (kernel entry, FIT kernel, DTB placement, partition sizing)
# is exercised by the gcx-cm4-wolfboot-yocto flow (see docs/Targets.md).
ARCH?=AARCH64
TARGET?=cm4
SIGN?=ECC384
HASH?=SHA384
IMAGE_HEADER_SIZE?=1024
DEBUG?=0
DEBUG_UART?=1
# --- eMMC disk driver (identical to the validated cm4_emmc.config) -----------
DISK_SDCARD?=0
DISK_EMMC?=1
CFLAGS_EXTRA+=-DSDHCI_FORCE_CARD_DETECT
CFLAGS_EXTRA+=-DSDHCI_SDMA_DISABLED
# Opt into the bounded multi-block write settle-wait: the BCM2711 EMMC2 does not
# raise TC until CMD12, so cap the pre-CMD12 wait (src/sdhci.c) instead of
# spinning forever; completion is then re-confirmed via CMD13.
CFLAGS_EXTRA+=-DSDHCI_WRITE_SETTLE_SPINS=1000000U
#CFLAGS_EXTRA+=-DDEBUG_SDHCI
#CFLAGS_EXTRA+=-DDEBUG_DISK
#CFLAGS_EXTRA+=-DDEBUG_GPT
EXT_FLASH?=0
NO_XIP=1
NO_QNX?=1
ELF?=1
VTOR?=1
SPMATH?=1
PKA?=0
WOLFTPM?=0
WOLFBOOT_NO_PARTITIONS=1
CFLAGS_EXTRA+=-DBOOT_PART_A=1
CFLAGS_EXTRA+=-DBOOT_PART_B=2
CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x80000
# --- Linux boot additions ----------------------------------------------------
# gzip-decompress the FIT kernel subimage at load time (kernel = Image.gz).
GZIP?=1
# Enter the kernel at EL2 (the RPi firmware brings the secondary CPUs up at EL2,
# so the primary must match or Linux warns "CPUs started in inconsistent modes"
# and KVM is unavailable). This is the default cm4 EL2 direct-jump handoff, which
# already passes the DTB in x0 - so we do NOT define BOOT_EL1/EL2_HYPERVISOR here.
# Console UART: the Linux mini-UART (bcm2835-aux) fails to register cleanly on
# this DTB, so use dtoverlay=disable-bt (routes the PL011 onto GPIO14/15) and
# build wolfBoot for the PL011. See hal/cm4.c (CM4_UART_PL011) and the config.txt
# generated by tools/scripts/cm4/prepare_emmc_linux.sh (adds disable-bt).
CFLAGS_EXTRA+=-DCM4_UART_PL011
# Use the RPi firmware's fully-patched DTB (RAM size, mini-UART clock, serial
# no.) for the kernel-only FIT, and inject the kernel command line. wolfBoot
# captures the firmware DTB pointer at _cm4_entry (x0). See hal/cm4.c
# hal_get_boot_dts(). Scoped here so the stub/FIPS builds are unaffected.
CFLAGS_EXTRA+=-DCM4_FIRMWARE_DTB
# Rootfs partition for the simple first-boot layout (p3). Overrides the
# LINUX_BOOTARGS_ROOT default in hal/cm4.c. With CM4_UART_PL011 the full cmdline is:
# earlycon=pl011,mmio32,0xfe201000 console=ttyAMA0,115200 root=/dev/mmcblk0p3 ...
CFLAGS_EXTRA+=-DLINUX_BOOTARGS_ROOT=\"/dev/mmcblk0p3\"
# Stage the signed FIT here (NOT 0x10000000): the FIT's kernel subimage has
# load=0x10000000, and a gzip kernel decompresses FIT-data -> 0x10000000. If the
# FIT itself were also at 0x10000000 the decompression output would overwrite its
# own compressed input mid-stream (observed: "FIT gunzip failed rc=-4"). 0x18000000
# (384MB) sits above the decompressed kernel (0x10000000 + ~30MB) with margin.
WOLFBOOT_LOAD_ADDRESS?=0x18000000
WOLFBOOT_RAMBOOT_MAX_SIZE=0x23C00000
# DTB landing zone. 0x1000 (the stub config value) is too low for a real kernel;
# 0x08000000 (128 MB) sits below the kernel (256 MB) and above wolfBoot (2 MB),
# clear of RPi low-memory reservations / kernel early use (HW-validated).
WOLFBOOT_LOAD_DTS_ADDRESS?=0x08000000
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000
# Partition size must hold the FIT (kernel Image.gz ~10-15 MB + DTB); 0x4000000
# (64 MB) is ample. The separate ext4 rootfs partition is sized in the
# eMMC-layout script, not here.
WOLFBOOT_PARTITION_SIZE=0x4000000
WOLFBOOT_SECTOR_SIZE=0x1000