kernel build script for latest mainline manjaro kernel
#1
greetings,

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

this fetches the tsys/manjaro *v5.6* 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. crossbuild script in later post.

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

remove maxcpus=4 from your u-boot config in /etc/default/u-boot

enjoy!

p.s.1 if you require additional package requirements please add those in your reply and i'll add to the script for others to benefit.

p.s.2 success reports and/or feedback welcome.

dependencies
Quote:sudo apt-get -y  install ncurses-dev make kernel-package build-essential git wget

build script
Quote:#!/bin/sh

### v0.20200316.1538
### COMPILE PBP KERNEL FROM MANJARO GIT

# VARS
DEVDIR=~/Development/UPSTREAM/PBP
GITTREE=linux-pinebook-pro
GITBRANCH=v5.6
PKGDIR=$DEVDIR/$GITTREE

# GIT CLONE
mkdir -p $DEVDIR;
cd $DEVDIR;
git clone --depth=1 --branch=$GITBRANCH https://gitlab.manjaro.org/tsys/$GITTREE.git;

# GIT UPDATE (RERUN)
cd $PKGDIR;
git clean -f && git reset --hard && git pull;

# CLEAN (RERUN)
make mrproper;

# USE DEFCONFIG
# if you want to reconfigure for some reason...
# cp arch/arm64/configs/pinebook_pro_defconfig .config;

# USE DANIELT CONFIG
# rm zbnV33Ey;
# wget https://pastebin.com/raw/zbnV33Ey;
# mv zbnV33Ey .config;

# USE XMIXAHLX CONFIG
# if you want (less) work in make oldconfig
# 5.5-rc7: iALkBwDi
# 5.5: 88HC0d6e
# 5.6-rc6: 7zNv5YSD
rm .config;
wget https://pastebin.com/raw/7zNv5YSD -O .config;

# OLDCONFIG
# important: do NOT enable ARM64_ERRATUM_1319367 or your big cores won't work!
# you should see in your processed config: # CONFIG_ARM64_ERRATUM_1319367 is not set
make oldconfig;

# MAKE MENUCONFIG (MOSTLY OPTIONAL)
# you probably want to change LOCALVERSION under General to something else
make menuconfig;

# BUILD
make -j6 INITRD=yes KBUILD_IMAGE=arch/arm64/boot/Image bindeb-pkg;

# EXIT
exit

# INSTALL
# sudo dpkg -i linux-image*.deb
# reboot
# enjoy
  Reply
#2
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
  Reply
#3
crosscompile pbp kernel script:
Quote:#!/bin/sh

### v0.20200216.1614
### CROSSCOMPILE PBP KERNEL
###
### 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-soft.../downloads
## https://developer.arm.com/-/media/Files/...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
  Reply
#4
a note about big cores: you can either disable the noted erratum, or remove maxcpus=4 from your u-boot defaults.
  Reply
#5
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-pi...17e0.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/ker...2=v5.6-rc5
  Reply
#6
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.
  Reply
#7
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.
  Reply
#8
I need to build some kernel so I can get the matching linux-headers package so I can build WireGuard.
  Reply
#9
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.
  Reply
#10
Yup, according to this,
https://www.kernel.org/doc/html/latest/k...dules.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-...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.
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  mesa-git build script for latest panfrost xmixahlx 27 2,726 05-31-2020, 09:04 PM
Last Post: xmixahlx
  Installing WPS Office on Manjaro brent.thierens 2 307 05-27-2020, 09:49 AM
Last Post: brent.thierens
  full disk encryption with luks on manjaro xfce limxr 39 1,927 05-24-2020, 12:04 AM
Last Post: e-minguez
  Instructions for Installing VS Code on Manjaro clover 4 743 05-23-2020, 07:54 AM
Last Post: e-minguez
  QGroundcontrol on Manjaro chaoskampf 0 98 04-06-2020, 05:12 PM
Last Post: chaoskampf
  How to boot Manjaro from NVME with uboot on eMMC as400 43 2,231 03-28-2020, 10:26 AM
Last Post: stoelpi
  sway-git build script for latest wayland wm xmixahlx 2 468 03-27-2020, 02:46 PM
Last Post: xmixahlx
  openarena build script xmixahlx 4 264 03-20-2020, 10:25 PM
Last Post: xmixahlx
  How to get kernel boot messages on screen on Manjaro as400 2 263 01-23-2020, 04:35 PM
Last Post: as400
  Manjaro XFCE: Enable Natural Scrolling (Reverse scrolling direction) kiddailey 0 257 01-22-2020, 08:10 PM
Last Post: kiddailey

Forum Jump:


Users browsing this thread: 1 Guest(s)