2021-11-26 18:37:42 +00:00
|
|
|
# Maintainer: graysky <graysky@archlinux.us>
|
|
|
|
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
|
|
|
|
# Maintainer: Oleg Rakhmanov <oleg@archlinuxarm.org>
|
|
|
|
# Maintainer: Dave Higham <pepedog@archlinuxarm.org>
|
|
|
|
# Contributer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
|
|
|
|
|
|
|
|
pkgbase=linux-rpi
|
2023-02-06 12:42:00 +00:00
|
|
|
_commit=c113cf128749d17b6262d76769a6ad0e0e1f33c3
|
2021-11-26 18:37:42 +00:00
|
|
|
_srcname=linux-${_commit}
|
|
|
|
_kernelname=${pkgbase#linux}
|
2023-02-06 12:42:00 +00:00
|
|
|
pkgver=5.15.92
|
2023-01-30 15:36:02 +00:00
|
|
|
pkgrel=1
|
2021-11-26 18:37:42 +00:00
|
|
|
pkgdesc='Linux'
|
|
|
|
url="http://www.kernel.org/"
|
|
|
|
arch=(armv7h aarch64)
|
|
|
|
license=(GPL2)
|
|
|
|
makedepends=(
|
|
|
|
bc kmod inetutils
|
|
|
|
)
|
|
|
|
options=('!strip')
|
|
|
|
source_armv7h=('config' 'config.txt')
|
|
|
|
source_aarch64=('config8' 'config8.txt')
|
2022-01-05 13:57:05 +00:00
|
|
|
source=("linux-$pkgver-${_commit:0:10}.tar.gz::https://github.com/raspberrypi/linux/archive/${_commit}.tar.gz"
|
2021-11-26 18:37:42 +00:00
|
|
|
cmdline.txt
|
|
|
|
0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch
|
|
|
|
linux.preset
|
|
|
|
60-linux.hook
|
|
|
|
90-linux.hook
|
|
|
|
)
|
2023-02-06 12:42:00 +00:00
|
|
|
md5sums=('8397aac8a94f0db9705dd36ce16b016d'
|
2022-09-16 18:49:26 +00:00
|
|
|
'3bab7426d8c8818dda8353da3892a41f'
|
2021-11-26 18:37:42 +00:00
|
|
|
'f66a7ea3feb708d398ef57e4da4815e9'
|
|
|
|
'86d4a35722b5410e3b29fc92dae15d4b'
|
|
|
|
'0a5f16bfec6ad982a2f6782724cca8ba'
|
|
|
|
'441ec084c47cddc53e592fb0cbce4edf')
|
2023-01-30 12:07:58 +00:00
|
|
|
md5sums_armv7h=('dc02ee6afd5b17e0e1ab761f87ade643'
|
2023-01-29 16:33:15 +00:00
|
|
|
'177bbdbe1baa46a04dcba86352cfa3fe')
|
2023-01-30 12:07:58 +00:00
|
|
|
md5sums_aarch64=('c0287cde6ccb6b207fbd846a37619ccd'
|
2022-05-27 19:19:49 +00:00
|
|
|
'7e4403dea857e40005bf76beda9927ff')
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
# setup vars
|
|
|
|
if [[ $CARCH == "armv7h" ]]; then
|
|
|
|
_kernel=kernel7.img KARCH=arm _image=zImage _config=config _bconfig=config.txt
|
|
|
|
elif [[ $CARCH == "aarch64" ]]; then
|
|
|
|
_kernel=kernel8.img KARCH=arm64 _image=Image _config=config8 _bconfig=config8.txt
|
|
|
|
fi
|
|
|
|
|
|
|
|
prepare() {
|
|
|
|
cd "${srcdir}/${_srcname}"
|
|
|
|
|
|
|
|
# consistent behavior of lscpu on arm/arm64
|
|
|
|
patch -Np1 -i ../0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch
|
|
|
|
|
|
|
|
echo "Setting version..."
|
|
|
|
scripts/setlocalversion --save-scmversion
|
|
|
|
echo "-$pkgrel" > localversion.10-pkgrel
|
|
|
|
echo "${pkgbase#linux}" > localversion.20-pkgname
|
|
|
|
|
|
|
|
echo "Setting config..."
|
|
|
|
cp ../"$_config" .config
|
|
|
|
make olddefconfig
|
|
|
|
|
|
|
|
make -s kernelrelease > version
|
|
|
|
echo "Prepared $pkgbase version $(<version)"
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "${srcdir}/${_srcname}"
|
|
|
|
|
|
|
|
make "$_image" modules dtbs
|
|
|
|
}
|
|
|
|
|
|
|
|
_package() {
|
2021-11-30 18:55:41 +00:00
|
|
|
pkgdesc="RPi Foundation patched Linux kernel and modules"
|
2021-11-26 18:37:42 +00:00
|
|
|
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7' 'firmware-raspberrypi')
|
2022-07-30 08:47:47 +00:00
|
|
|
optdepends=('wireless-regdb: to set the correct wireless channels of your country')
|
|
|
|
provides=("linux=${pkgver}" 'WIREGUARD-MODULE')
|
|
|
|
conflicts=('linux' 'uboot-raspberrypi')
|
2021-11-26 18:37:42 +00:00
|
|
|
install=${pkgname}.install
|
|
|
|
backup=('boot/config.txt' 'boot/cmdline.txt')
|
|
|
|
replaces=('linux-raspberrypi-latest' 'linux-raspberrypi4')
|
|
|
|
|
|
|
|
cd "${srcdir}/${_srcname}"
|
|
|
|
|
|
|
|
local kernver="$(<version)"
|
|
|
|
local modulesdir="$pkgdir/usr/lib/modules/$kernver"
|
|
|
|
|
|
|
|
# Used by mkinitcpio to name the kernel
|
|
|
|
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
|
|
|
|
echo "Installing modules..."
|
2022-05-03 14:24:44 +00:00
|
|
|
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
|
|
|
|
DEPMOD=/doesnt/exist modules_install # Suppress depmod
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
# remove build and source links
|
|
|
|
rm "$modulesdir"/{source,build}
|
|
|
|
|
|
|
|
echo "Installing Arch ARM specific stuff..."
|
|
|
|
mkdir -p "${pkgdir}"/boot
|
|
|
|
make INSTALL_DTBS_PATH="${pkgdir}/boot" dtbs_install
|
|
|
|
|
|
|
|
if [[ $CARCH == "aarch64" ]]; then
|
|
|
|
# drop hard-coded devicetree=foo.dtb in /boot/config.txt for
|
|
|
|
# autodetected load of supported of models at boot
|
|
|
|
find "${pkgdir}/boot/broadcom" -type f -print0 | xargs -0 mv -t "${pkgdir}/boot"
|
|
|
|
rmdir "${pkgdir}/boot/broadcom"
|
|
|
|
fi
|
|
|
|
|
|
|
|
cp arch/$KARCH/boot/$_image "${pkgdir}/boot/$_kernel"
|
|
|
|
cp arch/$KARCH/boot/dts/overlays/README "${pkgdir}/boot/overlays"
|
|
|
|
install -m644 ../$_bconfig "${pkgdir}/boot/config.txt"
|
|
|
|
install -m644 ../cmdline.txt "${pkgdir}/boot"
|
|
|
|
|
|
|
|
# sed expression for following substitutions
|
|
|
|
local _subst="
|
|
|
|
s|%PKGBASE%|${pkgbase}|g
|
|
|
|
s|%KERNVER%|${kernver}|g
|
|
|
|
"
|
|
|
|
|
|
|
|
# install mkinitcpio preset file
|
|
|
|
sed "${_subst}" ../linux.preset |
|
|
|
|
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
|
|
|
|
|
|
|
|
# install pacman hooks
|
|
|
|
sed "${_subst}" ../60-linux.hook |
|
|
|
|
install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook"
|
|
|
|
sed "${_subst}" ../90-linux.hook |
|
|
|
|
install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook"
|
|
|
|
}
|
|
|
|
|
|
|
|
_package-headers() {
|
2021-11-30 18:55:41 +00:00
|
|
|
pkgdesc="RPi Foundation header and scripts for building modules for Linux kernel"
|
2021-11-26 18:37:42 +00:00
|
|
|
provides=("linux-headers=${pkgver}")
|
|
|
|
conflicts=('linux-headers')
|
|
|
|
replaces=('linux-raspberrypi-latest-headers' 'linux-raspberrypi4-headers')
|
|
|
|
|
|
|
|
cd ${_srcname}
|
|
|
|
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"
|
|
|
|
|
|
|
|
echo "Installing build files..."
|
|
|
|
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
|
|
|
|
localversion.* version
|
|
|
|
install -Dt "$builddir/kernel" -m644 kernel/Makefile
|
|
|
|
install -Dt "$builddir/arch/$KARCH" -m644 "arch/$KARCH/Makefile"
|
|
|
|
cp -t "$builddir" -a scripts
|
|
|
|
|
|
|
|
# add xfs and shmem for aufs building
|
|
|
|
mkdir -p "$builddir"/{fs/xfs,mm}
|
|
|
|
|
|
|
|
echo "Installing headers..."
|
|
|
|
cp -t "$builddir" -a include
|
|
|
|
cp -t "$builddir/arch/$KARCH" -a "arch/$KARCH/include"
|
|
|
|
install -Dt "$builddir/arch/$KARCH/kernel" -m644 "arch/$KARCH/kernel/asm-offsets.s"
|
|
|
|
|
|
|
|
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
|
|
|
|
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h
|
|
|
|
|
|
|
|
# https://bugs.archlinux.org/task/13146
|
|
|
|
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
|
|
|
|
|
|
|
|
# https://bugs.archlinux.org/task/20402
|
|
|
|
install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
|
|
|
|
install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
|
|
|
|
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h
|
|
|
|
|
|
|
|
# https://bugs.archlinux.org/task/71392
|
|
|
|
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h
|
|
|
|
|
|
|
|
echo "Installing KConfig files..."
|
|
|
|
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;
|
|
|
|
|
|
|
|
echo "Removing unneeded architectures..."
|
|
|
|
local _arch
|
|
|
|
for _arch in "$builddir"/arch/*/; do
|
|
|
|
if [[ $CARCH == "aarch64" ]]; then
|
|
|
|
[[ $_arch = */"$KARCH"/ || $_arch == */arm/ ]] && continue
|
|
|
|
else
|
|
|
|
[[ $_arch = */"$KARCH"/ ]] && continue
|
|
|
|
fi
|
|
|
|
echo "Removing $(basename "$_arch")"
|
|
|
|
rm -r "$_arch"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Removing documentation..."
|
|
|
|
rm -r "$builddir/Documentation"
|
|
|
|
|
|
|
|
echo "Removing broken symlinks..."
|
|
|
|
find -L "$builddir" -type l -printf 'Removing %P\n' -delete
|
|
|
|
|
|
|
|
echo "Removing loose objects..."
|
|
|
|
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete
|
|
|
|
|
2023-01-30 11:16:16 +00:00
|
|
|
echo "Symlinking common aliases..."
|
|
|
|
# https://archlinuxarm.org/forum/viewtopic.php?f=60&t=16354
|
|
|
|
[[ -d "$builddir/arch/arm" ]] && ln -sr "$builddir/arch/arm" "$builddir/arch/armv7l"
|
|
|
|
[[ -d "$builddir/arch/arm64" ]] && ln -sr "$builddir/arch/arm64" "$builddir/arch/aarch64"
|
|
|
|
|
2021-11-26 18:37:42 +00:00
|
|
|
echo "Stripping build tools..."
|
|
|
|
local file
|
|
|
|
while read -rd '' file; do
|
|
|
|
case "$(file -bi "$file")" in
|
|
|
|
application/x-sharedlib\;*) # Libraries (.so)
|
|
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
|
|
application/x-archive\;*) # Libraries (.a)
|
|
|
|
strip -v $STRIP_STATIC "$file" ;;
|
|
|
|
application/x-executable\;*) # Binaries
|
|
|
|
strip -v $STRIP_BINARIES "$file" ;;
|
|
|
|
application/x-pie-executable\;*) # Relocatable binaries
|
|
|
|
strip -v $STRIP_SHARED "$file" ;;
|
|
|
|
esac
|
|
|
|
done < <(find "$builddir" -type f -perm -u+x)
|
|
|
|
|
|
|
|
echo "Adding symlink..."
|
|
|
|
mkdir -p "$pkgdir/usr/src"
|
|
|
|
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
|
|
|
|
}
|
|
|
|
|
|
|
|
pkgname=("${pkgbase}" "${pkgbase}-headers")
|
|
|
|
for _p in ${pkgname[@]}; do
|
|
|
|
eval "package_${_p}() {
|
|
|
|
_package${_p#${pkgbase}}
|
|
|
|
}"
|
|
|
|
done
|