diff --git a/core/linux-rpi-16k/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch b/core/linux-rpi-16k/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch new file mode 100644 index 000000000..4b2e24fe1 --- /dev/null +++ b/core/linux-rpi-16k/0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch @@ -0,0 +1,29 @@ +From 988f69b247fa3a1b70876395342aeb8c7dc2e834 Mon Sep 17 00:00:00 2001 +From: graysky +Date: Mon, 7 Dec 2020 13:03:40 -0500 +Subject: [PATCH] Make /proc/cpuinfo consistent on arm64 and arm + +Signed-off-by: graysky +--- + arch/arm64/kernel/cpuinfo.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c +index 721350d21074..88e2b8fcd7e6 100644 +--- a/arch/arm64/kernel/cpuinfo.c ++++ b/arch/arm64/kernel/cpuinfo.c +@@ -153,9 +153,8 @@ static int c_show(struct seq_file *m, void *v) + * "processor". Give glibc what it expects. + */ + seq_printf(m, "processor\t: %d\n", i); +- if (compat) +- seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", +- MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); ++ seq_printf(m, "model name\t: ARMv8 Processor rev %d (%s)\n", ++ MIDR_REVISION(midr), COMPAT_ELF_PLATFORM); + + seq_printf(m, "BogoMIPS\t: %lu.%02lu\n", + loops_per_jiffy / (500000UL/HZ), +-- +2.29.2 + diff --git a/core/linux-rpi-16k/60-linux.hook b/core/linux-rpi-16k/60-linux.hook new file mode 100644 index 000000000..584ce3537 --- /dev/null +++ b/core/linux-rpi-16k/60-linux.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Operation = Remove +Target = usr/lib/modules/%KERNVER%/* + +[Action] +Description = Updating %PKGBASE% module dependencies... +When = PostTransaction +Exec = /usr/bin/depmod %KERNVER% diff --git a/core/linux-rpi-16k/90-linux.hook b/core/linux-rpi-16k/90-linux.hook new file mode 100644 index 000000000..4e62c1676 --- /dev/null +++ b/core/linux-rpi-16k/90-linux.hook @@ -0,0 +1,13 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Target = boot/kernel.img +Target = boot/kernel7.img +Target = boot/kernel8.img +Target = usr/lib/initcpio/* + +[Action] +Description = Updating %PKGBASE% initcpios... +When = PostTransaction +Exec = /usr/bin/mkinitcpio -p %PKGBASE% diff --git a/core/linux-rpi-16k/PKGBUILD b/core/linux-rpi-16k/PKGBUILD new file mode 100644 index 000000000..543b6a588 --- /dev/null +++ b/core/linux-rpi-16k/PKGBUILD @@ -0,0 +1,259 @@ +# Maintainer: graysky +# Maintainer: Kevin Mihelich +# Maintainer: Oleg Rakhmanov +# Maintainer: Dave Higham +# Contributer: Jan Alexander Steffens (heftig) + +pkgbase=linux-rpi-16k +_commit=24ec6335f52e1fe3a895a1a2675200f452694923 +_srcname=linux-${_commit} +_kernelname=${pkgbase#linux} +_regen= +pkgver=6.6.5 +pkgrel=1 +pkgdesc='Linux' +url="https://github.com/raspberrypi/linux" +arch=(aarch64) +license=(GPL2) +makedepends=( + bc + kmod + inetutils +) +options=('!strip') +source=("linux-$pkgver-${_commit:0:10}.tar.gz::https://github.com/raspberrypi/linux/archive/${_commit}.tar.gz" + cmdline.txt + config.txt + config8 + 0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch + linux.preset + 60-linux.hook + 90-linux.hook + archarm.diffconfig +) +md5sums=('b04201ec76e17e06a0a8cd45bb3bfaf0' + '3bab7426d8c8818dda8353da3892a41f' + '16c484af9f72b9275afcf83a6b8eab36' + '4cbed2795359a053fce9098da15d4588' + 'f66a7ea3feb708d398ef57e4da4815e9' + '86d4a35722b5410e3b29fc92dae15d4b' + '0a5f16bfec6ad982a2f6782724cca8ba' + '441ec084c47cddc53e592fb0cbce4edf' + 'c8f84694321e249492c80149833671d7') + +# setup vars +_kernel=kernel8.img KARCH=arm64 _image=Image _config=config8 + +prepare() { + cd "${srcdir}/${_srcname}" + + # consistent behavior of lscpu on arm/arm64 + patch -p1 -i ../0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch + + echo "Setting version..." + echo "-$pkgrel" > localversion.10-pkgrel + echo "${pkgbase#linux}" > localversion.20-pkgname + + if [[ $_regen -eq 1 ]]; then + # useful on two point releases to keep shit straight + echo "Applying custom shit to bcm2712_defconfig" + make bcm2712_defconfig + cat ../archarm.diffconfig >> .config + make oldconfig + sed '/^CONFIG_LOCALVERSION=/s,.*$,CONFIG_LOCALVERSION="-ARCH",' .config >$startdir/newconfig.$_config + echo "verify that newconfig.$_config is fit for purpose then redefine $_config" + exit + else + make bcm2712_defconfig + make -s kernelrelease | sed 's/rpi-16k.*$/rpi-16k-ARCH/' > version + make mrproper + echo "Setting config..." + cp ../"$_config" .config + make olddefconfig + diff -u ../"$_config" .config || : + echo "Prepared $pkgbase version $(=0.7' + ) + optdepends=( + 'wireless-regdb: to set the correct wireless channels of your country' + ) + provides=( + linux="${pkgver}" + WIREGUARD-MODULE + ) + conflicts=( + linux + linux-rpi + uboot-raspberrypi + ) + install=${pkgname}.install + backup=( + boot/config.txt + boot/cmdline.txt + ) + + cd "${srcdir}/${_srcname}" + local modulesdir="$pkgdir/usr/lib/modules/$(>> You appear to have dynamic memory (CMA) enabled, which is currently broken" + echo ">>> in newer kernels and will cause many issues if left enabled." + echo ">>> Disabling that for you now." + sed -i 's/^cma_/#cma_/g' /boot/config.txt + fi +} + +correct_fstab() { + # starting with v5.10.y, fstab requires a padded zero in the path to /boot + if [[ -f /etc/fstab ]]; then + if grep -q mmcblk1p1 /etc/fstab; then + sed -i 's/mmcblk1p1/mmcblk0p1/' /etc/fstab + fi + fi +} + +post_install () { + disable_cma + + # coming from linux-aarch64 also needs a padded zero in the path to /boot + correct_fstab +} + +post_upgrade() { + if grep "^[^#]*[[:space:]]/boot" etc/fstab 2>&1 >/dev/null; then + if ! grep "[[:space:]]/boot" etc/mtab 2>&1 >/dev/null; then + echo "WARNING: /boot appears to be a separate partition but is not mounted." + echo " You probably just broke your system. Congratulations." + fi + fi + + disable_cma + + if [ "$(vercmp $2 3.18.3)" -lt 0 ]; then + echo "________________________________________________________________________________" + echo "" + echo "WARNING: This kernel provides updated config.txt and cmdline.txt files." + echo " Check for pacnew files in /boot and merge or replace the existing files" + echo " with the new versions." + echo "________________________________________________________________________________" + echo "" + fi + + if [ "$(vercmp $2 5.10.0)" -lt 0 ]; then + correct_fstab + fi +} + +post_remove() { + rm -f boot/initramfs-linux.img +} diff --git a/core/linux-rpi-16k/linux.preset b/core/linux-rpi-16k/linux.preset new file mode 100644 index 000000000..8d7f379c9 --- /dev/null +++ b/core/linux-rpi-16k/linux.preset @@ -0,0 +1,10 @@ +# mkinitcpio preset file for the '%PKGBASE%' package + +ALL_config="/etc/mkinitcpio.conf" +ALL_kver="%KERNVER%" + +PRESETS=('default') + +#default_config="/etc/mkinitcpio.conf" +default_image="/boot/initramfs-linux.img" +#default_options=""