Skip to content

Commit

Permalink
add rpi4
Browse files Browse the repository at this point in the history
  • Loading branch information
june-fish committed Dec 21, 2024
1 parent 1e187b9 commit 9fe89fa
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
variant: ["mt8192", "mt8183", "sc7180", "rpi5"]
variant: ["mt8192", "mt8183", "sc7180", "rpi5", "rpi4"]
runs-on: x86-64-lg
container:
image: registry.fedoraproject.org/fedora-minimal:40
Expand Down
27 changes: 27 additions & 0 deletions rpi4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
REF=$(shell cat ref)

ifeq ($(shell uname -m), x86_64)
CROSS=aarch64-linux-gnu-
endif

setup:
rm -rf ../linux/*.patch
cp *.patch ../linux
cd ../linux; \
git remote remove raspberrypi; \
git remote add raspberrypi https://github.com/raspberrypi/linux.git; \
git checkout master; \
git branch -D $(REF); \
git fetch -f raspberrypi refs/heads/$(REF):refs/heads/$(REF); \
git reset --hard raspberrypi/$(REF); \
git clean -df; \
for patch in $$(ls *.patch); do patch -p1 < "$$patch"; done; \
git -c commit.gpgsign=false commit -a -m 'removing -dirty suffix after patches'; \
make ARCH=arm64 bcm2711_defconfig

compile:
ARCH=arm64 CROSS_COMPILE=$(CROSS) make -C ../linux olddefconfig rpm-pkg -j$(shell nproc)
cp -r ../linux/rpmbuild .
rm -rf ../linux/rpmbuild

build: setup compile
1 change: 1 addition & 0 deletions rpi4/ref
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rpi-6.6.y
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index 3eee0143e0c5..a11b779a4033 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -65,6 +65,7 @@ cp $(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEA
%endif
%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
%{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
+%{make} %{makeflags} INSTALL_DTBS_PATH=%{buildroot}/boot/dtb-%{KERNELRELEASE} dtbs_install
cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE}
cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build
@@ -77,11 +78,7 @@ rm -rf %{buildroot}

%post
if [ -x /sbin/installkernel -a -r /boot/vmlinuz-%{KERNELRELEASE} -a -r /boot/System.map-%{KERNELRELEASE} ]; then
-cp /boot/vmlinuz-%{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm
-cp /boot/System.map-%{KERNELRELEASE} /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
-/sbin/installkernel %{KERNELRELEASE} /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
-rm -f /boot/.vmlinuz-%{KERNELRELEASE}-rpm /boot/.System.map-%{KERNELRELEASE}-rpm
+/sbin/installkernel %{KERNELRELEASE} /boot/vmlinuz-%{KERNELRELEASE} /boot/System.map-%{KERNELRELEASE}
fi

%preun
22 changes: 22 additions & 0 deletions rpi4/scripts-package-kernel-spec-rename-package.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index 3eee0143e0c5..ddc52d125f7c 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -5,7 +5,7 @@
%define __spec_install_post /usr/lib/rpm/brp-compress || :
%define debug_package %{nil}

-Name: kernel
+Name: kernel-rpi4
Summary: The Linux Kernel
Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
Release: %{pkg_release}
@@ -41,7 +41,7 @@ glibc package.
Summary: Development package for building kernel modules to match the %{version} kernel
Group: System Environment/Kernel
AutoReqProv: no
-%description -n kernel-devel
+%description -n kernel-rpi4-devel
This package provides kernel headers and makefiles sufficient to build modules
against the %{version} kernel package.
%endif

0 comments on commit 9fe89fa

Please sign in to comment.