-
Notifications
You must be signed in to change notification settings - Fork 159
Add Raspberry Pi Compute Module 4 (BCM2711) target + wolfCrypt FIPS 140-3 #824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dgarske
wants to merge
5
commits into
wolfSSL:master
Choose a base branch
from
dgarske:cm4_bcm2711
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
25c0c1f
cm4: add Raspberry Pi Compute Module 4 (BCM2711 Cortex-A72) target wi…
dgarske ba92654
cm4: add wolfCrypt FIPS 140-3 support + CI, SDHCI unit test, review f…
dgarske 08b2651
cm4: hardware-validate eMMC A/B disk boot and FIPS on CM4 (arm64 head…
dgarske 73596b7
cm4: add Linux kernel FIT boot via firmware-provided DTB with injecte…
dgarske a31b617
cm4: fix Linux FIT boot - separate FIT stage addr, PL011 console, EL2…
dgarske File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Raspberry Pi CM4 (BCM2711) - RAM-boot authenticated boot. | ||
| # | ||
| # For wolfCrypt FIPS 140-3, build with FIPS=1 pointing at a FIPS / FIPS-ready | ||
| # wolfSSL tree. The FIPS module uses portable-C crypto, so NO_ARM_ASM is | ||
| # required. Entropy comes from the BCM2711 RNG200 hardware TRNG (hal/cm4.c). | ||
| # See docs/FIPS.md for the in-core hash-seal procedure (done on-target). e.g.: | ||
| # make FIPS=1 WOLFBOOT_LIB_WOLFSSL=../wolfssl-5.9.2-gplv3-fips-ready NO_ARM_ASM=1 | ||
| #FIPS?=1 | ||
| #WOLFBOOT_LIB_WOLFSSL?=../wolfssl-5.9.2-gplv3-fips-ready | ||
| #NO_ARM_ASM?=1 | ||
| ARCH?=AARCH64 | ||
| TARGET?=cm4 | ||
| SIGN?=ECC384 | ||
| HASH?=SHA384 | ||
| DEBUG?=1 | ||
| VTOR?=1 | ||
| SPMATH?=1 | ||
| IMAGE_HEADER_SIZE?=1024 | ||
| PKA?=0 | ||
| WOLFTPM?=0 | ||
| DEBUG_UART?=0 | ||
| NO_XIP?=1 | ||
| NO_QNX?=1 | ||
| WOLFBOOT_SECTOR_SIZE=0x400 | ||
| WOLFBOOT_NO_PARTITIONS=1 | ||
| WOLFBOOT_RAMBOOT_MAX_SIZE=0x20000000 | ||
| WOLFBOOT_LOAD_ADDRESS?=0x3080000 | ||
| WOLFBOOT_LOAD_DTS_ADDRESS?=0x400000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Raspberry Pi CM4 (BCM2711) - onboard eMMC A/B disk boot. | ||
| # | ||
| # wolfBoot drives the BCM2711 EMMC2 controller (Arasan SDHCI v3.0 @ 0xFE340000) | ||
| # to read GPT A/B image partitions from the onboard eMMC via update_disk.c, and | ||
| # boots the highest valid version with rollback. | ||
| # | ||
| # Transfer mode: SDHCI_SDMA_DISABLED forces PIO. The BCM2711 EMMC2 SDMA | ||
| # boundary-restart and cache coherency are not yet validated (same Arasan | ||
| # family as the Versal quirk); DISK_EMMC compiles in the PIO BRR-race | ||
| # workaround in src/sdhci.c. SDHCI_FORCE_CARD_DETECT: the onboard eMMC has no | ||
| # routed card-detect line. | ||
| # | ||
| # Bring-up: uncomment DEBUG_SDHCI (+ DEBUG_DISK / DEBUG_GPT) for verbose | ||
| # controller/partition tracing over the mini-UART console. | ||
| # | ||
| # For wolfCrypt FIPS 140-3, build with FIPS=1 pointing at a FIPS / FIPS-ready | ||
| # wolfSSL tree (NO_ARM_ASM required; entropy from the RNG200 TRNG). See | ||
| # docs/FIPS.md. e.g.: | ||
| # make FIPS=1 WOLFBOOT_LIB_WOLFSSL=../wolfssl-5.9.2-gplv3-fips-ready NO_ARM_ASM=1 | ||
| #FIPS?=1 | ||
| #WOLFBOOT_LIB_WOLFSSL?=../wolfssl-5.9.2-gplv3-fips-ready | ||
| #NO_ARM_ASM?=1 | ||
| ARCH?=AARCH64 | ||
| TARGET?=cm4 | ||
| SIGN?=ECC384 | ||
| HASH?=SHA384 | ||
| IMAGE_HEADER_SIZE?=1024 | ||
| DEBUG?=0 | ||
| DEBUG_UART?=1 | ||
| DISK_SDCARD?=0 | ||
| DISK_EMMC?=1 | ||
| CFLAGS_EXTRA+=-DSDHCI_FORCE_CARD_DETECT | ||
| CFLAGS_EXTRA+=-DSDHCI_SDMA_DISABLED | ||
| #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 | ||
| WOLFBOOT_LOAD_ADDRESS?=0x10000000 | ||
| WOLFBOOT_RAMBOOT_MAX_SIZE=0x2BC00000 | ||
| WOLFBOOT_LOAD_DTS_ADDRESS?=0x1000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000 | ||
| WOLFBOOT_PARTITION_SIZE=0x4000000 | ||
| WOLFBOOT_SECTOR_SIZE=0x1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # 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. | ||
| # | ||
| # DRAFT: not yet HW-validated. The disk-driver half is identical to the proven | ||
| # cm4_emmc.config; the Linux-handoff half (EL1 entry, FIT kernel, DTB placement, | ||
| # partition sizing) needs bring-up with real GCX artifacts. Items marked VERIFY | ||
| # are the known unknowns. | ||
| 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 | ||
| #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=0x2BC00000 | ||
| # VERIFY: 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). Confirm no collision with RPi low-memory reservations / kernel early | ||
| # use on HW. | ||
| WOLFBOOT_LOAD_DTS_ADDRESS?=0x08000000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000 | ||
| # VERIFY: 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Raspberry Pi CM4 (BCM2711) - eMMC/SD A/B disk boot. | ||
| # | ||
| # Boots from the BCM2711 EMMC2 controller (Arasan SDHCI @ 0xFE340000), which | ||
| # drives the onboard eMMC (eMMC variants) or the microSD (CM4 Lite). wolfBoot | ||
| # reads GPT A/B image partitions via update_disk.c and boots the highest valid | ||
| # version with rollback. | ||
| # | ||
| # The EMMC2 glue in hal/cm4.c is hardware-validated on the onboard eMMC | ||
| # (see cm4_emmc.config). The microSD path uses the same driver but needs a CM4 | ||
| # Lite - an eMMC module disables the carrier's microSD slot. Use | ||
| # SDHCI_FORCE_CARD_DETECT for media with no routed card-detect line. | ||
| # | ||
| # For wolfCrypt FIPS 140-3, build with FIPS=1 pointing at a FIPS / FIPS-ready | ||
| # wolfSSL tree. The FIPS module uses portable-C crypto, so NO_ARM_ASM is | ||
| # required. Entropy comes from the BCM2711 RNG200 hardware TRNG (hal/cm4.c). | ||
| # See docs/FIPS.md for the in-core hash-seal procedure (done on-target). e.g.: | ||
| # make FIPS=1 WOLFBOOT_LIB_WOLFSSL=../wolfssl-5.9.2-gplv3-fips-ready NO_ARM_ASM=1 | ||
| #FIPS?=1 | ||
| #WOLFBOOT_LIB_WOLFSSL?=../wolfssl-5.9.2-gplv3-fips-ready | ||
| #NO_ARM_ASM?=1 | ||
| ARCH?=AARCH64 | ||
| TARGET?=cm4 | ||
| SIGN?=ECC384 | ||
| HASH?=SHA384 | ||
| IMAGE_HEADER_SIZE?=1024 | ||
| DEBUG?=0 | ||
| DEBUG_UART?=1 | ||
| DISK_SDCARD?=1 | ||
| DISK_EMMC?=0 | ||
| CFLAGS_EXTRA+=-DSDHCI_FORCE_CARD_DETECT | ||
| # Force PIO: the BCM2711 EMMC2 SDMA path is unvalidated and hal/cm4.c provides no | ||
| # DMA cache-maintenance hooks, while the disk configs run with the D-cache on | ||
| # (CM4_USE_MMU), so SDMA could hash/verify stale DDR. Matches cm4_emmc.config. | ||
| CFLAGS_EXTRA+=-DSDHCI_SDMA_DISABLED | ||
| 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 | ||
| WOLFBOOT_LOAD_ADDRESS?=0x10000000 | ||
| WOLFBOOT_RAMBOOT_MAX_SIZE=0x2BC00000 | ||
| WOLFBOOT_LOAD_DTS_ADDRESS?=0x1000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80200000 | ||
| WOLFBOOT_PARTITION_SIZE=0x4000000 | ||
| WOLFBOOT_SECTOR_SIZE=0x1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # wolfBoot simulator build using the wolfCrypt FIPS 140-3 module. | ||
| # Point WOLFBOOT_LIB_WOLFSSL at an unpacked FIPS (or FIPS-ready) wolfSSL tree. | ||
| # Prototype target for the CM4 FIPS integration (see docs/FIPS.md). | ||
| ARCH=sim | ||
| TARGET=sim | ||
| SIGN?=ECC384 | ||
| HASH?=SHA384 | ||
| FIPS?=1 | ||
| WOLFBOOT_LIB_WOLFSSL?=../wolfssl-5.9.2-gplv3-fips-ready | ||
| WOLFBOOT_SMALL_STACK?=0 | ||
| SPI_FLASH=0 | ||
| DEBUG=1 | ||
|
|
||
| # sizes should be multiple of system page size | ||
| WOLFBOOT_PARTITION_SIZE=0x40000 | ||
| WOLFBOOT_SECTOR_SIZE=0x1000 | ||
| WOLFBOOT_PARTITION_BOOT_ADDRESS=0x80000 | ||
| WOLFBOOT_PARTITION_UPDATE_ADDRESS=0x100000 | ||
| WOLFBOOT_PARTITION_SWAP_ADDRESS=0x180000 | ||
|
|
||
| # required for keytools | ||
| WOLFBOOT_FIXED_PARTITIONS=1 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.