Commit Graph

1288 Commits

Author SHA1 Message Date
Oliver Smith 40679f7126
pmb.chroot.root: order env vars alphabetically (MR 2209) 2022-10-07 09:02:53 +02:00
Oliver Smith aaeff96d23
Prepare 1.47.1 release 2022-10-06 07:59:42 +02:00
Oliver Smith 54268b72e1
pmb.build.package: add workaround for missing isl
Install isl25 for the specific gcc versions we currently have in
pmaports master that are missing it; this is easier than building new
packages and going out of sync with Alpine's versioning. This can be
reverted as soon as there is a newer gcc.

Related: pmaports issue 1732
2022-10-05 20:44:36 +02:00
Oliver Smith 550b9b3466
pmb.aportgen.gcc: remove !tracedeps option
abuild traces shared library dependencies for binaries in built
packages, and adds all of them to depends. This is needed for the cross
gcc builds, as otherwise it will not add the isl dependency (currently
isl25).

With the crossdirect compilation method we mount the cross-gcc from the
native chroot in the foreign arch chroot. Due to the missing dependency,
isl was not installed in the native chroot, and so when attempting to
use that native cross gcc from the foreign arch chroot, it would try to
load the foreign arch isl instead of the native one. Resulting in lots
of the following errors (and of course not a working gcc):

  Error relocating /usr/lib/libisl.so.23: unsupported relocation type 1026

I had probably added '!tracedeps' because abuild complains about it
otherwise... but as noted in [1] these complaints are safe to ignore.

