#!/usr/bin/env bash set -xeuf -o pipefail BOOT_PART="$(grep '/ ' /etc/fstab | awk '{print $1}')" cp /opt/opi5-efi/boot.cmd boot/efi/boot.cmd cp /opt/opi5-efi/uEnv.txt boot/efi/uEnv.txt if [ ! -f "/boot/initramfs.img" ]; then echo "Initramfs not found." exit 1 fi echo "rootdev=${BOOT_PART}" >> "/boot/efi/uEnv.txt" sed -i "s/setenvrootdev/setenv rootdev \"${BOOT_PART}\"/" "/boot/efi/boot.cmd" mkimage -A arm -T ramdisk -C none -n uInitrd -d /boot/initramfs.img /boot/uInitrd mkimage -C none -A arm -T script -d /boot/efi/boot.cmd /boot/efi/boot.scr