From 259e0bd1be9e9790fbb61449192045e07a2acd29 Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Mon, 2 Nov 2020 09:07:45 -0800 Subject: [PATCH 1/2] meta-mender-tegra: reduce BOOTENV_SIZE on Jetson Nano SPI/SD platforms To maintain compatibility with the layout of the NVIDIA partitions in the SPI flash for L4T R32.4.3+ and still keep the U-Boot environment start at the same offset in SPI flash we've been using, we need to reduce the size of the environment to allow it to fit into the available space. To do this, set BOOTENV_SIZE on SPI flash-equipped tegra210 platforms to 64KiB instead of the Mender default of 128KiB. Signed-off-by: Matt Madison Signed-off-by: Dan Walkes --- ...duce-env-size-on-p3450-0000-to-64KiB.patch | 29 +++++++++++++++++++ .../u-boot/u-boot-mender-tegra-vars.inc | 4 +++ .../u-boot/u-boot-mender-tegra.inc | 1 + 3 files changed, 34 insertions(+) create mode 100644 meta-mender-tegra/recipes-bsp/u-boot/patches/0013-Reduce-env-size-on-p3450-0000-to-64KiB.patch diff --git a/meta-mender-tegra/recipes-bsp/u-boot/patches/0013-Reduce-env-size-on-p3450-0000-to-64KiB.patch b/meta-mender-tegra/recipes-bsp/u-boot/patches/0013-Reduce-env-size-on-p3450-0000-to-64KiB.patch new file mode 100644 index 00000000..7c3079b3 --- /dev/null +++ b/meta-mender-tegra/recipes-bsp/u-boot/patches/0013-Reduce-env-size-on-p3450-0000-to-64KiB.patch @@ -0,0 +1,29 @@ +From 00d2500c1a78e3b49d70256e5cbea6aedb3ebe83 Mon Sep 17 00:00:00 2001 +From: Matt Madison +Date: Mon, 2 Nov 2020 08:24:14 -0800 +Subject: [PATCH] Reduce env size on p3450-0000 to 64KiB + +Signed-off-by: Matt Madison +--- + configs/p3450-0000_defconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configs/p3450-0000_defconfig b/configs/p3450-0000_defconfig +index c3200216b9..c6dfbc79d8 100644 +--- a/configs/p3450-0000_defconfig ++++ b/configs/p3450-0000_defconfig +@@ -58,9 +58,9 @@ CONFIG_ENV_SECT_SIZE=0x1000 + CONFIG_BOOTP_PREFER_SERVERIP=y + CONFIG_POSITION_INDEPENDENT=y + CONFIG_DISABLE_SDMMC1_EARLY=y +-CONFIG_ENV_SIZE=0x20000 ++CONFIG_ENV_SIZE=0x10000 + CONFIG_ENV_OFFSET=0x3b0000 +-CONFIG_ENV_OFFSET_REDUND=0x3d0000 ++CONFIG_ENV_OFFSET_REDUND=0x3c0000 + CONFIG_SYS_REDUNDAND_ENVIRONMENT=y + # CONFIG_ENV_IS_NOWHERE is not set + # CONFIG_ENV_IS_IN_EEPROM is not set +-- +2.25.1 + diff --git a/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra-vars.inc b/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra-vars.inc index e5474fc5..eb078cd4 100644 --- a/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra-vars.inc +++ b/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra-vars.inc @@ -1,6 +1,10 @@ MENDER_UBOOT_AUTO_CONFIGURE = "0" MENDER_UBOOT_CONFIG_SYS_MMC_ENV_PART = "2" +TEGRA_MENDER_BOOTENV_SIZE_DEFAULT = "0x20000" +TEGRA_MENDER_BOOTENV_SIZE_DEFAULT_tegra210 = "${@'0x10000' if (d.getVar('TEGRA_SPIFLASH_BOOT') or '') == '1' else '0x20000'}" +BOOTENV_SIZE ?= "${TEGRA_MENDER_BOOTENV_SIZE_DEFAULT}" + # Calculate this offset by adding up the offsets of each partition preceeding the uboot_env partition in sdmmc_boot and aligning to the next # 4096 byte boundary, then subtracting 4 MiB (4194304) since the sdmmc_boot represents the combined boot0 and boot1 partitions # Please note the suggestions in the nvidia thread at https://devtalk.nvidia.com/default/topic/1063652/jetson-tx2/mmcblk0boot1-usage-at-address-4177408-and-u-boot-parameter-storage-space-availability/ diff --git a/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra.inc b/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra.inc index 4e2804a1..923acebf 100644 --- a/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra.inc +++ b/meta-mender-tegra/recipes-bsp/u-boot/u-boot-mender-tegra.inc @@ -2,6 +2,7 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/patches:" SRC_URI_append_mender-uboot = " file://0010-tegra-mender-auto-configured-modified.patch" SRC_URI_append_mender-uboot = " file://0011-Jetson-TX2-mender-boot-commands.patch" +SRC_URI_append_mender-uboot = " file://0013-Reduce-env-size-on-p3450-0000-to-64KiB.patch" do_provide_mender_defines_append_tegra210() { if [ "${TEGRA_SPIFLASH_BOOT}" = "1" ]; then From b3201085a742af3702ca6f2c34d1a61d8e9d0668 Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Sat, 31 Oct 2020 06:36:52 -0700 Subject: [PATCH 2/2] meta-mender-tegra: update flash layout file for jetson-nano-qspi-sd The flashing tools and flash layout for the QSPI-equipped Nanos were updated in L4T R32.4.3, and our existing layout file generates an error during USB flashing because the updated tools think the VER partition runs off the end of the flash. Either we added up the sizes incorrectly, or there's a bug in the tools. This patch updates the flash layout to keep the U-Boot environment area we reserve in the QSPI flash at the same location and with the same size. The VER_b and VER partitions that follow are reduced in size to prevent the flashing tools from complaining. This should retain compatibility for an OTA upgrade that updates the SPI flash without having to save and restore the U-Boot environment. The VER partitions are smaller than the default L4T settings (which were also reduced in R32.4.3), but still plenty large enough to hold the version information. Signed-off-by: Matt Madison --- .../jetson-nano-qspi-sd/flash_mender.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/meta-mender-tegra/recipes-bsp/tegra-binaries/mender-custom-flash-layout/jetson-nano-qspi-sd/flash_mender.xml b/meta-mender-tegra/recipes-bsp/tegra-binaries/mender-custom-flash-layout/jetson-nano-qspi-sd/flash_mender.xml index 021c99d5..5a974231 100644 --- a/meta-mender-tegra/recipes-bsp/tegra-binaries/mender-custom-flash-layout/jetson-nano-qspi-sd/flash_mender.xml +++ b/meta-mender-tegra/recipes-bsp/tegra-binaries/mender-custom-flash-layout/jetson-nano-qspi-sd/flash_mender.xml @@ -48,21 +48,22 @@ binary. - - + sequential basic - 3342336 + 0x3B0000 + 131072 0 8 0 - Empty padding. + U-Boot environment area - + sequential basic - 65536 + 0x3E0000 + 32768 0 0 8 @@ -72,10 +73,11 @@ information. - + sequential basic - 65536 + 0x3F0000 + 32768 0 0 8