Commit Graph

2047 Commits

Author SHA1 Message Date
HenriDellal 2d496d983e
pmb/aportgen/linux.py: Fix bad substitution error (MR 1999) 2020-12-02 21:32:43 +03:00
Oliver Smith 7683b80541
pmb/parse/arguments.py: refactor 'install' args (MR 1977)
Move the numerous "install" arguments into an own function (as it was
done with actions added later). Categorize the options and update the
help output, so the options are easier to understand.
2020-11-23 20:35:40 +01:00
Oliver Smith a1d9f66d96
install: embed_firmware: use correct suffix (MR 1979)
Embed the firmware from the right chroot suffix. Previously it would
always use the rootfs_{args.device} chroot, which does not work anymore
with upcoming 'pmbootstrap install --ondev --no-rootfs' as there will
only be the installer_{args.device} chroot.
2020-11-23 20:20:40 +01:00
HenriDellal 6793612a7e
pmb/aportgen/linux.py: add different QCDT implementations (MR 1992)
Adds QCDT templates for Spreadtrum and Exynos SoCs
When "pmbootstrap init" is executed, after the boot image analysis,
if the device is QCDT, then the user is asked about the SoC vendor.
Example:
[HH:MM:SS] SoC vendor (spreadtrum/exynos/other) [other]: exynos
After that, the corresponding template is picked.
2020-11-23 11:48:19 +01:00
Oliver Smith 5ff0bbe4b2
test/static: enforce E501 length check iteratively (MR 1993)
Enforce the E501 length check of max 79 characters for all files where
this test passes already. We can add more to the list as we adjust them
and eventuelly require the check for all files.
2020-11-23 11:31:57 +01:00
Johannes Marbach e2d4678fb7
pmb.aportgen.device Reformat to 79 characters per line (MR 1993) 2020-11-23 11:30:56 +01:00
Johannes Marbach 1e51376b7f
pmb.helpers.aportupgrade Reformat to 79 characters per line (MR 1993) 2020-11-23 11:30:56 +01:00
Johannes Marbach fc7e39d301
pmb.parse.arguments Reformat to 79 characters per line (MR 1993) 2020-11-23 11:30:51 +01:00
Oliver Smith 383bad9e93
Prepare 1.25.0 release 2020-11-23 10:13:36 +01:00
Oliver Smith 20aa4a01a1
install: FDE: use /dev/random, not /dev/urandom (MR 1994)
Change 'cryptsetup luksFormat' arguments to use --use-random instead of
--use-urandom. urandom is not recommended for the generation of long-term
cryptographic keys, as it may generate weak keys in low entropy
situations.
2020-11-23 08:57:09 +01:00
Johannes Marbach 74931b9b93
install: fix CREATE DEVICE ROOTFS message (MR 1991)
This converts the 1st step message to use a format string as well and
fixes two small typos in the 2nd step message.
2020-11-20 11:48:33 +01:00
Johannes Marbach 751524b5b4
install: tweak flash information output (MR 1991)
This adds generic advice when no flashing method is configured and
remove deprecated angle brackets.

Closes: #1948
2020-11-20 11:48:33 +01:00
Johannes Marbach ed2175546c
install: print_flash_info: make non-step (MR 1991)
This doesn't actually do anything else besides printing
advice so it doesn't need to be a processing step.
2020-11-20 11:48:33 +01:00
Johannes Marbach c31bf38409
install: install_recovery_zip: add step args (MR 1991)
This replaces the inline step numbers with arguments passed down
from the install method.
2020-11-20 11:48:33 +01:00
Johannes Marbach 126a299c43
install: install_system_image: no step defaults (MR 1991)
With the default argument values removed, the step logic is more
centralized in the install method which makes the code a bit less
brittle and easier to follow.
2020-11-20 11:48:33 +01:00
Johannes Marbach 5dea31058d
Add option to specify extra free space in pmbootstrap init (MR 1989)
This adds a new commandline flag -E / --extra-space for
specifying the amount of additional space to be added to
the image size to work around cases where the automatically
determined size turns out to not actually be enough.

The value is also asked for in the "Additional options"
section of the interactive mode.

Fixes: #1904
2020-11-17 20:07:01 +01:00
Luca Weiss e6543332de
pmb/config/__init__.py: parse more APKBUILD attributes (MR 1990)
This will be required for an upcoming CI test
2020-11-16 21:46:43 +01:00
Oliver Smith fe6db08069
Prepare 1.24.0 release 2020-11-11 11:10:01 +01:00
Oliver Smith 108ed0f28b
pmbootstrap install: fix cryptsetup warning (MR 1984)
Create /run/cryptsetup before running "cryptsetup luksFormat" to fix:
	WARNING: Locking directory /run/cryptsetup is missing!
2020-11-11 10:43:26 +01:00
Oliver Smith 06d91897da
pmb/install/format.py: refactor luks related code (MR 1984)
format_and_mount_root() => format_luks_root():
* Rename to reflect what it's actually doing
* Move the FDE check from format_luks_root to the only caller
* Make arguments to "cryptsetup luksFormat" more readable

