This commit is contained in:
Pratham Patel 2023-10-08 13:30:58 +05:30
parent 532f9ece58
commit 5a3a5b8fcf
No known key found for this signature in database
3 changed files with 12 additions and 20 deletions

View File

@ -12,14 +12,12 @@ setenv bootlogo "false"
setenv rootfstype "ext4"
setenv docker_optimizations "on"
setenv earlycon "off"
setenv devtype "mmc"
setenvrootdev
setenvuname_r
setenvefiver
echo "Boot script loaded from ${devtype} ${devnum}"
if test -e ${devtype} ${devnum}:1 uEnv.txt-${efi_ver}; then
load ${devtype} ${devnum}:1 ${load_addr} uEnv.txt-${efi_ver}
if test -e ${devtype} ${devnum}:1 uEnv.txt; then
load ${devtype} ${devnum}:1 ${load_addr} uEnv.txt
env import -t ${load_addr} ${filesize}
fi

View File

@ -5,7 +5,7 @@
Name: opi5-efi
Version: 0.0.4
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Necessary files for booting from vendor U-Boot on Orange Pi 5
License: GPL
Provides: %{name}-%{version}
@ -32,8 +32,6 @@ mkdir -p $RPM_BUILD_ROOT/opt/opi5-efi
cp %{SOURCE0} $RPM_BUILD_ROOT/opt/opi5-efi/boot.cmd
cp %{SOURCE1} $RPM_BUILD_ROOT/opt/opi5-efi/uEnv.txt
cp %{SOURCE2} $RPM_BUILD_ROOT/opt/opi5-efi/post.sh
sed -i "s/replacewithfullver/FULL_VER=%{full_ver}/" $RPM_BUILD_ROOT/opt/opi5-efi/post.sh
sed -i "s/setenvefiver/setenv efi_ver %{full_ver}/" $RPM_BUILD_ROOT/opt/opi5-efi/boot.cmd
%clean
rm -rf $RPM_BUILD_ROOT

20
post.sh
View File

@ -4,28 +4,24 @@ set -xeuf -o pipefail
UNAME_R="$(</boot/.uname)"
BOOT_PART="$(grep '/ ' /etc/fstab | awk '{print $1}')"
replacewithfullver
cp /opt/opi5-efi/boot.cmd "/boot/efi/boot.cmd-${FULL_VER}"
cp /opt/opi5-efi/uEnv.txt "/boot/efi/uEnv.txt-${FULL_VER}"
cp /opt/opi5-efi/boot.cmd "/boot/efi/boot.cmd"
cp /opt/opi5-efi/uEnv.txt "/boot/efi/uEnv.txt"
if [ ! -f /boot/.uname ]; then
echo "ERROR: No /boot/.uname found to extract 'uname -r' from."
exit 1
fi
if [ ! -f "/boot/initramfs-${UNAME_R}" ]; then
if [ ! -f "/boot/initramfs-${UNAME_R}.img" ]; then
echo "Initramfs not found... regenerating."
/sbin/installkernel "${UNAME_R}" "/boot/.vmlinuz-${UNAME_R}-rpm" "/boot/.System.map-${UNAME_R}-rpm"
mv "/boot/vmlinuz-${UNAME_R}.old" "/boot/vmlinuz-${UNAME_R}"
fi
echo "rootdev=${BOOT_PART}" >> "/boot/efi/uEnv.txt-${FULL_VER}"
sed -i "s/setenvrootdev/setenv rootdev \"${BOOT_PART}\"/" "/boot/efi/boot.cmd-${FULL_VER}"
sed -i "s/setenvuname_r/setenv uname_r \"${UNAME_R}\"/" "/boot/efi/boot.cmd-${FULL_VER}"
echo "rootdev=${BOOT_PART}" >> "/boot/efi/uEnv.txt"
sed -i "s/setenvrootdev/setenv rootdev \"${BOOT_PART}\"/" "/boot/efi/boot.cmd"
sed -i "s/setenvuname_r/setenv uname_r \"${UNAME_R}\"/" "/boot/efi/boot.cmd"
mkimage -A arm -T ramdisk -C none -n uInitrd -d "/boot/initramfs-${UNAME_R}.img" "/boot/uInitrd-${UNAME_R}"
mkimage -C none -A arm -T script -d "/boot/efi/boot.cmd-${FULL_VER}" "/boot/efi/boot.scr-${FULL_VER}"
cp "/boot/uInitrd-${UNAME_R}" "/boot/efi/uInitrd-${UNAME_R}"
cp "/boot/vmlinuz-${UNAME_R}" "/boot/efi/vmlinuz-${UNAME_R}"
cp -r "/boot/dtb-${UNAME_R}" "/boot/efi/dtb-${UNAME_R}"
mkimage -C none -A arm -T script -d "/boot/efi/boot.cmd" "/boot/efi/boot.scr"