Compare commits

1 Commits

Author SHA1 Message Date
0209f64410 Support OERV
- RPM packaging added
- Use generic method to detect installed kernels
- Allow initrd named as initramfs-version.img
2024-10-29 16:55:04 +08:00
5 changed files with 69 additions and 5 deletions

4
Makefile Normal file
View File

@@ -0,0 +1,4 @@
.PHONY: rpm
rpm:
tar -czf ./rpmbuild/SOURCES/u-boot-menu.tar.gz --exclude='rpmbuild' --exclude='.git' --transform "s,^\.,u-boot-menu-`git describe`," .
rpmbuild -D"ubm_ver `git describe`" -D"_topdir `pwd`/rpmbuild" -ba ./rpmbuild/SPECS/u-boot-menu.spec

5
rpmbuild/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/BUILD
/BUILDROOT
/RPMS
/SOURCES/*
/SRPMS

View File

@@ -0,0 +1,48 @@
Name: u-boot-menu
Version: %{ubm_ver}
Release: oerv%{?dist}
Summary: u-boot menu update
License: GPLv2
URL: https://salsa.debian.org/debian/u-boot-menu
BuildArch: noarch
Source0: u-boot-menu.tar.gz
Requires: coreutils
%description
Automatically create extlinux-style boot menu for u-boot. Boot menu
entries are automatically created for every kernel package when they are
installed.
.
When /boot is on a separate partition, the package flash-kernel may help
ensure that device-tree (dtb) files are made available to u-boot.
%prep
%setup
%build
%install
install -Dm 755 u-boot-update %{buildroot}/%{_bindir}/u-boot-update
install -Dm 755 read-config %{buildroot}/usr/share/u-boot-menu/read-config
install -Dm 644 etc/default/u-boot %{buildroot}/etc/default/u-boot
install -Dm 755 etc/kernel/postinst.d/zz-u-boot-menu %{buildroot}/etc/kernel/postinst.d/zz-u-boot-menu
install -Dm 755 etc/kernel/postrm.d/zz-u-boot-menu %{buildroot}/etc/kernel/postrm.d/zz-u-boot-menu
install -Dm 755 usr/lib/kernel/install.d/91-u-boot-menu.install %{buildroot}/usr/lib/kernel/install.d/91-u-boot-menu.install
install -Dm 644 COPYING %{buildroot}/usr/share/u-boot-menu/COPYING
install -Dm 644 u-boot-update.8 %{buildroot}/usr/share/u-boot-menu/u-boot-update.8
%files
%{_bindir}/u-boot-update
/usr/share/u-boot-menu/read-config
/etc/default/u-boot
/etc/kernel/postinst.d/zz-u-boot-menu
/etc/kernel/postrm.d/zz-u-boot-menu
/usr/lib/kernel/install.d/91-u-boot-menu.install
%license /usr/share/u-boot-menu/COPYING
%doc /usr/share/u-boot-menu/u-boot-update.8
%changelog
* Mon Oct 28 2024 Hangfan Li <lihangfan@iscas.ac.cn>
- Initilal RPM release

View File

@@ -113,7 +113,7 @@ timeout ${U_BOOT_TIMEOUT}
"
# Find linux versions
_KERNELS=$(linux-version list --paths | linux-version sort --reverse | sed -e 's,.*/boot/,,g')
_KERNELS="$(find /boot -maxdepth 1 -name "vmlinuz-*" -printf "%T@ %p\n" | sort -nr | cut -d' ' -f2- | rev | cut -d'/' -f1 | rev)"
for _KERNEL in ${_KERNELS}
do
@@ -130,9 +130,16 @@ do
elif [ -e "/boot/${U_BOOT_INITRD}" ]
then
_INITRD="initrd ${_BOOT_DIRECTORY}/${U_BOOT_INITRD}"
elif [ -e "/boot/initramfs-${_VERSION}.img" ]
then
_INITRD="initrd ${_BOOT_DIRECTORY}/initramfs-${_VERSION}.img"
elif [ -e "/boot/initramfs.img" ]
then
_INITRD="initrd ${_BOOT_DIRECTORY}/initramfs.img"
else
_INITRD=""
fi
if [ -e "${U_BOOT_FDT}" ] && [ -n "${U_BOOT_FDT}" ] && [ "/" = $(echo "${U_BOOT_FDT}" | head -c1) ]
then
_FDT="fdt ${U_BOOT_FDT}"

View File

@@ -132,10 +132,10 @@ Default is not set.
.IP "U_BOOT_INITRD=""\fBinitrd.img\fR""" 4
This variable specifies the unversioned stem of initramfs filename.
If versioned filename exists (e.g. 'initrd.img-5.10.0-8-armmp-lpae')
then this filename set as option 'initrd',
otherwise if unversioned filename exists (e.g. 'initrd.img)
then that is set as option 'initrd',
If versioned filename exists (e.g. '${U_BOOT_INITRD}-5.10.0-8-armmp-lpae'
or 'initramfs-6.6.18+.img') then this filename set as option 'initrd',
otherwise if unversioned filename exists
(e.g. 'initrd.img' or 'initramfs.img') then that is set as option 'initrd',
otherwise option 'initrd' is not set.
Default is 'initrd.img'.