Keep !strip for now even though it's not in Alpine's APKBUILD. I've
tried to build without and the build fails with:
  strip: Unable to recognise the format of the input file `./usr/aarch64-alpine-linux-musl/lib/libgcc_s.so.1'

[1]: 0415ebf6f9
Related: pmaports issue 1732
2022-10-05 20:44:31 +02:00
Oliver Smith dac8b27738
Prepare 1.47.0 release 2022-10-04 09:00:44 +02:00
David Wronek b9e7a98c07
pmb.config.apkbuild_attributes: Add _pkgbase and _pkgsnap (MR 2208)
Parse _pkgbase and _pkgsnap variables in pkgver for gcc.
2022-09-30 22:04:16 +02:00
Oliver Smith b262609199
pmb.aportgen.gcc: add subpkg libstdc++-dev-$arch
Add the subpackage, because g++-$arch depends on it since
12.1.1_git20220630-r6. This fix was already applied to pmaports, thanks
to ungeskriptet! Adjust the aportgen code to make sure this is added in
the future as well.

Related: pmaports MR 3464
Related: f1044b1dae
2022-09-30 22:02:31 +02:00
Oliver Smith 22e0f64095
pmb.aportgen.gcc: set libgcc=false (MR 2203)
Do not build the foreign arch libgcc. We are using the one provided by
Alpine's binary repository instead, and when building it here and trying
to use it, we actually run into a conflict.

I tried setting BOOTSTRAP="nolibc" first since there is already logic to
then disable libgcc in the APKBUILD. But that also disables g++ which we
do want to build, so we can't use this.

Fixes: issue 2168
2022-09-13 23:42:15 -07:00
Oliver Smith 4c7d2459f5
pmb.aportgen.gcc: remove isl from depends (MR 2203)
Remove it from depends, as the package has been removed in Alpine and
since quite some time we shouldn't have depended on it anyway.

Related: issue 2167
2022-09-13 23:42:15 -07:00
Luca Weiss f7fb1fe078
pmb.parse.kconfig: rename anbox check to waydroid (MR 2204)
Change the naming to fit what software is actually used in postmarketOS.
2022-09-13 09:30:23 +02:00
Luca Weiss e468fc518e
pmb.parse.kconfig: add 'community' option (MR 2204)
Add the new option that will be mandatory for all devices in
community/main category. This is just a combination of anbox + iwd +
nftables + containers + zram + netboot.

While the existing options could be removed we're keeping it for now
given that also some devices with downstream kernel might find some
options useful.
2022-09-13 09:30:23 +02:00
Luca Weiss 1fee644dce
pmb.parse.kconfig: fix containers check for x86 (MR 2204)
Options in this list are not supposed to have CONFIG_ prefix, remove it.
2022-09-13 09:30:18 +02:00
Oliver Smith 0c18c664aa
pmb.config.apkbuild_package_attributes: + triggers (MR 2202)
Do not only parse triggers, but also emit them in the packages dicts in
pmb.parse.apkbuild. This is the first half to fix pmaports issue 1690,
the other is in pmaports MR 3386.
2022-09-11 13:49:24 +02:00
Song Fuchang d650ed4a14
pmb.chroot.root: preserve proxy environment variables (MR 2201)
This fixes #457.
2022-09-08 18:11:54 +08:00
Luca Weiss 52530caaf8
pmb.parse.kconfig: remove apparmor check (MR 2200)
Remove the check as apparmor is not the way we want to go for privilege
separation anymore.
See https://gitlab.com/postmarketOS/pmaports/-/issues/1596
2022-09-04 19:10:48 +02:00
Oliver Smith b41e4a418f
aportgen binutils: modernize (MR 2199)
Set CTARGET and CTARGET_ARCH on top of the generated APKBUILD and use
the existing code in the APKBUILD for build(), package(), makedepends,
subpackages. This is now possible, because the pmbootstrap parser for
APKBUILDs has been improved a lot since this was originally written and
because the Alpine APKBUILD does everything that was hacked in here,
like removing man, info directories and bfd-plugins if doing a cross
build.

This is now very similar to bootstrapping binutils for another
architecture via scripts/bootstrap.sh in aports.git.

Most importantly this sets --disable-gprofng, which fails to build
against musl and is the reason why our cross/binutils-* packages
generated from binutils 2.39.x didn't build anymore.

Related: https://git.alpinelinux.org/aports/tree/main/binutils/APKBUILD
Related: https://sourceware.org/bugzilla/show_bug.cgi?id=29477
2022-08-24 08:38:49 +02:00
Raymond Hackley e5d580e98a
pmb: sideload: Handle ssh_install_apks() errors (MR 2195)
Even add_cmd has exited with code 99, it will be overwritten by clean_cmd
later. Exit with code returned by add_cmd to raise a runtime error when
an error occurs.
2022-08-22 09:45:30 +02:00
Salvatore Stella 3567b7c123
Fix wrong output of pmbootstrap bootimg_analyze (MR 2198) 2022-08-21 14:25:11 +02:00
Oliver Smith 21b86f7f64
pmb.helpers.run: only pass stdin where useful (MR 2197)
Don't pass stdin to commands that aren't supposed to be used
interactively (output: log, background, pipe).

This fixes an inconsistency between building packages in CI on gitlab
and building them via bpo on sourcehut or locally. In gitlab, apparently
there is no stdin for the entire build job and so unanswered kernel
config prompts will just use the default. In local builds and on
sourcehut stdin is available and so it just hangs at the prompt until
pmbootstrap kills the build job due to no output being written.

I considered adding an additional check to pmaports to ensure that there
are no unanswered kernel config prompts just in case users run abuild
manually on the kernel APKBUILD with stdin available. But I think
forcing the users to answer all the prompts even if it's not really
needed just creates additional work / makes the workflow worse without
real benefit.

Related: https://builds.sr.ht/~postmarketos/job/824373#task-pmbootstrap_build-432
Fixes: pmaports issue 1225
2022-08-19 10:40:25 +02:00
Oliver Smith c88a18d3f6
treewide: fix various lint errors (MR 2197)
Fix errors found by new flake8 version
2022-08-19 10:40:25 +02:00
Oliver Smith 8d736c5fcc
Prepare 1.46.0 release 2022-08-15 19:32:12 +02:00
Newbyte b9485902cf
pmb.qemu.run: drop removed depedency (MR 2196)
mesa-dri-gallium provides all available drivers in Mesa nowadays.

Closes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2157
2022-08-11 21:17:20 -04:00
Jami Kettunen 5b3cd7a7a6
pmb.aportgen.linux: Install DTBs on header v2 (MR 2194)
A single DTB is required for "mkbootimg --dtb ..."
2022-07-18 14:49:38 -07:00
Jami Kettunen de890c83e7
pmb.aportgen.device: Generate appropriate header v2 deviceinfo (MR 2194)
Here's an example of the properties this could generate:

  deviceinfo_header_version="2"
  deviceinfo_append_dtb="false"
  deviceinfo_flash_offset_dtb="0x0bc08000"
2022-07-18 14:49:33 -07:00
Jami Kettunen 255e69be5e
pmb.parse.bootimg: Add preliminary support for header v2 (MR 2194)
This includes setting header_version="2" as well as dtb_offset
according to the input boot.img when header v2 is detected.

Also adds the following previously missed deviceinfo_attributes:

* "header_version"
* "bootimg_custom_args"

And fixes failing tests now that header_version is always parsed from
boot.img files.
2022-07-18 14:49:16 -07:00
Oliver Smith e527a159ad
Prepare 1.45.0 release 2022-07-03 17:51:32 +02:00
Luca Weiss 58c39f2cb2
pmb.config.init: fix init when work path is an empty directory (MR 2192)
In case a user removes all contents of the work path then pmbootstrap
init will fail and show

  WARNING: Your work folder version needs to be migrated (from version 0 to 6)!

Later the migration would fail with the error

  ERROR: We have split the aports repository from the pmbootstrap repository (#383). Please run 'pmbootstrap init' again to clone it.

This is due to the existing check not accounting for e.g. log.txt being
written in the work path before we get to this check. Now change it so
we always create the version file if it doesn't exist yet.

Test plan:
$ grep work ~/.config/pmbootstrap.cfg
work = /tmp/pmbootstrap-work
$ rm -rf /tmp/pmbootstrap-work
$ mkdir /tmp/pmbootstrap-work
$ pmbootstrap init

This was previously attempted to be fixed in !1975
2022-06-24 14:57:20 +02:00
Shinjo Park 87f7520e51
pmb/export: Fix Odin export filenames (MR 2191)
Since pmaports@50ee94d8 the kernel filename won't contain the flavor
information, but this is not correctly synchronized with the Odin
export. This fixes Odin export.
2022-06-23 17:45:47 +02:00
Jami Kettunen c0cec06df8
pmb/config: vndbinder ANDROID_BINDER_DEVICE is required for Waydroid (MR 2190)
Fixes 'ERROR: Binder node "vndbinder" for waydroid not found' during
'waydroid init'.
2022-06-15 20:26:05 +03:00
Anton Bambura dc1433ead0
Rename Chrome OS kernel partition to pmOS_kernel (MR 2187)
Make it consistent with pmOS_boot and pmOS_root and
make itmore pmOS-specific to prepare for automatic
kernel upgrades in the future.
2022-06-08 23:16:17 +03:00
Minecrell f1cbcb7b3b
pmb: flasher: frontend: don't fail if kernel config cannot be found (MR 2184)
When using a kernel from Alpine the kernel configuration cannot be
found in pmaports. We cannot check the kernel config for missing
options in that case, but that's no reason to break the flasher
entirely.
2022-06-06 09:52:17 +02:00
Oliver Smith cc90bc81f0
pmb.chroot.apk.install: move pkgname sanitization (MR 2185)
Check if the pkgnames are sane in install_run_apk, right before running
apk. This makes sure that we really run it on all arguments that are
supposed to be packages / files and not options to apk.
2022-05-30 19:09:01 +02:00
Oliver Smith 7b09cc7546
pmb.chroot.apk.install: fix empty install messages (MR 2185)
Previously pmbootstrap would only show the packages that are about to be
installed. In case all packages were already installed, this would lead
to weird empty install messages:

  (rootfs_asus-me176c) install

Show all packages that we want to install, even if they are already
installed in the given chroot.

  (rootfs_asus-me176c) install device-asus-me176c
2022-05-30 19:09:01 +02:00
Oliver Smith 6a74109154
pmb.chroot.apk.install: let apk figure out depends (MR 2185)
Previously to this patch, pmbootstrap would pass a full dependency tree
to "apk add". It would use a virtual package to ensure only the right
packages get added to /etc/apk/world. For example:
  apk add -u --virtual .pmbootstrap postmarketos-base device-asus-me176c \
  postmarketos-ui-sxmo-de-sway device-asus-me176c-nonfree-firmware w3m \
  sfeed clickclack firefox-esr font-noto font-noto-emoji gnome-icon-theme \
  imv megapixels mobile-config-firefox ttyescape postmarketos-base-nofde \
  eudev openssh postmarketos-mkinitfs postmarketos-mvcfg postmarketos-keys \
  ...

Instead of doing that, only pass the packages we want to install and let
apk figure out the dependencies. Most of the time we can even avoid
using the virtual package now.

== Remaining edge case: locally built packages
apk will only upgrade a package with the same pkgver + pkgrel but a
different build date if the full path to an apk file gets passed as
argument. So if the user built a package locally that will be installed,
or one of its dependencies then we still need to use a virtual package
and possibly pass a dependency to apk. Replace
replace_aports_packages_with_path() with packages_get_locally_built_apks()
to get a list of such packages and adjust install() and
install_run_apk() to use it.
2022-05-30 19:09:00 +02:00
Oliver Smith 903ed4ee30
pmb.chroot.apk.packages_split_to_add_del: new func (MR 2185)
Make the code easier to read by moving split_to_add_del() to a separate
function and do some related refactoring. A future patch will use it
twice in install().

Move "arch = ..." to the top of the function while at it, since it's
needed later in the function in 2 places and is not needed for figuring
out packages_with_depends, to_add and to_del.

Remove "# Add depends to packages" because it's obvious from the
packages_with_depends variable name, and getting to_add/to_del is a
different action that stood under the same comment.
2022-05-30 19:09:00 +02:00
Oliver Smith 682ee74ea6
pmb.chroot.apk.install_run_apk: new func (MR 2185)
Split out the part that builds the apk commands and runs them out from
install() to a new function install_run_apk(). This makes install()
easier to read.
2022-05-30 19:09:00 +02:00
Oliver Smith 12948eeb3d
pmb.chroot.apk.install: move empty packages check (MR 2185)
Since the previous commit that adds install_build(), all packages either
end up in to_add or to_del. Move the check for empty packages to the top
of the function, and directly check the packages variable.

I think it's worth keeping this check because it's shorter to add this
check once here than having it a few times in other place where we may
have or may not have something to install. And so we can avoid printing
an empty "install" message with no packages.
2022-05-30 19:09:00 +02:00
Oliver Smith e91dbefd16
pmb.chroot.apk.install_{is_necessary -> build} (MR 2185)
install_is_necessary used to do the following things:

1. Error out if there's no binary package but pmb was invoked as
   "pmbootstrap install" and build_pkgs_on_install is disabled.
2. Build the package if necessary.
3. Return if a package "needs to be installed" (Boolean or Float).

The only caller of the function is pmb.chroot.apk.install. It would not
add the package to the long "apk add" command if according to 3. it does
not need to be installed.

When I implemented this a few years ago, I probably thought it would be
useful to not unnecessarily pass packages to apk. But this actually
makes it more complicated and doesn't have a benefit, apk is perfectly
capable of recognizing which packages it had already installed.

Replace the function with a much simpler pmb.chroot.apk.install_build,
which only does 1. and 2. Change the order of the package, arch
arguments to match called functions pmb.parse.apkindex.package and
pmb.build.package.
2022-05-30 19:09:00 +02:00
Oliver Smith c898b13296
pmb.chroot.apk.install: rename to{add,del} vars (MR 2185)
Put underscores between the words for consistency with other variable
names. Since the whole function is about dealing with packages, remove
the "packages_" prefix to make them shorter.

	packages_toadd -> to_add
	packages_todel -> to_del
2022-05-30 19:09:00 +02:00
Oliver Smith 6b520d2d26
pmb.chroot.apk.install: update func desc (MR 2185) 2022-05-30 19:09:00 +02:00
Oliver Smith 03303ef7bc
Prepare 1.44.1 release
Tag 1.44.0 was done without bumping pmb.config.version, so tag another
one.
2022-05-24 20:16:07 +02:00
Bart Ribbers 741be5f521
Prepare pmbootstrap for pmOS v22.06 release (MR 2183) 2022-05-24 08:59:13 +02:00
Oliver Smith 8c7e99acd9
Prepare 1.43.1 release 2022-05-15 18:47:46 +02:00
David Wronek be9aab895b
pmb.install: Check for alpine-conf version (MR 2182)
Upstream Alpine change the way how `setup-timezone` works, it no longer
uses the `-z` argument to change the timezone.
2022-05-15 16:51:53 +02:00
Clayton Craft 9901cb31ea
pmb.parse.depends: ignore conflict dependency that no longer exists (MR 2181)
So it looks like some packages might be mentioned in the "depends=" of
other packages and marked as conflict, for example:
    depends="!foo"

..and the conflicting package can be dropped from the repo entirely if
it is no longer needed, however the reference to it in `depends=` still
exists. This handles that situation by just ignoring the missing package
if it is only a conflicting dependency.

fixes https://gitlab.com/postmarketOS/pmaports/-/issues/1525
2022-05-12 22:26:53 -07:00
Oliver Smith 6fbe916e0d
Prepare 1.43.0 release 2022-04-14 09:33:20 +02:00
Oliver Smith 7abb281296
partitions_mount: fix finding the partition (MR 2178)
Instead of trying both "${dev}1" and "${dev}p1" as partition paths, only
try one of them depending on if "${dev}" ends in a number or not. This
fixes getting a wrong /dev/loop11 partition by accident if there are
many loop devices, instead of only looking for the correct path
/dev/loop1p1. People reported this happening with snaps on ubuntu.
2022-04-14 09:09:46 +02:00
Minecrell faf523911a
pmb.install: Treat empty "flash_sparse_samsung_format" as disabled (MR 2180)
Deviceinfo variables are empty strings by default if they are unset
in the deviceinfo file, so the "is not None" check currently enables
the sm_sparse_image_tool for all existing devices using sparse format.

Simplify the check to convert the string to a bool. Empty strings
evaluate to False so this should work as originally intended.
2022-04-13 21:01:20 +02:00
Enrico Lumetti dee8e34298
pmb.config, pmb.install: add option to handle Samsung sparse image format (MR 2177) 2022-04-13 08:59:29 +02:00
Newbyte ff569ece14
config: Move ASHMEM into conditional (MR 2176)
Option was dropped and is no longer available.

See https://lore.kernel.org/all/20220315123457.2354812-1-hch@lst.de
And 721412ed3d
2022-04-05 21:04:22 +02:00
Newbyte 9a74848f19
pmb.parse.kconfig: print a helpful error message on invalid kconfig name (MR 2172)
Currently pmbootstrap prints a stacktrace if there's no . in the
kernel configuration name. Let's make it more helpful.
2022-04-02 16:36:17 +02:00
Alexey Min 0bab8ab6d2
install: fix alignment of information messages (MR 2174)
Make it in line with other information messages in this section.
Otherwise lk2nd flashing info paragraph looks shifted to the right.
2022-03-29 20:06:40 +03:00
Alexey Min fd74b54001
config: allow using flash_lk2nd with heimdall too (MR 2174)
One of the main purposes of lk2nd is to have a replacement for
the stock bootloader "Odin mode" on many Samsung devices with
sane fastboot implementation, which supports many more features
like live booting and many others.

This is done by using heimdall to flash lk2nd to device's boot
partition. Allow this method to be used with this flash action.
2022-03-29 15:36:08 +03:00
Bart Ribbers 1eef7fbdeb
pmb.parse.kconfig: implement UEFI kconfig check (MR 2169) 2022-03-16 09:25:00 +01:00
Oliver Smith 301f0995fb
pmb.parse.kconfig.check_file: fix broken f-string (MR 2169) 2022-03-16 09:24:55 +01:00
Laszlo Molnar 2e39912790
pmb.parse.arguments: add zap --all flag (MR 2117)
Fixes: #1692
2022-02-28 17:09:21 +03:00
Luca Weiss 5252d8de78
config: Move NFT_COUNTER into conditional (MR 2171)
The option has been removed and is now always enabled with nftables
core.

See also https://git.kernel.org/torvalds/c/023223d
2022-02-24 08:54:50 +01:00
Oliver Smith e45e8f932c
Prepare 1.42.0 release 2022-02-20 15:29:40 +01:00
Clayton Craft a367e0d95b
pmb.chroot.mount: create /dev/fd (MR 2170)
Specifically, this fixes issues with process substitution in bash in the
chroot.

For example, the following lines from a NetworkManager build script:

    ... |
        grep -Fx -f <(get_symbols_explicit) -v |
        grep -Fx -f <(get_symbols_nm)

fail with:
     ninja: job failed: /home/pmos/build/src/NetworkManager-1.35.92/tools/create-exports-NetworkManager.sh --called-from-build /home/pmos/build/src/NetworkManager-1.35.92
     grep: /dev/fd/63: No such file or directory
     grep: /dev/fd/63: No such file or directory
2022-02-20 15:03:09 +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
Anton Bambura 2363732645
pmb.install: add get_partition_layout() (MR 2163)
"Keeping track of which partition number is what is hard to understand now.
 I think this should be refactored, so we have it defined only in one
 place, and easy to read. Since this merge request increases the complexity
 of the partitions again, let's do it here before merging." - Oliver

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2022-02-20 14:48:18 +01:00
Caleb Connolly 18a16c7899
pmb: flasher: add support for rk partitions (MR 2165) 2022-02-13 19:54:29 +01:00
Martijn Braam 884174ce3c
config: use partition names for rkdeveloptool (MR 2165) 2022-02-13 19:54:23 +01:00
Clayton Craft 100fd332df
pmb.qemu.run: add option to set serial to mon:stdio (MR 1980)
This makes QEMU trap signals like Ctrl-C and send it to the guest
instead of terminating QEMU.

To quit QEMU with this option you can use [Ctrl-A] [x]
  or
[Ctrl-A] [c] and type 'quit' at the prompt.

This behavior is disabled by default, and can be enabled by setting a
new option in the pmbootstrap.cfg (using "pmbootstrap config
qemu_redir_stdio true")

Co-authored-by: Luca Weiss <luca@z3ntu.xyz>
2022-02-13 19:22:49 +01:00
Tony Garnock-Jones 3c5effa0e7
Allow override of SSH key glob (MR 2167) 2022-02-08 12:29:27 +01:00
Oliver Smith 5d3cbbdb86
pmb.helpers.pkgrel_bump: !-deps are not missing (MR 2166)
Do not assume that conflicting dependencies are missing.

Fix for:
  Increase 'unl0kr' pkgrel (0 -> 1), missing depend(s): !osk-sdl

Related: https://gitlab.com/postmarketOS/monitoring/-/jobs/2058087076
2022-02-05 11:54:32 +01:00
Caleb Connolly 47410eafb9
config: fix missing comma in flash methods (MR 2164)
o/ hi Martijn
2022-02-02 21:20:11 +00:00
Marian Stramm 80c988236f
pmb.install: add support for creating btrfs root filesystem (MR 2155)
in preparation for reversible upgrades, this change adds the option of
creating a btrfs root filesystem
2022-01-29 11:47:29 +03:00
Bart Ribbers 9e63d5820c
Support generating GPT partition tables (MR 2160)
The PPP will, in combination with tow-boot, boot with GPT on the
internal storage. We need to support that on postmarketOS and as a first
step, let's make it possible to generate GPT images and boot from that
2022-01-28 10:01:46 +01:00
Bart Ribbers 36aabcc4fe
Print return code when subprocess fails (MR 2161)
It can be very useful to figure out why a particular subprocess might be
failing ;)
2022-01-22 15:45:12 +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
Rudraksha Gupta 997e3fb1f5
pmb.install: Remove pass to conform to code style (MR 2159) 2022-01-20 21:01:46 +01:00
Rudraksha Gupta bea18e03f3
pmb.install: password for root is already locked (MR 2159)
When running `pmbootstrap install`, pmbootstrap does not unlock root
when it completes. This patch allows `pmbootstrap install` to run two or
more times (without zap).

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2022-01-20 21:01:41 +01:00
Oliver Smith d698aa15ad
Prepare 1.41.0 release 2022-01-18 21:46:34 +01:00
Johannes Marbach 6d7d113040
pmb.chroot.apk: Delete conflicting dependencies (MR 2157)
When installing dependencies for a package, conflicting (!) dependencies
are now deleted (with `apk del pkg`) whereas before a constraint for
their _absence_ was added (with `apk add !pkg`). Doing it the new way
around prevents creating deadlocks because a `!pkg` constraint will
prevent pkg from ever being installed without an explicit `apk del`
call.

Fixes: #2092
2022-01-18 20:06:23 +01:00
Newbyte 614cb72a2a
pmb.install: update UID 10000 explanation (MR 2158) 2022-01-11 00:17:55 +03:00
Johannes Marbach 2ad5427126
pmb.install: automatically pick unlocker package (MR 2154)
This removes the hard-coded installation of osk-sdl when specifying
--fde (or using the on-device installer) and instead determines the
unlocker package by taking the most suitable provider of
postmarketos-fde-unlocker (factoring provider priority and packages
selected for installation).

With this change applied, one can manually select an unlocker package to
be installed via

    pmbootstrap install --fde --add other-unlocker

Relates to: postmarketOS/pmaports#1309
2022-01-02 22:40:23 +01:00
Oliver Smith 6f6a3b0408
Happy new year 2022! 2022-01-02 22:39:14 +01:00
Andreas Kemnade 8ca71ed3a0
install: do not choke on blockdevices without fs (MR 2153)
when blkid returns 2 while searching for existing pmos installations,
do not abort. That might happen if there is a block device without a
filesystem.

Error given:
(1653851) [21:39:19] (native) % blkid -s LABEL -o value /dev/sdcardp1
(1653851) [21:39:19] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(1653851) [21:39:19] NOTE: The failed command's output is above the ^^^ line in the log file: /home/andi/.local/var/pmbootstrap/log.txt
(1653851) [21:39:19] ERROR: Command failed: (native) % blkid -s LABEL -o value /dev/sdcardp1
(1653851) [21:39:19] See also: <https://postmarketos.org/troubleshooting>
(1653851) [21:39:19] Traceback (most recent call last):
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/__init__.py", line 49, in main
    getattr(frontend, args.action)(args)
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/helpers/frontend.py", line 314, in install
    pmb.install.install(args)
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/install/_install.py", line 944, in install
    install_system_image(args, 0, f"rootfs_{args.device}", step, steps,
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/install/_install.py", line 586, in install_system_image
    pmb.install.blockdevice.create(args, size_boot, size_root,
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/install/blockdevice.py", line 138, in create
    mount_sdcard(args, sdcard)
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/install/blockdevice.py", line 51, in mount_sdcard
    if previous_install(args, path):
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/install/blockdevice.py", line 27, in previous_install
    label = pmb.chroot.root(args, ["blkid", "-s", "LABEL", "-o", "value",
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/chroot/root.py", line 76, in root
    return pmb.helpers.run_core.core(args, msg, cmd_sudo, None, output,
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/helpers/run_core.py", line 343, in core
    check_return_code(args, code, log_message)
  File "/home/andi/.local/lib/python3.9/site-packages/pmb/helpers/run_core.py", line 219, in check_return_code
    raise RuntimeError("Command failed: " + log_message)
RuntimeError: Command failed: (native) % blkid -s LABEL -o value /dev/sdcardp1
2022-01-02 22:14:06 +01:00
Johannes Marbach a9d1049a3c
build: add support for conflicting dependencies (MR 2146)
This adds support for the depends="!conflict ..." syntax for explicitly
marking another package as conflicting with the current one.

Fixes: #2085
2021-12-30 20:25:02 +01:00
Oliver Smith 3e5f27d5e3
pmb.parse.depends.recurse: tweak message (MR 2151)
Fix the lint error. While at it, change the wording so it's clear it's
looking in pmaports instead of aports, use '' around the source package
just as the message does about the pkgname_depend, remove <> from the
link URL.

New message:
  Could not find dependency 'so:libPocoData.so.80' in checked out pmaports dir or any APKINDEX. Required by 'nymphcast'. See: https://postmarketos.org/depends

Fixes: 81dc4c ("pmb.parse: show which package require the missing package")
2021-12-19 18:16:51 +01:00
Martijn Braam 81dc4c17f6
pmb.parse: show which package require the missing package (MR 2150)
When a dependency is not found it now shows all the pacakges that
require that dependency in the error message.
2021-12-17 17:17:25 +01:00
Oliver Smith fd7050835f
Prepare 1.40.0 release 2021-12-12 19:07:21 +01:00
Anjandev Momi c1407f921b
Use doas instead of sudo if installed (MR 2091)
Prefer using doas over sudo if both are installed. Let the user override
the sudo tool with PMB_SUDO.
2021-12-12 18:46:17 +01:00
Tim Zimmermann 2801b5d687
kconfig-check: only check TZDEV/SAMSUNG_TUI on kernels older than 4.14 (MR 2148)
* On newer samsung devices disabling these does the exact opposite of
  what's mentioned in 50cdf04760
* With these enabled the device boots up just fine
2021-12-12 17:23:21 +03:00
Alexey Min 66d11d6d34
pmb.helpers.ui: clarify "none" UI purpose
And suggest users to use "console" UI instead.
2021-12-12 16:51:39 +03:00
Clayton Craft 58e4e86b6b
pmb.parse.parse_attribute: strip off trailing comment on attrib line (MR 2149)
The apkbuild parser could not handle cases where a line ends in a
comment but the value is not quoted.

E.g. this:

    pkgver=1.0 # I'm a comment, look at me

was being parsed to a value like this:

    1.0 # I'm a comment, look at me

... which is obviously wrong. This strips off any trailing comment on
the line, so it's parsed to the correct value.

fixes #2087
2021-12-12 16:16:30 +03:00
Anjandev Momi 8563efb9da
aportupgrade: if $pkgver=9999, use $_pkgver variable instead (MR 2127)
fixes #2071
2021-11-27 15:05:25 +01:00
Oliver Smith 54fade131c
Fix 'kconfig edit linux-...' (MR 2143)
Properly assemble the required pkgname to fix:

  $ pmbootstrap kconfig linux-postmarketos-allwinner
  ERROR: Could not find aport for package: postmarketos-allwinner

Fixes: 6557e6 ("kconfig argcomplete: support full pkgname")
2021-11-27 14:45:09 +01:00
BO41 3f2bd03d33
remove unused args argument (MR 2136) 2021-11-27 14:13:33 +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
BO41 ce0f1c2d4a
args.cache: remove (MR 2136)
Replace "args.cache" with a global variable 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-11-27 14:13:27 +01:00
Oliver Smith f30b1cc3f2
pmb.config.apk_tools_min_version: add alpine 3.15 (MR 2144)
Prepare for postmarketOS v21.12 release.
2021-11-26 00:51:11 +01:00
Jami Kettunen b3d91f274d
pmb/config: check CROSS_MEMORY_ATTACH config required for Waydroid (MR 2140)
Without this syscall zygote keeps constantly crashing in the container.
2021-11-18 19:43:51 +02:00
Caleb Connolly 4c4bd77c87
install: support password as cmdline arg (MR 2125)
So I can finally run `pmbootstrap install --password 147147` and go and
make a cup of tea.

Based on MR 1919.

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2021-11-06 22:45:00 +01:00
Oliver Smith 498738abcc
Prepare 1.39.0 release 2021-11-06 21:06:53 +01:00
Ultracoolguy 54afa35d70
Add 'flasher flash_lk2nd' command (MR 2089)
Many Qualcomm devices need this second bootloader for booting a mainline
kernel. Add an option to flash one if it exists.
2021-11-06 20:51:58 +01:00
Luca Weiss f4990cfc7a
aportupgrade: support gitlab.gnome.org (MR 2119)
Also sort the gitlab hosts alphabetically
2021-11-06 20:31:25 +01:00
Luca Weiss f996f3ed5a
aportupgrade: prefer explicit package mapping (MR 2119)
This solves some edge cases with packages like 'date', 'fmt' and others.
2021-11-06 20:31:19 +01:00
Oliver Smith 6557e6892a
kconfig argcomplete: support full pkgname (MR 2134)
Support full linux-* package names in argument completion for
"pmbootstrap kconfig ..." command-lines and get rid of related PROTIP
messages:
  PROTIP: You can simply do 'pmbootstrap kconfig check postmarketos-allwinner'

This improves consistency, as in other places we expect the user to
supply full package names as well (e.g. pmbootstrap build).
2021-11-06 15:23:37 +01:00
Oliver Smith 152bd6753c
arguments: fix compat with argcomplete 1.8 (MR 2134)
When running pmbootstrap on debian bullseye with the distro's
python3-argcomplete 1.8 from 2017, tab completion was broken. After
disabling stderr redirect to /dev/null, the error appeared:
  TypeError: package_completer() missing 1 required positional argument: 'parser'

Support this ancient version of argcomplete too by setting None as
default value for parser (we don't use it anyway).

Related: https://wiki.postmarketos.org/wiki/Pmbootstrap_development_guide#Debugging_tab_completion_.28argparse.29
2021-11-06 15:23:31 +01:00
Minecrell 8ace36113c
pmb.config/install: add flexible provider selection for "pmbootstrap init" (MR 2132)
The provider selection for "pmbootstrap init" added in this commit
is a flexible way to offer UI/device-specific configuration options
in "pmbootstrap init", without hardcoding them in pmbootstrap.
Instead, the options are defined entirely in pmaports using APK's
virtual package provider mechanism. The code in pmbootstrap searches
for available providers and displays them together with their pkgdesc.

There are many possible use cases for this but I have tested two so far:

  1. Selecting root provider (sudo vs doas). This can be defined entirely
     in postmarketos-base, without having to handle this specifically in
     pmbootstrap.

     $ pmbootstrap init
     [...]
     Available providers for postmarketos-root (2):
      * sudo: Use sudo to run root commands (**default**)
      * doas: Use doas (minimal replacement for sudo) to run root commands
              (Note: Does not support all functionality of sudo)
     Provider [default]: doas

  2. Device-specific options. My main motivation for working on this
     feature is a new configuration option for the MSM8916-based devices.
     It allows more control about which firmware to enable:

     $ pmbootstrap init
     [...]
     Available providers for soc-qcom-msm8916-rproc (3):
      * all: Enable all remote processors (audio goes through modem) (default)
      * no-modem: Disable only modem (audio bypasses modem, ~80 MiB more RAM)
      * none: Disable all remote processors (no WiFi/BT/modem, ~90 MiB more RAM)
     Provider [default]: no-modem

The configuration prompts show up dynamically by defining
_pmb_select="<virtual packages>" in postmarketos-base, a UI PKGBUILD
or the device APKBUILD. Selecting "default" (just pressing enter)
means that no provider is selected. This allows APK to choose it
automatically based on the "provider_priority". It also provides
compatibility with existing installation; APK will just choose the
default provider when upgrading. The selection can still be changed
after installation by installing another provider using "apk".

Note that at the end this is just a more convenient interface for the
already existing "extra packages" prompt. When using pmbootstrap in
automated scripts the providers (e.g. "postmarketos-root-doas") can be
simply selected through the existing "extra_packages" option.
2021-11-06 15:04:34 +01:00
Minecrell 47645f41b1
pmb.parse._apkbuild: parse provider_priority as int (MR 2132) 2021-11-06 15:04:25 +01:00
Minecrell 19b232969d
pmb.helpers.pmaports: search for provides in both root and subpackages (MR 2132)
At the moment, "provides" are only checked in the root package and not
in subpackages of APKBUILDs. Fix this by looking through the subpackages
as well.
2021-11-06 15:04:25 +01:00
Minecrell 5ed807c064
pmb.helpers.pmaports: parse guessed APKBUILD first for speed up (MR 2132)
At the moment we have to parse all APKBUILDs to find subpackages,
even if they are guessed easily shortly after. To speed this up,
let's guess first but verify the guess by only parsing that particular
APKBUILD. If the subpackage/provides is in there we seem to have found it.
2021-11-06 15:04:25 +01:00
Minecrell eb3e38d15c
pmb.helpers.pmaports: separate finding pkg in APKBUILD to function (MR 2132)
Make it possible to call this in a different place as well by placing
it in a separate function.
2021-11-06 15:04:25 +01:00
Minecrell 7246c32539
pmb.install: move install_recommends check into _install.py (MR 2132)
The current install code looks a bit confusing, there is an existing
if statement for the ui and ui-extras package but the recommended
packages are already installed before with a check in a completely
different file. Make this a bit more clear by moving this to the
ui if statement instead.
2021-11-06 15:04:25 +01:00
Minecrell 9d724d5d3d
pmb.config.init: parse deviceinfo only once (MR 2132)
Instead of parsing the deviceinfo over and over again, parse it once
and pass it to all the functions that make use of it.
2021-11-06 15:04:20 +01:00
Oliver Smith 05f257295d
pmb.config: add comment: kconfig check value types (MR 2133) 2021-11-06 14:28:54 +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 d856e21673
pmb.config.necessary_kconfig_*: tweak comments (MR 2133)
Improve the comments for consistency and to give a little more info than
just repeating the variable name.
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
Oliver Smith dcedc4bc1f
kconfig check: support strings too (MR 2133)
Extend the kconfig check code to not only support booleans and arrays,
but also strings. This will be used for CONFIG_LSM with apparmor where
it's important that "apparmor" has a certain spot in the list.
2021-11-06 14:28:53 +01:00
Oliver Smith 6b8fa93d37
pmb.parse.kconfig.check: git friendly arguments (MR 2133)
Put each component argument into a separate line, as these get changed
whenever adding a new kernel config check. I'm about to add two new
ones.
2021-11-06 14:28:49 +01:00
Alexey Min 0664a38190
pmb.qemu.run: workaround for new mkinitfs requirements (MR 2138)
It's been 3 months since we switched to new mkinitfs
and we are still fixing consequences.

linux-lts and linux-virt used by qemu-amd64 device package
install vmlinuz-lts (vmlinuz-virt). And qemu run cmdline
passed -kernel vmlinuz which makes it impossible to run
qemu without this change.

With this change proper kernel arg is passed to qemu.

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
Signed-off-by: Alexey Min <alexeymin@postmarketos.org>
2021-11-06 13:36:34 +01:00
Jami Kettunen 931675450d
pmb/config: check CRYPTO_AES and INPUT_EVDEV configs required for FDE (MR 2137)
AES is needed on top of XTS to unlock a disk with FDE enabled and evdev
is used in osk-sdl to input the passphrase.
2021-11-01 23:07:05 +03: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
Oliver Smith f2966e62ae
pmb.parse.arch.alpine_native: remove unused ret (MR 2130) 2021-10-24 14:34:30 +02:00
bo41 a8d425554c
remove unused args argument (MR 2130) 2021-10-24 14:34:26 +02:00
Martijn Braam 896879e89a
pmb: data: keys: sync with Alpine (MR 2131)
Alpine has new keys for the riscv64 builder and new 4096 bit
builder keys. This fixes CI again.
2021-10-19 01:44:35 +02:00
Martijn Braam ea70d3205e
pmb/config: add rkdeveloptool support (MR 2103)
Needed for flashing some rockchip platforms
2021-10-17 18:41:52 +02:00
Caleb Connolly 8bc5366e60
parse: deviceinfo: arch is required (MR 2124)
The deviceinfo_arch property is required but not checked, this leads to
weird errors if not caught.
2021-10-17 17:44:18 +02:00
Pablo Correa Gómez 4f793125d1
Allow to set mirror_alpine with pmbootstrap config command (MR 2129)
There is a double reason for this:
 * Better performance when developers/users choose local mirrors
 * Allows to continue developing if a mirror is down
2021-10-17 14:40:37 +02:00
Oliver Smith a676bdef0c
pmb.install.partition: fix mb_reserved calculation (MR 2123)
Calculate the end of the reserved space properly. Instead of:
	from size_boot to size_reserve
it is:
	from size_boot to (size_reserve + size_boot)

The reserved space is used by the on-device installer. Without this
patch, the reserved space could easily end up being too small, resulting
in no space left errors during the installation.
2021-10-17 14:27:44 +02:00
Alexey Min 97f59ffe93
pmb/config: fixup zram check options (MR 2126)
The main option - CONFIG_ZRAM - was not checked.
Add it and its direct requirement - CONFIG_ZSMALLOC.

The other two (ZSMALLOC_STAT, ZRAM_MEMORY_TRACKING) are
for debugging information only.
2021-10-15 21:48:18 +03:00
BO41 58922142ac
pmb.qemu.run.which_qemu: remove args argument (MR 2114)
Drop the argument, as it is not used.
2021-10-10 16:59:21 +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
Oliver Smith 313c9611c8
Prepare 1.38.0 release 2021-10-10 16:31:58 +02:00
Alexey Min ad491bc121
pmb.chroot.initfs: adapt to new mkinitfs (MR 2112)
Follow-up to 09794ef832 -
initfs file does not have flavor now, too.

Without this 'pmbootstrap initfs extract' fails with:

 (rootfs_samsung-klte) % cp /boot/initramfs-postmarketos-qcom-msm8974 /tmp/initfs-extracted/_initfs.gz
 cp: cannot stat '/boot/initramfs-postmarketos-qcom-msm8974': No such file or directory
2021-10-10 16:09:29 +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
Bart Ribbers 37c390aeed
pmb/parse/arguments: add aportupgrade to --help (MR 2121)
I keep forgetting this command exists, for one because it doesn't appear
(besides in a big, hard-to-read, one-line list) in the --help output
2021-10-10 13:55:02 +02:00
Alexey Min 5761a29f07
pmb.aportgen.binutils: fix for new binutils file conflict (MR 2116)
Newly generated binutils package has file conflicsts with
non-cross binutils.

  ERROR: binutils-2.37-r3: trying to overwrite usr/lib/bfd-plugins/libdep.so
         owned by binutils-aarch64-2.37-r3.

Fix the generator to produce package that does not include these plugins.
2021-09-29 23:41:58 +02:00
Newbyte 2d23849aa3
pmb, test: remove redundant commas (MR 2115) 2021-09-26 17:58:40 +02:00
Bart Ribbers 4675def8e6
pmb/config: add required option for Waydroid support (MR 2109) 2021-09-13 21:10:05 +03:00
Alexey Min 374d7379ab
pmb.parse.bootimg: make boot.img readable for all after copying (MR 2105)
This prevents rare errors when source file didn't have the
correct permissions.
2021-09-13 14:40:15 +03:00
Boris Lysov d559db062f
pmb.parse.bootimg: accept Mediatek recovery images too (MR 2105)
Some Mediatek recovery images have headers named
"RECOVERY". Accept those too.

Signed-off-by: Boris Lysov <arzamas-16@mail.ee>
Co-Authored-By: Alexey Min <alexeymin@postmarketos.org>
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2021-09-13 14:40:02 +03:00
Oliver Smith 881a3a03bc
pmb.parse.bootimg: refactor mtk_bootimg code (MR 2105)
Move all code that verifies the labels of the kernel and ramdisk inside
the boot.img file into a separate function, so it is easier to extend it
to allow recovery images too.
2021-09-12 22:02:52 +02:00
Oliver Smith 6fde1f0851
build --strict: use pmb.chroot.init_keys (MR 2110)
Fix the issue of having the postmarketOS binary repository key deleted
from the chroots after "abuild undeps" removes the postmarketos-keys
package. This happens if e.g. building two device packages in a row (as
they depend on postmarketos-base, which depends on postmarketos-keys in
current pmaports.git master).

I've also considered installing the postmarketos-keys next to
alpine-base in new chroots. But this would introduce a bootstrap
problem, since you can't install the postmarketos-keys package unless
it already exists in the repository. We'd run into that when building
the next release.
2021-09-10 21:27:20 -07:00
Oliver Smith 9b7feadca6
pmb.chroot.init_keys: split into own function (MR 2110)
Move code to install Alpine and postmarketOS keys into its own function,
so it can be called outside of pmb.chroot.init too (next patch).

Describe why this is needed in the first place and, while at it, tweak
the function to only copy the key if it does not exist in the target
directory.
2021-09-10 21:27:19 -07:00
BO41 77d39ecdf1
lint: enforce max line length (MR 2097) 2021-09-10 03:18:27 +02:00
Henrik Grimler 51bfdc9784
pmb.aportgen: prefix $_outdir to dtbTool-sprd -p arg (MR 2107)
The -p arg is suppose to point to the folder where the dtc program
resides (if it is not found in PATH). If we use an _outdir, which the
template currently does, then the arg needs to be -p
$_outdir/scripts/dtc/, and not -p scripts/dtc/, as scripts/dtc/ only
contains the dtc source code.
2021-09-05 15:56:52 +02:00
Henrik Grimler c524926295
pmb.aportgen: rm -p scripts/dtc arg from dtbTool cmd (MR 2107)
The python variant of dtbTool, that we currently use, does not use
this arg as it does not run dtc in a shell.  I suppose the argument
was added only for compatibility with other dtbtools.
2021-09-05 15:54:43 +02:00
Clayton Craft 393184672d
pmb/config/flashers/heimdall: support a single kernel flavor (MR 2106)
This was missed in 05c9fb78
2021-09-05 00:50:01 -07: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
Oliver Smith 0b95779e30
Prepare 1.37.0 release 2021-09-03 19:28:07 +02:00
Clayton Craft 45ce639aca
pmb/qemu: add support for single kernel 'flavor' (MR 2093) 2021-09-02 18:18:14 -07:00
Clayton Craft 453ce35b8c
pmb/export/symlinks: add support for a single 'flavor' (MR 2093) 2021-09-02 18:18:13 -07:00
Clayton Craft 91bb682755
pmb/install/recovery: add support for single kernel 'flavor' (MR 2093) 2021-09-02 18:18:13 -07:00
Clayton Craft 05c9fb784f
pmb/config/flashers: add support for single kernel 'flavor' (MR 2093) 2021-09-02 18:18:13 -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 184ac91ec5
pmb/install: use kernel pkg for device when printing firewall info (MR 2093)
multiple 'flavor' support will be going away
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 ca7ac4c704
pmb/chroot/initfs: change invocation to support the new mkinitfs (MR 2093)
The new mkinitfs does not have options for kernel flavor or version

A new pmaports.cfg variable, "supported_mkinitfs_without_flavors" is used to
determine how to invoke mkinitfs
2021-09-02 18:18:05 -07:00
Clayton Craft 9ae2eef0f0
pmb/config: add missing option for flash_heimdall_partition_dtbo (MR 2104)
This fixes a regression introduced by pmb!2099
2021-08-31 19:45:25 -07:00
afeuerstein 2d3cfbcbb4
pmbootstrap flasher: add flash_dtbo (MR 2099) 2021-08-29 22:51:56 +02:00
Oliver Smith 468d313790
Prepare 1.36.0 release 2021-08-22 21:45:59 +02:00
BO41 87dd1d0961
pmbootstrap: add color support (MR 2090)
Can be disabled by setting the $NO_COLOR environment variable
2021-08-19 11:00:04 +02:00
BO41 e1aef47271
pmbootstrap: make use of consistent casing (MR 2090) 2021-08-12 17:06:11 +02:00
Alexey Min a6c63f9580
pmb.aportgen.gcc: use more f-strings (MR 2092) 2021-08-10 01:18:22 +03:00
afeuerstein 83c4f142e2
pmb.aportgen.gcc: sync makedepends of gcc aportgen to upstream (MR 2092)
Remove paxmark dep. Follow up to
1c6ba9f907,
which happened 5 months ago.

Fixup testdata too.
2021-08-10 01:16:54 +03:00
Oliver Smith d01027fe2c
pmb.config.apk_tools_min_version: update
Require an apk-tools version that has the recent CVE fixed.

Related: https://security.alpinelinux.org/vuln/CVE-2021-36159
2021-08-07 17:12:03 +02:00
Petr Vorel ba07c4cf14
pmbootstrap init: Fix regexp for int (MR 2086)
This improves handling input in pmbootstrap init.

Various config options in "Additional options" are int, thus whole input
must be checked:

This fixes obvious error:
Jobs [9]: 5e

and less obvious errors:
Extra space size: 600.5
Extra space size: 600m
...
$ pmbootstrap install
[17:28:23] *** (3/4) PREPARE INSTALL BLOCKDEVICE ***
[17:28:23] ERROR: invalid literal for int() with base 10: '600.5'

NOTE: I suppose moving ^ $ to ReadlineTabCompleter.ask() would break
some of already defined regexes.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2021-08-01 16:12:04 +02:00
Clayton Craft db12e987d0
pmb/chroot/binfmt: always install qemu- binary (MR 2088)
gitlab runners seem to be registering binfmt now (?), so this fixes an
issue where register() might return immediately because the OS (or ??)
took care of registration, but the qemu-<arch> binary wasn't added to
the chroot.
2021-07-28 15:27:59 -07:00
Clayton Craft 8447629f3c
pmb/chroot/binfmt: don't register arch if OS does it automatically (MR 2088)
It seems like the gitlab runners will now automatically register archs
when binfmt is mounted (I'm not completely sure, it's really
hard/annoying to confirm using gitlab CI jobs and no direct access to
the runner)

In any case, checking if it's already registered fixes a problem where
CI fails with "File exists" when it tries to register the arch.
2021-07-28 14:39:07 -07:00
Petr Vorel f3b6534b69
pmbootstrap init: Fix project in issue reference (MR 2087)
It's in https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1904,
not in https://gitlab.com/postmarketOS/pmaports/-/issues/1904.

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
2021-07-28 10:51:21 -07:00
Newbyte 3c98cae230
kconfig check: require CONFIG_SWAP for zram (MR 2085)
While zram has uses outside of swap-on-zram, I would believe that the
main use of zram in postmarketOS is swap-on-zram. In addition to that,
I imagine many probably expect swap-on-zram to work if the zram kconfig
succeeds.
2021-07-17 18:11:50 -07:00
Oliver Smith 68fe7df046
pmbootstrap install: support new ondev boot label (MR 2083)
In order to support FAT32 as boot partition, the label is shortened from
pmOS_inst_boot to pmOS_i_boot. Read the value from pmaports.cfg and fall
back to the old value, so both are supported (-> building v21.06 and
v21.03 will use the old label).

Remove the old codepath that would set "pmOS_boot" as label for the
install partition, if the postmarketos-ondev package was older than
0.4.0. This is only the case on the long unsupported v20.05 branch.
2021-07-13 19:57:08 +02:00
Oliver Smith a34db4c8fd
Prepare 1.35.0 release 2021-07-11 22:47:27 +02:00
Oliver Smith a0ca7d9a14
install --ondev: no postmarketos-base-nofde (MR 2082)
Install osk-sdl in the installer OS's boot partition for now. I forgot
about a code path earlier, which could render an encrypted target OS
without osk-sdl in the initramfs (and being unable to boot).

The target OS gets embeded in the installer OS as image file. This can
happen in two formats:

a) a full image with partition header and the boot and root partition
This is what bpo is doing when building the official, pre-built images,
as this method allows having the exact same image available separately
without the installer. Basically:
	pmbootstrap install \
		--ondev \
		--no-rootfs \
		--cp path/to/rootfs:/var/lib/rootfs.img

b) an image with just the root partition, no partition header and no
boot partition. This is what you get when running regular
"pmbootstrap install --ondev". It's slightly smaller, as there is no
duplicate boot partition.

If b) was done, the installer will copy the contents of the installer's
boot partition to the target OS. And that means: if osk-sdl is missing
from the installer's boot partition (the initramfs generated there), it
will also be missing in the boot partition of the target OS!

I think we should get rid of the b) code path to avoid confusion in the
future/make maintenance. But until that is done, always install osk-sdl
into the installer OS.
2021-07-11 20:18:41 +02:00
Oliver Smith 9bef0a815a
pmbootstrap init: fix question for locale (MR 2082)
Remove the "(y/n) " in the question:
  Choose default locale for installation (y/n) [C.UTF-8]:
So it becomes:
  Choose default locale for installation [C.UTF-8]:
2021-07-11 17:12:31 +02:00
Oliver Smith 9e03034b28
Fix pmbootstrap -h for --mirror-pmOS (MR 2082)
Fix this weird help output:
  -mp URL, --mirror-pmOS URL
                        postmarketOS mirror, disable with: -mp='', specify
                        multiple with: -mp='one' -mp='two', default: h, t, t,
                        p, :, /, /, m, i, r, r, o, r, ., p, o, s, t, m, a, r,
                        k, e, t, o, s, ., o, r, g, /, p, o, s, t, m, a, r, k,
                        e, t, o, s, /
2021-07-11 17:12:31 +02:00
Oliver Smith 7616803207
pmb.chroot.shutdown: clean up chroot marker here (MR 2082)
Remove /in-pmbootstrap inside chroots in "pmbootstrap shutdown" instead
of having it at a specific part of "pmbootstrap install".

Reasoning:
* With current approach, it didn't get removed in the on-device
  installer chroot.
* This is less error prone than calling it multiple times in
  "pmbootstrap install"
2021-07-11 17:12:26 +02:00
Anri Dellal c347b27f69
pmb/config/init.py: use f-strings, fix E501 (MR 2043) 2021-07-06 18:55:41 -07:00
Anri Dellal 08617722a4
init: Hide unsupported UIs (MR 2043)
Hides user interfaces which require GPU acceleration
for unsupported devices. Device support is identified
by deviceinfo property `deviceinfo_gpu_accelerated`.
UI which has GPU acceleration as requirement,
must have `pmb:gpu-accel` in APKBUILD's options.
2021-07-06 18:55:34 -07:00
Anri Dellal d764b0de58
bootimg_analyze: Add support for boot header version 3 (MR 2073) 2021-07-07 04:43:24 +03:00
Clayton Craft 9d22989a88
kconfig: add missing options for nftables support to kconfig check (MR 2076)
I missed these when collecting the required kconfig options for
nftables, and it was a happy coincidence that the kernels I enabled the
nftables stuff on already had these enabled so that the initial kconfig
check passsed

test/kconfig: add missing nftables options
2021-07-07 04:24:07 +03:00
Maxim Karasev 1bb15765ed
pmb.helpers.run_core.kill_commands: use minimal subset of ps parameters (MR 2074)
again, busybox ps supports only -o option (-e is ignored, because
busybox always shows all processes).
2021-06-28 02:07:55 +03:00
Maxim Karasev 31e7a0006d
pmb.helpers.other.folder_size: use kilobytes (MR 2074)
busybox du doesn't support bytes or custom block sizes.
2021-06-28 02:07:55 +03:00
Anri Dellal 5c1da79634
pmbootstrap init: Add mirror choice (MR 2035)
Allows user to choose one of the mirrors from
https://mirrors.postmarketos.org.

Example:
[1] Mirror 1 (Location 1)
[2] Mirror 2 (Location 2)
[3] Mirror 3 (Location 3)
Select a mirror [1]: 2

Co-Authored-By: Alexey Min <alexey.min@gmail.com>
2021-06-27 18:38:01 +02:00
Alexey Min c5bd07e3ae
pmb.helpers.http: add missing parameter doc (MR 2035) 2021-06-27 18:37:57 +02:00
Dylan Van Assche 834cc7f877
install: allow to use last block for embedding (MR 2069)
Devices such as ODROIDs have binaries use which every single block for
embedding. Do not raise an error when binaries are touching, but not
overlapping, each other when embedding these binaries during installation.

Add a test for this scenario, which fails when reverting the change.

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2021-06-26 20:11:42 +02:00
Dylan Van Assche e900ee169a
install: refactor embed_firmware and add test (MR 2069) 2021-06-26 20:11:36 +02:00
Clayton Craft 31e36e195c
install: explicitly install osk-sdl when needed (MR 2066)
This adds osk-sdl to the rootfs when --fde is set, or when building a
rootfs for the ondev installer. Ideally the ondev installer would
selectively install osk-sdl if the user opted for fde at runtime, but
I haven't found a straight forward way to enable that yet, and this
behavior here is no different than the current behavior (where osk-sdl
is always installed in the rootfs by way of depends= in pmos-mkinitfs).

For images that are built without --fde, osk-sdl won't be installed at
all in the rootfs, once the dependency is dropped from pmos-mkinitfs.
Instead, a dummy package postmarketos-base-nofde will be installed
instead to satisfy the dependency that postmarketos-mkinitfs has on the
virtual package "postmarketos-fde-unlocker"
2021-06-25 12:28:36 -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
Oliver Smith 716336e30b
kconfig check: allow range of kernel versions (MR 2060)
Make it possible to specify rules as range, e.g. ">=4.0 <5.0".
2021-06-23 01:12:43 +02:00
Martijn Braam 475377fbfc
Prepare 1.34.0 release
* Update so v21.06 can be built
2021-06-20 11:02:04 +02:00
Oliver Smith 5afc2e626f
pmb.config.apk_tools_min_version: add alpine v3.14 2021-06-16 22:15:49 +02:00
Oliver Smith 53dfe85956
Prepare 1.33.0 release 2021-06-15 00:09:42 +02:00
Clayton Craft f8fa80e20e
install: add --no-firewall / print firewall status (MR 2042)
The option, --no-firewall, will disable nftables on boot in the image,
and print a warning message if it's being disabled in a device image
where the device's kernel should support running the firewall.

Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2021-06-14 21:51:36 +02:00
Anri Dellal 21c9e38162
kconfig: Refactor check_config (MR 2042)
Support force-checking multiple components. Fixes #2034.

Co-Authored-By: Clayton Craft <clayton@craftyguy.net>
2021-06-14 21:50:56 +02:00
Clayton Craft 599d74ec25
kconfig check: add support for nftables (MR 2042) 2021-06-14 21:50:45 +02:00
Alexey Min df9c61a868
pmb.config.aportgen_mirror_alpine: use working mirror (MR 2067)
The dl-2 mirror is missing required .apk files now.
Use dl-4 instead.
2021-06-13 23:49:55 +02:00
Luca Weiss b18281ab26
pmb.aportgen: fix architecture autocomplete (MR 2054)
Previously hitting the tab key wouldn't actually complete the
architecture field.
2021-06-13 15:05:27 +03:00
Luca Weiss edf43916a5
pmb.aportgen: don't suggest armhf (MR 2054)
New ports shouldn't use that architecture; and devices whose CPU only
supports armhf aren't really useful for anything anyways.

This will also make the suggested/default architecture be armv7
(architectures[0]).
2021-06-13 15:05:27 +03:00
Alexey Min 4a8fac6c6e
pmb.aportgen: use correct arch for gcc aportgen (MR 2068)
Previously it always used native (x84_64) arch for apkindex
version check.

As pmb.aportgen.core.alpine_apkindex_path() already has arch
parameter, use it to look up correct APKINDEX.

Also fixup test.
2021-06-13 02:17:28 +03:00
Clayton Craft aa2c740810
config: fix config file path when XDG_CONFIG_HOME is set (MR 2065)
fixes a regression from f3b3fe906 where the file name was not being
appended to the path in the case where `XDG_CONFIG_HOME` was set.
2021-06-06 23:41:40 -07:00
Caio Fontes f3b3fe906b
enforce E501 in pmb/config (MR 2058) 2021-06-06 19:21:31 +02:00