@@ -2037,6 +2037,154 @@ Application running successfully!
20372037Entering idle loop...
20382038```
20392039
2040+ ### Booting PetaLinux
2041+
2042+ wolfBoot can boot a signed Linux kernel on the Versal VMK180. This replaces U-Boot entirely for a secure boot chain.
2043+
2044+ #### Prerequisites
2045+
2046+ 1 . ** PetaLinux 2024.2** (or compatible version) built for VMK180
2047+ 2 . ** Pre-built Linux images** from your PetaLinux build:
2048+ - ` Image ` - Uncompressed Linux kernel (ARM64)
2049+ - ` system-default.dtb ` - Device tree blob for VMK180
2050+ - ` bl31.elf ` - ARM Trusted Firmware
2051+ - ` plm.elf ` - Platform Loader & Manager
2052+ - ` psmfw.elf ` - PSM firmware
2053+
2054+ 3 . ** SD card** with root filesystem (PetaLinux rootfs.ext4 written to partition 2)
2055+
2056+ #### Boot Flow
2057+
2058+ ```
2059+ PLM -> PSM -> BL31 (EL3) -> wolfBoot (EL2) -> Linux (EL1)
2060+ ```
2061+
2062+ wolfBoot:
2063+ 1 . Loads the signed FIT image from QSPI flash
2064+ 2 . Verifies the cryptographic signature (ECC384/SHA384)
2065+ 3 . Parses the FIT image to extract kernel and DTB
2066+ 4 . Applies DTB fixups (bootargs for root filesystem)
2067+ 5 . Transitions from EL2 to EL1 and jumps to the kernel
2068+
2069+ #### Creating the FIT Image
2070+
2071+ wolfBoot uses a FIT (Flattened Image Tree) image containing the kernel and device tree. Create the FIT image using the provided ITS file:
2072+
2073+ ``` sh
2074+ # Copy Linux images to wolfBoot root directory
2075+ cp /path/to/petalinux/images/linux/Image .
2076+ cp /path/to/petalinux/images/linux/system-default.dtb .
2077+
2078+ # Create FIT image using mkimage
2079+ mkimage -f hal/versal.its fitImage
2080+ ```
2081+
2082+ The ITS file (` hal/versal.its ` ) specifies:
2083+ - Kernel load address: ` 0x00200000 `
2084+ - DTB load address: ` 0x00001000 `
2085+ - SHA256 hashes for integrity
2086+
2087+ #### Signing the FIT Image
2088+
2089+ Sign the FIT image with wolfBoot tools:
2090+
2091+ ``` sh
2092+ # Sign with ECC384 (default for Versal config)
2093+ ./tools/keytools/sign --ecc384 --sha384 fitImage wolfboot_signing_private_key.der 1
2094+ ```
2095+
2096+ This creates ` fitImage_v1_signed.bin ` .
2097+
2098+ #### DTB Fixup for Root Filesystem
2099+
2100+ wolfBoot automatically modifies the device tree to set the kernel command line (` bootargs ` ). The default configuration mounts the root filesystem from SD card partition 2:
2101+
2102+ ```
2103+ earlycon root=/dev/mmcblk0p2 rootwait
2104+ ```
2105+
2106+ To customize the root device, add to your config:
2107+
2108+ ``` makefile
2109+ # Mount root from SD card partition 4
2110+ CFLAGS_EXTRA+=-DLINUX_BOOTARGS_ROOT =\"/dev/mmcblk0p4\"
2111+ ```
2112+
2113+ #### Flashing to QSPI
2114+
2115+ Flash the signed FIT image to the boot partition at ` 0x800000 ` :
2116+
2117+ ``` sh
2118+ # From U-Boot (via SD card boot)
2119+ tftp ${loadaddr} fitImage_v1_signed.bin
2120+ sf probe 0
2121+ sf erase 0x800000 +${filesize}
2122+ sf write ${loadaddr} 0x800000 ${filesize}
2123+ ```
2124+
2125+ #### Automated Testing
2126+
2127+ The test script supports Linux boot testing:
2128+
2129+ ``` sh
2130+ # Set path to PetaLinux images
2131+ export LINUX_IMAGES_DIR=/path/to/petalinux/images/linux
2132+
2133+ # Build wolfBoot, create signed FIT, flash to QSPI, and boot
2134+ ./tools/scripts/versal_test.sh --linux
2135+ ```
2136+
2137+ #### Example Linux Boot Output
2138+
2139+ ```
2140+ ========================================
2141+ wolfBoot Secure Boot - AMD Versal
2142+ ========================================
2143+ Current EL: 2
2144+ QSPI: Lower ID: 20 BB 21
2145+ QSPI: Upper ID: 20 BB 21
2146+ QSPI: 75MHz, Quad mode, DMA
2147+ Versions: Boot 1, Update 0
2148+ Trying Boot partition at 0x800000
2149+ Loading header 512 bytes from 0x800000 to 0xFFFFE00
2150+ Loading image 24658696 bytes from 0x800200 to 0x10000000...done (701 ms)
2151+ Boot partition: 0xFFFFE00 (sz 24658696, ver 0x1, type 0x601)
2152+ Checking integrity...done (167 ms)
2153+ Verifying signature...done (3 ms)
2154+ Successfully selected image in part: 0
2155+ Firmware Valid
2156+ Loading elf at 0x10000000
2157+ Invalid elf, falling back to raw binary
2158+ Flattened uImage Tree: Version 17, Size 24658696
2159+ Loading Image kernel-1: 0x100000D8 -> 0x200000 (24617472 bytes)
2160+ Image kernel-1: 0x200000 (24617472 bytes)
2161+ Loading Image fdt-1: 0x1177A3DC -> 0x1000 (39384 bytes)
2162+ Image fdt-1: 0x1000 (39384 bytes)
2163+ Loading DTS: 0x1000 -> 0x1000 (39384 bytes)
2164+ FDT: Version 17, Size 39384
2165+ FDT: Setting bootargs: earlycon root=/dev/mmcblk0p2 rootwait
2166+ FDT: Set chosen (28076), bootargs=earlycon root=/dev/mmcblk0p2 rootwait
2167+ Booting at 0x200000
2168+ [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
2169+ [ 0.000000] Linux version 6.6.40-xilinx-g2b7f6f70a62a ...
2170+ [ 0.000000] Machine model: Xilinx Versal vmk180 Eval board revA
2171+ ...
2172+ PetaLinux 2024.2 xilinx-vmk180 ttyAMA0
2173+
2174+ xilinx-vmk180 login:
2175+ ```
2176+
2177+ #### Boot Performance
2178+
2179+ Typical boot timing with ECC384/SHA384 signing:
2180+
2181+ | Operation | Time |
2182+ | -----------| ------|
2183+ | Load 24MB FIT from QSPI | ~ 700ms |
2184+ | SHA384 integrity check | ~ 167ms |
2185+ | ECC384 signature verify | ~ 3ms |
2186+ | ** Total wolfBoot overhead** | ** ~ 870ms** |
2187+
20402188
20412189## Cypress PSoC-6
20422190
0 commit comments