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

rauc: add custom bootloader backend and post-install to do rauc updates #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Jesseeee
Copy link

Necessary files to have custom bootloader backend handling in rauc, you can create a config e.g.

[system]
compatible = jetson-agx-xavier-devkit
bootloader = custom

[handlers]
bootloader-custom-backend = /usr/bin/nvbootctrl-rauc
post-install = /usr/bin/post-install

[keyring]
path = /etc/rauc/ca.cert.pem

[slot.rootfs.0]
device = /dev/disk/by-partlabel/APP
type = ext4
bootname = APP

[slot.rootfs.1]
device = /dev/disk/by-partlabel/APP_b
type = ext4
bootname = APP_b

Copy link
Member

@madisongh madisongh left a comment

Choose a reason for hiding this comment

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

Thanks for this. See some notes in-line about bashisms that should be replaced with generic bourne shell constructs (there may be others I have missed) and how to have the bbappend be tegra-specific.

Finally, this needs to be made a "dynamic layer" modification and a BBFILES_DYNAMIC setting needs to be added to this layer's layer.conf file so that the bbappend only gets picked up if meta-rauc is one of the layers in the build. See here for an example.

SLOT_A="APP"
SLOT_B="APP_b"

function get_status(){
Copy link
Member

Choose a reason for hiding this comment

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

The function keyword is a bashism.


case "${1}" in
get-current|get-primary)
[ $(nvbootctrl get-current-slot) == "0" ] && echo "${SLOT_A}" || echo "${SLOT_B}"
Copy link
Member

Choose a reason for hiding this comment

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

== is a bashism

SLOT="$(get_slot_AB ${2})"
ERRCODE="$(get_slot_err_code ${3})"
printf "\x07\x00\x00\x00\x${ERRCODE}\x00\x00\x00" > \
"/opt/nvidia/esp/EFI/NVDA/Variables/RootfsStatusSlot${SLOT}-781e084c-a330-417c-b678-38e696380cb9"
Copy link
Member

@madisongh madisongh Sep 12, 2023

Choose a reason for hiding this comment

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

This method of writing EFI variables only works on the AGX Xavier. You might instead want to use the set_efi_var function in the uefi_common.func file installed by the setup-nv-boot-control recipe.

Copy link

Choose a reason for hiding this comment

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

@madisongh @joekale-pp: Hi, I'am currently trying to integrate RAUC and I came across your recommendation to use the set_efi_var function provided in the uefi_common.func file installed by the setup-nv-boot-control recipe.
Could you please provide clarification on:

  • Why the direct method of writing EFI variables is limited to the AGX Xavier platform?
  • How does the set_efi_var function address this limitation?

Copy link
Member

Choose a reason for hiding this comment

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

Just take a look at the code to see how it works.

As for why, it's apparently due to the AGX Xavier platform using eMMC storage only. All the others use SPI flash for the boot firmware, and NVIDIA's UEFI implementation for that configuration supports the normal EFI variable interfaces.

do_install:append() {
install -m 755 ${WORKDIR}/nvbootctrl-rauc ${D}${bindir}
install -m 755 ${WORKDIR}/post-install ${D}${bindir}
}
Copy link
Member

Choose a reason for hiding this comment

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

These modifications should be made tegra-specific, i.e., using the :tegra override for SRC_URI, RAUC_USE_DEVEL_VERSION, SRCREV, RDEPENDS, and do_install mods. You should also set PACKAGE_ARCH:tegra = "${TEGRA_PKGARCH}" so that the modified version is tegra-specific. Otherwise, other platforms that might be getting built will be affected by this tegra-specific bbapend.

Choose a reason for hiding this comment

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

Should setup-nv-boot-control also be added to the RDEPENDS to pull in the uefi_common.func file?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, if you change to use the functions there. We could get fancy and move that file to a separate package to be more granular, but I think we pretty much need what setup-nv-boot-control does all the time anyway.

@ichergui
Copy link
Member

Hi @Jesseeee
Any update on this PR ?
Otherwise I will close it

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.

5 participants