Commit Graph

1768 Commits

Author SHA1 Message Date
Oliver Smith 5d5801b2a9
install --ondev: set username to "user" 2020-06-29 21:26:33 +02:00
Oliver Smith 4d940736a8
install --ondev: add ondev_min_version
Put a minimum version check for postmarketos-ondev in the pmbootstrap
install code and verify it before starting the installation. This avoids
using incompatible versions, similar to the pmaports.cfg version check
we already have. Set the minimum required version to 0.2.0.
2020-06-29 21:26:33 +02:00
Oliver Smith a6bcc2ba83
install --ondev: ondev-prepare: fix log msg 2020-06-29 21:26:33 +02:00
Oliver Smith afeeeee4d7
install --ondev: ondev-prepare: pass pmb ver, ui
Pass the pmbootstrap version and user interface, so it can be checked /
displayed in postmarketos-ondev.
2020-06-29 21:26:33 +02:00
Oliver Smith a7dbdf58bc
install --ondev: ondev-prepare: use env vars
Do not pass the arguments to ondev-prepare as command-line arguments in
a specific order, but instead as environment variables. New arguments
will be added in a follow-up patch.
2020-06-29 21:26:33 +02:00
Oliver Smith 7da4903223
pmbootstrap install --no-local-pkgs: new option
Don't install locally compiled packages and package signing keys. This
will be used for the official images generated with pmbootstrap.
2020-06-29 21:26:33 +02:00
Oliver Smith 879cd06024
pmbootstrap install: make building pkgs optional
Add a question at the end of "pmbootstrap init", to ask if the user
wants to build outdated packages during "pmbootstrap install". Store the
result in the new pmbootstrap.cfg key "install_build_pkgs". I've put it at
the end, because it is a rather complicated question compared to the rest.

This is useful to speed up the installation for casual users who can now
avoid compiling packages. But also for the official images where we only
want to ship the official binary packages and not build anything
on-the-fly.
2020-06-29 21:26:28 +02:00
Oliver Smith bfbb095895
pmb/aportgen/musl.py: fix distfile collisions (MR 1947)
Add the Alpine mirrordir (e.g. "edge", "v3.12") to the distfile, so
musl-*.apk files of the same version and arch but from different
mirrordirs do not collide.

Let "abuild checksum" download these apks and generate the checksums,
instead of letting apk download them as side-effect of initializing
foreign arch chroots. The latter did not work anymore, because we would
copy the apk file with a glob that may matches the hash of either mirrordir.
Essentially:
    glob.glob(f"{args.work}/cache_apk_{arch}/{subpkgname}-{version}.*.apk")[0]

In the context of the on-device installer, I found that calculating this
hash is not trivial, so let's just avoid it here as well.

While at it, order the imports of musl.py alphabetically.
2020-06-24 04:41:54 +03:00
Oliver Smith 4f7a13084f
pmb/aportgen/musl.py: use channel alpine mirrordir (MR 1939)
On branch stable, we would use Alpine's mirrordir "v3.12" for example.
2020-06-21 12:07:29 +02:00
Oliver Smith ac90787e76
pmb/aportgen/musl.py: pass 'pmbootstrap lint' (MR 1939)
Remove quotes around pkgname and pkgver, indent with tabs and provide
a stub for arch_to_hostspec.
2020-06-21 12:07:09 +02:00
Oliver Smith 37ee340166
pmb/aportgen/musl.py: use f-string in APKBUILD (MR 1939) 2020-06-21 12:07:05 +02:00
Oliver Smith 357c1acc82
test/test_aportgen.py::test_aportgen: armhf->armv7 (MR 1942)
Alpine's armhf edge build bot is stuck, so musl-1.1.24-r9.*.apk is
missing and the test fails. armhf is on it's way out, so replace it with
armv7.
2020-06-21 11:50:57 +02:00
Oliver Smith ea710caafe
pmb/aportgen/binutils.py: pass apkbuild-lint (MR 1942) 2020-06-21 11:50:57 +02:00
Oliver Smith 654cc56062
pmb/aportgen/core.py: no quotes around some keys (MR 1942)
Don't print quotes for pkgname, pkgver, pkgrel. This is required to pass
apkbuild-lint.
2020-06-21 11:50:57 +02:00
Oliver Smith c0b80b26b5
pmb.aportgen.core.rewrite: no lines with empty val (MR 1942)
Avoid apkbuild-lint errors like:
	[AL5]:APKBUILD:15:variable set to empty string
