From d421bf5cfe1c3ad876984d12a4a6c7158d67d6b7 Mon Sep 17 00:00:00 2001 From: Dan Walkes Date: Sat, 2 Dec 2023 11:19:51 -0700 Subject: [PATCH] edk-firmware-tegra: Support A/B redundancy When USE_REDUNDANT_FLASH_LAYOUT is specified, add the .dtbo file to the build which enables RootfsA/B suport in UEFI based on discussion at [1]. This content of the variable is set based on the corresponding logic found in nvidia's flash.sh. The usage for this variable can be found at [2]. 1: https://github.com/OE4T/meta-tegra/discussions/1182#discussioncomment-5067058 2: https://github.com/NVIDIA/edk2-nvidia/blob/71fc2f6de48f3e9f01214b4e9464dd03620b876b/Silicon/NVIDIA/Application/L4TLauncher/L4TRootfsValidation.c#L464-L466 Signed-off-by: Dan Walkes --- conf/machine/include/tegra-common.inc | 1 + .../uefi/edk2-firmware-tegra_35.4.1.bb | 5 +++ ...uration-RootfsRedundancyLevelABEnable.dtsi | 36 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 recipes-bsp/uefi/files/L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi diff --git a/conf/machine/include/tegra-common.inc b/conf/machine/include/tegra-common.inc index d10c5e6a..e7e5d4db 100644 --- a/conf/machine/include/tegra-common.inc +++ b/conf/machine/include/tegra-common.inc @@ -13,6 +13,7 @@ UBOOT_EXTLINUX_KERNEL_ARGS ?= "${KERNEL_ARGS}" UBOOT_EXTLINUX_INITRD ?= "${@'/boot/initrd' if d.getVar('INITRAMFS_IMAGE') != '' and d.getVar('INITRAMFS_IMAGE_BUNDLE') != '1' else ''}" TEGRA_BOOTCONTROL_OVERLAYS ?= "L4TConfiguration.dtbo" +TEGRA_BOOTCONTROL_OVERLAYS += "${@'L4TConfiguration-RootfsRedundancyLevelABEnable.dtbo' if bb.utils.to_boolean(d.getVar('USE_REDUNDANT_FLASH_LAYOUT')) else ''}" TEGRA_PLUGIN_MANAGER_OVERLAYS ??= "" # The following variable is deprecated; add new overlays # to one of the above instead. diff --git a/recipes-bsp/uefi/edk2-firmware-tegra_35.4.1.bb b/recipes-bsp/uefi/edk2-firmware-tegra_35.4.1.bb index 1d0f99b9..c4711a56 100644 --- a/recipes-bsp/uefi/edk2-firmware-tegra_35.4.1.bb +++ b/recipes-bsp/uefi/edk2-firmware-tegra_35.4.1.bb @@ -20,6 +20,8 @@ NVDISPLAY_INIT ?= "${NVDISPLAY_INIT_DEFAULT}" NVDISPLAY_INIT_DEPS = "" NVDISPLAY_INIT_DEPS:tegra194 = "nvdisp-init:do_deploy" +SRC_URI += "${@'file://L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi' if bb.utils.to_boolean(d.getVar('USE_REDUNDANT_FLASH_LAYOUT')) else ''}" + do_compile:append() { rm -rf ${B}/images mkdir ${B}/images @@ -42,6 +44,9 @@ do_compile:append() { done cp ${B}/images/L4TConfiguration.dtbo ${B}/images/L4TConfiguration-rcmboot.dtbo fdtput -t s ${B}/images/L4TConfiguration-rcmboot.dtbo /fragment@0/__overlay__/firmware/uefi/variables/gNVIDIATokenSpaceGuid/DefaultBootPriority data boot.img + if [ ${USE_REDUNDANT_FLASH_LAYOUT} -eq 1 ]; then + dtc -Idts -Odtb -o ${B}/images/L4TConfiguration-RootfsRedundancyLevelABEnable.dtbo ${WORKDIR}/L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi + fi } do_compile[depends] += "${NVDISPLAY_INIT_DEPS}" diff --git a/recipes-bsp/uefi/files/L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi b/recipes-bsp/uefi/files/L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi new file mode 100644 index 00000000..c2656510 --- /dev/null +++ b/recipes-bsp/uefi/files/L4TConfiguration-RootfsRedundancyLevelABEnable.dtsi @@ -0,0 +1,36 @@ +/dts-v1/; + +/ { + overlay-name = "L4T Configuration Settings"; + + fragment@0 { + target-path = "/"; + + board_config { + sw-modules = "uefi"; + }; + + __overlay__ { + + firmware { + + uefi { + + variables { + + gNVIDIAPublicVariableGuid { + + RootfsRedundancyLevel { + data = [01 00 00 00]; + runtime; + locked; + }; + + }; + + }; + }; + }; + }; + }; +};