format_and_mount_pm_crypt() => format_and_mount_root():
* Rename to reflect what it's actually doing
* Don't overwrite device if doing FDE; instead provide the proper device
  in the caller

The old function names were for historic reasons, early on it was only
possible to create encrypted installations with pmbootstrap.
2020-11-11 10:43:21 +01:00
Oliver Smith 77a5dd1910
pmb.aportgen.linux: add gcc10 extern YYLOC patch (MR 1987)
Most downstream kernels need this patch to build with GCC-10, so add it
by default in the linux aport generator.
2020-11-10 12:06:36 +01:00
timbz 5e01477d64
test: add deviceinfo kernel suffix parsing (MR 1986)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2020-11-10 09:15:52 +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
Oliver Smith 4d3c14f6c1
flasher: heimdall-isorec: use kernel+dtb (MR 1986)
Use the dtb-appended kernel file, e.g. postmarketos-exynos4-dtb instead
of postmarketos-exynos4, if it is available. This is needed to flash a
mainline kernel with appended dtb to isorec devices.
2020-11-10 09:15:51 +03:00
Oliver Smith ac796121e2
pmb.flasher.run: proper check for None (MR 1986)
Change the 'not value' condition raising the '...value for this variable
is None!' error to 'value is None' so it doesn't raise when the value is
something else that evaluates to boolean False, like an empty string.

Remove the special treatment for $KERNEL_CMDLINE here by making it
default to empty string.
2020-11-10 09:15:51 +03:00
Oliver Smith fae2379d6b
pmb.parse.deviceinfo: parse kernel suffix (MR 1986) 2020-11-10 09:15:49 +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 173f90d796
Support arch="" in APKBUILD to skip builds (MR 1985)
Alpine indicates with arch="", that a package should temporarily not be
built for any architecture. Support this in postmarketOS too by not
complaining in the APKBUILD parser if arch is empty.

Adjust pmb.build.autodetect.arch and pmb.build.menuconfig.get_arch, so
both don't fail with an IndexError when encountering a disabled package.

Co-Authored-By: Luca Weiss <luca@z3ntu.xyz>
2020-10-30 17:33:33 +01:00
Oliver Smith 112e72b068
menuconfig: refactor get_arch() (MR 1985)
Simplify the logic by not even calling get_arch() if args.arch is set.
2020-10-30 17:33:33 +01:00
Oliver Smith e43ef5c22e
menuconfig: don't require --arch to match APKBUILD (MR 1985)
Do not verify that the architecture passed with --arch is part of the
arch variable in APKBUILD. This prepares to set 'arch=""' to temporarily
disable building packages. Users will still be able to run "pmbootstrap
menuconfig" on them by manually specifying the architecture.
2020-10-30 17:33:33 +01:00
Oliver Smith 13b96df350
pmbootstrap install: refactor: install_pkgs block (MR 1981)
Put all install_packages related lines into one block and fix up the
comments:
* The list of packages to be installed is not listed at this point (and
  it does not make sense there, if we would want to list it, it should
  be done in the next block at 'if args.build_pkgs_on_install).
* Remove "including the ones specified by --add", as it doesn't add any
  value.
2020-10-27 17:56:46 +01:00
Oliver Smith 340329599b
pmbootstrap install: refactor: move set_user() up (MR 1981)
Don't have the set_user() call weirdly between multiple commands
building the install_packages list. Move it up, together with the log
message announcing that the device rootfs is being built.

Update the comment above set_user(): there is no 'build' user anymore,
and at this point we only call it before actually installing the
packages for legacy reasons.
2020-10-27 17:56:46 +01:00
Oliver Smith fc1ba9ba7b
pmbootstrap install: don't screw up /etc/apk/world (MR 1981)
Do not attempt to upgrade packages in the rootfs chroot when running
"pmbootstrap install".

This was responsible for placing every single package in /etc/apk/world
(which should only hold the packages explicitly installed), because the
upgrade function was literally implemented as getting a list of
installed packages and explicitly running pmb.chroot.apk.install on each
of them. The intention was to rebuild these packages if they were outdated,
I guess I didn't realize that this makes /etc/apk/world unusable when I
introduced this three years ago in 51bdc243 ("Properly rebuild/install
packages when something changed").

Remove pmb.chroot.apk.upgrade altogether, because:
1) pmb.install.install builds and upgrades outdated pmaports
2) pmb.install.install is the only user of pmb.chroot.apk.upgrade
3) 'pmbootstrap init' is warning that the chroots do not get upgraded
   automatically, so let's not go against that expectation. users who
   want an updated rootfs chroot can simply run zap and install again.

Replace it with a call to pmb.helpers.repo.update, because we still need
to update the APKINDEX files before attempting to build/install the
generated list of packages.
2020-10-27 17:56:45 +01:00
yarl 864469531c
pmbootstrap qemu: add aarch64 big/little hack (MR 1983)
Workaround for qemu failing with:
  kvm_arm_vcpu_init failed: invalid argument.

