opi5-efi/opi5-efi.spec

57 lines
1.4 KiB
RPMSpec

# 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.4
Release: 12%{?dist}
Summary: Necessary files for booting from vendor U-Boot on Orange Pi 5
License: GPL
Provides: %{name}-%{version}
Requires: (kernel-next-tfg or kernel-rc-tfg or kernel-stable-tfg or kernel-lts-tfg)
Requires: uboot-tools bash
%global full_ver %{version}-%{release}
Source0: boot.cmd
Source1: uEnv.txt
%description
This is a hack to get the kernel booting on the Oragne Pi 5
%prep
echo "Nothing to prepare"
%build
echo "Nothing to build"
%install
rm -rf $RPM_BUILD_ROOT
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
%clean
rm -rf $RPM_BUILD_ROOT
%post
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/*