Commit Graph

113 Commits

Author SHA1 Message Date
Bart Ribbers 1eef7fbdeb
pmb.parse.kconfig: implement UEFI kconfig check (MR 2169) 2022-03-16 09:25:00 +01:00
jenneron 7b2ffc3e5f
Support ChromeOS partition table and kernel partition (MR 2163)
Stock bootloader on these devices boots kernel (it is intended to boot
kernel, but i place secondary bootloader there) from special ChromeOS
kernel partition on special GPT which is created with cgpt utility.
This MR adds initial support for it introducing new deviceinfo options:

- cgpt_kpart - path to file to be flashed to ChromeOS partition;
- cgpt_kpart_start - offset from the start in sectors;
- cgpt_kpart_size - partition size in sectors.

For example:

deviceinfo_cgpt_kpart="/usr/share/u-boot/google-peach-pit/u-boot-dtb.img.kpart"
deviceinfo_cgpt_kpart_start="8192"
deviceinfo_cgpt_kpart_size="32768"

cgpt requires start and size values of partition, so these values
are calculated for each partition.

Reserved size and on-device installer are not yet supported.

Reference: https://archlinuxarm.org/platforms/armv7/samsung/samsung-chromebook
2022-02-20 14:49:56 +01:00
Mark Hargreaves ff0942b12d
pmbootstrap kconfig check: add netboot check (MR 2064)
Allow checking for the necessary kernel option for netboot.

Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
2022-01-20 22:29:46 +01:00
Mark Hargreaves 47539f1bef
pmb/netboot: new feature (MR 2064)
pmbootstrap netboot command exposes the generated vendor-codename.img
rootfs through nbd interface so that device can mount it and boot
postmarketOS without having any storage medium at all.

Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
2022-01-20 22:29:41 +01:00
Oliver Smith 6f6a3b0408
Happy new year 2022! 2022-01-02 22:39:14 +01:00
BO41 379991aa62
pmb.parse.apkindex.parse: remove unused args argument (MR 2136) 2021-11-27 14:13:33 +01:00
BO41 99bed38272
pmb.parse.apkbuild: remove unused args argument (MR 2136) 2021-11-27 14:13:33 +01:00
Oliver Smith aead36d5ac
pmbootstrap kconfig check: add iwd check (MR 2133)
iwd seems like a promising alternative to wpa_supplicant. It uses crypto
implementations from the kernel, so let's make kconfig check aware of
the options it needs.
2021-11-06 14:28:53 +01:00
Oliver Smith 93e7a1d876
pmbootstrap kconfig check: add apparmor check (MR 2133)
SECURITY_APPARMOR_BOOTPARAM_VALUE was required to enable it by default
until 5.1 where the option was removed.

Related: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0102fb83f90050b86ce37aec810ea17bb4448e0c
Related: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/security/Kconfig?id=fe91c4725aeed35023ba4f7a1e1adfebb6878c23#n285
2021-11-06 14:28:53 +01:00
bo41 caf7973e24
args.arch_native: remove (MR 2130)
Replace "args.arch_native" with the direct function call in order to
avoid passing "args" to all functions. This is a step to get rid of this
args-passed-to-all-functions pattern in pmbootstrap.
2021-10-24 14:34:30 +02:00
bo41 a8d425554c
remove unused args argument (MR 2130) 2021-10-24 14:34:26 +02:00
BO41 944f539dd6
args.logfd: remove (MR 2114)
Replace "args.logfd" with "pmb.helpers.logging.logfd" in order to avoid
passing "args" to all functions that only use it to write to logfd. This
is the first step to get rid of this args-passed-to-all-functions
pattern in pmbootstrap.
2021-10-10 16:59:17 +02:00
Alexey Min 48c85cdc1f
kconfig migrate: new option to migrate kernel configs (MR 2111)
With this option you can run

$ pmbootstrap kconfig migrate --arch <arch> linux-postmarketos-xxx-xxx

to perform safe kconfig upgrades between kernel releases.

"make oldconfig" will ask question for every new/renamed kconfig option,
so you have no chance to miss anything.
2021-10-10 15:38:45 +02:00
Johannes Marbach ac4c967e18
pmbootstrap lint: avoid looping and copying files (MR 2100)
Before this commit, package folders were copied into the chroot one by
one in order to run apkbuild-lint on them. This logic is replaced by
mounting pmaports.git into the chroot and using a single apkbuild-lint
invocation to lint the supplied packages.