2020-06-21 11:50:52 +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 8fb69f9c46
install_system_image: add sdcard argument (MR 1946)
The on-device installer will run install_system_image once with
sdcard=None and the second time with sdcard=args.sdcard.
2020-06-19 09:36:51 +02:00
Oliver Smith 718839364b
install_system_image: add split argument (MR 1946) 2020-06-19 09:36:51 +02:00
Oliver Smith 539108bbc4
install_system_image: add step, steps parameters (MR 1946) 2020-06-19 09:36:51 +02:00
Oliver Smith a56e4eae5a
install_system_image: add root_label parameter (MR 1946)
Prepare for on-device installer, so it can use something other than
"pmOS_root" as label.
2020-06-19 09:36:51 +02:00
Oliver Smith 7fb41641ea
install_system_image: add suffix argument (MR 1946)
Allow files to be copied from a different suffix than rootfs_$DEVICE.
The on-device installer will use this.
2020-06-19 09:36:51 +02:00
Oliver Smith 17e7edb254
Cosmetics: install_system_image(): remove FDE msg (MR 1946)
Full disk encryption (--fde) has not been the default for a long time,
so no need to warn the user about it.
2020-06-19 09:36:51 +02:00
Oliver Smith cd58efdbd7
pmb.install._install.print_flash_info: cosmetics (MR 1946)
Fix a typo and wrap lines at 80 characters (especially one extra long
line). Use f-strings in lines that were modified (as we're doing it
nowadays).
2020-06-19 09:36:51 +02:00
Oliver Smith a3fd169c76
pmb.install._install.print_flash_info: new func (MR 1946)
Move code that prints flashing information from install_system_image()
to its own function. For the on-device installer, we'll need to call
install_system_image() twice, without printing the flashing information
each time. While at it, add "step" and "steps" parameters.
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 5fbc95c3c2
Cosmetic: pmb.install.partition: fix comment (MR 1946) 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 00691a56ee
blockdevice.create_and_mount_image: add split arg (MR 1946)
Add a "split" argument to the function, instead of using "args.split"
directly. "args.split" is only defined when calling "pmbootstrap install",
but the next patch will add a code path that calls the function from
"pmbootstrap chroot".
2020-06-19 09:36:50 +02:00
Bhushan Shah 79409053ad ci: install pip as well 2020-06-17 13:34:59 +05:30
Minecrell 3ebb994206
pmb.parse: Respect provider_priority if multiple providers exist (MR 1945)
Alpine APKBUILDs have the concept of "provider priorities" that affect
the choice of the provider to install when multiple packages provide
a virtual package.

One use case for this is to allow installation of different firmware
versions. bq-paella can run unsigned firmware, therefore you have the
choice between using the original firmware from the manufacturer, or
a slightly newer version from Qualcomm for the Dragonboard 410c.

We add provides="firmware-qcom-msm8916-wcnss" (the "virtual package")
to both firmware-qcom-db410c-wcnss and firmware-bq-picmt-wcnss.
At this point, attempting to install "firmware-qcom-msm8916-wcnss"
would still fail with apk. (Because it does not know which provider
to install.)

To pick a default we can set e.g. provider_priority=100 for
firmware-qcom-db410c-wcnss (the slightly newer version).
In that case, firmware-qcom-db410c-wcnss should be installed by default.

However, the user can choose to do "apk add firmware-bq-picmt-wcnss"
to override the default choice in case of problems. In that case,
the conflicting firmware-qcom-db410c-wcnss will be automatically removed.

At the moment, pmbootstrap does not respect the "provider_priority" at all.
In the above case, it would always install "firmware-bq-picmt-wcnss"
during "pmbootstrap install" since that has the shortest name.

