bootloader,flash: pre-seed VolatileVars.bin for overlay/DTBO loading#203
bootloader,flash: pre-seed VolatileVars.bin for overlay/DTBO loading#203guanquan (GuanquanTian) wants to merge 3 commits into
Conversation
37c8344 to
41fb4ed
Compare
41fb4ed to
5f808fa
Compare
|
Reviewed the change. The path that runs today (targets.json
|
Adds a script to build an EBBR-style VolatileVars.bin containing UEFI variable entries (with a built-in VendorDtbOverlays default), optionally merged with overrides from a JSON config. Signed-off-by: Guanquan Tian <guanquan@qti.qualcomm.com>
5f808fa to
3b21d66
Compare
Add --seed-volatile-vars/--seed-volatile-vars-config to build-efi-esp.sh, so a fresh ESP can be built with VolatileVars.bin pre-seeded (e.g. VendorDtbOverlays) via gen-volatile-vars.py. This only helps when building a fresh ESP, though — flows that build one efi.bin and reuse it across multiple boards (flash/gen-flash-dirs.sh) need to patch VolatileVars.bin into an individual board's copy after the fact, without root/mount. Add patch-volatile-vars.sh, which writes VolatileVars.bin into an existing FAT32 image in place via mtools (mcopy) — no loop device or root required. mcopy is installed on demand if missing. Signed-off-by: Guanquan Tian <guanquan@qti.qualcomm.com>
Some boards sharing a job's efi.bin need VolatileVars.bin pre-seeded (e.g. VendorDtbOverlays for DTBO overlay loading); others don't. Since one CI job can build multiple boards' flash dirs from one shared efi.bin, gate this per board rather than per platform/suite. Add "seed_volatile_vars" (bool, default false) and "seed_volatile_vars_config" (optional JSON path) to targets.json. When seed_volatile_vars is true, gen-flash-dirs.sh runs bootloader/patch-volatile-vars.sh against that board's own efi.bin copy after it's staged, forwarding seed_volatile_vars_config as --config if set, and leaving other boards sharing the same source efi.bin unaffected. Signed-off-by: Guanquan Tian <guanquan@qti.qualcomm.com>
3b21d66 to
7293ab0
Compare
|
Bjordis Collaku (@bjordiscollaku) Thanks for the thorough review — all five points below are addressed: build-efi-esp.sh
gen_volatile_vars.py
Also renamed |
Summary
Add tooling to pre-seed VolatileVars.bin with the VendorDtbOverlays UEFI variable at build time, and wire it into the flat-meta flash pipeline on a per-board basis.
Why
Overlay-based DTBO loading depends on the VendorDtbOverlays UEFI variable being present in VolatileVars.bin. Today this file is only ever generated by the firmware itself during the UEFI boot stage — there's no way to seed it ahead of time.
This means the variable doesn't exist on first boot (or after any reset that wipes the ESP), so overlay/DTBO loading can't be relied upon without an extra runtime step.
In the flat-meta flash pipeline, a single CI job can build one shared efi.bin and reuse it across several boards (see targets.json). Only some of those boards need VolatileVars.bin pre-seeded, so the injection needs to be per-board rather than per-platform/suite, and it needs to work against an existing efi.bin (not just a freshly-built one).
What it does
bootloader/gen-volatile-vars.py— builds an EBBR-style VolatileVars.bin (EFI_VARIABLE_FILE + EFI_VARIABLE_ENTRY layout consumed byUpdateVariableFromRTVolatileBin()). Ships a built-in default entry for VendorDtbOverlays (camx). Accepts an optional--config extra.jsonto add/override entries (matched by guid+name) without touching the script.bootloader/build-efi-esp.sh— new--seed-volatile-vars/--seed-volatile-vars-configflags to bake VolatileVars.bin into a freshly built ESP image.bootloader/patch-volatile-vars.sh— writes VolatileVars.bin into an existing FAT32 image in place via mtools (mcopy), no loop device/mount/root required. Used when one efi.bin is built once and eused across multiple boards.flash/parse-boards-config.py/flash/gen-flash-dirs.sh— new"seed_volatile_vars"field (bool, default false) and"seed_volatile_vars_config"field (optional JSON path, default"") in targets.json. Whenseed_volatile_varsis true for a board,gen-flash-dirs.shpatches that board's own efi.bin copy after staging it (forwardingseed_volatile_vars_configas--configif set), leaving other boards sharing the same source efi.bin unaffected.Usage
Add VolatileVars.bin to an already-generated efi.bin:
./build-efi-esp.sh --out efi.bin
./patch-volatile-vars.sh --efi efi.bin
Generate VolatileVars.bin separately:
python3 gen-volatile-vars.py --out VolatileVars.bin
Generate and add VolatileVars.bin during the compilation of efi.bin:
./build-efi-esp.sh --seed-volatile-vars --out efi.bin