Skip to content

Commit

Permalink
Merge pull request #5 from cakre/rollback-support
Browse files Browse the repository at this point in the history
Add Rollback support
  • Loading branch information
mwest90 authored May 3, 2024
2 parents 7785d73 + c5371bd commit 4b8cdde
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#! /bin/sh
NAME=nv_update_verifier
DESC="OTA bootloader update verifier"

case "$1" in
start|restart)
echo -n "Running $DESC: "
/usr/sbin/nv_update_verifier < /dev/null
echo "[OK]"
;;
stop)
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart}" >&2
exit 1
;;
esac

exit 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=OTA bootloader update verifier
After=nvstartup.service

[Service]
Type=simple
ExecStart=/usr/sbin/nv_update_verifier

[Install]
WantedBy=basic.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

upgrade_available=$(/sbin/fw_printenv upgrade_available | cut -d "=" -f2)

# Only verify booted slot if we are not in an upgrade process
# since mender will do that on commit (through fw_setenv)
if [ "$upgrade_available" == "0" ]; then
/usr/sbin/nvbootctrl verify
fi
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,13 @@ EXTRADEPS:tegra210 = ""
EXTRADEPS:tegra234 = ""
RDEPENDS:${PN} += "${EXTRADEPS}"

FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI:append = "\
file://nv_update_verifier.sh \
"

do_install:append:tegra234() {
install -d ${D}/${sbindir}
install -m 0755 ${S}/nv_update_verifier.sh ${D}/${sbindir}/nv_update_verifier
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"

SRC_URI += "file://0007-runtime-access-for-KernelCommandLine-efivar.patch;patchdir=.."
SRC_URI += "file://0008-enable-rootfs-redundancy.patch;patchdir=.."
SRC_URI += "file://0009-BootChainDxe-fix.patch;patchdir=.."


Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/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;
};

RootfsRetryCountMax {
data = [ 01 00 00 00 ];
runtime;
};

};

};
};
};
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

CAPTARGET="/opt/nvidia/esp/EFI/UpdateCapsule/TEGRA_BL.Cap"

if [ -f "$CAPTARGET" ]; then
rm "$CAPTARGET"
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

/usr/sbin/nvbootctrl verify
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
SRC_URI = " \
file://switch-rootfs \
file://verify-slot \
file://abort-blupdate \
"

LICENSE = "Apache-2.0"
Expand All @@ -14,6 +16,8 @@ PERSIST_MACHINE_ID:mender-persist-systemd-machine-id = "yes"

do_compile() {
cp ${S}/switch-rootfs ${MENDER_STATE_SCRIPTS_DIR}/ArtifactInstall_Leave_50_switch-rootfs
cp ${S}/verify-slot ${MENDER_STATE_SCRIPTS_DIR}/ArtifactCommit_Leave_50_verify-slot
cp ${S}/abort-blupdate ${MENDER_STATE_SCRIPTS_DIR}/ArtifactRollback_Leave_50_abort-blupdate
}

# Make sure scripts aren't left around from old builds
Expand Down

0 comments on commit 4b8cdde

Please sign in to comment.