Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta-mender-tegra: dunfell nano development board partition layout fixes #188

Conversation

dwalkes
Copy link
Contributor

@dwalkes dwalkes commented Nov 8, 2020

Per discussion at OE4T#5

As of r32.3.1 (or possibly earlier) NVIDIA has defined a UBENV partition at offset 0x3D8000 for jetson-nano-qspi-sd partition layout, which is the layout used for the Nano development board with SD card. Previously this area was defined as a PAD partition and we had stored our uboot environment in that location. However, we'd also accidentally overflowed into the VER_b location with our definition of uboot storage environment from 0x3B0000 to 0x3F0000. This might be a problem if/when we add support for Nano redundant boot for bootloader components.

The area defined by NVIDIA for UBENV is too small to store dual redundant copies of mender variables, so we need to stretch our area back into what was known as the PAD partition on previous releases and the unused space between NXC_R and VER_b partitions.

After some discussion in the previously mentioned thread, we've settled on keeping the UBENV starting at 0x3B0000 and reducing the size to 131072 bytes instead of 262144 of so we could continue to make the first uboot environment boundary at the same start location and complete both copies of uboot environment before the VER_b sector starts. This means the u-boot environment for existing sdcard based Nano builds on the dunfell branch will move on the next tegraflash or dosdcard.sh based update. In the cvase of a dosdcard.sh based update the existing SPI flash u-boot environment will be invalid and replaced with defaults.

This alignment will be shared with the Jetson Nano 2GB hardware which will be brought in during gatesgarth/L4T+next (unless someone volunteers to add and backport it sooner in OE4T#4) and the patches here were rebased from those in the above linked PR.

I've started a sheet at this link which I plan to try to update with each new release and platform to make sure we don't miss these layout changes going forward with new L4T releases.

I've completed the uboot integration tests at this link for jetson-nano-qspi-sd with these changes.

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 <matt@madison.systems>
Signed-off-by: Dan Walkes <danwalkes@trellis-logic.com>
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 <matt@madison.systems>
@mirzak
Copy link
Contributor

mirzak commented Nov 9, 2020

This probably means the u-boot environment for existing sdcard based Nano builds on the dunfell branch need to be re-tegraflashed, which hopefully isn't an issue since these devices aren't really meant for production anyway

What will happen if you do not do this and just deploy an update with a Mender Artifact (.mender) with these changes included? I assume this depends if U-Boot updates are enabled or not in the Nano board? If they are not enabled, there are no implications on existing devices I guess.

@dwalkes
Copy link
Contributor Author

dwalkes commented Nov 9, 2020

What will happen if you do not do this and just deploy an update with a Mender Artifact (.mender) with these changes included? I assume this depends if U-Boot updates are enabled or not in the Nano board? If they are not enabled, there are no implications on existing devices I guess.

Good point @mirzak. Since we do not yet support bootloader updates on Nano I don't think anyone just performing mender updates will notice this change. I think the only way they might be able to get confused would be if they updated the SDCard using the dosdcard.sh script, which would update both the bootloader and root filesystem but leave the u-boot environment alone in the SPI flash. In this case I'd expect that on the next boot the old SPI flash environment would be corrupt (due to wrong size) and the boot would happen based on the default settings of boot partition, which is fine.

I've updated the description.

@mirzak mirzak merged commit d6a8be8 into mendersoftware:dunfell Nov 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants