2023-10-21 11:57:06 +00:00
|
|
|
# Maintainer: graysky <therealgraysky AT proton DOT me>
|
2021-11-26 18:37:42 +00:00
|
|
|
# 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
|
2024-04-16 19:27:36 +00:00
|
|
|
_commit=044dae4ac76ab3677977f432e78b29e423e8c54e
|
2021-11-26 18:37:42 +00:00
|
|
|
_srcname=linux-${_commit}
|
|
|
|
_kernelname=${pkgbase#linux}
|
2023-09-01 19:50:12 +00:00
|
|
|
_regen=
|
2024-04-11 18:01:31 +00:00
|
|
|
pkgver=6.6.26
|
2024-04-16 19:27:36 +00:00
|
|
|
pkgrel=2
|
2021-11-26 18:37:42 +00:00
|
|
|
pkgdesc='Linux'
|
2023-12-11 10:31:58 +00:00
|
|
|
url="https://github.com/raspberrypi/linux"
|
2021-11-26 18:37:42 +00:00
|
|
|
arch=(armv7h aarch64)
|
|
|
|
license=(GPL2)
|
|
|
|
makedepends=(
|
2023-05-02 13:01:41 +00:00
|
|
|
bc
|
|
|
|
kmod
|
|
|
|
inetutils
|
2021-11-26 18:37:42 +00:00
|
|
|
)
|
|
|
|
options=('!strip')
|
2023-12-08 21:43:06 +00:00
|
|
|
source_armv7h=('config')
|
|
|
|
source_aarch64=('config8')
|
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
|
2023-12-08 21:43:06 +00:00
|
|
|
config.txt
|
2021-11-26 18:37:42 +00:00
|
|
|
0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch
|
|
|
|
linux.preset
|
2023-02-08 21:46:56 +00:00
|
|
|
archarm.diffconfig
|
2021-11-26 18:37:42 +00:00
|
|
|
)
|
2024-04-16 19:27:36 +00:00
|
|
|
md5sums=('c9814cd80f1759a310d1226f612af8c1'
|
2022-09-16 18:49:26 +00:00
|
|
|
'3bab7426d8c8818dda8353da3892a41f'
|
2023-12-08 21:43:06 +00:00
|
|
|
'16c484af9f72b9275afcf83a6b8eab36'
|
2024-02-03 17:05:56 +00:00
|
|
|
'a157c5bfc0f03d0728c92bd953b06265'
|
2021-11-26 18:37:42 +00:00
|
|
|
'86d4a35722b5410e3b29fc92dae15d4b'
|
2024-04-16 19:27:36 +00:00
|
|
|
'87526ee83367947d179edb373009a7d6')
|
2024-04-05 18:45:54 +00:00
|
|
|
md5sums_armv7h=('122187220bd9e151106a057f614b76c2')
|
2024-04-16 19:27:36 +00:00
|
|
|
md5sums_aarch64=('b31e9117df51f288960a0fbb114deabe')
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
# setup vars
|
|
|
|
if [[ $CARCH == "armv7h" ]]; then
|
2023-12-08 21:43:06 +00:00
|
|
|
_kernel=kernel7.img KARCH=arm _image=zImage _config=config
|
2021-11-26 18:37:42 +00:00
|
|
|
elif [[ $CARCH == "aarch64" ]]; then
|
2023-12-08 21:43:06 +00:00
|
|
|
_kernel=kernel8.img KARCH=arm64 _image=Image _config=config8
|
2021-11-26 18:37:42 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
prepare() {
|
|
|
|
cd "${srcdir}/${_srcname}"
|
|
|
|
|
|
|
|
# consistent behavior of lscpu on arm/arm64
|
2023-03-11 11:35:40 +00:00
|
|
|
patch -p1 -i ../0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch
|
|
|
|
|
2021-11-26 18:37:42 +00:00
|
|
|
echo "Setting version..."
|
|
|
|
echo "-$pkgrel" > localversion.10-pkgrel
|
|
|
|
echo "${pkgbase#linux}" > localversion.20-pkgname
|
|
|
|
|
2023-02-08 21:46:56 +00:00
|
|
|
if [[ $_regen -eq 1 ]]; then
|
|
|
|
# useful on two point releases to keep shit straight
|
|
|
|
echo "Applying custom shit to bcm2711_defconfig"
|
|
|
|
make bcm2711_defconfig
|
|
|
|
cat ../archarm.diffconfig >> .config
|
|
|
|
make oldconfig
|
2023-02-14 12:54:00 +00:00
|
|
|
if [[ $CARCH == "armv7h" ]]; then
|
|
|
|
# https://archlinuxarm.org/forum/viewtopic.php?f=23&t=16373
|
|
|
|
scripts/config --enable CONFIG_BCM2835_THERMAL
|
2023-12-14 10:59:04 +00:00
|
|
|
|
|
|
|
# re-enable LRU_GEN by default as the intial observation that it was to blame
|
|
|
|
# for triggering OOM was likely a false positive, see:
|
|
|
|
# https://github.com/raspberrypi/linux/issues/5395#issuecomment-1854410361
|
2023-03-25 06:39:23 +00:00
|
|
|
# https://archlinuxarm.org/forum/viewtopic.php?f=23&t=16377
|
2023-12-14 10:59:04 +00:00
|
|
|
scripts/config --enable CONFIG_LRU_GEN_ENABLED
|
2023-02-14 12:54:00 +00:00
|
|
|
fi
|
2024-01-14 12:22:02 +00:00
|
|
|
# bcm2711_defconfig inserts either -v7l or -v8 for CONFIG_LOCALVERSION= so set this to null
|
|
|
|
sed '/^CONFIG_LOCALVERSION=/s,.*$,CONFIG_LOCALVERSION="",' .config >$startdir/newconfig.$_config
|
2023-02-08 21:46:56 +00:00
|
|
|
echo "verify that newconfig.$_config is fit for purpose then redefine $_config"
|
|
|
|
exit
|
|
|
|
else
|
|
|
|
echo "Setting config..."
|
|
|
|
cp ../"$_config" .config
|
2023-10-31 11:43:58 +00:00
|
|
|
make olddefconfig
|
2023-05-02 13:01:41 +00:00
|
|
|
diff -u ../"$_config" .config || :
|
2024-01-14 12:22:02 +00:00
|
|
|
|
|
|
|
make -s kernelrelease > version
|
2023-02-08 21:46:56 +00:00
|
|
|
echo "Prepared $pkgbase version $(<version)"
|
|
|
|
fi
|
2021-11-26 18:37:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
|
|
|
cd "${srcdir}/${_srcname}"
|
|
|
|
|
2023-10-31 11:43:58 +00:00
|
|
|
make "$_image" modules dtbs
|
2021-11-26 18:37:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_package() {
|
2023-12-10 19:44:51 +00:00
|
|
|
pkgdesc="Linux kernel and modules (RPi Foundation fork)"
|
2023-05-02 13:01:41 +00:00
|
|
|
depends=(
|
|
|
|
coreutils
|
|
|
|
firmware-raspberrypi
|
|
|
|
kmod
|
|
|
|
linux-firmware
|
|
|
|
'mkinitcpio>=0.7'
|
|
|
|
)
|
|
|
|
optdepends=(
|
|
|
|
'wireless-regdb: to set the correct wireless channels of your country'
|
|
|
|
)
|
|
|
|
provides=(
|
|
|
|
linux="${pkgver}"
|
|
|
|
WIREGUARD-MODULE
|
|
|
|
)
|
|
|
|
conflicts=(
|
|
|
|
linux
|
2023-12-11 10:31:58 +00:00
|
|
|
linux-rpi-16k
|
2023-05-02 13:01:41 +00:00
|
|
|
uboot-raspberrypi
|
|
|
|
)
|
2021-11-26 18:37:42 +00:00
|
|
|
install=${pkgname}.install
|
2023-05-02 13:01:41 +00:00
|
|
|
backup=(
|
2023-06-24 21:02:35 +00:00
|
|
|
boot/config.txt
|
|
|
|
boot/cmdline.txt
|
2023-05-02 13:01:41 +00:00
|
|
|
)
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
cd "${srcdir}/${_srcname}"
|
2023-05-02 13:01:41 +00:00
|
|
|
local modulesdir="$pkgdir/usr/lib/modules/$(<version)"
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
# Used by mkinitcpio to name the kernel
|
|
|
|
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"
|
2023-05-02 13:01:41 +00:00
|
|
|
|
2021-11-26 18:37:42 +00:00
|
|
|
echo "Installing modules..."
|
2023-10-31 11:43:58 +00:00
|
|
|
make INSTALL_MOD_PATH="$pkgdir/usr" INSTALL_MOD_STRIP=1 \
|
2022-05-03 14:24:44 +00:00
|
|
|
DEPMOD=/doesnt/exist modules_install # Suppress depmod
|
2021-11-26 18:37:42 +00:00
|
|
|
|
2024-01-03 22:02:13 +00:00
|
|
|
# remove build link
|
|
|
|
rm -f "$modulesdir"/build
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
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"
|
2023-12-08 21:43:06 +00:00
|
|
|
install -m644 ../config.txt "${pkgdir}/boot/config.txt"
|
2021-11-26 18:37:42 +00:00
|
|
|
install -m644 ../cmdline.txt "${pkgdir}/boot"
|
|
|
|
|
|
|
|
# sed expression for following substitutions
|
|
|
|
local _subst="
|
|
|
|
s|%PKGBASE%|${pkgbase}|g
|
2023-05-08 16:34:34 +00:00
|
|
|
s|%KERNVER%|$(<version)|g
|
2021-11-26 18:37:42 +00:00
|
|
|
"
|
|
|
|
|
|
|
|
# install mkinitcpio preset file
|
|
|
|
sed "${_subst}" ../linux.preset |
|
|
|
|
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"
|
|
|
|
|
2024-01-15 21:10:06 +00:00
|
|
|
# rather than use another hook (90-linux.hook) rely on mkinitcpio's 90-mkinitcpio-install.hook
|
2024-01-14 12:22:02 +00:00
|
|
|
# which avoids a double run of mkinitcpio that can occur
|
|
|
|
touch "${pkgdir}/usr/lib/modules/$(<version)/vmlinuz"
|
2021-11-26 18:37:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_package-headers() {
|
2023-12-10 19:44:51 +00:00
|
|
|
pkgdesc="Headers and scripts for building modules for Linux kernel"
|
2021-11-26 18:37:42 +00:00
|
|
|
provides=("linux-headers=${pkgver}")
|
2023-12-11 10:31:58 +00:00
|
|
|
conflicts=('linux-headers' 'linux-rpi-16k-headers')
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-02-08 21:46:56 +00:00
|
|
|
echo "Symlinking common aliases..."
|
|
|
|
# https://archlinuxarm.org/forum/viewtopic.php?f=60&t=16354
|
|
|
|
ln -sr arm "$builddir/arch/armv7h"
|
|
|
|
ln -sr arm "$builddir/arch/armv7l"
|
|
|
|
ln -sr arm64 "$builddir/arch/aarch64"
|
|
|
|
|
2021-11-26 18:37:42 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
echo "Stripping build tools..."
|
|
|
|
local file
|
|
|
|
while read -rd '' file; do
|
2023-05-02 13:01:41 +00:00
|
|
|
case "$(file -Sib "$file")" in
|
2021-11-26 18:37:42 +00:00
|
|
|
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
|
2023-11-22 12:09:31 +00:00
|
|
|
done < <(find "$builddir" -type f -perm -u+x -print0)
|
2021-11-26 18:37:42 +00:00
|
|
|
|
|
|
|
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
|
2023-12-11 10:31:58 +00:00
|
|
|
|
|
|
|
# vim:set ts=8 sts=2 sw=2 et:
|