* Add AArch64/ARM64 EFI boot support (for QEMU and some boards) * Allow GRUB to load cmdline.txt-like * Enable qcow2/vmdk disk images Co-authored-by: Stefan Agner <stefan@agner.ch>
43 lines
1.1 KiB
Bash
Executable File
43 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
MACHINE_ID=$(cat /etc/machine-id)
|
|
|
|
###
|
|
# u-boot
|
|
if [ -e /usr/sbin/fw_setenv ]; then
|
|
|
|
# machine-id
|
|
if [ "$(fw_printenv -n MACHINE_ID)" != "${MACHINE_ID}" ]; then
|
|
echo "[INFO] set machine-id to ${MACHINE_ID}"
|
|
fw_setenv MACHINE_ID "${MACHINE_ID}"
|
|
else
|
|
echo "[INFO] machine-id is okay"
|
|
fi
|
|
|
|
###
|
|
# GRUB
|
|
elif [ -e /usr/bin/grub-editenv ]; then
|
|
GRUBENV_FILE="$(grep '^grubenv=' < /etc/rauc/system.conf | cut -d= -f2)"
|
|
# machine-id
|
|
if [ "$(/usr/bin/grub-editenv "$GRUBENV_FILE" list | grep '^MACHINE_ID=' | cut -d= -f2)" != "${MACHINE_ID}" ]; then
|
|
echo "[INFO] set machine-id to ${MACHINE_ID}"
|
|
/usr/bin/grub-editenv "$GRUBENV_FILE" set "MACHINE_ID=${MACHINE_ID}"
|
|
else
|
|
echo "[INFO] machine-id is okay"
|
|
fi
|
|
|
|
###
|
|
# Barebox
|
|
else
|
|
|
|
# machine-id
|
|
if [ "$(barebox-state -g state.machine_id -i /etc/barebox-state.dtb)" != "${MACHINE_ID}" ]; then
|
|
echo "[INFO] set machine-id to ${MACHINE_ID}"
|
|
barebox-state -s "state.machine_id=${MACHINE_ID}" -i /etc/barebox-state.dtb
|
|
else
|
|
echo "[INFO] machine-id is okay"
|
|
fi
|
|
|
|
fi
|