Both of these changes result in a performance improvement, especially
when linting multiple packages at once.

Before this change:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m5,261s
    user    0m7,046s
    sys     0m1,842s

Using the pmaports.git mount but calling apkbuild-lint in a loop:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m4,089s
    user    0m6,418s
    sys     0m1,219s

After this change:

    $ time ./pmbootstrap.py -q lint $(cd ../pmaports/cross; echo *) \
        > /dev/null

    real    0m3,518s
    user    0m5,968s
    sys     0m0,959s

Additionally, running apkbuild-lint from the pmaports.git mount point
has the benefit that every printed violation contains a nice source
identifier à la "./cross/grub-x86/APKBUILD". This makes it possible to
differentiate between different packages even though only a single
apkbuild-lint invocation is used.

Relates: postmarketOS/pmaports#564
2021-09-03 10:52:50 -07:00
Clayton Craft 09794ef832
chroot/other/kernel_flavor_installed: support generic kernel name (MR 2093)
kernel is named /boot/vmlinuz now, looking at the filename will no
longer tell us what flavor it is. This now will look at
/usr/share/kernel, which has always contained the kernel 'flavor', and
since we currently only install 1 kernel these days, guarding this with
pmaports.cfg should be unnecessary. In the worst case (if there are
multiple kernel 'flavors' installed), it'll just grab the first one and
return it.
2021-09-02 18:18:13 -07:00
Clayton Craft 1d5030738c
pmb/helpers/frontend: drop all --flavors args (MR 2093) 2021-09-02 18:18:13 -07:00
Clayton Craft 6afd35eb11
kconfig check: add support for checking zram options (MR 2075)
Device kernels that enable zram support can use `pmb:kconfigcheck-zram`
to protect against kconfig regressions that disable support for zram.
2021-06-23 21:17:41 -07:00
Alexey Min 687807fa73
Add kconfig check for containers (MR 2060)
Usage: pmbootstrap kconfig check --containers linux-postmarketos-qcom-msm8974
2021-06-23 01:12:47 +02:00
Clayton Craft 599d74ec25
kconfig check: add support for nftables (MR 2042) 2021-06-14 21:50:45 +02:00
Caio Fontes 039552f5b7
enforce E501 in pmb/helpers (MR 2058) 2021-06-06 19:21:30 +02:00
Alexey Min 2b620a0fdd
pmb.sideload: support non-standard SSH port (!2046)
This can be used for example to sideload packages to
pmbootstrap's QEMU which is running on the port 2222
by default, as follows:

  pmbootstrap sideload --host localhost --port 2222 --user user <pkg>

This adds a `--port` parameter to sideload subcommand.
If not specified, port defaults to 22.
2021-04-25 21:04:49 +03:00
Oliver Smith 8df7514b8e
install: verify pmaports branch supporting fs (MR 2011)
Do not attempt to install with a filesystem that is not supported by the
initramfs code in the checked out pmaports branch.

Previously we would have increased the pmaports.cfg version and require
that new version by pmbootstrap, however this will break compatibility
with release branches where we won't roll out this feature (v20.05).
Therefore don't change the version, but add a new
"supported_root_filesystems" key to pmaports.cfg, which defaults to
"ext4".

Related: https://postmarketos.org/pmaports.cfg
2021-04-11 20:10:28 +02:00
Bobby The Builder 807d7019f8
install: add --filesystem to handle ext4 or f2fs (MR 2011)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2021-04-11 20:10:28 +02:00
Oliver Smith 1c791da482
treewide: bump copyright to 2021 2021-01-07 23:30:47 +01:00
Oliver Smith 2247fc5aad
pmbootstrap install: add --ondev --no-rootfs (MR 1995)
Skip building the postmarketOS rootfs, and allow either installing a
pre-built pmOS rootfs, or even another operating system.
2020-12-19 13:41:23 +01:00
Oliver Smith 74d71c1b6c
pmbootstrap install: add --ondev --cp (MR 1995)
Allow to copy one or more files to the install chroot. It will be
possible to use this to put a non-pmOS image into the generated
installer OS.
2020-12-19 13:41:23 +01:00
Martijn Braam 1921fc5f27
Add sideload command
The sideload command runs the supplied names through the pmbootstrap
buildsystem to make sure they're up-to-date, then uses scp from the host
to copy the built apks to /tmp on the phone and installs them through
ssh.

