# Maintainer: Natanael Copa _flavor=vanilla pkgname=linux-${_flavor} pkgver=4.4.38 case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac pkgrel=0 pkgdesc="Linux vanilla kernel" url="http://kernel.org" depends="mkinitfs linux-firmware" makedepends="perl sed installkernel bash gmp-dev bc linux-headers" options="!strip" _config=${config:-config-vanilla.${CARCH}} install= source="http://ftp.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz gcc-default-pie.patch config-vanilla.aarch64 config-vanilla.armhf config-vanilla.x86 config-vanilla.x86_64 0001-Add-dts-for-GIGABYTE-X-Gene-MP30-AR0.patch " if [ "${pkgver%.0}" = "$pkgver" ]; then source="$source http://ftp.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/patch-$pkgver.xz" fi subpackages="$pkgname-dev" arch="all" license="GPL2" _abi_release=${pkgver} _carch=${CARCH} case "$_carch" in aarch64*) _carch="arm64" ;; arm*) _carch="arm" ;; esac HOSTCC="${CC:-gcc}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}" prepare() { local _patch_failed= cd "$srcdir"/linux-$_kernver if [ "$_kernver" != "$pkgver" ]; then msg "Applying patch-$pkgver.xz" unxz -c < "$srcdir"/patch-$pkgver.xz | patch -p1 -N || return 1 fi # first apply patches in specified order for i in $source; do case $i in *.patch) msg "Applying $i..." if ! patch -s -p1 -N -i "$srcdir"/$i; then echo $i >>failed _patch_failed=1 fi ;; esac done if ! [ -z "$_patch_failed" ]; then error "The following patches failed:" cat failed return 1 fi mkdir -p "$srcdir"/build cp "$srcdir"/$_config "$srcdir"/build/.config || return 1 make -C "$srcdir"/linux-$_kernver O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \ silentoldconfig } # this is so we can do: 'abuild menuconfig' to reconfigure kernel menuconfig() { cd "$srcdir"/build || return 1 make ARCH="$_carch" menuconfig cp .config "$startdir"/$_config } build() { cd "$srcdir"/build make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ || return 1 } package() { cd "$srcdir"/build mkdir -p "$pkgdir"/boot "$pkgdir"/lib/modules local _install case "$CARCH" in aarch64*|arm*) _install="zinstall dtbs_install" ;; *) _install="install" ;; esac make -j1 modules_install firmware_install $_install \ ARCH="$_carch" \ INSTALL_MOD_PATH="$pkgdir" \ INSTALL_PATH="$pkgdir"/boot \ INSTALL_DTBS_PATH="$pkgdir"/usr/lib/linux-${_abi_release} \ || return 1 rm -f "$pkgdir"/lib/modules/${_abi_release}/build \ "$pkgdir"/lib/modules/${_abi_release}/source rm -rf "$pkgdir"/lib/firmware install -D include/config/kernel.release \ "$pkgdir"/usr/share/kernel/$_flavor/kernel.release } dev() { # 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 # # this way you dont need to install the 300-400 kernel sources to # build a tiny kernel module # pkgdesc="Headers and script for third party modules for grsec kernel" depends="gmp-dev bash" 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"/$_config "$dir"/.config make -j1 -C "$srcdir"/linux-$_kernver O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \ silentoldconfig prepare modules_prepare scripts # remove the stuff that poits to real sources. we want 3rd party # modules to believe this is the soruces rm "$dir"/Makefile "$dir"/source # copy the needed stuff from real sources # # this is taken from ubuntu kernel build script # http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-jaunty.git;a=blob;f=debian/rules.d/3-binary-indep.mk;hb=HEAD cd "$srcdir"/linux-$_kernver find . -path './include/*' -prune -o -path './scripts/*' -prune \ -o -type f \( -name 'Makefile*' -o -name 'Kconfig*' \ -o -name 'Kbuild*' -o -name '*.sh' -o -name '*.pl' \ -o -name '*.lds' \) | cpio -pdm "$dir" cp -a drivers/media/dvb/dvb-core/*.h "$dir"/drivers/media/dvb/dvb-core cp -a drivers/media/video/*.h "$dir"/drivers/media/video cp -a drivers/media/dvb/frontends/*.h "$dir"/drivers/media/dvb/frontends cp -a scripts include "$dir" find $(find arch -name include -type d -print) -type f \ | cpio -pdm "$dir" install -Dm644 "$srcdir"/build/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 } md5sums="9a78fa2eb6c68ca5a40ed5af08142599 linux-4.4.tar.xz 736b1cec515210eee8ec243c910a4be2 gcc-default-pie.patch fb219ff405db2d34ab1f7d052d2d2fbb config-vanilla.aarch64 ec4bd577f32f24143def18f66c59bb18 config-vanilla.armhf 95a504ec4ded3a581f6d2a7b43547d30 config-vanilla.x86 7bd6f86ea0e2854278e782805aa63dd7 config-vanilla.x86_64 e10e580b7aadf42ba595e35d3ff3fc69 0001-Add-dts-for-GIGABYTE-X-Gene-MP30-AR0.patch c0233a162dfd6403c828abc86b69a062 patch-4.4.38.xz" sha256sums="401d7c8fef594999a460d10c72c5a94e9c2e1022f16795ec51746b0d165418b2 linux-4.4.tar.xz bc2a20a2fb42480cf09f1b240435396707fd08ae2cf9ec16be9953e922a40187 gcc-default-pie.patch 4bcde0ce497ef057006dd98915aab5797eab0a84598aad03260e3a3f4413f572 config-vanilla.aarch64 223d31ce209e61a299ac314340cb82ebbe1c18167a09dedff317f0c4bee2d6a9 config-vanilla.armhf 11e71593580afb5087614c7e0c18f7ab7e773abeb14837c2b56e8c374df73b77 config-vanilla.x86 4dde03d7f4a4155bfd5981cdb8c2ec6c87f8e01dd17971767c200fe95bc45521 config-vanilla.x86_64 b9bcbe11c017764075179fb61fb13f6d0eca2c5495402d8f4ace2331cfe0c0b4 0001-Add-dts-for-GIGABYTE-X-Gene-MP30-AR0.patch 48ec169c7adda820973b3cb9c4c91c72bb69c86f530d149065491a20ef0c4057 patch-4.4.38.xz" sha512sums="13c8459933a8b80608e226a1398e3d1848352ace84bcfb7e6a4a33cb230bbe1ab719d4b58e067283df91ce5311be6d2d595fc8c19e2ae6ecc652499415614b3e linux-4.4.tar.xz e0ce6bee9bca8bc6486df3f88e38c3177983be176249146e7e1135ef322e25357b12cbe67bf8cec9bab88911ec866a100b2e623337175bdeb94ea05fa14bd714 gcc-default-pie.patch 897b4b7d4dc2b5a72f4497283d5b90336e6097e79872325255296c01498389c883f1a266f8732833ab492936fbdb1d32606b0c8e67136c7b90268352b56e8cad config-vanilla.aarch64 2e8711861f7765cb35f70b905dc40189b1436afca11b35b3000a426d4c1afed2d9028ef71589e37340ed0c0e5e12abe45375d122712dec47d2edc0df7ea73faf config-vanilla.armhf 7cec58789a99e6b9f929667ff5516574ec1938cf3c00d8227a4eab910efedcc54514d6a83110e57a946ab59aace33774fbccc892a85ef20cfbe51431b9988607 config-vanilla.x86 d46691e2ed91b07ea4dda57d5939fb596e46b2d14be1e13ab79e9c669893c8848a308a9508d103c9d33f9a824678597e1020f04db1a21c431b0159f1d33586fa config-vanilla.x86_64 ebc1b89ff0985246889f68c32fb0bd326eb0f015a97b913bf8e2b92855c75809d114c57aff8f3f74d120694f1c5891d7a11ebe4aadaadd1954a947e762bf121d 0001-Add-dts-for-GIGABYTE-X-Gene-MP30-AR0.patch 38ba64e67b12d922da9d8aa278336009f6a798ac5ff127a9d9b87b872606d23b22d21bea63af21cccdc661cb24e9cbaa8d975f47d5ffae408fa9b3092cac15d4 patch-4.4.38.xz"