Commit Graph

64 Commits

Author SHA1 Message Date
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 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 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
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
Luca Weiss 1356707e9a
pmb.install._install: update comments (MR 1933) 2020-05-24 08:38:15 +02:00
Daniele Debernardi 37101a8035
pmb.install._install: fix subpartitions size calculation (MR 1915) 2020-04-20 03:19:30 +03:00
Daniele Debernardi 34c6f88691
pmb.install._install: add option to not generate the image (MR 1914) 2020-04-14 00:29:35 +03:00
Daniele Debernardi 43bf45bd02
pmb.config.init: prompt for installing UI extras package (!1906) 2020-04-11 19:10:45 +02:00
Antoine Fontaine 350d384492
pmb.install._install: check sdcard exist (extra sanity check) (!1894) 2020-04-05 13:33:51 +02:00
Antoine Fontaine 00dc54a6c7
pmb.install._install: correct capitalisation in an error message (!1894) 2020-04-05 13:33:46 +02:00
Alexey Min e5e48537b1
pmb.install: offer to flash vbmeta if device declares support for it (!1885) 2020-03-21 20:58:08 +01:00
Minecrell fb8de5a553
pmb: Look for device/* files in device/*/... instead (!1879)
In the future, device ports will be located in a subdirectory
below device/... (e.g. device/testing/device-...).
Replace all occurrences of device/* with a glob that checks the
subdirectories instead.

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

Change the glob for pmaports to <aports>/**/APKBUILD.
This allows using subdirectories for organization outside of device/
as well.
2020-03-14 08:44:16 +01:00
Minecrell 320b2faa4c
pmb.qemu: remove QEMU mesa driver setup question (!1886)
mesa-dri-swrast and mesa-dri-virtio are both provided by mesa-dri-gallium
now, so this option does not have much use anymore. With both selections,
exactly the same packages are installed.
2020-03-14 08:05:32 +01:00
KuroLevin b05c0e78c7
Increase the size of boot partition. (!1884)
Give enough space to do atomic replacement of boot files, as is now done
with:
ed3eeeeebb
2020-03-01 11:06:42 +01:00
Oliver Smith f21c216a26
Cosmetic: use SPDX license header (!1877)
While at it, also remove unnecessary "#!/usr/bin/env python3" in files
that only get imported, and adjust other empty/comment lines in the
beginnings of the files for consistency.

This makes files easier to read, and makes the pmbootstrap codebase more
consistent with the build.postmarketos.org codebase.
2020-02-24 03:11:10 +03:00
Minecrell 87dd071b32
add "fastboot-bootpart" flasher to flash split images with fastboot (!1871)
asus-me176c has a Fastboot interface that can be used for flashing,
but in postmarketOS we do not use Android boot images for it.
This is because is it not very practical - the boot partition is
quite small and there is a (custom) EFI bootloader that can boot
directly from any other FAT32 partition.

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

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

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

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

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

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

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

  - At the moment the boot partition image is not regenerated when
    using "pmbootstrap flasher flash_kernel" (unlike when using Android
    boot images). "pmbootstrap install" needs to be run manually first.
2020-02-10 00:05:00 +03:00
Minecrell c8737740b1
pmb.install: Add pmbootstrap install --(no-)sparse option (!1862)
At the moment, sparse images are generated if the device sets
deviceinfo_flash_sparse="true". But for testing purposes it can be
useful to specifically enable or disable the default behavior.

Add a --sparse and --no-sparse option that enables or disables
sparse image generation.
2020-01-26 22:56:42 +01:00
Minecrell 44e887f11e
pmb.install: remove qemu-user binary stub from device rootfs (!1861)
Now that the qemu-user binary is bind-mounted, we no longer copy
the binary to the device rootfs. However, there is still the empty
stub file that we used as a destination mount point.

Let's remove it before copying it to the device rootfs.
It is automatically re-created the next time the qemu-user binary
is needed.
2020-01-26 19:47:43 +01:00
Clayton Craft 9f1dd64fa1
install/partition: allow specifying a different boot partition start (!1856)
This adds a new deviceinfo parameter, 'boot_part_start' which accepts an
int and indicates the number of sectors from the start of the drive to
place the boot partition.