If the --install-key option is set then it will also copy over the apk
key that's used for signing the packages built by pmbootstrap in case
the postmarketOS install on the device isn't build by the same machine
as you're sideloading from.
2020-12-08 17:42:30 +01:00
HenriDellal e8e560e18e
kconfig edit: make package name a positional argument (MR 1998)
Makes argument "package" positional instead of required.
Uses codename from deviceinfo as default value.
2020-12-03 12:36:48 +03:00
timbz d0b32b3b05
pmbootstrap deviceinfo_parse: new action (MR 1986)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2020-11-10 09:15:52 +03:00
Eyal Sawady 741b0f298f
pmbootstrap log: don't depend on non-POSIX getopt (MR 1988)
Signed-off-by: Newbyte <newbie13xd@gmail.com>
2020-11-09 14:29:25 -08:00
Oliver Smith 3f10399db3
pmbootstrap log: use tail -F, not -f (MR 1982)
Let tail attempt to open the file again, if it becomes inaccessible.
This is useful, when writing a reproducer that deletes pmbootstrap's
log.txt while at the same time running 'pmbootstrap log'.

(027724) [17:57:34] Done
tail: '/home/user/.local/var/pmbootstrap/log.txt' has become inaccessible: No such file or directory
tail: '/home/user/.local/var/pmbootstrap/log.txt' has appeared;  following new file
(003493) [17:57:35] % cd /home/user/.local/var/pmbootstrap/cache_git/pmaports; git remote -v
2020-10-07 20:50:14 +02:00
Oliver Smith c8d581e749
pmbootstrap install --no-local-pkgs: new option (MR 1951)
Don't install locally compiled packages and package signing keys. This
will be used for the official images generated with pmbootstrap.
2020-07-15 16:47:51 +03:00
Mark Hargreaves 0aed64d661
pmb/helpers/frontend.py: fix pmbootstrap kconfig check --file (MR 1961) 2020-07-15 16:30:57 +03:00
Oliver Smith 3b02d35f1d
install --fde --android-recovery-zip: show warning (MR 1958)
This is likely to fail with the new default cryptsetup cipher of
aes-xts-plain64, as many downstream kernels used in recovery OS (like
TWRP) do not have CRYPTO_XTS set.
2020-07-11 13:25:09 +02:00
Oliver Smith 90f57bbbcc
install --ondev: set username to "user" (MR 1953) 2020-06-30 21:50:49 +02:00
Oliver Smith ddb5d9ae2c
pmbootstrap install --ondev: new option (MR 1946)
Add initial support for the on-device installer in pmbootstrap. Let
pmbootstrap create a regular split image, then prepare a new installer
rootfs and copy the previously generated rootfs image into the installer
rootfs. Put the installer rootfs into a new image, with reserved space.

There is more to do from here, such as disabling the generation of the
user account when using --ondev. But this requires support in
postmarketos-ondev first, so let's build that iteratively.

Related: https://wiki.postmarketos.org/wiki/On-device_installer
Related: https://gitlab.com/postmarketOS/postmarketos-ondev/-/issues
2020-06-19 09:36:51 +02:00
Oliver Smith a97ec615ad
pmbootstrap install: support size_reserve (MR 1946)
Create an empty partition between boot and root. This will be used by
the on-device installer, as explained in detail here:
https://wiki.postmarketos.org/wiki/On-device_installer
2020-06-19 09:36:50 +02:00
Oliver Smith 2fc0794e30
pmb/install: have size_boot, size_root in MiB (MR 1946)
Prepare for a future patch, that adds reserved space in MiB, by changing
size_boot and size_root from bytes to MB everywhere. This is what we need
most of the time and allows to drop some /1024**2 statements.
2020-06-19 09:36:50 +02:00
Oliver Smith 63fc2b621a
pmbootstrap chroot --install-blockdev: new option (MR 1946)
Create /dev/install inside the chroot from a block device, just like
done during the installation. This is useful for testing the Calamares
installer.
2020-06-19 09:36:50 +02:00
Oliver Smith 6d013b4472
pmbootstrap chroot --xauth: new option (MR 1944)
Make it easy to start any X11 application from the native chroot.
2020-06-09 04:10:51 +02:00
Antoine Fontaine 28da033267
pmb.parse.kconfig: implement anbox kconfig check (MR 1916)
fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1891.
2020-05-24 04:42:01 +02:00
Niklas Cathor 29a3cb2b8c
pmb.helpers.frontend.config: add option to reset config to default (!1907) 2020-04-07 01:02:19 +03:00
Niklas Cathor 00a4eaf91d
pmb.helpers.frontend.config: add support for clearing a config value (!1907)
Previously these two commands would both print the current value:
  pmbootstrap config extra_packages
  pmbootstrap config extra_packages ''

