diff --git a/opi5-efi.spec b/opi5-efi.spec index b112362..5571312 100644 --- a/opi5-efi.spec +++ b/opi5-efi.spec @@ -16,7 +16,6 @@ Requires: uboot-tools bash Source0: boot.cmd Source1: uEnv.txt -Source2: post.sh %description This is a hack to get the kernel booting on the Oragne Pi 5 @@ -38,7 +37,21 @@ cp %{SOURCE2} $RPM_BUILD_ROOT/opt/opi5-efi/post.sh rm -rf $RPM_BUILD_ROOT %post -bash /opt/opi5-efi/post.sh +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 %files /opt/opi5-efi/* diff --git a/post.sh b/post.sh deleted file mode 100644 index 825a137..0000000 --- a/post.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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