Add linux package

This commit is contained in:
Alex D. 2021-07-21 20:10:59 +00:00
parent aff29ea948
commit 99214c1e9c
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
13 changed files with 72566 additions and 0 deletions

221
kernel/linux/APKBUILD Normal file
View File

@ -0,0 +1,221 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
_kernver=5.10
_kernpatch=52
pkgname=linux
pkgver=$_kernver.$_kernpatch
pkgrel=0
arch="noarch"
subpackages="
$pkgname-headers:_headerspkg:$CBUILD_ARCH
"
_configs="
config-full.aarch64
config-full.armv7
config-full.mips64
config-full.ppc64le
config-full.x86
config-full.x86_64
config-virt.aarch64
config-virt.armv7
config-virt.ppc64le
config-virt.s390x
config-virt.x86
config-virt.x86_64
"
source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$pkgver.tar.xz
$_configs
"
_archflavors() {
for i in $_configs; do
local _nocfg="${i#config-}"
local _arch="${_nocfg#*.}"
local _flavour="${_nocfg%.*}"
[ "$_arch" == "$CARCH" ] && echo "$_flavour"
done
}
for i in $(_archflavors); do
subpackages="
$subpackages
$pkgname-$i:_flavorpkg:$CBUILD_ARCH
$pkgname-$i-dev:_devpkg:$CBUILD_ARCH
"
done
_depends_dev="
perl
gmp-dev
elfutils-dev
bash
flex
bison
"
makedepends="
$_depends_dev
sed
installkernel
bc
linux-headers
linux-firmware-any
openssl-dev
diffutils
findutils
"
pkgdesc="Linux Kernel - Metapackage"
url="https://www.kernel.org"
license="GPL-2.0"
options="!strip"
builddir="$srcdir/"
_carch=${CARCH} # abuild to kernel arch mapping
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
mips*) _carch="mips" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
export KBUILD_BUILD_TIMESTAMP="$(date -Ru${SOURCE_DATE_EPOCH:+d @$SOURCE_DATE_EPOCH})"
prepare() {
default_prepare
for i in $(_archflavors); do
local _builddir=
local _config="config-$i.$CARCH"
for _builddir in "$srcdir/build-$i.$CARCH" "$srcdir/build-$i-dev.$CARCH"; do
mkdir -p "$_builddir"
echo "-$pkgrel-$i" > "$_builddir"/localversion-alpine \
|| return 1
cp "$srcdir"/"$_config" "$_builddir"/.config
make -C "$srcdir"/"linux-$pkgver" \
O="$_builddir" \
ARCH="$_carch" \
listnewconfig oldconfig
done
done
}
build() {
unset LDFLAGS
for i in $(_archflavors); do
# Build kernel and modules
msg "Building $i for $CARCH"
cd "$srcdir"/"build-$i.$CARCH"
make \
ARCH="$_carch" \
CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine"
# Build out-of-tree builder
msg "Building $i=dev for $CARCH"
cd "$srcdir"/"build-$i-dev.$CARCH"
make syncconfig \
O="$_outdir" \
ARCH="$_carch"
make prepare \
O="$_outdir" \
ARCH="$_carch"
make modules_prepare \
O="$_outdir" \
ARCH="$_carch"
make scripts \
O="$_outdir" \
ARCH="$_carch"
done
}
package() {
mkdir -p "$pkgdir"
}
_flavorpkg() {
local _buildflavor="${subpkgname##$pkgname-}" _outdir="$subpkgdir"
local _abi_release="$pkgver-$pkgrel-$_buildflavor"
cd "$srcdir"/"build-$_buildflavor.$CARCH"
mkdir -p "$_outdir"/boot "$_outdir"/lib/modules
local _install
case "$CARCH" in
arm*|aarch64) _install="zinstall dtbs_install";;
*) _install=install;;
esac
# Install kernel
make "$_install" \
ARCH="$_carch" \
INSTALL_PATH="$_outdir"/boot \
INSTALL_DTBS_PATH="$_outdir/boot/dtbs-$_buildflavor"
# Install modules
make modules_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$_outdir"
# Remove incorrect build-time symlinks
rm -f "$_outdir"/lib/modules/"$_abi_release"/build \
"$_outdir"/lib/modules/"$_abi_release"/source
rm -rf "$_outdir"/lib/firmware
install -D -m644 include/config/kernel.release \
"$_outdir"/usr/share/kernel/"$_buildflavor"/kernel.release
}
_devpkg() {
depends="$_depends_dev"
local _pkgnodev="${subpkgname%-dev}"
local _buildflavor="${_pkgnodev##$pkgname-}"
local _config="config-$_buildflavor.$CARCH" _abi_release="$pkgver-$pkgrel-$_buildflavor"
local _outdir="$subpkgdir/usr/src/linux-headers-$_abi_release" _builddir="$subpkgdir/lib/modules/$_abi_release"
mkdir -p "$_outdir"
cd "$srcdir"/"build-$_buildflavor-dev.$CARCH"
cp -a . "$_outdir"
mkdir -p "$_builddir"
ln -sf "$_outdir" "$_builddir"/build
}
_headerspkg() {
local _outdir="$subpkgdir/usr"
cd "$srcdir"/"linux-$pkgver"
mkdir -p "$_outdir"
make headers_install \
ARCH="$_carch" \
INSTALL_HDR_PATH="$_outdir"
rm -f **/.install **/install.cmd
rm -rf "$subpkgdir/usr/include/drm" # provided by libdrm-dev
}
sha512sums="
37262e3793ed433ee619e7b08c0ab64d34bbc66e29229025ada498edf45ab2c870569c0a3b17f026379c67153f277e90e1b301c95711638645bde025230201ef linux-5.10.52.tar.xz
7ae670f2dbbdec616becce3944fe190a797a19346b4fa266deae71d4c1ccd7b0e60e400bde47d32261cb15c1b2f1579a2848adace3397d82552c52bff1421f0a config-full.aarch64
84aaad1001be4e55c5885dcf27a4647028319123bf54195f8c1233287bec9c890dbb131920976e950136d5eacc7ff153fc9ad305cfd0ca28fd0194a263e8be4f config-full.armv7
0caf98dec1162b1ba4e4bb4e198d0a34e59ac022532d562961cf9b22cbdb930675ff3a845bb17ddff83b91a84ad61df9d607f175c34133916e0a3cdbb4c13786 config-full.mips64
35b8424024af2fdcd93a8f2062f6b55bdfe65daf4d0a160e5b217df122dbb1727ef899636ba18d063af0e0c02a5bd57ba414466264f82c4525dd20e54d6b4b82 config-full.ppc64le
35bce78364f269e5e1fa07d36614a0204b4e180239a83d793e118c461eaf0e305e4ed3821bcfa8be128b79bf1837be5248c13c44817c8038cd80806dfb06525c config-full.x86
6984f5fa18a0b15929b80f5480072c40cf153b96e1fbb9adf626fc9707cd2df2b702d5925fecd32362c02b28b9109c603ce520d26924105f4f9513b309949d47 config-full.x86_64
078e2b8ac688c79728c388f6cd87633b7835f19a5b3842b8ab97ef961d8b537e377e4acef4c0e65d94a686525a345586d9c31898c37a75075b5c0e5c8b6db748 config-virt.aarch64
3ce5419983ec07d3ae525fed81f26bc4b08e829d5128d6fb76d2ee707343c1ed1efbc03ca53910d406a4c6d303a01e3d2eed8af5257e134083434de0ccede5eb config-virt.armv7
287cf039eb8a5df7844559812f9eb5cb0ce41bd47c96132e3d234d2a2b28a883cd59d7964682a530da2e482d49e2bb94601e84085cac0b631c7bf858b4f3f7c6 config-virt.ppc64le
e2657b50b1844710cc29b545e4b560b7b79827b9005c6b1ccc7e5c89de31ce0a2a169407b0bff1e3cd9a1bcaa88745c149092d45029ca13bcc2b56a2b6d77ac6 config-virt.s390x
3eba52caf34ec45f0cdaa2606643b98f46f8a19251ea3ab9d6fbe9def714674c28388be825dddeed4085eda865c63d321884ad435529b14f0fb04310d7275b31 config-virt.x86
acc7f183a6773d3de0e10c808cbfadb7b54b6f9fcf891234473adef449f87e04a486ed6ec3fae106d0ff10f0c4bc3224971319aeba03fbcaafb1590e89c5ae84 config-virt.x86_64
"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

8983
kernel/linux/config-full.x86 Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4690
kernel/linux/config-virt.x86 Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff