mirror of https://github.com/wolfSSL/wolfBoot.git
75 lines
3.0 KiB
Plaintext
75 lines
3.0 KiB
Plaintext
# Raspberry Pi CM4 (BCM2711) - production RAUC A/B boot: wolfBoot replaces GCX's
|
|
# U-Boot as the RAUC slot arbiter. Same Linux boot as cm4_emmc_linux.config, plus
|
|
# wolfBoot reads a raw U-Boot-env partition (RAUC bootloader=uboot, fw_setenv),
|
|
# runs the BOOT_ORDER / BOOT_<name>_LEFT state machine, decrements the try counter
|
|
# (so a hung slot fails over), and injects "root=<slot> rauc.slot=<name>".
|
|
#
|
|
# eMMC GPT layout (0-based indices in [brackets]):
|
|
# p1 boot FAT [0] : RPi fw + wolfBoot kernel8.img + config.txt (disable-bt)
|
|
# p2 uboot-env raw [1] : U-Boot env (RAUC fw_env.config -> this partition)
|
|
# p3 fitImage raw [2] : wolfBoot-signed kernel FIT (shared across A/B)
|
|
# p4 rootfs_A ext4 [3] : RAUC slot A
|
|
# p5 rootfs_B ext4 [4] : RAUC slot B
|
|
# p6 data ext4 [5] : persistent /data
|
|
#
|
|
# Target: GCX "iron-butterfly" Yocto Scarthgap, kernel 6.6.63, raspberrypi4-64.
|
|
ARCH?=AARCH64
|
|
TARGET?=cm4
|
|
SIGN?=ECC384
|
|
HASH?=SHA384
|
|
IMAGE_HEADER_SIZE?=1024
|
|
DEBUG?=0
|
|
DEBUG_UART?=1
|
|
|
|
# --- eMMC disk driver --------------------------------------------------------
|
|
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 (BCM2711 EMMC2 raises TC
|
|
# only at CMD12). Especially relevant here: the RAUC try-counter writeback is a
|
|
# multi-block write, and a silently timed-out write must propagate as a failure.
|
|
CFLAGS_EXTRA+=-DSDHCI_WRITE_SETTLE_SPINS=1000000U
|
|
#CFLAGS_EXTRA+=-DDEBUG_SDHCI
|
|
#CFLAGS_EXTRA+=-DDEBUG_DISK
|
|
EXT_FLASH?=0
|
|
NO_XIP=1
|
|
NO_QNX?=1
|
|
ELF?=1
|
|
VTOR?=1
|
|
SPMATH?=1
|
|
PKA?=0
|
|
WOLFTPM?=0
|
|
WOLFBOOT_NO_PARTITIONS=1
|
|
# Shared kernel FIT lives on p3 (index 2); no per-slot kernel, so A==B. RAUC A/B
|
|
# here is rootfs-level (root= selected via the U-Boot env, see hal/cm4.c); the
|
|
# kernel FIT is common to both slots. Consequence: the wolfBoot image A/B retry
|
|
# points at the same partition (a corrupt shared FIT is not recoverable by slot
|
|
# failover - protect it with the outer wolfBoot signature + a known-good image).
|
|
CFLAGS_EXTRA+=-DBOOT_PART_A=2
|
|
CFLAGS_EXTRA+=-DBOOT_PART_B=2
|
|
CFLAGS_EXTRA+=-DDISK_BLOCK_SIZE=0x80000
|
|
|
|
# --- Linux boot (see cm4_emmc_linux.config for the rationale) -----------------
|
|
GZIP?=1
|
|
CFLAGS_EXTRA+=-DCM4_UART_PL011
|
|
CFLAGS_EXTRA+=-DCM4_FIRMWARE_DTB
|
|
# Fallback root if the RAUC env read fails (normally root= comes from the slot).
|
|
CFLAGS_EXTRA+=-DLINUX_BOOTARGS_ROOT=\"/dev/mmcblk0p4\"
|
|
|
|
# --- RAUC A/B slot selection (wolfBoot replaces U-Boot's boot.scr) ------------
|
|
# CM4_RAUC_AB is a make var: arch.mk links src/ubootenv.o and defines -DCM4_RAUC_AB.
|
|
CM4_RAUC_AB?=1
|
|
# 0-based GPT index of the raw U-Boot-env partition (p2). Match RAUC fw_env.config.
|
|
CFLAGS_EXTRA+=-DCM4_UBOOT_ENV_PART=1
|
|
# RAUC bootname -> rootfs device. Match RAUC system.conf slot devices.
|
|
CFLAGS_EXTRA+=-DCM4_ROOT_A=\"/dev/mmcblk0p4\"
|
|
CFLAGS_EXTRA+=-DCM4_ROOT_B=\"/dev/mmcblk0p5\"
|
|
|
|
WOLFBOOT_LOAD_ADDRESS?=0x18000000
|
|
WOLFBOOT_RAMBOOT_MAX_SIZE=0x23C00000
|
|
WOLFBOOT_LOAD_DTS_ADDRESS?=0x08000000
|
|
WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000
|
|
WOLFBOOT_PARTITION_SIZE=0x4000000
|
|
WOLFBOOT_SECTOR_SIZE=0x1000
|