Related: https://bugs.linaro.org/show_bug.cgi?id=1443
2020-10-20 22:34:08 +02: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 496be6f593
Prepare 1.23.0 release 2020-09-24 11:20:42 +02:00
Oliver Smith 0dfe489b78
pmbootstrap aportgen: replace arch=all with native (MR 1965)
Packages like binutils-*, busybox-static-*, gcc-*, grub-efi-*, musl-*
are only needed for the native architecture during cross compilation.
Don't bother with trying to build them for other arches to save time and
to avoid getting stuck frequently at "armv7/binutils-aarch64" etc.

A few people like to use pmbootstrap on aarch64 hosts (e.g. PineBook
Pro), so let's make it available for aarch64 again when we can build
aarch64 packages natively in CI and bpo. (They do get stuck there right
now, because of qemu user emulation.)

Related: https://gitlab.com/postmarketOS/build.postmarketos.org/-/issues/75
2020-09-21 17:48:34 +02:00
Oliver Smith 5b55abd4d2
pmbootstrap aportgen: don't use CDN alpine mirror (MR 1963)
Use a deterministic mirror URL instead of CDN for aportgen. Otherwise we
may generate a pmaport that wraps an apk from Alpine (e.g. musl-armv7)
locally with one up-to-date mirror given by the CDN. But then the build
will fail if CDN picks an outdated mirror for CI or BPO.
2020-09-18 03:20:25 +03:00
Oliver Smith a870a69151
pmbootstrap kconfig edit: list all arches in error (MR 1957)
If a kernel is available for multiple architectures, let the user know
which architectures are available in the error message.
2020-09-16 21:38:16 +02:00
Luca Weiss 9815f81742
aportupgrade: use f-strings (MR 1964) 2020-09-16 20:31:31 +03:00
Luca Weiss 93f13277b9
aportupgrade: add support for specifying git ref (MR 1964)
This adds support for specifying an arbitrary git ref (e.g. commits,
tags, branches) to upgrade to. This can be useful if a specific commit
needs to be packaged instead of the latest available. Alternatively you
can also specify a branch to be used if the default branch is 'stable'
but 'develop' should be packaged.

This also removes old code to use the 'bionic' branch for UBports Lomiri
(formerly Unity 8) packages.
2020-09-16 20:31:04 +03:00
Henrik Grimler efd64f7714
Check if workpath/ is empty and in that case create workpath/version (MR 1975)
Fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1965
2020-09-14 19:01:19 +02:00
Antoine Fontaine 1b5120e24f
test/testcases_fast.sh: correct pmaports location (MR 1974)
This makes the script ask pmbootstrap what is the correct directory
instead of hardcoding the default value.
2020-09-12 10:35:37 +02:00
Linus Walleij be41c94c57
pmb.install.setup_keymap: Fix up keymaps for Nokia n900 (MR 1972)
The Nokia n900 XkbLayout is a bit peculiar and sometimes
join two keymaps into one, for example:

    Option "XkbLayout" "fise"

For the combined finnish/swedish layout. Add the common
joined keymaps, even if not all of these countries are
yet supported.

For details see:
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/symbols/nokia_vndr/rx-51

I also include this link in the code so no-one gets confused.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-08-31 16:02:04 +02:00
Martijn Braam 5d540ad4fb
pmb/install: warn if the target disk is larger than expected (MR 1956) 2020-08-31 13:05:20 +02:00
Ralf Rachinger 72e24f7f96
Use $XDG_CONFIG_HOME instead of hardcoded path (MR 1969) 2020-08-23 13:51:42 +02:00
Luca Weiss 86d61b8012
pmb.parse.bootimg: detect mediatek header (MR 1955)
Some Mediatek devices have a special 512-byte header around the zImage
which must be generated so the device boots.

Support for that exists for a while in postmarketOS but detection was
missing. Add that.
2020-08-21 18:33:30 +02:00
Oliver Smith 9718fd294a
pmb.install.setup_keymap: fix fail on X11 setup (MR 1968)
Do not fail in "pmbootstrap setup" if a keymap was selected, but no
/etc/X11/xorg.conf.d path exists in the rootfs chroot. The grep output
is not empty in that case (it would be empty if the directory exists and
there are no matches), so we need to add this extra check:

	(rootfs_nokia-n900) % grep -rl XkbLayout /etc/X11/xorg.conf.d/
	grep: /etc/X11/xorg.conf.d/: No such file or directory
2020-08-12 01:16:09 +02:00
Oliver Smith e233b73949
pmb.config.mirrors_postmarketos: update URL (MR 1967)
Official pmOS binary package mirror is now mirror.postmarketos.org. The
old URL will stay functional as redirect.
2020-08-08 21:16:39 +02:00
Oliver Smith a498c3afab
Prepare 1.22.2 release 2020-08-05 11:02:08 +02:00