This shows you the differences between two versions of the page.
|
ass:labs-2025:04:tasks:03 [2025/08/07 15:35] florin.stancu |
ass:labs-2025:04:tasks:03 [2026/07/16 15:34] (current) florin.stancu |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ==== 03. Bootloader [re]configuration ==== | + | ==== 03. RAUC ==== |
| - | === Modify the U-Boot script === | + | Finally, it comes down to installing RAUC into the Debian partitions. |
| - | For this task, you will need to configure u-boot with a default environment as documented in [[:ass:labs-2025:03:tasks:01|this previous lab]]. | + | 📄 Our script: ''rauc-utils/install.sh'' is already complete. Feel free to read and understand it. |
| - | Simply paste the recommended default and use ''menuconfig'' to enable it (don't worry about the ''bootcmd'', we will replace it here with a custom script). | + | This script will: |
| - | Now, edit the ''20-modify-bootcmd.sh'' script and set the path to your ''default.env'' file. Read its source code to see what it does and run it! | + | - Mount both rootfsA and rootfsBÂ |
| + | - Uses QEMU and chroot to install:Â | ||
| + | - ''rauc''Â | ||
| + | - your ''ca.cert.pem'' (certificate used to sign the update images)Â | ||
| + | - ''system.conf''Â | ||
| + | - ''rauc-mark-good.service''Â | ||
| + | - Sets up ''/etc/fw_env.config'', ''fstab'', and enables systemd services | ||
| - | Check out your default file again. It shoule have a quite large boot command concatenated from the source ''utils/boot.cmd.in'' script. | + | But in order to run it, recursively copy the entire RAUC utils directory from host to somewhere inside the debian rootfs (e.g., ''/root/rauc-utils/'') and run it using ''chroot-enter.sh'' (as you've done in the prev. task). |
| - | **Now pay attention:** make a backup of your current ''flash.bin'' file you used to boot using ''uuu -b spl''. You'll need it later to flash the emmc, as the one you'll build in the following instructions will not work (you will override the boot command!). Put the backup file into artifacts as ''flash_spl.bin''! | + | === [Re]Generate the disk image === |
| - | Let's get this over with: re-build your u-boot, copy all resulting binaries (''uboot-imx/*.bin'', ''uboot-imx/spl/*.bin'') back into ''imx-mkimage/iMX93/'', invoke the ''imx-mkimage'' make command again to obtain a new ''flash.bin'' file. Store it as ''artifacts/flash_emmc.bin'' (will get to reside on the eMMC persistent storage). | + | We can now run ''mk-disk-image2.sh''. The ''disk.img'' will be updated with 4 partitions (boot, A, B + data), Debian will be copied to the first 2 EXT4 partitions and the bootloader will be installed at 32KB offset (the SoC's BL1/BOOTROM wants it there). |
| - | === Kernel === | + | === Custom u-boot script === |
| - | We still have some work to do before generating the disk image... | + | 📄 In order to have the A-B partitioning scheme, we'll need to add this script: ''rauc-utils/boot.cmd.in'' to our u-boot default environment. Feel free to study it (highly recommended)! |
| - | We must pack our kernel + device tree again, but this time **without** the Buildroot initramfs (we don't need it since we've got 2xDebians now!). So back up your ''linux.its'' (surely you don't want to waste your work so far, right?), then modify the original and simply **delete** the ''initrd'' block from ''images'' and the ''ramdisk = "initrd";'' property. | + | Use the ''rauc-utils/uboot-modify-bootcmd.sh'' script to just to this! |
| - | Rebuild the Linux FIT uImage to obtain your new ''linux.itb'', which you'll then copy to ''rauc-lab/artifacts/linux.itb''. | + | Then rebuild uboot (you must delete ''u-boot/.config'' and ''u-boot/flash.bin'' for our Makefile to trigger the recompilation of UBoot). |
| - | Now it's time to run ''21-install-boot.sh''. What's that? it wants a ''.env'' file? You can create an empty one ;) | + | === Flashing the board ===Â |
| + | Â | ||
| + | Power up the board and go into u-boot. Let ''fastboot'' start and use ''fastboot flash 0:0 disk.img''. | ||
| + | Â | ||
| + | Use your root password (hope you set it!). | ||
| + | Â | ||
| + | Once Debian booted, check:Â | ||
| + | Â | ||
| + | <code bash>Â | ||
| + | mount | grep rootfs | ||
| + | cat /etc/rauc/system.conf | ||
| + | </code> | ||