summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahmut Dikcizgi2023-01-26 00:29:39 +0100
committerMahmut Dikcizgi2023-01-26 00:29:39 +0100
commitae8a95618d41ef17d1926a6dba0cc9b1ea3e44d3 (patch)
tree96164eb7144d8c014b21782cb977892652d36072
downloadaur-ae8a95618d41ef17d1926a6dba0cc9b1ea3e44d3.tar.gz
Precompiled Kernel Images based on 5.10.x BSP kernel published by RADXA
-rw-r--r--.SRCINFO42
-rw-r--r--PKGBUILD139
-rw-r--r--extlinux.arch.template9
-rwxr-xr-xextract-vmlinux71
-rw-r--r--linux.preset10
5 files changed, 271 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..f6b8b7504f84
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,42 @@
+pkgbase = linux-radxa-rkbsp5-bin
+ pkgdesc = Precompiled Kernel Images based on 5.10.x BSP kernel published by RADXA Minimum supported boards: RK3399 based rock4[a/b/c/se/io/se] boards RK3588 based rock5[a/b/nx] modules boards It is possible to make other RK3588 and RK3399 board with few DTS adapdations
+ pkgver = 5.10.110
+ pkgrel = 1
+ url = https://github.com/radxa/kernel
+ arch = aarch64
+ license = GPL2
+ makedepends = binutils
+ makedepends = tar
+ makedepends = grep
+ makedepends = mkinitcpio
+ makedepends = sed
+ noextract = linux.preset
+ noextract = extract-vmlinux
+ noextract = extlinux.arch.template
+ options = !strip
+ source = linux.preset
+ source = extract-vmlinux
+ source = extlinux.arch.template
+ sha512sums = f01e7925b262d2874a8a991b1f27d057356a2a384d2012b61be5a631d4e4d7cf87461c8fb9e7f183831f5a829ad204897f1f0545a52df6288a0e04a5c2e31b96
+ sha512sums = ba6edcd5f56a4c3e865578eabf1e1311b8e5e7babffdb0f84b99971238505ca27eba506f2723638129ef6558eba95f7e4fd2e07b40e5a4de716e5de90d1cbe79
+ sha512sums = b09481badcc35acc5455b97545e87c706c5cb326e1b80237b2435d821c3c45002b44538095f3c5f3cfc720acf55bc27d97b0290e5cffa5acbdbaf0c2314f2d1b
+
+pkgname = linux-radxa-rkbsp5-bin
+ pkgdesc = The Linux 5.x Kernel and Modules for Rockchip published by Radxa
+ depends = coreutils
+ depends = linux-firmware
+ depends = kmod
+ depends = mkinitcpio>=0.7
+ depends = grep
+ depends = gzip
+ optdepends = crda: to set the correct wireless channels of your country
+ provides = linux=5.10.110
+ provides = linux-rkbsp
+ conflicts = linux
+ backup = etc/mkinitcpio.d/linux-radxa-rkbsp5.preset
+
+pkgname = linux-radxa-rkbsp5-bin-headers
+ pkgdesc = The Linux 5.x Kernelmakepkg Headers for Rockchip published by Radxa
+ provides = linux-headers=5.10.110
+ provides = linux-rkbsp-headers
+ conflicts = linux-headers
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..71b0e952b7a8
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,139 @@
+# Maintainer: Faruk Dikcizgi <boogiepop@gmx.de>
+# Contributor: Jan Keith Darunday <aur@jkcdarunday.mozmail.com>
+# Contributor: Jack Chen <redchenjs@live.com>
+
+_kernel=linux-radxa-rkbsp5
+pkgver=5.10.110
+pkgbase=$_kernel-bin
+pkgname=($pkgbase $pkgbase-headers)
+pkgrel=1
+arch=('aarch64')
+url="https://github.com/radxa/kernel"
+_repourl="https://github.com/radxa/apt/raw/gh-pages/bullseye-stable/"
+license=('GPL2')
+options=('!strip')
+makedepends=('binutils' 'tar' 'grep' 'mkinitcpio' 'sed')
+pkgdesc="Precompiled Kernel Images based on 5.10.x BSP kernel published by RADXA
+Minimum supported boards:
+RK3399 based rock4[a/b/c/se/io/se] boards
+RK3588 based rock5[a/b/nx] modules boards
+It is possible to make other RK3588 and RK3399 board with few DTS adapdations"
+
+source=(
+ "linux.preset"
+ "extract-vmlinux"
+ "extlinux.arch.template"
+ )
+sha512sums=('f01e7925b262d2874a8a991b1f27d057356a2a384d2012b61be5a631d4e4d7cf87461c8fb9e7f183831f5a829ad204897f1f0545a52df6288a0e04a5c2e31b96'
+ 'ba6edcd5f56a4c3e865578eabf1e1311b8e5e7babffdb0f84b99971238505ca27eba506f2723638129ef6558eba95f7e4fd2e07b40e5a4de716e5de90d1cbe79'
+ 'b09481badcc35acc5455b97545e87c706c5cb326e1b80237b2435d821c3c45002b44538095f3c5f3cfc720acf55bc27d97b0290e5cffa5acbdbaf0c2314f2d1b')
+
+noextract=("${source[@]##*/}")
+
+prepare() {
+ cd "$srcdir"
+ rm -rf $(find -mindepth 1 -maxdepth 1 -type d)
+
+ mkdir -p debs
+ cd debs
+
+ # get the latest image version from debian repo
+ local _latest=$(curl -Lk ${_repourl}db/packages.db | grep -oa "pool/main/l/linux-5.10-rock-5-latest.*" | sort -r | head -1)
+ curl -L "${_repourl}${_latest}" -o latest.deb
+ ar x "latest.deb"
+ tar -m -xf control.tar.gz
+ _imagever=$(cat control | grep -o linux-image-[A-Za-z0-9\.\-]*)
+ _version=${_imagever#linux-image-}
+ echo $_version > ../version
+ rm -rf *
+}
+
+pkgver(){
+ local _version="$(<version)"
+ _version="${_version//-/.}"
+ printf "${_version//rockchip./}"
+}
+
+_package-bin() {
+ pkgdesc="The Linux 5.x Kernel and Modules for Rockchip published by Radxa"
+ depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7' 'grep' 'gzip')
+ optdepends=('crda: to set the correct wireless channels of your country')
+ backup=("etc/mkinitcpio.d/$_kernel.preset")
+ provides=("linux=${pkgver}" "linux-rkbsp")
+ conflicts=('linux' )
+
+ cd "$srcdir/debs"
+ local _version="$(<../version)"
+ # download & extract image deb
+ local _imagedeb=$(curl -Lk ${_repourl}db/packages.db | grep -oa "pool.*linux-image-$_version.*\.deb" | sort -r | head -1)
+ curl -L "${_repourl}${_imagedeb}" -o image.deb
+ ar x "image.deb"
+ mkdir -p ../image
+ tar -m -xf data.tar.xz -C ../image
+ rm -rf *
+
+ cd "$srcdir/image"
+
+ install -dm755 "$pkgdir/boot"
+ install -dm755 "$pkgdir/usr"
+
+ # copy dtbs
+ mkdir -p "$pkgdir/boot/dtbs/$_kernel"
+ cp -raf "usr/lib/linux-image-${_version}/." "$pkgdir/boot/dtbs/$_kernel"
+
+ # install extlinux template
+ install -Dm755 ../extlinux.arch.template "$pkgdir/boot/extlinux/extlinux.arch.template"
+
+ # copy modules
+ cp -r lib "$pkgdir/usr/lib"
+
+ # copy kernel, bootlaoder can not load compressed kernels
+ ../extract-vmlinux "boot/vmlinuz-${_version}" > "$pkgdir/usr/lib/modules/$_version/vmlinuz"
+
+ # sed expression for following substitutions
+ local _subst="
+ s|%PKGBASE%|$_kernel|g
+ s|%KERNVER%|$_version|g
+ "
+
+ # install mkinitcpio preset file
+ sed "$_subst" ../linux.preset |
+ install -Dm644 /dev/stdin "$pkgdir/etc/mkinitcpio.d/$_kernel.preset"
+
+ # used by mkinitcpio to name the kernel
+ echo "$_kernel" | install -Dm644 /dev/stdin "$pkgdir/usr/lib/modules/$_version/pkgbase"
+}
+
+_package-bin-headers() {
+ pkgdesc="The Linux 5.x Kernelmakepkg Headers for Rockchip published by Radxa"
+ provides=("linux-headers=${pkgver}" "linux-rkbsp-headers")
+ conflicts=('linux-headers')
+
+ cd "$srcdir/debs"
+ local _version="$(<../version)"
+
+ # download & extract header deb
+ local _headersdeb=$(curl -Lk ${_repourl}db/packages.db | grep -oa "pool.*linux-headers-$_version.*\.deb" | sort -r | head -1)
+ curl -L "${_repourl}${_headersdeb}" -o headers.deb
+ ar x "headers.deb"
+ mkdir -p ../headers
+ tar -m -xf data.tar.xz -C ../headers
+ rm -rf *
+
+ cd "$srcdir/headers"
+
+ install -dm755 "$pkgdir/usr/lib/modules/$_version"
+ # copy headers
+ cp -r "usr/src/linux-headers-$_version" "$pkgdir/usr/lib/modules/$_version/build"
+
+ # add real version for building modules and running depmod from hook
+ echo "$_version" |
+ install -Dm644 /dev/stdin "$pkgdir/usr/lib/modules/$_version/build/version"
+}
+
+for _p in "${pkgname[@]}"; do
+ eval "package_$_p() {
+ $(declare -f "_package${_p#$_kernel}")
+ _package${_p#$_kernel}
+ }"
+done
diff --git a/extlinux.arch.template b/extlinux.arch.template
new file mode 100644
index 000000000000..0a540f869526
--- /dev/null
+++ b/extlinux.arch.template
@@ -0,0 +1,9 @@
+#timeout 10
+#menu title select kernel
+
+label Archlinux
+ kernel /vmlinuz-linux-radxa-rkbsp5
+ initrd /initramfs-linux-radxa-rkbsp5.img
+ devicetreedir /dtbs/linux-radxa-rkbsp5
+ fdtoverlays /dtbs/linux-radxa-rkbsp5/rockchip/overlays/rk3588-uart7-m2.dtbo
+ append root=UUID=CHANGEME earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 console=tty1 consoleblank=0 loglevel=0 panic=10 rootwait rw init=/sbin/init rootfstype=ext4 cgroup_enable=cpuset cgroup_memory=1 cgroup_enable=memory swapaccount=1 irqchip.gicv3_pseudo_nmi=0 switolb=1 coherent_pool=2M
diff --git a/extract-vmlinux b/extract-vmlinux
new file mode 100755
index 000000000000..15e8f7d0a8cd
--- /dev/null
+++ b/extract-vmlinux
@@ -0,0 +1,71 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+# ----------------------------------------------------------------------
+# extract-vmlinux - Extract uncompressed vmlinux from a kernel image
+#
+# Inspired from extract-ikconfig
+# (c) 2009,2010 Dick Streefland <dick@streefland.net>
+#
+# (c) 2011 Corentin Chary <corentin.chary@gmail.com>
+#
+# ----------------------------------------------------------------------
+
+check_vmlinux()
+{
+ # Use readelf to check if it's a valid ELF
+ # TODO: find a better to way to check that it's really vmlinux
+ # and not just an elf
+ case "$2" in
+ 0|"")
+ readelf -h $1 > /dev/null 2>&1 || return 1
+ ;;
+ 1)
+ # For ARCH like armel/armhf, vmlinux is not ELF, so we skip the check
+ ;;
+ esac
+
+ cat $1
+ exit 0
+}
+
+try_decompress()
+{
+ # The obscure use of the "tr" filter is to work around older versions of
+ # "grep" that report the byte offset of the line instead of the pattern.
+
+ # Try to find the header ($1) and decompress from here
+ for pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
+ do
+ pos=${pos%%:*}
+ tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
+ test $? -eq 0 && check_vmlinux $tmp 1
+ done
+}
+
+# Check invocation:
+me=${0##*/}
+img=$1
+if [ $# -ne 1 -o ! -s "$img" ]
+then
+ echo "Usage: $me <kernel-image>" >&2
+ exit 2
+fi
+
+# Prepare temp files:
+tmp=$(mktemp /tmp/vmlinux-XXX)
+trap "rm -f $tmp" 0
+
+# That didn't work, so retry after decompression.
+try_decompress '\037\213\010' xy gunzip
+try_decompress '\3757zXZ\000' abcde "unxz --single-stream"
+try_decompress 'BZh' xy bunzip2
+try_decompress '\135\0\0\0' xxx unlzma
+try_decompress '\211\114\132' xy 'lzop -d'
+try_decompress '\002!L\030' xxx 'lz4 -d'
+try_decompress '(\265/\375' xxx unzstd
+
+# Finally check for uncompressed images or objects:
+check_vmlinux $img
+
+# Bail out:
+echo "$me: Cannot find vmlinux." >&2
diff --git a/linux.preset b/linux.preset
new file mode 100644
index 000000000000..ca3832faa636
--- /dev/null
+++ b/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-%PKGBASE%.img"
+#default_options=""