aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-rpi/APKBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'main/linux-rpi/APKBUILD')
-rw-r--r--main/linux-rpi/APKBUILD221
1 files changed, 116 insertions, 105 deletions
diff --git a/main/linux-rpi/APKBUILD b/main/linux-rpi/APKBUILD
index 7a69ee63b9d..d95b8fa14aa 100644
--- a/main/linux-rpi/APKBUILD
+++ b/main/linux-rpi/APKBUILD
@@ -1,48 +1,37 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=linux-rpi
-pkgver=4.19.80
+pkgver=6.6.21
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
-*.*) _kernver=${pkgver};;
+*.*) _kernver=$pkgver;;
esac
pkgrel=0
pkgdesc="Linux kernel with Raspberry Pi patches"
url=https://github.com/raspberrypi/linux
-depends="mkinitfs"
-_depends_dev="perl gmp-dev elfutils-dev bash"
-makedepends="$_depends_dev sed installkernel bc linux-headers linux-firmware
- bison flex openssl-dev
+depends="initramfs-generator linux-firmware-brcm"
+_depends_dev="perl gmp-dev elfutils-dev bash mpc1-dev mpfr-dev"
+makedepends="$_depends_dev gcc>=13.1.1_git20230603 sed installkernel bc linux-headers linux-firmware
+ bison flex openssl-dev>3 findutils xz
"
options="!strip !check"
-_rpi_repo="git://github.com/raspberrypi/linux.git"
-_linux_repo="git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
-source="https://kernel.org/pub/linux/kernel/v4.x/linux-$_kernver.tar.xz
- https://kernel.org/pub/linux/kernel/v4.x/patch-$pkgver.xz
+_rpi_repo="https://github.com/raspberrypi/linux.git"
+_linux_repo="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
+source="https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
+ https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz
https://dev.alpinelinux.org/archive/rpi-patches/rpi-$pkgver-alpine.patch
- issue-4973.patch
-
- config-changes-rpi.armhf
- config-changes-rpi.aarch64
- config-changes-rpi2.armhf
- config-changes-rpi.armv7
- config-changes-rpi2.armv7
+ common-changes.config
"
-subpackages=""
arch="armhf armv7 aarch64"
-license="GPL-2.0"
-_flavors=
-for _i in $source; do
- case $_i in
- config-*.$CARCH)
- _f=${_i%.$CARCH}
- _f=${_f#config-changes-}
- _flavors="$_flavors ${_f}"
- [ "linux-$_f" != "$pkgname" ] && subpackages="$subpackages linux-${_f}::$CBUILD_ARCH"
- subpackages="$subpackages linux-${_f}-dev:_dev:$CBUILD_ARCH"
- ;;
- esac
+license="GPL-2.0-only"
+_flavors="rpi"
+
+for _f in $_flavors; do
+ if [ "linux-$_f" != "$pkgname" ]; then
+ subpackages="$subpackages linux-$_f::$CBUILD_ARCH"
+ fi
+ subpackages="$subpackages linux-$_f-dev:_dev:$CBUILD_ARCH"
done
case "$CARCH" in
@@ -50,9 +39,6 @@ case "$CARCH" in
arm*) _carch="arm" ;;
esac
-HOSTCC="${CC:-gcc}"
-HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
-
prepare() {
local _patch_failed=
cd "$srcdir"/linux-$_kernver
@@ -85,56 +71,61 @@ prepare() {
local flavor=
for flavor in $_flavors; do
- local builddir="$srcdir"/build-$flavor
- mkdir -p "$builddir"
- echo "-$pkgrel-$flavor" > "$builddir"/localversion-alpine
+ local _builddir="$srcdir"/build-$flavor.$CARCH
+ mkdir -p "$_builddir"
+ echo "-$pkgrel-$flavor" > "$_builddir"/localversion-alpine
_genconfig $flavor
make -C "$srcdir"/linux-$_kernver \
- O="$builddir" \
+ O="$_builddir" \
ARCH="$_carch" \
- HOSTCC="$HOSTCC" \
olddefconfig
_verifyconfig $flavor
done
}
# generate config from defconfig and apply local changes.
-# config-changes-$flavor.$CARCH holds a list of = delimited
+# common-changes.config holds a list of = delimited
# config command and values used by kernel scripts/config script.
_genconfig() {
local flavor=$1 defconfig=
- local builddir="$srcdir"/build-$flavor
+ local builddir="$srcdir"/build-$flavor.$CARCH
local defconfig=
- case $flavor in
- rpi) defconfig=bcmrpi_defconfig
- [ "$CARCH" = "aarch64" ] && defconfig=bcmrpi3_defconfig ;;
- rpi2) defconfig=bcm2709_defconfig ;;
- *) die "Unknown flavor: $flavor" ;;
+ case "$CARCH" in
+ armhf) defconfig=bcmrpi_defconfig;;
+ armv7) defconfig=bcm2709_defconfig;;
+ aarch64) defconfig=bcm2711_defconfig;;
+ *) die "Unknown CARCH: $CARCH" ;;
esac
cp "$srcdir"/linux-$_kernver/arch/$_carch/configs/$defconfig \
"$builddir"/.config
while read line; do
- [ ${line:0:1} = "#" ] && continue
+ # skip comments
+ case "$line" in
+ "#"*) continue;;
+ esac
local option=${line%%=*} str=
local cmd=$(echo $line | cut -d= -f2)
case "$cmd" in
- enable|disable|module) str= ;;
- set-str|set-val) str=${line##*=} ;;
+ y) cmd="enable";;
+ n) cmd="disable";;
+ m) cmd="module";;
+ '"'*) cmd="set-str"; str="${line#*=}";;
+ [0-9]*) cmd="set-val"; str="${line#*=}";;
*) die "Command $cmd not accepted" ;;
esac
msg "[$flavor] $cmd: $option $str"
"$srcdir"/linux-$_kernver/scripts/config \
--file "$builddir"/.config \
- --${cmd} "$option" "${str//\"/}"
- done < "$srcdir"/config-changes-$flavor.${CARCH}
+ --$cmd "$option" "${str//\"/}"
+ done < "$srcdir"/common-changes.config
}
# verify if options are set to correct value
_verifyconfig() {
local flavor=$1
- local builddir="$srcdir"/build-$flavor
+ local builddir="$srcdir"/build-$flavor.$CARCH
while read line; do
[ ${line:0:1} = "#" ] && continue
local option=${line%%=*} str= invert=
@@ -149,13 +140,21 @@ _verifyconfig() {
esac
grep -q $invert "^$str" "$builddir"/.config || \
die "Config: $option not properly set!"
- done < "$srcdir"/config-changes-$flavor.${CARCH}
+ done < "$srcdir"/common-changes.config
}
build() {
unset LDFLAGS
+ # for some reason these sometimes leak into the kernel build,
+ # -Werror=format-security breaks some stuff
+ unset CFLAGS CPPFLAGS CXXFLAGS
for i in $_flavors; do
- cd "$srcdir"/build-$i
+ cd "$srcdir"/build-$i.$CARCH
+ local _kver=$(make kernelversion)
+ if [ "$_kver" != "$pkgver" ]; then
+ error "Version in Makefile ($_kver) does not correspond with pkgver ($pkgver)"
+ return 1
+ fi
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
done
@@ -163,10 +162,10 @@ build() {
_package() {
local _buildflavor="$1" _outdir="$2"
- local _abi_release=${pkgver}-${pkgrel}-${_buildflavor}
-
- cd "$srcdir"/build-$_buildflavor
+ local _builddir="$srcdir"/build-$_buildflavor.$CARCH
+ cd "$_builddir"
+ local _abi_release="$(make -s kernelrelease)"
mkdir -p "$_outdir"/boot "$_outdir"/lib/modules
local _install
@@ -182,21 +181,28 @@ _package() {
;;
esac
- cd "$srcdir"/build-$_buildflavor
- local INSTALL_DTBS_PATH="$_outdir"/usr/lib/linux-${_abi_release}
- make -j1 modules_install $_install \
+ # modules_install seems to regenerate a defect Modules.symvers. Work
+ # around it by backing it up and restore it after modules_install
+ cp Module.symvers Module.symvers.backup
+
+ local INSTALL_DTBS_PATH="$_outdir"/boot
+ make modules_install $_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$_outdir" \
INSTALL_PATH="$_outdir"/boot \
INSTALL_DTBS_PATH="$INSTALL_DTBS_PATH"
+ cp Module.symvers.backup Module.symvers
- rm -f "$_outdir"/lib/modules/${_abi_release}/build \
- "$_outdir"/lib/modules/${_abi_release}/source
+ rm -f "$_outdir"/lib/modules/$_abi_release/build \
+ "$_outdir"/lib/modules/$_abi_release/source
rm -rf "$_outdir"/lib/firmware
- install -D include/config/kernel.release \
+ install -D -m644 include/config/kernel.release \
"$_outdir"/usr/share/kernel/$_buildflavor/kernel.release
+ # allow the initramfs generators to know the package name the kernel came from
+ echo "${subpkgname:-$pkgname}" > "$_outdir"/lib/modules/$_abi_release/pkgname
+
if [ "$CARCH" = "aarch64" ]; then
mv -f "$INSTALL_DTBS_PATH"/broadcom/*.dtb \
"$INSTALL_DTBS_PATH"
@@ -204,40 +210,28 @@ _package() {
fi
}
-genpatch() {
- local RPI_REPO_PATH="$HOME/repositories/linux-rpi"
- msg "Checking out/pulling the Linux kernel git repository.."
- mkdir -p "$RPI_REPO_PATH" && cd "$RPI_REPO_PATH"
- git clone "$_linux_repo" "$RPI_REPO_PATH" 2>/dev/null || git pull
- msg "Fetching raspberry git repository.."
- git remote add rpi "$_rpi_repo" 2>/dev/null || true
- git fetch rpi
- msg "Generating rpi patch: rpi-$pkgver.patch"
- mkdir -p "$srcdir"
- git diff v$pkgver remotes/rpi/rpi-${pkgver%.*}.y > \
- "$srcdir"/rpi-$pkgver.patch
- msg "Sending patch to dev.alpinelinux.org.."
- scp "$srcdir"/rpi-$pkgver.patch \
- dev.alpinelinux.org:/archive/rpi-patches/rpi-$pkgver.patch
- cd "$startdir" && abuild checksum
-}
-
# main flavor installs in $pkgdir
package() {
- depends="$depends linux-firmware-brcm"
+ case "$CARCH" in
+ armv7)
+ provides="linux-rpi2=$pkgver-r$pkgrel" # for backward compatibility
+ replaces="linux-rpi2" # for backward compatibility
+ ;;
+ aarch64)
+ provides="linux-rpi4=$pkgver-r$pkgrel" # for backward compatibility
+ replaces="linux-rpi4" # for backward compatibility
+ ;;
+ esac
_package rpi "$pkgdir"
}
-# subflavors install in $subpkgdir
-rpi2() {
- depends="$depends linux-firmware-brcm"
-
- _package rpi2 "$subpkgdir"
-}
_dev() {
local _flavor=$(echo $subpkgname | sed -E 's/(^linux-|-dev$)//g')
- local _abi_release=${pkgver}-${pkgrel}-$_flavor
+ local _builddir="$srcdir"/build-$_flavor.$CARCH
+
+ cd "$_builddir"
+ local _abi_release="$(make -s kernelrelease)"
# copy the only the parts that we really need for build 3rd party
# kernel modules and install those as /usr/src/linux-headers,
# simlar to what ubuntu does
@@ -247,14 +241,34 @@ _dev() {
#
pkgdesc="Headers and script for third party modules for $_flavor kernel"
depends="$_depends_dev"
- local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
+
+ # handle backward compatibility with legacy flavors
+ case "$_flavor" in
+ rpi)
+ case "$CARCH" in
+ armv7)
+ provides="linux-rpi2-dev=$pkgver-r$pkgrel"
+ replaces="linux-rpi2-dev"
+ ;;
+ aarch64)
+ provides="linux-rpi4-dev=$pkgver-r$pkgrel"
+ replaces="linux-rpi4-dev"
+ ;;
+ esac
+ ;;
+ *) die "Unknown flavor: $flavor" ;;
+ esac
+
+ local dir="$subpkgdir"/usr/src/linux-headers-$_abi_release
# first we import config, run prepare to set up for building
# external modules, and create the scripts
mkdir -p "$dir"
- cp "$srcdir"/build-$_flavor/.config "$dir"/.config
- make -j1 -C "$srcdir"/linux-$_kernver O="$dir" HOSTCC="${CC:-gcc}" \
- silentoldconfig prepare modules_prepare scripts
+ cp "$_builddir"/.config "$dir"/.config
+ echo "-$pkgrel-$_flavor" > "$dir"/localversion-alpine
+
+ make -j1 -C "$srcdir"/linux-$_kernver ARCH="$_carch" O="$dir" \
+ syncconfig prepare modules_prepare scripts
# remove the stuff that points to real sources. we want 3rd party
# modules to believe this is the soruces
@@ -275,20 +289,17 @@ _dev() {
find $(find arch -name include -type d -print) -type f \
| cpio -pdm "$dir"
- install -Dm644 "$srcdir"/build-$_flavor/Module.symvers \
+ install -Dm644 "$_builddir"/Module.symvers \
"$dir"/Module.symvers
- mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
- ln -sf /usr/src/linux-headers-${_abi_release} \
- "$subpkgdir"/lib/modules/${_abi_release}/build
+ mkdir -p "$subpkgdir"/lib/modules/$_abi_release
+ ln -sf /usr/src/linux-headers-$_abi_release \
+ "$subpkgdir"/lib/modules/$_abi_release/build
}
-sha512sums="ab67cc746b375a8b135e8b23e35e1d6787930d19b3c26b2679787d62951cbdbc3bb66f8ededeb9b890e5008b2459397f9018f1a6772fdef67780b06a4cb9f6f4 linux-4.19.tar.xz
-52ff33e5c16cc6de7f1ce6c5a5544545e248c48478e634ec881f54e2eeb698e7a891341158a61d556aeb013a0198a0696ec6dba8db562252cda0e10c44dc429e patch-4.19.80.xz
-1d91f15174d84c0dfc6737864f68790cce4fd42fcf46d583633ee487b8551c25f9175d9f0da1dff3878c61ca4c12acf3aa724d59de35aec61951ee069298f995 rpi-4.19.80-alpine.patch
-501c91bf2538a18102da59bbccc3097f9c3c90079acc0e946ff075074160c09b8a66934e5ce5470e170f0e4f93d114709a95230367426d0bb7ea02c4bdf4cc9b issue-4973.patch
-6c1c1c61ceb323eecb0e81e226af6b5b8fef7c8c075b1eb836639f465de5ef5d23648716c953d295250f8c6567546782956afe644573b84920a4f6902a1a0454 config-changes-rpi.armhf
-6c1c1c61ceb323eecb0e81e226af6b5b8fef7c8c075b1eb836639f465de5ef5d23648716c953d295250f8c6567546782956afe644573b84920a4f6902a1a0454 config-changes-rpi.aarch64
-6c1c1c61ceb323eecb0e81e226af6b5b8fef7c8c075b1eb836639f465de5ef5d23648716c953d295250f8c6567546782956afe644573b84920a4f6902a1a0454 config-changes-rpi2.armhf
-6c1c1c61ceb323eecb0e81e226af6b5b8fef7c8c075b1eb836639f465de5ef5d23648716c953d295250f8c6567546782956afe644573b84920a4f6902a1a0454 config-changes-rpi.armv7
-6c1c1c61ceb323eecb0e81e226af6b5b8fef7c8c075b1eb836639f465de5ef5d23648716c953d295250f8c6567546782956afe644573b84920a4f6902a1a0454 config-changes-rpi2.armv7"
+sha512sums="
+458b2c34d46206f9b4ccbac54cc57aeca1eaecaf831bc441e59701bac6eadffc17f6ce24af6eadd0454964e843186539ac0d63295ad2cc32d112b60360c39a35 linux-6.6.tar.xz
+e7c8e640fc519d6c92cd13985a7e37d2c8fe0277b7386a9f861c39a6f164d815133b5fb02a691d43c7b79563b09d6ea78674af0ccecfef1b418f4d03bf52a9bc patch-6.6.21.xz
+cd73e92fbd2fe47bd756eeaae06b3927813bca528c2aecc7e5833797f0bb1d24cd15dec762088b1faaa8ca9785d8d30027aa6b4a419d030a7f1c7d078c8d6486 rpi-6.6.21-alpine.patch
+f014a9b3574df17a3f6e0d8a2c48aef4239f33a062d64704fd56ecd596d090bb0413c8cb2abd6ec3ceeee09fa66243b6a3f7b405657edbd9c7a6407d6ec79fef common-changes.config
+"