Skip to content
Snippets Groups Projects

pmbootstrap init: kernel selection

Merged Imported Administrator requested to merge feature/1263-init-choose-kernel into master

Created by: ollieparanoid

Example output

[17:12:27] Device [qemu-amd64]: sony-amami
[17:12:29] Which kernel do you want to use with your device?
[17:12:29] Upstream kernels (mainline, stable, lts) get security updates, but may have less working features than downstream kernels.
[17:12:29] Available kernels (2):
[17:12:29] * downstream: Display and wifi works (see device table for details)
[17:12:29] * mainline: For kernel development only (most features aren't working)
[17:12:29] Kernel [downstream]:

Details

  • new config option "kernel" with possible values: "downstream", "mainline", "stable", "lts" (downstream is always linux-$devicename)
  • ask for the kernel during pmbootstrap init if the device package has kernel subpackages and install it in _install.py
  • postmarketos-mkinitfs: display note instead of exit with error when the deviceinfo_dtb file is missing (because we expect it to be missing for downstream kernels)
  • device-sony-amami:
    • add kernel subpackages for downstream, mainline
    • set deviceinfo_dtb
  • device-qemu-amd64: add kernel subpackages for stable, lts, mainline
  • test cases and test data for new functions
  • test case that checks all aports for right usage of the feature:
    • don't mix specifying kernels in depends and subpackages
    • 1 kernel in depends is maximum
    • kernel subpackages must have a valid name

Closes #1263 (closed). When this is merged, I will update the device specific package wiki page.

Merge request reports

Approval is optional

Merged by avatar (Mar 28, 2025 11:29pm UTC)

Merge details

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Author Owner

    also maybe add a testcase to check if one kernel is added at all if we're at it?

    Also I remembered, potentially different cmdlines are needed for different kernels (e.g. on mainline I use cma=64m msm.vram=16m and downstream console=ttyHSL0,115200,n8)

    By Luca Weiss on 2018-03-26T21:04:38

    Edited by Ghost User
  • Author Owner

    Created by: ollieparanoid

    also maybe add a testcase to check if one kernel is added at all if we're at it?

    Good idea!

    Also I remembered, potentially different cmdlines are needed for different kernels (e.g. on mainline I use cma=64m msm.vram=16m and downstream console=ttyHSL0,115200,n8)

    I have two solutions for this, and I recommend to pick the appropriate one when we hit this case:

    1. package the deviceinfo in the kernel subpackage, so we can have 2 versions (one for upstream kernels and one where we replace the kernel commandline with sed or something)
    2. add two kernel cmdline variables to the deviceinfo, one for upstream and one for downstream kernels.

    By * postmarketOS Bot on 2018-03-26T21:18:31

  • Author Owner

    Two deviceinfo packages would probably be better (or partial deviceinfo files??) as

    ==> kernel: appending device-tree qcom-msm8974-fairphone-fp2
    ==> initramfs: creating boot.img
    ERROR: File not found: /boot/dt.img, but
    'deviceinfo_bootimg_qcdt' is set. Please verify that your
    device is a QCDT device by analyzing the boot.img file
    (e.g. 'pmbootstrap bootimg_analyze path/to/twrp.img')
    and based on that, set the deviceinfo variable to false or
    adjust your linux APKBUILD to properly generate the dt.img
    file. See also: <https://postmarketos.org/deviceinfo>
    ERROR: postmarketos-mkinitfs-0.6.3-r0.trigger: script exited with error 1

    mainline is (of course) not qcdt...

    By Luca Weiss on 2018-03-26T21:20:46

  • Author Owner

    the term 'downstream' may be confusing to new folks, though I'm not sure what else to call it. Maybe have a short description in init.py stating that this is "typically an older kernel from Android" or something?

    By clayton craft on 2018-03-26T21:29:28

  • Author Owner

    Created by: ollieparanoid

    @z3ntu: See my answer above to the deviceinfo problem. Thoughts?

    @craftyguy: Good point. I've adopted the term from various talks on mainlining, which talk about upstream and downstream kernels. We could explain the term right above the "available kernels", would that work?

    By * postmarketOS Bot on 2018-03-26T21:34:23

  • Author Owner

    @ollieparanoid sound good :)

    By clayton craft on 2018-03-26T21:36:33

  • Author Owner

    @ollieparanoid FYI, also for the Samsung S5 I have different cmdline and QCDT should be set only for downstream kernel. Solution 1.) simple but the actual cmdline will be stored in the APKBUILD instead of the deviceinfo file. Solution 2.) Requires additional changes in the various commands using it What about a solution similar to 2. by having both lines in deviceinfo, e.g.:

    deviceinfo_kernel_cmdline_mainline="cma=64m msm.vram=16m"
    deviceinfo_kernel_cmdline_downstream="console=ttyHSL0,115200,n8"

    but in the subpackage installation just remove all the other lines and rename the variable to deviceinfo_kernel_cmdline? That way we can have a common logic between all the APKBUILDs

    By Daniele Debernardi on 2018-03-26T22:07:46

    Edited by Ghost User
  • Author Owner

    Created by: ollieparanoid

    @drebrez: Wow, that sounds like one really nice solution :tada:

    EDIT: The code to generate the new deviceinfo file from the one with the _mainline and _downstream variables could be part of the devicepkg-dev package which we have already.

    By * postmarketOS Bot on 2018-03-26T22:14:34

    Edited by Ghost User
  • Author Owner

    The change is going to be useful for Droid 4 as well, since currently it has downstream kernel packages, but there is mostly working mainline kernel for it. As for "downstream" term, another proporsal from me would be "vendor" kernel, as the sources usually come from device's vendor.

    By NotKit on 2018-03-27T20:47:16

    Edited by Ghost User
  • Author Owner

    Created by: ollieparanoid

    I've put @drebrez proposal into a new issue #1368 (closed) and addressed the review comments, as well as deleted the lts kernel (as discussed in IRC yesterday - we don't really use it, and updates come in about once a week which is a lot maintenance extra effort). If someone has time, it would be nice to review it again and test it. Thanks!

    By * postmarketOS Bot on 2018-03-27T20:54:33

  • Administrator
    Administrator @root started a thread on commit 7588262d
  • 1 _flavor=postmarketos-lts
  • Administrator
    Administrator @root started a thread on commit 7588262d
  • 29 35 "$subpkgdir"/etc/xdg/weston/weston.ini
    30 36 }
    31 37
    38 kernel_stable() {
    39 pkgdesc="Stable for everyday usage (recommended)"
    40 depends="linux-postmarketos-mainline"
  • Author Owner

    Created by: ollieparanoid

    @drebrez: thanks for finding these bugs, updated the PR!

    By * postmarketOS Bot on 2018-03-30T01:15:00

  • Author Owner

    @ollieparanoid I get another error: (device: soni-amami, kernel: mainline)

    drebrez@drebrez-pc:~/Development/pmbootstrap$ pmbootstrap initfs build
    [00:38:53] ERROR: list index out of range
      File "/home/drebrez/Development/pmbootstrap/pmb/__init__.py", line 61, in main
        getattr(frontend, args.action)(args)
      File "/home/drebrez/Development/pmbootstrap/pmb/helpers/frontend.py", line 170, in initfs
        pmb.chroot.initfs.frontend(args)
      File "/home/drebrez/Development/pmbootstrap/pmb/chroot/initfs.py", line 98, in frontend
        flavor = pmb.chroot.other.kernel_flavor_autodetect(args, suffix)
      File "/home/drebrez/Development/pmbootstrap/pmb/chroot/other.py", line 43, in kernel_flavor_autodetect
        return kernel_flavors_installed(args, suffix)[0]
    IndexError: list index out of range

    kernel_flavor_autodetect function seems broken: https://github.com/postmarketOS/pmbootstrap/blob/master/pmb/chroot/other.py#L37-L43

    By Daniele Debernardi on 2018-03-30T23:18:50

    Edited by Ghost User
  • Author Owner

    Created by: ollieparanoid

    @drebrez: Thanks for your incredible patience and for all the testing! \o/

    By * postmarketOS Bot on 2018-04-03T23:45:49

  • Please register or sign in to reply
    Loading