The librem5 devkit (and actual phone) u-boot has grown beyond the 2048
sector space previously before the boot partition, so this is necessary in
order to boot pmos on this device.
2020-01-18 19:26:31 +00:00
Oliver Smith 948e3f931f
Change copyright to 2020 2020-01-06 02:43:00 +01:00
Drew DeVault 87389fbad3
pmbootstrap install: add --no-base option (!1843) 2019-12-14 02:38:56 +01:00
Daniele Debernardi 8326025c27
install: setup xorg keymap (!1833)
With the nokia N900 the user can choose between different keyboard
layouts and during the install the setup-keymap installs the choosen
layout.

This only changes the keyboard layout of the console, while installing
a UI using xorg, the layout was hardcoded to "us".

With a simple check for the existence of an xorg config containing
XkbLayout, this will run sed to replace the default with the layout
chosen by the user.

Tested with a clean install of the nokia N900 with the xfce4 UI.
2019-11-20 21:57:58 +01:00
lambdadroid 23ebb71b27
Install "android-tools" instead of "libsparse" for img2simg (!1821)
The sparse image tools (simg2img, img2simg, append2simg) are now
part of Alpine's android-tools where they are continously updated.
(See https://github.com/nmeum/android-tools/pull/8)

Therefore, "libsparse" now conflicts with "android-tools", which
causes the fastboot flasher to fail if "libsparse" is already
installed.

Install "android-tools" instead of "libsparse" before generating
a sparse image to avoid this problem.
2019-10-07 22:43:27 +02:00
lambdadroid c3a9452ccb
Skip sparse image generation when installing to SD card (!1809)
At the moment, attempting to install to SD card when
flash_sparse is set to "true" will always fail because
/home/pmos/rootfs does not exist in that case.

Sparse images are only useful to speed up Fastboot flashing.
Nothing will be able to read it from the SD card.
The problem can therefore be avoided by simply skipping the
generation of the sparse image when SD card installation is used.
2019-08-27 11:54:30 +02:00
Steffen Pankratz 3b240e46f7
fix deprecation warnings in regular expressions (!1804)
From https://docs.python.org/3/library/re.html
"Backslashes are not handled in any special way
in a string literal prefixed with 'r'."

Signed-off-by: Steffen Pankratz <kratz00@gmx.de>
2019-07-28 12:26:15 +02:00
Idan Horo fd79a60383
pmbootstrap install: make --no-fde default (!1798)
Implement --fde, add deprecation warning to --no-fde, update related
help files and tests.
2019-07-05 20:04:10 +02:00
Luca Weiss 650ed4925e
Fix spelling mistakes (!1794)
codespell --skip="./.git,./aports*"
2019-06-25 09:20:05 +02:00
Martijn Braam cea6e70209
Check if the SD card is writable before starting the install (!1772) 2019-03-30 15:12:42 +01:00
Clayton Craft 644083c0f7
Allow embedding multiple firmware binaries into SD images (!1739)
This allows embedding multiple firmware binaries into SD images.
Firmware images for most devices that require this functionality consist
mainly of u-boot, but some devices (e.g. librem5) have multiple firmware
images that need to be embedded in the SD image created by pmbootstrap.

This functionality uses two new deviceinfo parameters:
    - deviceinfo_sd_embed_firmware: a comma-separated list of
      binary:offset (where binary is under /usr/share/firmware)
    - deviceinfo_sd_embed_firmware_step_size: The number of bytes for
      each increment of the offset specified in the
      deviceinfo_sd_embed_firmware (typically 1024 or 2048)

deviceinfo_write_uboot_spl has been obsoleted by these new parameters.
2019-01-10 21:41:49 +01:00
Oliver Smith f16bdaf0ca
Update copyright to 2019
Happy new year \o/
2019-01-02 09:31:20 +01:00
Oliver Smith f09845bced
recovery zip install: link to wiki page
Show a link to a new wiki page with working sideload instructions
instead of the broken command: <https://postmarketos.org/recoveryzip>
2018-10-24 08:53:55 +02:00
Oliver Smith d8aba7e81b
Add ten more megabytes of free space for /boot 2018-10-12 09:36:33 +02:00
Martijn Braam d88a09e6bd Added write_uboot_spl deviceinfo variable 2018-09-11 07:05:04 +00:00
NotKit e22ba8caea Change default user uid to 10000 2018-08-02 20:10:56 +00:00