Skip to content

pmbootstrap build --src: override source for any package

postmarketOS Bot requested to merge feature/1041-kernel-local-git-repo into master

Created by: ollieparanoid

This is outdated, updated version below.

Closes #1041 (closed). CC: @ata2001, @bhush9, @drebrez, @filippz, @flacks, @fourkbomb, @opendata26, @pavelmachek, @z3ntu

Changes

  • pmbootstrap init allows to specify a local linux kernel repository
  • New --local-src parameter for pmbootstrap build: pmbootstrap build linux-postmarketos-mainline --arch=armhf --local-src
    • Mounts the kernel source to /mnt/pmbootstrap-local-src inside the chroot
    • exports PMB_LOCAL_SRC=/mnt/pmbootstrap-local-src to abuild
  • pmb/helpers/frontend.py: Verifies, that the packages passed to pmbootstrap build use PMB_LOCAL_SRC when --local-src is specificed and raise an exception if they don't
  • linux-postmarketos-mainline APKBUILD adjustments:
    • update linux-v4.14-v4.15-rc6.patch checksum to upstream (they probably updated their git/patch tool, which caused a different checksum)
    • fetch(): don't download anything when using --local-src
    • unpack(): don't extract anything, but create a link to $PMB_LOCAL_SRC if it is specified
    • prepare(): don't apply any patches to the kernel source folder when using --local-src
    • package(): change the pkgdesc when using --local-src

Workflow

Initial setup:

$ pmbootstrap init # select any device, configure kernel repo path
$ pmbootstrap install

Regular testing:

$ pmbootstrap build --force --local-src --arch=armhf linux-postmarketos-mainline
$ pmbootstrap chroot -r -- apk del linux-postmarketos-mainline
$ pmbootstrap chroot -r -- apk add linux-postmarketos-mainline # rebuilds initfs, boot.img, ...
$ pmbootstrap flasher --flavor=postmarketos-mainline boot

The del, add could be made smoother in a future PR (unless someone has an idea how to do it in this one easily), but with this PR we have a first version where it's possible to build kernel trees from a local folder.

@z3ntu: regarding clean up or not: the way the APKBUILD worked already, a "build" folder gets created, in which the actual compilation takes place. we don't keep that during builds (could be implemented if necessary), but we have ccache which already makes it a lot faster. We need such a folder anyway, because the pmos user we use to build does not have permissions to write into the (outside-of-pmbootstrap) user's folder.

Merge request reports