Extend the pmbootstrap code to pick a provider with the highest priority
(if any of the providers has a priority set).
2020-06-16 01:31:28 +03: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
Iskren Chernev 2dd707a7ea
envkernel.sh: Add reactivate, deactivate on re-source (MR 1918)
Some users prefer to re-source the script from time to time. Detect that
and deactivate first.
2020-06-02 11:34:46 +02:00
HenriDellal 4e3a2d6923
Add "flasher flash_vbmeta" support for heimdall devices (MR 1936) 2020-06-02 11:14:59 +02:00
Oliver Smith 40a328388d
pmb.install: simplify root size estimation (MR 1931)
Do not substract the estimated size of the home and boot directories
from the root directory size. While that would be the correct way if we
were able to get exact sizes, it isn't helpful with the very rough
estimates we are getting from pmb.helpers.other.folder_size. Replace
"calculate" wording with "estimate".
2020-06-02 10:48:03 +02:00
Anjandev Momi 37b4af19fc
make boot partition size user-overridable (MR 1931)
Ask for the boot partition size during "pmbootstrap init" in the
additional options with a default of 128 MB, and allow to override it
with -B.
2020-06-02 10:48:03 +02:00
Oliver Smith d623913491
pmbootstrap init: (build => additional) options (MR 1931)
Rename "build options" to "additional options", so we can put non-build
related options there too.
2020-06-02 10:47:58 +02:00
Anjandev Momi 0ff9c5d471
pmbootstrap init: only display UIs for device arch (MR 1937)
Hide user interfaces that are not available for the selected device's
architecture.

Closes #1790
2020-06-02 09:18:39 +02:00
Oliver Smith 2d2ab1df56
testdata: update lg-mako deviceinfo (MR 1937)
Copy from current pmaports master, so pmbootstrap doesn't complain about
missing deviceinfo_codename when parsing it. Right now pmbootstrap
doesn't complain about this, but with the next patch it will attempt to
parse the file.

This replaces the year from 1337 to 2012 too, but let's rather have it
slightly more maintainable than introducing a diff for a funny reference.
2020-06-02 09:18:34 +02:00
Oliver Smith 445410d08c
Prepare 1.20.0 release 2020-05-24 08:51:01 +02:00
Oliver Smith 0aa1dd7145
pmb.parse.deviceinfo.sanity_check: verify chassis (MR 1933) 2020-05-24 08:38:43 +02:00
Luca Weiss 1356707e9a
pmb.install._install: update comments (MR 1933) 2020-05-24 08:38:15 +02:00
Luca Weiss 6bb7f022b1
pmb: introduce deviceinfo_chassis (MR 1933)
"Chassis" defines the what kind of device a device is. Currently the
following standardized types exist:

  "desktop", "laptop", "convertible", "server", "tablet", "handset",
  "watch", "embedded", "vm", "container"

This property is exposed by org.freedesktop.hostname1 (e.g.
openrc-settingsd) and can be used by applications for example to display
appropriate strings instead of "About this phone" for non-phone devices.
2020-05-24 08:38:10 +02:00
Antoine Fontaine c5d0f76005
pmb.parse.kconfig: add tests (MR 1916) 2020-05-24 04:42:13 +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
Antoine Fontaine e36e160167
pmb.parse.kconfig: check for end of line in "CONFIG_…=y" (MR 1916)
it's a nitpick, but now `is_set` won't return true
for (e.g.) CONFIG_XYZ=marmelade.
2020-05-22 23:05:28 +02:00
Antoine Fontaine 075706b26e
pmb/build: remove implicit native cross-compilation (MR 1941)
If a package want native cross compilation, it should explicit that
with "pmb:cross-native" in `options=`.
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1910.
2020-05-21 08:03:50 +03:00
Oliver Smith 7f60a6d782
chroot: put built packages into channel subdir (MR 1912)
Migrate to workdir version 5 and move already built packages into the edge
channel subdir, for example:
	$WORK/packages/x86_64/hello-world-1-r5.apk
to:
	$WORK/packages/edge/x86_64/hello-world-1-r5.apk

The build.postmarketos.org code has already been adjusted to find built
packages in either directory structure.
2020-05-17 08:08:45 +02:00
Daniele Debernardi d3dc3b2c98
pmb.chroot.shutdown: losetup with auto_init=False (MR 1912)
Do not go through the pmb.chroot.init() code path when running
pmb.install.losetup.umount() inside pmb.chroot.shutdown(). This is not
necessary, as pmb.install.losetup.umount() only gets called if the
chroot is already initialized and /dev/loop-control is mounted inside
the chroot.

Not going through this code path is important for the upcoming workdir
migration patch. Without this fix, it will fail with the following if
running "pmbootstrap install" before the work migration:

ERROR: Could not figure out on which release channel the 'native' chroot is
2020-05-17 08:08:45 +02:00
Oliver Smith 5a256f66de
pmb.helpers.pkgrel_bump.auto_apkindex_files: remove (MR 1912)
Replace the call to this function with the almost identical
pmb.helpers.repo.apkindex_files(), so release channel related changes
only need to be done in one place.
2020-05-17 08:08:45 +02:00