PINE64
kernel build script for latest mainline manjaro kernel - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: Pinebook Pro Tutorials (https://forum.pine64.org/forumdisplay.php?fid=117)
+--- Thread: kernel build script for latest mainline manjaro kernel (/showthread.php?tid=8968)

Pages: 1 2 3 4 5


kernel build script for latest mainline manjaro kernel - xmixahlx - 01-30-2020

greetings,

included is a kernel build script, and dependencies debian-based systems (and you can modify for other systems easily... ).

this fetches the tsys/manjaro *v5.7* branch from the manjaro git, applies a config of your choice, preps, builds, and debianizes a custom kernel. build time is about 90min for the pbp, or ?min via crossbuilding. (for me is ~10min.)

you can also choose any branch in the manjaro git by changing the VAR.

enjoy!


SCRIPT
script now part of pbp-tools. see other forum thread for details.
https://github.com/xmixahlx/pbp-tools
https://forum.pine64.org/showthread.php?tid=10190


RE: kernel build script for tsys kernel - xmixahlx - 01-30-2020

v5.5 branch working well. script updated. thank you @tsys !

Linux pbp-deb-arm64-emmc 5.5.0-1-pinebookpro-arm64-custom+ #1 SMP PREEMPT Thu Jan 30 13:38:40 PST 2020 aarch64 GNU/Linux


RE: kernel build script for latest mainline manjaro kernel - xmixahlx - 02-19-2020

crosscompile pbp kernel script: (configure VARS for your own usage)
Quote:#!/bin/sh
### LINUX-PINEBOOK-PRO-GIT-CROSSCOMPILE v0.20200607.1701
# execute in clean kernel source directory after placing your .config and applying any patches
## VARS
BUILDCONFIG="ARCH=arm64 CROSS_COMPILE=aarch64-none-linux-gnu-"
KERNELCONFIG="INITRD=yes KBUILD_IMAGE=arch/arm64/boot/Image"
GCCARMDIR=/usr/local/linaro-arm-gcc9
NPROC=10
TCPU=cortex-a72.cortex-a53
TOPTS=+crypto+crc
TARCH=armv8-a
## USE LINARO ARM GCC
# https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
# https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz
# untar to GCCARMDIR
export PATH=$GCCARMDIR/bin:$PATH
## CONFIGURE
make -j $NPROC $BUILDCONFIG oldconfig
make -j $NPROC $BUILDCONFIG menuconfig
## BUILD
KCFLAGS="-O2 -pipe -march=$TARCH$TOPTS -mcpu=$TCPU -mtune=$TCPU" \
KCPPFLAGS="-O2 -pipe -march=$TARCH$TOPTS -mcpu=$TCPU -mtune=$TCPU" \
make -j $NPROC $BUILDCONFIG $KERNELCONFIG bindeb-pkg
## EXIT
exit
## INSTALL
# move to pinebook pro and install manually via dpkg
## ENJOY



RE: kernel build script for latest mainline manjaro kernel - xmixahlx - 02-19-2020

a note about big cores: you can either disable the noted erratum, or remove maxcpus=4 from your u-boot defaults.


RE: kernel build script for latest mainline manjaro kernel - xmixahlx - 03-16-2020

tsys has focused development on the 5.6 branch of late, including the pinebook dts and cw2015 battery kernel module. recommend using either the 5.6 branch (dev) or master (stable) depending on your interests.

you may want to apply the hantro patches from the hantro-h264 branch for testing, which are rebased from libreelec and described in the mainline hwaccel thread.
https://gitlab.manjaro.org/tsys/linux-pinebook-pro/-/commit/30991bc414cf575816bcd76bec746bd7dce917e0.patch

you may want to apply the latest 5.6 rc patch if not yet applied to the v5.6 branch, i.e. 5.6-rc6 from https://www.kernel.org:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/rawdiff/?id=v5.6-rc6&id2=v5.6-rc5


RE: kernel build script for latest mainline manjaro kernel - Dendrocalamus64 - 03-22-2020

Trying to build on the stock Debian+Mate which is stretch rather than sid.

Needed additional packages: bison fakeroot flex libssl-dev

Also kernel-package has to be got from stretch-backports as it's not in stretch.
https://backports.debian.org/Instructions/

Now dying with "gcc: error: unrecognized command line option '-mgeneral-regs-only' "

That is an option understood only by the aarch64 compiler, and stock uses debian armhf rather than arm64.
So that would need an armhf->arm64 cross-compile, or building the kernel with a different selected arch, I suppose.
And I'll look at that more later, I'm out of time for now.


RE: kernel build script for latest mainline manjaro kernel - xmixahlx - 03-22-2020

no reason to build your own mainline kernel with the mrfixit2001 debian os. it is hacked together for the 4.4.x rockchip kernel.

either crossbuild or install multiarch on an armhf system.

debian stable armhf with mainline kernel works great, tho. i have this as an sdcard install for testing. uses same kernel as arm64.


RE: kernel build script for latest mainline manjaro kernel - Dendrocalamus64 - 03-22-2020

I need to build some kernel so I can get the matching linux-headers package so I can build WireGuard.


RE: kernel build script for latest mainline manjaro kernel - xmixahlx - 03-22-2020

oh, you can probably fake this with a git clone of the repository. i have this enabled in my mainline kernel package, although it is untested.


RE: kernel build script for latest mainline manjaro kernel - Dendrocalamus64 - 03-23-2020

Yup, according to this,
https://www.kernel.org/doc/html/latest/kbuild/modules.html

one can prepare the kernel source tree for building external modules without actually having to build the kernel, with the make target modules_prepare.

Multiarch,
https://wiki.debian.org/Multiarch/HOWTO

only supports parallel versions of libraries, not applications, so I'd have to remove some amount of the armhf build environment. Don't know yet if a mix of armhf & arm64 would work for general purposes.

For cross-compiling the kernel, one needs binutils-aarch64-linux-gnu and gcc-aarch64-linux-gnu, and those are only available for x86 in the Debian repositories.

So, I used this Raspberry Pi Howto to build minimal versions of both from source:
https://www.tal.org/tutorials/raspberry-pi3-build-64-bit-kernel
(It needed package 'texinfo' in addition to the dependencies in the howto)

Next is to clone MrFixit's kernel, identify the right commit to checkout that matches the running kernel (looks like 209da1a), and modules_prepare that. I'll continue the drama in my thread since it's starting to get off-topic for manjaro mainline.