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

jetson: Update next active slots on HUP #245

Merged
9 commits merged into from
Feb 2, 2022
Merged

Conversation

acostach
Copy link
Contributor

@acostach acostach commented Dec 22, 2021

We use tegra-boot-tools to mark the future
active slot on the Xavier and write the new signed
bootblobs, which include the dtb that contains the cmdline
with the new rootfs label. A slot designates any
nvidia partition, like for instance kernel-dtb
and kernel-dtb_b. Tegra bootloaders fallback to
the previous active slot after 3 unsuccessful
boot attempts.

Upstream related discussions:
OE4T/meta-tegra#879
OE4T/meta-tegra#891

Related improvement for the TX2 on L4T 28.x to 32.x transition : #259

@acostach
Copy link
Contributor Author

acostach commented Jan 10, 2022

Needs one 32.6.1 cboot fix for OE4T/meta-tegra#879
After the new cboot is built, it needs to be updated in the boot bundle before trying the fix

@acostach acostach force-pushed the jetson_select_ab_slots_on_update branch from 703bd42 to a8b0f8a Compare January 11, 2022 13:42
@acostach
Copy link
Contributor Author

Current meta-tegra cboot fix did not work, will check with updated iteration of patches

@acostach acostach force-pushed the jetson_select_ab_slots_on_update branch 3 times, most recently from 37c0021 to a13932b Compare January 21, 2022 10:40
@acostach
Copy link
Contributor Author

@resin-jenkins test this please

@acostach acostach force-pushed the jetson_select_ab_slots_on_update branch 3 times, most recently from 23ae60d to 1b4930c Compare January 31, 2022 09:31
This package is provided by upstream
OE4T meta-tegra and allows for marking
boot slots (tegra partitions) as
succesfully booting.

Signed-off-by: Alexandru Costache <[email protected]>
boots on Xavier AGX and Xavier NX

The Xavier line of boards don't have u-boot support
and we use the command line in the dtb to switch
between the two root filesystems. Let's use
A/B slot switch to enable altbooting on these
devices.

Once redundancy is enabled, each successful boot
needs to be marked and we do this in a service file,
otherwise the lowlevel tegra bootloaders will fallback
to loading the previous slot (old dtb and old cmdline)
after 3 boot sequences that have not been marked.

Signed-off-by: Alexandru Costache <[email protected]>
We'll use tegra-boot-tools to mark the next
active slot on the Xavier and write the new signed
bootblobs, which include the dtb that contains the
cmdline with the new rootfs label.

A slot designates any tegra partition, like for instance
kernel-dtb and kernel-dtb_b. This is possible currently
only for the Xavier line of devices, which do not have
u-boot support.

On Jetson Nanos there are no extra partitions on the emmc
or sd-card, only a boot bundle in the qspi flash.

On the TX2 the 32.5.1 L4T boot firmware cannot boot the newer
32.6.1 bootloaders, because the boot firmware needs to be
in sync with bootloaders and rest of the firmwares (we'll have
to try with the next L4T releases when they become available
see meta-tegra issue 879). This however is not a problem because
rollback-altboot is already accomplished in u-boot on the TX2 and
Nano devices running L4T 32.X.

Signed-off-by: Alexandru Costache <[email protected]>
@acostach acostach force-pushed the jetson_select_ab_slots_on_update branch from 1b4930c to fa0e5fa Compare January 31, 2022 09:46
… for NX SD 32.6.1

Starting with 32.6.1, when the device is provisioned, the
flashing tools perform bpmp trimming by default, based on
a value read from the device, which is 0. If however
the files are signed without being written, the bpmp
dtb is not trimmed and the boot blob is generated
incorrectly (wrong offsets).
Therefore we now tell the flashing tools to trim
the bpmp dtb using the default ramcode, which is also 0,
as the one that's being read from our device.

Changelog-entry: tegra-binaries/tegra194-nxde-sdcard-flash: Adapt boot blob generation for NX SD 32.6.1
Signed-off-by: Alexandru Costache <[email protected]>
As well as latest tegra-boot-tools adapted to L4T 32.6.1

Signed-off-by: Alexandru Costache <[email protected]>
Patch boot blob to avoid these potential errors:

tegra-hsp-mailbox ivc-bc00000.rtcpu: IOVM setup error: 110
tegra186-cam-rtcpu bc00000.rtcpu: command: 0x00000000: empty mailbox timeout

Also switch to using the new meta-balena development flag.

Signed-off-by: Alexandru Costache <[email protected]>
@acostach
Copy link
Contributor Author

acostach commented Feb 1, 2022

@resin-jenkins test this please

Copy link

@jakogut jakogut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job on this, the detailed commit descriptions and organized commits are much appreciated. I'll hold off on approving this until some of the other reviewers can take a look, but you have my:

Reviewed-by: Joseph Kogut [email protected]


# Upon rollback to a release that does not have
# this feature implemented, the _a slots will
# be used by default, without chaning behavior.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor type here chaning -> changing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @jakogut , I'll get that fixed

Copy link
Contributor

@alexgg alexgg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superficial review, I didn't attempt to understand the complexities of the Xabier, I suspect that one of us suffering that pain is probably enough :)

ExecStart=/bin/sh -c /usr/bin/mark_active_tegra_boot_slot.sh

[Install]
WantedBy=multi-user.target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@acostach is this service running every single boot, even if no HUP happened?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @alexgg , indeed, it needs to run every boot, otherwise the tegra bootloaders will consider that the current one failed and decrease the current slot's priority, causing the alternate to be loaded once the retries number is achieved.

Disabling redundant boot after marking a boot sequence as successful unfortunately triggers the default slot _a to be loaded, so the only option for now is to mark every boot if we want to have the kernel and dtb loaded from the selected raw partitions, _a or _b.

@ghost ghost merged commit 5789f27 into master Feb 2, 2022
@ghost ghost deleted the jetson_select_ab_slots_on_update branch February 2, 2022 10:56
This pull request was closed.
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