2023-10-04 23:55:36 +00:00
|
|
|
# disable the '-debug{info,source}' pkgs
|
|
|
|
%define debug_package %{nil}
|
|
|
|
# also disable packaging files in '/usr/lib/.build-id/'
|
|
|
|
%define _build_id_links none
|
|
|
|
|
|
|
|
Name: opi5-efi
|
|
|
|
Version: 0.0.1
|
2023-10-05 05:51:12 +00:00
|
|
|
Release: 5%{?dist}
|
2023-10-04 23:55:36 +00:00
|
|
|
Summary: Necessary files for booting from vendor U-Boot on Orange Pi 5
|
|
|
|
License: GPL
|
|
|
|
Provides: %{name}-%{version}
|
2023-10-05 04:42:33 +00:00
|
|
|
Requires: kernel-opi5-tfg uboot-tools
|
2023-10-04 23:55:36 +00:00
|
|
|
|
|
|
|
%global full_ver %{version}-%{release}
|
|
|
|
|
|
|
|
Source0: boot.cmd
|
|
|
|
Source1: uEnv.txt
|
|
|
|
|
2023-10-05 00:28:20 +00:00
|
|
|
%description
|
|
|
|
This is a hack to get the kernel booting on the Oragne Pi 5
|
|
|
|
|
2023-10-04 23:55:36 +00:00
|
|
|
%prep
|
|
|
|
echo "Nothing to prepare"
|
|
|
|
|
|
|
|
%build
|
|
|
|
echo "Nothing to build"
|
|
|
|
|
|
|
|
%install
|
2023-10-05 00:36:47 +00:00
|
|
|
rm -rf $RPM_BUILD_ROOT
|
2023-10-05 03:50:53 +00:00
|
|
|
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
|
2023-10-04 23:55:36 +00:00
|
|
|
|
|
|
|
%clean
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
%post
|
|
|
|
set -xeuf -o pipefail
|
2023-10-05 03:50:53 +00:00
|
|
|
|
2023-10-05 04:27:43 +00:00
|
|
|
cp /opt/opi5-efi/boot.cmd /boot/efi/boot.cmd-%{full_ver}
|
|
|
|
cp /opt/opi5-efi/uEnv.txt /boot/efi/uEnv.txt-%{full_ver}
|
2023-10-05 03:50:53 +00:00
|
|
|
|
2023-10-04 23:55:36 +00:00
|
|
|
if [ -f /boot/.uname ]; then
|
|
|
|
UNAME_R=$(</boot/.uname)
|
|
|
|
BOOT_PART=$(grep '/ ' /etc/fstab | awk '{print $1}')
|
2023-10-05 00:00:41 +00:00
|
|
|
|
2023-10-05 00:03:37 +00:00
|
|
|
echo "${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/setenvunamer/setenv unamer \"${UNAME_R}\"/" /boot/efi/boot.cmd-%{full_ver}
|
2023-10-04 23:55:36 +00:00
|
|
|
else
|
|
|
|
echo "ERROR: No /boot/.uname found to extract 'uname -r' from."
|
2023-10-05 04:42:33 +00:00
|
|
|
exit 1
|
2023-10-04 23:55:36 +00:00
|
|
|
fi
|
2023-10-05 00:19:25 +00:00
|
|
|
|
2023-10-05 00:03:37 +00:00
|
|
|
mkimage -C none -A arm -T script -d /boot/efi/boot.cmd-%{full_ver} /boot/efi/boot.scr-%{full_ver}
|
2023-10-05 05:51:12 +00:00
|
|
|
cp /boot/efi/boot.scr-%{full_ver} /boot/efi/boot.scr
|
2023-10-05 00:19:25 +00:00
|
|
|
|
|
|
|
mkimage -A arm -T ramdisk -C none -n uInitrd -d /boot/initramfs-${UNAME_R}.img /boot/uInitrd-${UNAME_R}
|
|
|
|
cp /boot/uInitrd-${UNAME_R} /boot/uInitrd
|
|
|
|
|
|
|
|
diff /boot/efi/boot.cmd /boot/efi/boot.cmd-%{full_ver} > /boot/diff_boot_cmd
|
|
|
|
diff /boot/efi/uEnv.txt /boot/efi/uEnv.txt-%{full_ver} > /boot/diff_uenv_txt
|
2023-10-05 00:36:47 +00:00
|
|
|
|
|
|
|
%files
|
2023-10-05 04:24:08 +00:00
|
|
|
/opt/opi5-efi/*
|