# APKBUILD based on linux-vanilla aport. Changes: # - disabled module installation # - add !check !tracedeps # - package: just install zimage and kernel.release, because the kernel config # does not generate modules or dtb files # - do not create -dev subpackage (makes no sense without module support) # # Kernel config based on: arch/arm/configs/lineageos_mako_defconfig # Changes: # - enable devtmpfs (needed for udev -> touch support in weston) _vendor=nokia _flavor=nokia-rx51 _hash="7b6fbfd899b4133e4f789843e5967beb139ec4d2" _config="config-${_flavor}.armhf" pkgname=linux-${_flavor} pkgver=4.12.2 case $pkgver in *.*.*) _kernver=${pkgver%.*};; *.*) _kernver=$pkgver;; esac pkgrel=1 arch="armhf" pkgdesc="Mainline Linux for the Nokia N900" url="https://github.com/pali/linux-n900" depends="postmarketos-mkinitfs" makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev uboot-tools" options="!strip !check !tracedeps" install= source=" https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-"$pkgver".tar.xz $_config " subpackages="" license="GPL2" _abi_release=${pkgver} _carch="arm" HOSTCC="${CC:-gcc}" HOSTCC="${HOSTCC#${CROSS_COMPILE}}" ksrcdir="$srcdir/linux-$pkgver" prepare() { local _patch_failed= cd "$ksrcdir" # 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 "$ksrcdir" 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 unset LDFLAGS make ARCH="$_carch" CC="${CC:-gcc}" \ KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \ CFLAGS_MODULE=-fno-pic \ zImage modules omap3-n900.dtb \ || return 1 } package() { cd "$srcdir/build/arch/arm/boot" cat zImage dts/omap3-n900.dtb > zImage-dtb mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n postmarketos -d zImage-dtb uImage install -Dm644 "$srcdir/build/arch/arm/boot/uImage" \ "$pkgdir/boot/uImage" install -Dm644 "$srcdir/build/arch/arm/boot/zImage-dtb" \ "$pkgdir/boot/vmlinuz-$_flavor" install -Dm644 "$srcdir/build/arch/arm/boot/dts/omap3-n900.dtb" \ "$pkgdir/boot/omap3-n900.dtb" install -D "$srcdir/build/include/config/kernel.release" \ "$pkgdir/usr/share/kernel/$_flavor/kernel.release" cd "$srcdir"/build make -j1 modules_install firmware_install \ ARCH="$_carch" \ INSTALL_MOD_PATH="$pkgdir" \ || return 1 } sha512sums="683ff447607e1f10af81a539aae8620964173f61fc9fc69b8e108bfdfd49358cc1f5b04a5bd31efcb299f66fac9df2750f92a18ea1b9264a9f0e76d2759b66e9 linux-4.12.2.tar.xz 1343375a4709076080022899a7bb5fd7a583c3a7327b438c1fbec90c6005ceaca9591e8d8f83ea78130d53fda08392c7f19037063caa8f25f79a7166ce45cec3 config-nokia-rx51.armhf"