From 605d2bbcc1fafc139714993589837d7f63b6267d Mon Sep 17 00:00:00 2001 From: Pratham Patel Date: Mon, 9 Oct 2023 05:42:24 +0530 Subject: [PATCH] improve master.inc --- master.inc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/master.inc b/master.inc index 7bc2ad6..47c6854 100644 --- a/master.inc +++ b/master.inc @@ -123,6 +123,7 @@ echo "%{KVERREL}" > $RPM_BUILD_ROOT/boot/.uname-%{KVERREL} # install DTBs %ifarch aarch64 || riscv64 %{make} INSTALL_DTBS_PATH=$RPM_BUILD_ROOT/boot/dtb-%{KVERREL} dtbs_install +# delete "arch/%{build_arch}/boot/dts" because "$PWD" will be packaged in "%devel" find arch/%{build_arch}/boot/dts -name '*.dtb' -type f -delete %endif @@ -172,19 +173,26 @@ if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KVERREL} -a -r /boot/System.ma rm -f /boot/.vmlinuz-%{KVERREL}-rpm /boot/.System.map-%{KVERREL}-rpm fi +# we pushd into /boot because we want our symlinks to be +# vmlinuz -> vmlinuz-6.6.0-20231004.6.el9.aarch64 +# and not +# vmlinuz -> /boot/vmlinuz-6.6.0-20231004.6.el9.aarch64 pushd /boot -rm System.map vmlinuz +rm -vf .uname dtb initramfs.img System.map vmlinuz ln -s .uname-%{KVERREL} .uname +ln -s dtb-%{KVERREL} dtb ln -s initramfs-%{KVERREL}.img initramfs.img ln -s System.map-%{KVERREL} System.map ln -s vmlinuz-%{KVERREL} vmlinuz popd %preun +# remove symlinks rm -vf /boot/.uname /boot/.uname-%{KVERREL} rm -vf /boot/initramfs.img rm -vf /boot/System.map rm -vf /boot/vmlinuz + if [ -x /sbin/new-kernel-pkg ]; then new-kernel-pkg --remove %{KVERREL} --rminitrd --initrdfile=/boot/initramfs-%{KVERREL}.img elif [ -x /usr/bin/kernel-install ]; then @@ -195,6 +203,7 @@ fi if [ -x /sbin/update-bootloader ]; then /sbin/update-bootloader --remove %{KVERREL} fi +[ -d /boot/dtb ] && rm -rf /boot/dtb %files headers %defattr (-, root, root)