With this change, the second command will instead set the given config
value to the empty string.
2020-04-07 01:02:12 +03:00
Minecrell cd630edf25
pmb.helpers.pmaports: glob just once (!1898) 2020-03-31 23:58:38 +02:00
Daniele Debernardi 45f5ace1c2
pmb.helpers.frontend: fix wrong package name in kconfig check (!1891)
The kconfig check searches the aport with the "linux-" prefix to the
package name passed as argument. This is not working with the full
package name like linux-device-name because it searches a
linux-linux-device-name and fails.
2020-03-21 19:41:08 +01:00
Minecrell fb8de5a553
pmb: Look for device/* files in device/*/... instead (!1879)
In the future, device ports will be located in a subdirectory
below device/... (e.g. device/testing/device-...).
Replace all occurrences of device/* with a glob that checks the
subdirectories instead.

Note: To ensure that this always works properly we should also add some
checks that all devices are indeed located under one of the supported
subdirectories (i.e. testing/community/main).

Change the glob for pmaports to <aports>/**/APKBUILD.
This allows using subdirectories for organization outside of device/
as well.
2020-03-14 08:44:16 +01:00
Oliver Smith 1724ed4665
pmbootstrap status: show if chroots are outdated (!1878)
Add new "pmbootstrap status" command, which does a quick health check
for the work dir. As first health check, verify that the chroots are not
too old. Replace the reminder text at the end of "pmbootstrap init" to
tell users to run "pmbootstrap status" instead of "pmbootstrap zap" once
a day before working with pmbootstrap.

Related: #1829
2020-02-24 18:18:53 +01:00
Oliver Smith f21c216a26
Cosmetic: use SPDX license header (!1877)
While at it, also remove unnecessary "#!/usr/bin/env python3" in files
that only get imported, and adjust other empty/comment lines in the
beginnings of the files for consistency.

This makes files easier to read, and makes the pmbootstrap codebase more
consistent with the build.postmarketos.org codebase.
2020-02-24 03:11:10 +03:00
Luca Weiss 33e3553cdd
aportupgrade command for upgrading APKBUILDs (!1752)
The gist of this action is upgrading the specified aport to the latest
version. There are implementations for both stable packages (which check
via the release-monitoring.org API for new versions) and git packages
(which check the GitLab/GitHub API for new commits on the main branch).

There's also the possibility to pass --all, --all-stable & --all-git to
the action which either loops through all packages, or just stable or
git packages and upgrades them.

The --dry argument is also respected.

Note, that the implementation does update the variables pkgver, pkgrel
and _commit but it doesn't update the checksums because that would slow
down the process a lot, and is potentially undesirable.
2020-02-15 20:24:09 +01:00
Minecrell 87dd071b32
add "fastboot-bootpart" flasher to flash split images with fastboot (!1871)
asus-me176c has a Fastboot interface that can be used for flashing,
but in postmarketOS we do not use Android boot images for it.
This is because is it not very practical - the boot partition is
quite small and there is a (custom) EFI bootloader that can boot
directly from any other FAT32 partition.

At the moment the installation process is manual:
  1. pmbootstrap install --split to have separated boot (FAT32)
     and rootfs images
  2. pmbootstrap export
  3. Flash boot and rootfs images manually using Fastboot

The "fastboot-bootpart" flasher implements that process in a more
convenient way. When a device uses the "fastboot-bootpart" flasher:

  - We generate --split images on "pmbootstrap install" by default.
    (This can be disabled using --no-split instead.)

  - pmbootstrap flasher flash_kernel flashes the raw boot partition
    (not an Android boot image) using Fastboot, just like the rootfs.

There are some limitations that could be improved in the future:

  - "fastboot-bootpart" is not offered in the device wizard.
    I think it is special enough that no-one will be starting with it,
    and the difference to normal "fastboot" might be confusing.

  - Support "pmbootstrap flasher boot". asus-me176c does not support
    "fastboot boot" properly, but theoretically we could still generate
    Android boot images to use when booting an image directly.

  - At the moment the boot partition image is not regenerated when
    using "pmbootstrap flasher flash_kernel" (unlike when using Android
    boot images). "pmbootstrap install" needs to be run manually first.
2020-02-10 00:05:00 +03:00