Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #	Output a simple RPM spec file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #	This version assumes a minimum of RPM 4.0.3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #	The only gothic bit here is redefining install_post to avoid
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #	stripping the symbols from files in the kernel which we want
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #	Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) # how we were called determines which rpms we build and how we build them
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) if [ "$1" = prebuilt ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	S=DEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	MAKE="$MAKE -f $srctree/Makefile"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	S=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) if grep -q CONFIG_MODULES=y .config; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	M=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	M=DEL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) if grep -q CONFIG_DRM=y .config; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	PROVIDES=kernel-drm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) --exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) # We can label the here-doc lines for conditional output to the spec file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) # Labels:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #  $S: this line is enabled only when building source package
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #  $M: this line is enabled only when CONFIG_MODULES is enabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	Name: kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	Summary: The Linux Kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	Version: $__KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	Release: $(cat .version 2>/dev/null || echo 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	License: GPL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	Group: System Environment/Kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	Vendor: The Linux Community
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	URL: https://www.kernel.org
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) $S	Source: kernel-$__KERNELRELEASE.tar.gz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	Provides: $PROVIDES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	%define __spec_install_post /usr/lib/rpm/brp-compress || :
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	%define debug_package %{nil}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	%description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	The Linux Kernel, the operating system core itself
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	%package headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	Summary: Header files for the Linux kernel for use by glibc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	Group: Development/System
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	Obsoletes: kernel-headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	Provides: kernel-headers = %{version}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	%description headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	Kernel-headers includes the C header files that specify the interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	between the Linux kernel and userspace libraries and programs.  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	header files define structures and constants that are needed for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	building most standard programs and are also needed for rebuilding the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	glibc package.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) $S$M	%package devel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) $S$M	Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) $S$M	Group: System Environment/Kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) $S$M	AutoReqProv: no
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) $S$M	%description -n kernel-devel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) $S$M	This package provides kernel headers and makefiles sufficient to build modules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) $S$M	against the $__KERNELRELEASE kernel package.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) $S$M
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) $S	%prep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) $S	%setup -q
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) $S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) $S	%build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) $S	$MAKE %{?_smp_mflags} KBUILD_BUILD_VERSION=%{release}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) $S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	%install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	mkdir -p %{buildroot}/boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	%ifarch ia64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	mkdir -p %{buildroot}/boot/efi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	cp \$($MAKE image_name) %{buildroot}/boot/efi/vmlinuz-$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	ln -s efi/vmlinuz-$KERNELRELEASE %{buildroot}/boot/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	%else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	cp \$($MAKE image_name) %{buildroot}/boot/vmlinuz-$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	%endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) $M	$MAKE %{?_smp_mflags} INSTALL_MOD_PATH=%{buildroot} modules_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	$MAKE %{?_smp_mflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	cp System.map %{buildroot}/boot/System.map-$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	cp .config %{buildroot}/boot/config-$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	bzip2 -9 --keep vmlinux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	mv vmlinux.bz2 %{buildroot}/boot/vmlinux-$KERNELRELEASE.bz2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) $S$M	rm -f %{buildroot}/lib/modules/$KERNELRELEASE/source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) $S$M	mkdir -p %{buildroot}/usr/src/kernels/$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) $S$M	tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) $S$M	cd %{buildroot}/lib/modules/$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) $S$M	ln -sf /usr/src/kernels/$KERNELRELEASE build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) $S$M	ln -sf /usr/src/kernels/$KERNELRELEASE source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	%clean
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	rm -rf %{buildroot}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	%post
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	if [ -x /sbin/installkernel -a -r /boot/vmlinuz-$KERNELRELEASE -a -r /boot/System.map-$KERNELRELEASE ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	cp /boot/vmlinuz-$KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	cp /boot/System.map-$KERNELRELEASE /boot/.System.map-$KERNELRELEASE-rpm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	rm -f /boot/vmlinuz-$KERNELRELEASE /boot/System.map-$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	/sbin/installkernel $KERNELRELEASE /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	rm -f /boot/.vmlinuz-$KERNELRELEASE-rpm /boot/.System.map-$KERNELRELEASE-rpm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	%preun
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	if [ -x /sbin/new-kernel-pkg ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	new-kernel-pkg --remove $KERNELRELEASE --rminitrd --initrdfile=/boot/initramfs-$KERNELRELEASE.img
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	elif [ -x /usr/bin/kernel-install ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	kernel-install remove $KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	%postun
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	if [ -x /sbin/update-bootloader ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	/sbin/update-bootloader --remove $KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	%files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	%defattr (-, root, root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) $M	/lib/modules/$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) $M	%exclude /lib/modules/$KERNELRELEASE/build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) $M	%exclude /lib/modules/$KERNELRELEASE/source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	/boot/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	%files headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	%defattr (-, root, root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	/usr/include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) $S$M
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) $S$M	%files devel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) $S$M	%defattr (-, root, root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) $S$M	/usr/src/kernels/$KERNELRELEASE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) $S$M	/lib/modules/$KERNELRELEASE/build
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) $S$M	/lib/modules/$KERNELRELEASE/source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) EOF