Add envkernel.sh: instant mainlining environment
Created by: ollieparanoid
Thanks to @Decatf for the idea of aliasing make
!
CC: @bhush9, @julian-goldsmith, @pavelmachek, @filippz, @flacks, @fourkbomb, @opendata26
Usage example
$ cd ~/code/linux
$ source ~/code/pmbootstrap/helpers/envkernel.sh
Initializing Alpine chroot (details: 'pmbootstrap log')
pmbootstrap envkernel.sh activated successfully.
* kernel source: /home/user/code/linux
* output folder: /home/user/code/linux/.output
* architecture: arm (samsung-i9100 is armhf)
* aliases: make, kernelroot, pmbootstrap, pmbroot (see 'type make' etc.)
$ type make
make is an alias for echo '*** pmbootstrap envkernel.sh active for /home/user/code/linux! ***'; pmbootstrap -q chroot -- ARCH=arm CROSS_COMPILE=/usr/bin/armv6-alpine-linux-muslgnueabihf- make -C /mnt/linux O=/mnt/linux/.output
Notes
-
make menuconfig
works as well - Sourcing was tested with
zsh
andbash
, it should be easy to extend for other shells
Changes
- new action
pmbootstrap work_migrate
: does the interactive work folder migration if necessary, otherwise it doesn't output anything- when calling this first, we can safely use all other commands non-interactively without showing the output
-
helpers/envkernel.sh
:- installs everything needed for kernel compilation in the native chroot
- mounts the kernel source to
/mnt/linux
inside the chroot - creates
/mnt/linux/.output
and chowns it to thepmos
user, that folder will be used for the kernel build output - sets up aliases for
make
,pmbootstrap
,pmbroot
,kernelroot
Benefits
- Fast setup (especially for people who are new to kernel
compilation)
- No need to figure out distribution specific package names (cross compilers!)
- No need to do a test build just to verify that the right packages are installed
- Less error prone
- The right dependencies are always installed
-
ARCH
andCROSS_COMPILE
variables always get set automatically and based ondeviceinfo_arch
- If the build environment is broken for some reason, just zap and start over
- Easy to reproduce problems
How to test
- Source the script like shown above, then compile a full kernel
@MartijnBraam: I've used the SPDX license header here as you recommended in #postmarketOS-offtopic the other day. +1 for deploying that for the entire code base.
Closes #1356 (closed)