From af6ad76c4b2ec498b43aaab9d8fb5a0c4acf6b37 Mon Sep 17 00:00:00 2001
From: Koichiro Iwao
Date: Tue, 24 Jun 2025 16:36:15 +0900
Subject: [PATCH] Sync with a10, reintroduce initramfs
---
SPECS/raspberrypi2.spec | 130 +++++++++++++++++++++++++++++++++-------
1 file changed, 108 insertions(+), 22 deletions(-)
diff --git a/SPECS/raspberrypi2.spec b/SPECS/raspberrypi2.spec
index 48d6b2e..5e538b2 100644
--- a/SPECS/raspberrypi2.spec
+++ b/SPECS/raspberrypi2.spec
@@ -11,7 +11,7 @@ ExclusiveArch: aarch64
%define local_version v8
%define bcmmodel 2711
-%define extra_version 1
+%define extra_version 2
# This originally implies Kernel 4.x for RPi 2 and is not appropriate now.
# Be careful to change this not to disturb the seamless package update.
@@ -21,6 +21,12 @@ ExclusiveArch: aarch64
%define kversion 6.12
%define patchlevel 25
+%if 0%{?rhel} >= 10
+%define pathfix %{__python3} %{_rpmconfigdir}/redhat/pathfix.py
+%else
+%define pathfix pathfix.py
+%endif
+
# standard kernel
%define with_up %{?_without_up: 0} %{?!_without_up: 1}
# tools
@@ -35,9 +41,9 @@ Version: %{kversion}.%{patchlevel}
Release: %{version_tag}.%{local_version}.%{extra_version}%{?dist}
Summary: Specific kernel and bootcode for Raspberry Pi
-License: GPLv2
+License: GPL-2.0 WITH Linux-syscall-note
URL: https://github.com/raspberrypi/linux
-Source0: https://github.com/raspberrypi/linux/archive/refs/tags/stable_%{version_tag}.tar.gz
+Source0: https://github.com/raspberrypi/linux/archive/stable_%{version_tag}.tar.gz
Source1: https://github.com/raspberrypi/firmware/archive/refs/tags/%{firmware_tag}.tar.gz
Patch100: config_2711.patch
Patch101: config_2712.patch
@@ -69,9 +75,10 @@ Specific kernel and bootcode for Raspberry Pi
Group: System Environment/Kernel
Summary: The Linux kernel
Provides: kernel = %{version}-%{release}
+Provides: kernel-core = %{version}-%{release}
Provides: installonlypkg(kernel)
-Requires: coreutils
-
+Requires: coreutils
+Requires: dracut
%description kernel%{?ksuffix}
The kernel package contains the Linux kernel (vmlinuz), the core of any
Linux operating system. The kernel handles the basic functions
@@ -88,11 +95,54 @@ Autoreq: no
Requires(pre): findutils
Requires: findutils
Requires: perl-interpreter
-
%description kernel%{?ksuffix}-devel
This package provides kernel headers and makefiles sufficient to build modules
against the kernel package.
+%if 0%{?rhel} >= 10
+%package kernel%{?ksuffix}-modules
+Summary: Pseudo package for kernel modules
+Group: System Environment/Kernel
+Provides: installonlypkg(kernel-module)
+Provides: kernel-modules = %{version}-%{release}
+Provides: kernel-modules-uname-r = %{version}-%{release}
+Obsoletes: kernel-modules < %{version}-%{release}
+Requires: %{name}-kernel%{?ksuffix} = %{version}-%{release}
+AutoReq: no
+AutoProv: yes
+%description kernel%{?ksuffix}-modules
+This package provides pseudo dependency for the packages that depends on regular
+kernel-modules packages.
+
+%package kernel%{?ksuffix}-modules-core
+Summary: Pseudo package for core kernel modules
+Group: System Environment/Kernel
+Provides: installonlypkg(kernel-module)
+Provides: kernel-modules-core = %{version}-%{release}
+Provides: kernel-modules-core-uname-r = %{version}-%{release}
+Obsoletes: kernel-modules-core < %{version}-%{release}
+Requires: %{name}-kernel%{?ksuffix} = %{version}-%{release}
+AutoReq: no
+AutoProv: yes
+%description kernel%{?ksuffix}-modules-core
+This package provides pseudo dependency for the packages that depends on regular
+kernel-modules-core packages.
+
+%package kernel%{?ksuffix}-modules-extra
+Summary: Pseudo package for extra kernel modules
+Group: System Environment/Kernel
+Provides: kernel-modules-extra = %{version}-%{release}
+Provides: kernel-modules-extra-uname-r = %{version}-%{release}
+Provides: installonlypkg(kernel-module)
+Obsoletes: kernel-modules-extra < %{version}-%{release}
+Requires: %{name}-kernel%{?ksuffix} = %{version}-%{release}
+AutoReq: no
+AutoProv: yes
+%description kernel%{?ksuffix}-modules-extra
+This package provides pseudo dependency for the packages that depends on regular
+kernel-modules-extra packages.
+%endif
+
%if %{with_tools}
%package kernel%{?ksuffix}-tools
Summary: Assortment of tools for the Linux kernel
@@ -152,7 +202,7 @@ Obsoletes: kernel-headers < %{version}
Provides: kernel-headers = %{version}-%{release}
Obsoletes: glibc-kernheaders < 3.0-46
Provides: glibc-kernheaders = 3.0-46
-Summary: Header files for the Linux kernel for use by glibc
+Summary: Header files for the Linux kernel for use by glibc
%description kernel%{?ksuffix}-headers
Kernel-headers includes the C header files that specify the interface
@@ -164,8 +214,8 @@ glibc package.
%prep
%setup -q -n linux-stable_%{version_tag}
-%patch100 -p1
-%patch101 -p1
+%patch -P 100 -p1
+%patch -P 101 -p1
perl -p -i -e "s/^EXTRAVERSION.*/EXTRAVERSION = -%{release}/" Makefile
perl -p -i -e "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=/" arch/%{Arch}/configs/bcm2711_defconfig
perl -p -i -e "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=/" arch/%{Arch}/configs/bcm2712_defconfig
@@ -176,9 +226,9 @@ perl -p -i -e "s/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=/" arch/%{Arch}/con
# -p preserves timestamps
# -n prevents creating ~backup files
# -i specifies the interpreter for the shebang
-pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/
-pathfix.py -pni "%{__python3} %{py3_shbang_opts}" scripts/diffconfig scripts/bloat-o-meter scripts/show_delta scripts/jobserver-exec
-pathfix.py -pni "%{__python3} %{py3_shbang_opts}" tools/ tools/perf/scripts/python/*.py tools/kvm/kvm_stat/kvm_stat scripts/clang-tools/*.py
+%{pathfix} -pni "%{__python3} %{py3_shbang_opts}" scripts/
+%{pathfix} -pni "%{__python3} %{py3_shbang_opts}" scripts/diffconfig scripts/bloat-o-meter scripts/show_delta scripts/jobserver-exec
+%{pathfix} -pni "%{__python3} %{py3_shbang_opts}" tools/ tools/perf/scripts/python/*.py tools/kvm/kvm_stat/kvm_stat scripts/clang-tools/*.py
%endif
%build
@@ -376,13 +426,19 @@ if [ -d /boot ]; then
cp /usr/share/%{name}-kernel%{?ksuffix}/%{version}-%{release}/boot/overlays/*.dtb* /boot/overlays/
cp /usr/share/%{name}-kernel%{?ksuffix}/%{version}-%{release}/boot/overlays/README /boot/overlays/
cp /boot/config-kernel-%{version}-%{release}.inc /boot/config-kernel.inc
+
+ /usr/bin/dracut --no-hostonly /boot/initramfs-%{version}-%{release}.img %{version}-%{release}
+ cp /boot/initramfs-%{version}-%{release}.img /boot/initramfs%{armtarget}
fi
%postun kernel%{?ksuffix}
-if [ -f /boot/kernel%{armtarget}.img ];then
+if [ -f /boot/kernel%{armtarget}.img ]; then
#only restore kernel%{armtarget}.img if it exists, we may have moved to initramfs
cp $(ls -1 /boot/kernel-*-*|sort -V|tail -1) /boot/kernel%{armtarget}.img
fi
+if [ -f /boot/initramfs%{armtarget} ]; then
+ cp $(ls -1 /boot/initramfs-*-*|sort -V| tail -1) /boot/initramfs%{armtarget}
+fi
cp $(ls -1d /usr/share/%{name}-kernel%{?ksuffix}/*-*/|sort -V|tail -1)/boot/*.dtb /boot/
cp $(ls -1d /usr/share/%{name}-kernel%{?ksuffix}/*-*/|sort -V|tail -1)/boot/overlays/*.dtb* /boot/overlays/
cp $(ls -1d /usr/share/%{name}-kernel%{?ksuffix}/*-*/|sort -V|tail -1)/boot/overlays/README /boot/overlays/
@@ -392,6 +448,20 @@ cp $(ls -1 /boot/config-kernel-*-*|sort -V|tail -1) /boot/config-kernel.inc
%files kernel%{?ksuffix}-devel
%defattr(-,root,root)
/usr/src/kernels/%{version}-%{release}
+
+%if 0%{?rhel} >= 10
+%files kernel%{?ksuffix}-modules
+# empty package
+%defattr(-,root,root)
+
+%files kernel%{?ksuffix}-modules-core
+# empty package
+%defattr(-,root,root)
+
+%files kernel%{?ksuffix}-modules-extra
+# empty package
+%defattr(-,root,root)
+%endif
%endif
%if %{with_tools}
@@ -445,22 +515,38 @@ cp $(ls -1 /boot/config-kernel-*-*|sort -V|tail -1) /boot/config-kernel.inc
%endif
%changelog
+* Mon Jun 23 2025 Koichiro Iwao - 6.12.25-20250428.v8.2
+- Reintroduce initramfs for XFS / LUKS
+ https://github.com/AlmaLinux/raspberry-pi/issues/65
+ https://github.com/AlmaLinux/raspberry-pi/issues/86
+
* Mon May 26 2025 Koichiro Iwao - 6.12.25-20250428.v8.1
-- Update kernel to 6.12.25 stable_20250428
+- Update kernel to v6.12.25 stable_20250428
- Update firmware to 1.20250430
- Regenerate patches
-- Apply the consistent directory under /usr/share (fix missed cases)
-
-* Mon Apr 14 2025 Koichiro Iwao - 6.6.74-20250127.v8.2
-- Fixes to enable bootc
-- Enable EROFS
- Use the consistent directory under /usr/share with the package name
+- Enable EROFS bootc container (contributed by Kevin Fox)
+- Fixes to enable bootc (contributed by Kevin Fox)
-* Thu Feb 20 2025 Koichiro Iwao - 6.6.74-20250127.v8.1
-- Update kernel to v6.6.74 stable_20250127
-- Update firmware to 1.20250127
+* Mon Jan 27 2025 Koichiro Iwao - 6.12.1-20241206.v8.2
+- Add pseudo subpackages for kernel modules to resolve dependency issue
+- The main kernel package now provides kernel-core
+- Convert license to SPDX expression
- Remove dracut as initramfs is not needed (mentioned in 4.4.21-2)
+* Wed Dec 25 2024 Koichiro Iwao - 6.12.1-20241206.v8.1
+- Update kernel to v6.12.1 rpi-6.12.y_20241206_2
+- Update firmware to 1.20241126
+
+* Tue Nov 12 2024 Koichiro Iwao - 6.12.0-20241111.v8.1
+- Update kernel to v6.12.0-rc7 20241110 bf70ebd2
+
+* Tue Nov 12 2024 Koichiro Iwao - 6.11.7-20241110.v8.1
+- Update kernel to v6.11.7 20241110 efda653d
+
+* Fri Nov 08 2024 Koichiro Iwao - 6.6.51-20241008.v8.2
+- Fix build for AL10 Kitten
+
* Mon Oct 21 2024 Koichiro Iwao - 6.6.51-20241008.v8.1
- Update kernel to version v6.6.51 stable_20241008
- Update firmware to 1.20241008