@@ -2156,6 +2156,154 @@ Application running successfully!
21562156Entering idle loop...
21572157```
21582158
2159+ ### Booting PetaLinux
2160+
2161+ wolfBoot can boot a signed Linux kernel on the Versal VMK180. This replaces U-Boot entirely for a secure boot chain.
2162+
2163+ #### Prerequisites
2164+
2165+ 1 . ** PetaLinux 2024.2** (or compatible version) built for VMK180
2166+ 2 . ** Pre-built Linux images** from your PetaLinux build:
2167+ - ` Image ` - Uncompressed Linux kernel (ARM64)
2168+ - ` system-default.dtb ` - Device tree blob for VMK180
2169+ - ` bl31.elf ` - ARM Trusted Firmware
2170+ - ` plm.elf ` - Platform Loader & Manager
2171+ - ` psmfw.elf ` - PSM firmware
2172+
2173+ 3 . ** SD card** with root filesystem (PetaLinux rootfs.ext4 written to partition 2)
2174+
2175+ #### Boot Flow
2176+
2177+ ```
2178+ PLM -> PSM -> BL31 (EL3) -> wolfBoot (EL2) -> Linux (EL1)
2179+ ```
2180+
2181+ wolfBoot:
2182+ 1 . Loads the signed FIT image from QSPI flash
2183+ 2 . Verifies the cryptographic signature (ECC384/SHA384)
2184+ 3 . Parses the FIT image to extract kernel and DTB
2185+ 4 . Applies DTB fixups (bootargs for root filesystem)
2186+ 5 . Transitions from EL2 to EL1 and jumps to the kernel
2187+
2188+ #### Creating the FIT Image
2189+
2190+ wolfBoot uses a FIT (Flattened Image Tree) image containing the kernel and device tree. Create the FIT image using the provided ITS file:
2191+
2192+ ``` sh
2193+ # Copy Linux images to wolfBoot root directory
2194+ cp /path/to/petalinux/images/linux/Image .
2195+ cp /path/to/petalinux/images/linux/system-default.dtb .
2196+
2197+ # Create FIT image using mkimage
2198+ mkimage -f hal/versal.its fitImage
2199+ ```
2200+
2201+ The ITS file (` hal/versal.its ` ) specifies:
2202+ - Kernel load address: ` 0x00200000 `
2203+ - DTB load address: ` 0x00001000 `
2204+ - SHA256 hashes for integrity
2205+
2206+ #### Signing the FIT Image
2207+
2208+ Sign the FIT image with wolfBoot tools:
2209+
2210+ ``` sh
2211+ # Sign with ECC384 (default for Versal config)
2212+ ./tools/keytools/sign --ecc384 --sha384 fitImage wolfboot_signing_private_key.der 1
2213+ ```
2214+
2215+ This creates ` fitImage_v1_signed.bin ` .
2216+
2217+ #### DTB Fixup for Root Filesystem
2218+
2219+ 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:
2220+
2221+ ```
2222+ earlycon root=/dev/mmcblk0p2 rootwait
2223+ ```
2224+
2225+ To customize the root device, add to your config:
2226+
2227+ ``` makefile
2228+ # Mount root from SD card partition 4
2229+ CFLAGS_EXTRA+=-DLINUX_BOOTARGS_ROOT =\"/dev/mmcblk0p4\"
2230+ ```
2231+
2232+ #### Flashing to QSPI
2233+
2234+ Flash the signed FIT image to the boot partition at ` 0x800000 ` :
2235+
2236+ ``` sh
2237+ # From U-Boot (via SD card boot)
2238+ tftp ${loadaddr} fitImage_v1_signed.bin
2239+ sf probe 0
2240+ sf erase 0x800000 +${filesize}
2241+ sf write ${loadaddr} 0x800000 ${filesize}
2242+ ```
2243+
2244+ #### Automated Testing
2245+
2246+ The test script supports Linux boot testing:
2247+
2248+ ``` sh
2249+ # Set path to PetaLinux images
2250+ export LINUX_IMAGES_DIR=/path/to/petalinux/images/linux
2251+
2252+ # Build wolfBoot, create signed FIT, flash to QSPI, and boot
2253+ ./tools/scripts/versal_test.sh --linux
2254+ ```
2255+
2256+ #### Example Linux Boot Output
2257+
2258+ ```
2259+ ========================================
2260+ wolfBoot Secure Boot - AMD Versal
2261+ ========================================
2262+ Current EL: 2
2263+ QSPI: Lower ID: 20 BB 21
2264+ QSPI: Upper ID: 20 BB 21
2265+ QSPI: 75MHz, Quad mode, DMA
2266+ Versions: Boot 1, Update 0
2267+ Trying Boot partition at 0x800000
2268+ Loading header 512 bytes from 0x800000 to 0xFFFFE00
2269+ Loading image 24658696 bytes from 0x800200 to 0x10000000...done (701 ms)
2270+ Boot partition: 0xFFFFE00 (sz 24658696, ver 0x1, type 0x601)
2271+ Checking integrity...done (167 ms)
2272+ Verifying signature...done (3 ms)
2273+ Successfully selected image in part: 0
2274+ Firmware Valid
2275+ Loading elf at 0x10000000
2276+ Invalid elf, falling back to raw binary
2277+ Flattened uImage Tree: Version 17, Size 24658696
2278+ Loading Image kernel-1: 0x100000D8 -> 0x200000 (24617472 bytes)
2279+ Image kernel-1: 0x200000 (24617472 bytes)
2280+ Loading Image fdt-1: 0x1177A3DC -> 0x1000 (39384 bytes)
2281+ Image fdt-1: 0x1000 (39384 bytes)
2282+ Loading DTS: 0x1000 -> 0x1000 (39384 bytes)
2283+ FDT: Version 17, Size 39384
2284+ FDT: Setting bootargs: earlycon root=/dev/mmcblk0p2 rootwait
2285+ FDT: Set chosen (28076), bootargs=earlycon root=/dev/mmcblk0p2 rootwait
2286+ Booting at 0x200000
2287+ [ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd083]
2288+ [ 0.000000] Linux version 6.6.40-xilinx-g2b7f6f70a62a ...
2289+ [ 0.000000] Machine model: Xilinx Versal vmk180 Eval board revA
2290+ ...
2291+ PetaLinux 2024.2 xilinx-vmk180 ttyAMA0
2292+
2293+ xilinx-vmk180 login:
2294+ ```
2295+
2296+ #### Boot Performance
2297+
2298+ Typical boot timing with ECC384/SHA384 signing:
2299+
2300+ | Operation | Time |
2301+ | -----------| ------|
2302+ | Load 24MB FIT from QSPI | ~ 700ms |
2303+ | SHA384 integrity check | ~ 167ms |
2304+ | ECC384 signature verify | ~ 3ms |
2305+ | ** Total wolfBoot overhead** | ** ~ 870ms** |
2306+
21592307
21602308## Cypress PSoC-6
21612309
0 commit comments