From 135c92e02461ddac49f62c3dd350a77ee251e6ef Mon Sep 17 00:00:00 2001 From: Dan Walkes Date: Fri, 1 Dec 2023 14:09:33 -0700 Subject: [PATCH 1/2] conf/machine: Support redundant flash layouts NVIDIA provides redundant flash layouts with A/B support for most platforms. This commit adds a parameter USE_REDUNDANT_FLASH_LAYOUT which uses them instead of the default non-redundant. * Add a variable USE_REDUNDANT_FLASH_LAYOUT to control whether to use the default flash layout or the redundant flash layout for both internal and external layouts. The weak override var USE_REDUNDANT_FLASH_LAYOUT_DEFAULT can be set at the distro layer to override the default (off) state if desired. * Build a PARTITION_LAYOUT_TEMPLATE_REDUNDANT variable which appends the rootfs_ab string to the partition layout file for all cases other than when PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT is set, where PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT is set for nano platforms using flash_t234_qspi.xml which already contains redundant partitions. * Build a PARTITION_LAYOUT_EXTERNAL_REDUNDANT variable which appends the rootfs_ab string to the PARTITION_LAYOUT_EXTERNAL file for all platforms with the exception of orin nano platforms which use "flash_l4t_external.xml" by default. * Add a ROOTFSPART_SIZE_DEFAULT var which sets the default rootfs partition size for the MACHINE when not using dual redundancy. * Add a ROOTFSPART_SIZE_REDUNDANT var which divides the ROOTFSPART_SIZE_DEFAULT by two when USE_REDUNDANT_FLASH_LAYOUT is specified. After this commit: * Custom MACHINE types which need to support multiple flash layouts for redundancy can name their layouts to match the NVIDIA syntax, ending with _rootfs_ab, define PARTITION_LAYOUT_EXTERNAL_DEFAULT as well as PARTITION_LAYOUT_TEMPLATE_DEAFULT and the USE_REDUNDANT_FLASH_LAYOUT will function as expected for these platforms as well to select the appropriate xml files. * Custom MACHINEs which don't need to support multiple flash layouts can just define PARTITION_LAYOUT_EXTERNAL and/or PARTITION_LAYOUT_TEMPLATE as done previously to override the default assignments for these variables in tegra-common.inc * Custom MACHINEs which need to specify a custom partition size can either specify ROOTFSPART_SIZE_DEFAULT to let the size be set based on USE_REDUNDANT_FLASH_LAYOUT, or set ROOTFSPART_SIZE to force to a specific size regardless of USE_REDUNDANT_FLASH_LAYOUT See also https://github.com/OE4T/meta-tegra/wiki/Rendundant-Rootfs-A-B-Partition-Support Signed-off-by: Dan Walkes --- conf/machine/clara-agx-xavier-devkit.conf | 4 ++-- conf/machine/include/agx-xavier.inc | 2 +- conf/machine/include/orin-nano.inc | 2 +- conf/machine/include/tegra-common.inc | 13 +++++++++++++ conf/machine/include/tegra194.inc | 2 +- conf/machine/include/tegra234.inc | 2 +- conf/machine/include/xavier-nx.inc | 2 +- conf/machine/jetson-agx-orin-devkit-industrial.conf | 4 ++-- conf/machine/jetson-agx-orin-devkit.conf | 4 ++-- conf/machine/jetson-agx-xavier-devkit.conf | 2 +- conf/machine/jetson-agx-xavier-industrial.conf | 2 +- conf/machine/jetson-orin-nano-devkit-nvme.conf | 7 +++++-- conf/machine/jetson-orin-nano-devkit.conf | 2 +- conf/machine/jetson-xavier-nx-devkit-emmc.conf | 2 +- conf/machine/jetson-xavier-nx-devkit.conf | 2 +- conf/machine/p3509-a02-p3767-0000.conf | 7 ++++--- conf/machine/p3768-0000-p3767-0000.conf | 7 ++++--- conf/machine/p3768-0000-p3767-0004.conf | 5 +++-- 18 files changed, 45 insertions(+), 26 deletions(-) diff --git a/conf/machine/clara-agx-xavier-devkit.conf b/conf/machine/clara-agx-xavier-devkit.conf index ecedc477edc8..d056db4a4c31 100644 --- a/conf/machine/clara-agx-xavier-devkit.conf +++ b/conf/machine/clara-agx-xavier-devkit.conf @@ -14,12 +14,12 @@ EMMC_SIZE ?= "31276924928" EMMC_DEVSECT_SIZE ?= "512" BOOTPART_SIZE ?= "8388608" BOOTPART_LIMIT ?= "10485760" -ROOTFSPART_SIZE ?= "30064771072" +ROOTFSPART_SIZE_DEFAULT ?= "30064771072" ODMDATA ?= "0x69190000" EMMC_BCT ?= "tegra194-mb1-bct-memcfg-p2888.cfg" EMMC_BCT_OVERRIDE ?= "tegra194-memcfg-sw-override.cfg" NVIDIA_BOARD ?= "t186ref" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t194_sdmmc.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t194_sdmmc.xml" TEGRA_AUDIO_DEVICE ?= "tegra-hda-jetson-agx" diff --git a/conf/machine/include/agx-xavier.inc b/conf/machine/include/agx-xavier.inc index daf2b219909a..bf5429758ef5 100644 --- a/conf/machine/include/agx-xavier.inc +++ b/conf/machine/include/agx-xavier.inc @@ -6,7 +6,7 @@ EMMC_SIZE ?= "31276924928" EMMC_DEVSECT_SIZE ?= "512" BOOTPART_SIZE ?= "8388608" BOOTPART_LIMIT ?= "10485760" -ROOTFSPART_SIZE ?= "30064771072" +ROOTFSPART_SIZE_DEFAULT ?= "30064771072" ODMDATA ?= "0x9190000" EMMC_BCT_OVERRIDE ?= "tegra194-memcfg-sw-override.cfg" diff --git a/conf/machine/include/orin-nano.inc b/conf/machine/include/orin-nano.inc index 899b66c78ab8..3ab78e2e0485 100644 --- a/conf/machine/include/orin-nano.inc +++ b/conf/machine/include/orin-nano.inc @@ -27,7 +27,7 @@ MACHINE_EXTRA_RDEPENDS += "linux-firmware-rtl8168" EMMC_SIZE ?= "" BOOTPART_SIZE ?= "8388608" -ROOTFSPART_SIZE ?= "30064771072" +ROOTFSPART_SIZE_DEFAULT ?= "30064771072" ODMDATA ?= "gbe-uphy-config-8,hsstp-lane-map-3,hsio-uphy-config-0" EMMC_BCT ?= "tegra234-p3767-0000-sdram-l4t.dts" NVIDIA_BOARD ?= "t186ref" diff --git a/conf/machine/include/tegra-common.inc b/conf/machine/include/tegra-common.inc index 265760d3095a..d10c5e6a4a70 100644 --- a/conf/machine/include/tegra-common.inc +++ b/conf/machine/include/tegra-common.inc @@ -104,3 +104,16 @@ TEGRA_FLASHVARS ?= "BPFDTB_FILE BPF_FILE BR_CMD_CONFIG DEVICEPROD_CONFIG DEVICE_ EMMC_BCTS ?= "${EMMC_BCT}${@',' + d.getVar('EMMC_BCT_OVERRIDE') if d.getVar('EMMC_BCT_OVERRIDE') else ''}" TEGRA_UEFI_SIGNING_CLASS ?= "tegra-uefi-signing" + +USE_REDUNDANT_FLASH_LAYOUT_DEFAULT ??= "0" +HAS_REDUNDANT_PARTITION_LAYOUT_EXTERNAL ?= "1" +USE_REDUNDANT_FLASH_LAYOUT ?= "${@d.getVar('USE_REDUNDANT_FLASH_LAYOUT_DEFAULT') if bb.utils.to_boolean(d.getVar('HAS_REDUNDANT_PARTITION_LAYOUT_EXTERNAL')) else '0'}" +PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT ??= "0" + +PARTITION_LAYOUT_TEMPLATE_REDUNDANT ?= "${@d.getVar('PARTITION_LAYOUT_TEMPLATE_DEFAULT') if bb.utils.to_boolean(d.getVar('PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT')) else d.getVar('PARTITION_LAYOUT_TEMPLATE_DEFAULT').replace('.xml','_rootfs_ab.xml')}" +PARTITION_LAYOUT_TEMPLATE ?= "${@d.getVar('PARTITION_LAYOUT_TEMPLATE_REDUNDANT') if bb.utils.to_boolean(d.getVar('USE_REDUNDANT_FLASH_LAYOUT')) else d.getVar('PARTITION_LAYOUT_TEMPLATE_DEFAULT')}" +PARTITION_LAYOUT_EXTERNAL_REDUNDANT ?= "${@d.getVar('PARTITION_LAYOUT_EXTERNAL_DEFAULT').replace('.xml','_rootfs_ab.xml')}" +PARTITION_LAYOUT_EXTERNAL ?= "${@d.getVar('PARTITION_LAYOUT_EXTERNAL_REDUNDANT') if bb.utils.to_boolean(d.getVar('USE_REDUNDANT_FLASH_LAYOUT')) else d.getVar('PARTITION_LAYOUT_EXTERNAL_DEFAULT')}" + +ROOTFSPART_SIZE_REDUNDANT ?= "${@int(d.getVar('ROOTFSPART_SIZE_DEFAULT')) // 2}" +ROOTFSPART_SIZE ?= "${@d.getVar('ROOTFSPART_SIZE_REDUNDANT') if bb.utils.to_boolean(d.getVar('USE_REDUNDANT_FLASH_LAYOUT')) else d.getVar('ROOTFSPART_SIZE_DEFAULT')}" diff --git a/conf/machine/include/tegra194.inc b/conf/machine/include/tegra194.inc index e6ff3efd3bbc..5acfc5f12bb1 100644 --- a/conf/machine/include/tegra194.inc +++ b/conf/machine/include/tegra194.inc @@ -34,7 +34,7 @@ MACHINE_EXTRA_RRECOMMENDS += "kernel-module-tegra-udrm" KERNEL_MODULE_PROBECONF += "tegra-udrm" module_conf_tegra-udrm = "options tegra-udrm modeset=1" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_nvme.xml" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_nvme.xml" TEGRA_BOOT_FIRMWARE_FILES = "\ adsp-fw.bin \ diff --git a/conf/machine/include/tegra234.inc b/conf/machine/include/tegra234.inc index b6c88c0ed8e6..4745277e4e70 100644 --- a/conf/machine/include/tegra234.inc +++ b/conf/machine/include/tegra234.inc @@ -30,7 +30,7 @@ NVFANCONTROL ?= "nvfancontrol_p3701_0000" MACHINE_EXTRA_RRECOMMENDS += "kernel-module-nvidia kernel-module-nvidia-drm kernel-module-nvidia-modeset kernel-module-userspace-alert" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_t234_nvme.xml" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_t234_nvme.xml" TEGRA_BOOT_FIRMWARE_FILES = "\ adsp-fw.bin \ diff --git a/conf/machine/include/xavier-nx.inc b/conf/machine/include/xavier-nx.inc index 3946708c410d..a179b6ebff80 100644 --- a/conf/machine/include/xavier-nx.inc +++ b/conf/machine/include/xavier-nx.inc @@ -19,7 +19,7 @@ KERNEL_ARGS ?= "console=ttyTCU0,115200 console=tty0 fbcon=map:0 video=efifb:off EMMC_DEVSECT_SIZE ?= "512" BOOTPART_SIZE ?= "" BOOTPART_LIMIT ?= "10485760" -ROOTFSPART_SIZE ?= "15032385536" +ROOTFSPART_SIZE_DEFAULT ?= "15032385536" RECROOTFSSIZE ?= "104857600" ODMDATA ?= "0xB8190000" EMMC_BCT ?= "tegra194-mb1-bct-memcfg-p3668-0001-a00.cfg" diff --git a/conf/machine/jetson-agx-orin-devkit-industrial.conf b/conf/machine/jetson-agx-orin-devkit-industrial.conf index 0a55aa8f747b..325f94fb9ba3 100644 --- a/conf/machine/jetson-agx-orin-devkit-industrial.conf +++ b/conf/machine/jetson-agx-orin-devkit-industrial.conf @@ -14,11 +14,11 @@ EMMC_SIZE ?= "63652757504" EMMC_DEVSECT_SIZE ?= "512" BOOTPART_SIZE ?= "8388608" BOOTPART_LIMIT ?= "10485760" -ROOTFSPART_SIZE ?= "59055800320" +ROOTFSPART_SIZE_DEFAULT ?= "59055800320" ODMDATA ?= "gbe-uphy-config-22,hsstp-lane-map-3,nvhs-uphy-config-0,hsio-uphy-config-0,gbe0-enable-10g" EMMC_BCT ?= "tegra234-p3701-0008-sdram-l4t.dts" NVIDIA_BOARD ?= "t186ref" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi_sdmmc_industrial.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi_sdmmc_industrial.xml" TEGRA_AUDIO_DEVICE ?= "tegra-ape" OTABOOTDEV ?= "/dev/mtdblock0" diff --git a/conf/machine/jetson-agx-orin-devkit.conf b/conf/machine/jetson-agx-orin-devkit.conf index affc52ea09b0..2506459d909a 100644 --- a/conf/machine/jetson-agx-orin-devkit.conf +++ b/conf/machine/jetson-agx-orin-devkit.conf @@ -16,11 +16,11 @@ EMMC_SIZE ?= "31276924928" EMMC_DEVSECT_SIZE ?= "512" BOOTPART_SIZE ?= "8388608" BOOTPART_LIMIT ?= "10485760" -ROOTFSPART_SIZE ?= "30064771072" +ROOTFSPART_SIZE_DEFAULT ?= "30064771072" ODMDATA ?= "gbe-uphy-config-22,hsstp-lane-map-3,nvhs-uphy-config-0,hsio-uphy-config-0,gbe0-enable-10g" EMMC_BCT ?= "tegra234-p3701-0000-sdram-l4t.dts" NVIDIA_BOARD ?= "t186ref" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi_sdmmc.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi_sdmmc.xml" TEGRA_AUDIO_DEVICE ?= "tegra-hda-jetson-agx" OTABOOTDEV ?= "/dev/mtdblock0" diff --git a/conf/machine/jetson-agx-xavier-devkit.conf b/conf/machine/jetson-agx-xavier-devkit.conf index f6e6d8cc09d5..cca2363d4976 100644 --- a/conf/machine/jetson-agx-xavier-devkit.conf +++ b/conf/machine/jetson-agx-xavier-devkit.conf @@ -14,7 +14,7 @@ KERNEL_DEVICETREE ?= "tegra194-p2888-0001-p2822-0000.dtb" EMMC_BCT ?= "tegra194-mb1-bct-memcfg-p2888.cfg" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t194_sdmmc.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t194_sdmmc.xml" BOOT_PARTITIONS_ON_EMMC = "1" TEGRA_PLUGIN_MANAGER_OVERLAYS ?= "tegra194-p2822-camera-dual-imx274-overlay.dtbo tegra194-p2822-camera-e3326-overlay.dtbo tegra194-p2822-camera-e3331-overlay.dtbo tegra194-p2822-camera-e3333-overlay.dtbo tegra194-p2822-camera-imx185-overlay.dtbo tegra194-p2822-camera-imx390-overlay.dtbo tegra194-p2888-0005-overlay.dtbo tegra194-p2888-0001-p2822-0000-overlay.dtbo" diff --git a/conf/machine/jetson-agx-xavier-industrial.conf b/conf/machine/jetson-agx-xavier-industrial.conf index 7c0cbd434345..120236bc59cd 100644 --- a/conf/machine/jetson-agx-xavier-industrial.conf +++ b/conf/machine/jetson-agx-xavier-industrial.conf @@ -8,7 +8,7 @@ KERNEL_DEVICETREE ?= "tegra194-p2888-0008-p2822-0000.dtb" EMMC_BCT ?= "tegra194-mb1-bct-memcfg-4x-derated-ecc-p2888.cfg" -PARTITION_LAYOUT_TEMPLATE ?= "flash_l4t_t194_spi_emmc_jaxi.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_l4t_t194_spi_emmc_jaxi.xml" TEGRA_PLUGIN_MANAGER_OVERLAYS ?= "${TEGRA_BOOTCONTROL_OVERLAYS} tegra194-p2822-camera-dual-imx274-overlay.dtbo tegra194-p2822-camera-e3326-overlay.dtbo tegra194-p2822-camera-e3331-overlay.dtbo tegra194-p2822-camera-e3333-overlay.dtbo tegra194-p2822-camera-imx185-overlay.dtbo tegra194-p2822-camera-imx390-overlay.dtbo tegra194-p2888-0005-overlay.dtbo tegra194-p2888-0001-p2822-0000-overlay.dtbo" OTA_BOOT_DEVICE ?= "/dev/mtdblock0" diff --git a/conf/machine/jetson-orin-nano-devkit-nvme.conf b/conf/machine/jetson-orin-nano-devkit-nvme.conf index 032bd7c11284..08e8ff44ee8d 100644 --- a/conf/machine/jetson-orin-nano-devkit-nvme.conf +++ b/conf/machine/jetson-orin-nano-devkit-nvme.conf @@ -4,8 +4,11 @@ MACHINEOVERRIDES =. "jetson-orin-nano-devkit:" TNSPEC_BOOTDEV ?= "nvme0n1p1" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi.xml" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_external.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT_SUPPORTS_REDUNDANT ?= "1" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_external.xml" +PARTITION_LAYOUT_EXTERNAL_REDUNDANT ?= "flash_l4t_nvme_rootfs_ab.xml" + require conf/machine/include/orin-nano.inc require conf/machine/include/devkit-wifi.inc diff --git a/conf/machine/jetson-orin-nano-devkit.conf b/conf/machine/jetson-orin-nano-devkit.conf index 6e4919fbe944..4ffbd5ac857a 100644 --- a/conf/machine/jetson-orin-nano-devkit.conf +++ b/conf/machine/jetson-orin-nano-devkit.conf @@ -7,4 +7,4 @@ require conf/machine/include/devkit-wifi.inc TEGRA_SPIFLASH_BOOT ?= "1" TEGRAFLASH_SDCARD_SIZE ?= "32G" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi_sd.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi_sd.xml" diff --git a/conf/machine/jetson-xavier-nx-devkit-emmc.conf b/conf/machine/jetson-xavier-nx-devkit-emmc.conf index 78878bcebae3..1a461bb278ee 100644 --- a/conf/machine/jetson-xavier-nx-devkit-emmc.conf +++ b/conf/machine/jetson-xavier-nx-devkit-emmc.conf @@ -12,5 +12,5 @@ require conf/machine/include/xavier-nx.inc require conf/machine/include/devkit-wifi.inc EMMC_SIZE ?= "15758000128" -PARTITION_LAYOUT_TEMPLATE ?= "flash_l4t_t194_spi_emmc_p3668.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_l4t_t194_spi_emmc_p3668.xml" BOOT_PARTITIONS_ON_EMMC = "1" diff --git a/conf/machine/jetson-xavier-nx-devkit.conf b/conf/machine/jetson-xavier-nx-devkit.conf index 8134cea7dd92..ca244ec7e96f 100644 --- a/conf/machine/jetson-xavier-nx-devkit.conf +++ b/conf/machine/jetson-xavier-nx-devkit.conf @@ -14,6 +14,6 @@ require conf/machine/include/xavier-nx.inc require conf/machine/include/devkit-wifi.inc EMMC_SIZE ?= "" -PARTITION_LAYOUT_TEMPLATE ?= "flash_l4t_t194_spi_sd_p3668.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_l4t_t194_spi_sd_p3668.xml" TEGRA_SPIFLASH_BOOT ?= "1" TEGRAFLASH_SDCARD_SIZE ?= "16G" diff --git a/conf/machine/p3509-a02-p3767-0000.conf b/conf/machine/p3509-a02-p3767-0000.conf index b9dbf3df8b60..1553a21fc351 100644 --- a/conf/machine/p3509-a02-p3767-0000.conf +++ b/conf/machine/p3509-a02-p3767-0000.conf @@ -11,8 +11,9 @@ NVPMODEL ?= "nvpmodel_p3767_0000" NVFANCONTROL ?= "nvfancontrol_p3767_0000" TNSPEC_BOOTDEV ?= "nvme0n1p1" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi.xml" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_external.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi.xml" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_external.xml" +HAS_REDUNDANT_PARTITION_LAYOUT_EXTERNAL ?= "0" TEGRAFLASH_NO_INTERNAL_STORAGE = "1" require conf/machine/include/tegra234.inc @@ -37,7 +38,7 @@ MACHINE_EXTRA_RDEPENDS += "linux-firmware-rtl8168" EMMC_SIZE ?= "" BOOTPART_SIZE ?= "8388608" # 55GiB default rootfs size -ROOTFSPART_SIZE ?= "59055800320" +ROOTFSPART_SIZE_DEFAULT ?= "59055800320" ODMDATA ?= "gbe-uphy-config-8,hsstp-lane-map-3,hsio-uphy-config-0" EMMC_BCT ?= "tegra234-p3767-0000-sdram-l4t.dts" NVIDIA_BOARD ?= "t186ref" diff --git a/conf/machine/p3768-0000-p3767-0000.conf b/conf/machine/p3768-0000-p3767-0000.conf index 74045ed84ad0..41226d31f1b5 100644 --- a/conf/machine/p3768-0000-p3767-0000.conf +++ b/conf/machine/p3768-0000-p3767-0000.conf @@ -11,8 +11,9 @@ NVPMODEL ?= "nvpmodel_p3767_0000" NVFANCONTROL ?= "nvfancontrol_p3767_0000" TNSPEC_BOOTDEV ?= "nvme0n1p1" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi.xml" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_external.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi.xml" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_external.xml" +HAS_REDUNDANT_PARTITION_LAYOUT_EXTERNAL ?= "0" TEGRAFLASH_NO_INTERNAL_STORAGE = "1" require conf/machine/include/tegra234.inc @@ -37,7 +38,7 @@ MACHINE_EXTRA_RDEPENDS += "linux-firmware-rtl8168" EMMC_SIZE ?= "" BOOTPART_SIZE ?= "8388608" # 55GiB default rootfs size -ROOTFSPART_SIZE ?= "59055800320" +ROOTFSPART_SIZE_DEFAULT ?= "59055800320" ODMDATA ?= "gbe-uphy-config-8,hsstp-lane-map-3,hsio-uphy-config-0" EMMC_BCT ?= "tegra234-p3767-0000-sdram-l4t.dts" NVIDIA_BOARD ?= "t186ref" diff --git a/conf/machine/p3768-0000-p3767-0004.conf b/conf/machine/p3768-0000-p3767-0004.conf index 768fdce4c237..c133628fda23 100644 --- a/conf/machine/p3768-0000-p3767-0004.conf +++ b/conf/machine/p3768-0000-p3767-0004.conf @@ -5,8 +5,9 @@ MACHINEOVERRIDES =. "jetson-orin-nano-4g-devkit:" TNSPEC_BOOTDEV ?= "nvme0n1p1" -PARTITION_LAYOUT_TEMPLATE ?= "flash_t234_qspi.xml" -PARTITION_LAYOUT_EXTERNAL ?= "flash_l4t_external.xml" +PARTITION_LAYOUT_TEMPLATE_DEFAULT ?= "flash_t234_qspi.xml" +PARTITION_LAYOUT_EXTERNAL_DEFAULT ?= "flash_l4t_external.xml" +HAS_REDUNDANT_PARTITION_LAYOUT_EXTERNAL ?= "0" TEGRA_BOARDSKU = "0004" KERNEL_DEVICETREE = "tegra234-p3767-0004-p3768-0000-a0.dtb" From 5c5f37fcd0674f8209ed91c69cfe9fbb4f37cb73 Mon Sep 17 00:00:00 2001 From: Dan Walkes Date: Sat, 2 Dec 2023 11:19:51 -0700 Subject: [PATCH 2/2] 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 d10c5e6a4a70..e7e5d4dbba71 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 1d0f99b94a08..c4711a562317 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 000000000000..c26565103e39 --- /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; + }; + + }; + + }; + }; + }; + }; + }; +};