add core/linux-rpi (previously linux-raspberrypi4)

This commit is contained in:
graysky 2021-11-26 13:37:42 -05:00
parent d34a8527c7
commit 44aa69a103
11 changed files with 17018 additions and 0 deletions

View file

@ -0,0 +1,29 @@
From 988f69b247fa3a1b70876395342aeb8c7dc2e834 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Mon, 7 Dec 2020 13:03:40 -0500
Subject: [PATCH] Make /proc/cpuinfo consistent on arm64 and arm
Signed-off-by: graysky <graysky@archlinux.us>
---
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

View file

@ -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%

View file

@ -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%

220
core/linux-rpi/PKGBUILD Normal file
View file

@ -0,0 +1,220 @@
# 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>
buildarch=12
pkgbase=linux-rpi
_commit=e16e31540935728ce57f22a1de56e8b2da5dd33b
_srcname=linux-${_commit}
_kernelname=${pkgbase#linux}
_desc="RPi 3/4/400/Zero 2 W"
pkgver=5.10.81
pkgrel=3
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')
source=("linux-$pkgver-$pkgrel-${_commit:0:10}.tar.gz::https://github.com/raspberrypi/linux/archive/${_commit}.tar.gz"
cmdline.txt
0001-Make-proc-cpuinfo-consistent-on-arm64-and-arm.patch
linux.preset
60-linux.hook
90-linux.hook
)
md5sums=('04add30cbd4e5d412bd1e71a98c2f6ff'
'31c02f4518d46deb5f0c2ad1f8b083cd'
'f66a7ea3feb708d398ef57e4da4815e9'
'86d4a35722b5410e3b29fc92dae15d4b'
'0a5f16bfec6ad982a2f6782724cca8ba'
'441ec084c47cddc53e592fb0cbce4edf')
md5sums_armv7h=('5ec205f35bac1cc4df6436ba3cb83b07'
'e302936d860e78ca8e965459e64b2e5b')
md5sums_aarch64=('f460711568c3dc02505000b83703d024'
'e302936d860e78ca8e965459e64b2e5b')
# 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() {
pkgdesc="RPi Foundation patched Linux kernel and modules - ${_desc}"
depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7' 'firmware-raspberrypi')
optdepends=('crda: to set the correct wireless channels of your country')
provides=('kernel26' "linux=${pkgver}" 'WIREGUARD-MODULE')
conflicts=('kernel26' 'linux' 'uboot-raspberrypi')
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..."
make INSTALL_MOD_PATH="$pkgdir/usr" modules_install
# 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() {
pkgdesc="RPi Foundation header and scripts for building modules for Linux kernel - ${_desc}"
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
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

View file

@ -0,0 +1 @@
root=/dev/mmcblk0p2 rw rootwait console=serial0,115200 console=tty1 selinux=0 plymouth.enable=0 smsc95xx.turbo_mode=N dwc_otg.lpm_enable=0 kgdboc=serial0,115200

8316
core/linux-rpi/config Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
# See /boot/overlays/README for all available options
dtoverlay=vc4-kms-v3d
initramfs initramfs-linux.img followkernel
[pi4]
# Run as fast as firmware / board allows
arm_boost=1

8352
core/linux-rpi/config8 Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,8 @@
# See /boot/overlays/README for all available options
dtoverlay=vc4-kms-v3d
initramfs initramfs-linux.img followkernel
[pi4]
# Run as fast as firmware / board allows
arm_boost=1

View file

@ -0,0 +1,50 @@
disable_cma() {
if [[ -f /boot/config.txt && $(grep '^cma' /boot/config.txt) != '' ]]; then
echo ">>> 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/mmcblk01p1/' /etc/fstab
fi
fi
}
post_install () {
disable_cma
}
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
}

View file

@ -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=""