diff --git a/Makefile.am b/Makefile.am index 15e00ec..156fc79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,3 +70,5 @@ pkgconfig_DATA = src/libdt-utils.pc EXTRA_DIST += src/libdt-utils.pc.in CLEANFILES += src/libdt-utils.pc + +EXTRA_DIST += scripts/barebox-mark-successful-boot.sh diff --git a/scripts/barebox-mark-successful-boot.sh b/scripts/barebox-mark-successful-boot.sh new file mode 100644 index 0000000..952512d --- /dev/null +++ b/scripts/barebox-mark-successful-boot.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +DEFAULT_REMAINING_ATTEMPTS=3 +DEFAULT_PRIORITY=20 + +system=$(sed /proc/cmdline -ne "s/.*root=ubi0:\([^ ]*\).*/\1/p") +if [ -z "${system}" ]; then + echo "unable to detect system partition" >&2 + exit 1 +fi + +barebox-state -n /state \ + -s "bootstate.${system}.remaining_attempts=${DEFAULT_REMAINING_ATTEMPTS}" \ + -s "bootstate.${system}.priority=${DEFAULT_PRIORITY}"