Commit Graph

2038 Commits

Author SHA1 Message Date
Alexey Min d929f48aa2
pmb.chroot.initfs: adapt to new mkinitfs
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-03 17:38:09 +03:00
Newbyte 446a8fc430
pmbootstrap.py: Check which version of Python pmbootstrap is run with (MR 2118)
This prevents people from getting strange syntax errors if they
accidentally run pmbootstrap with e.g. Python 2.
2021-10-01 22:46:23 -07: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
Oliver Smith bf02c72da7
test: add test_bootimg_mtk_mkimage_recovery (MR 2105)
Verify that using a Mediatek recovery boot.img file works with
bootimg_analyze. The mtk_mkimage-boot.img file is the twrp boot.img file
posted in pmbootstrap issue 2066.
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 cd366859de
testdata: replace mtk_mtkimage-boot.img (MR 2105)
Replace the previous mtkimage-boot.img file, which were only the first 4
KiB of a mediatek boot.img file, with a full one. I made this full image
with pmbootstrap install for fairphone-fp1, it contains the kernel
packaged in pmaports.git master.

Reason for the replacement is, that the previous image did not contain
the label for the ramdisk. The current code ignored this, but upcoming
refactoring will test this more strictly and the dummy image will not
pass the test anymore.
2021-09-12 22:02:47 +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
Alexander Krotov f853ec18e5
helpers/envkernel.sh: support `aports` configuration variable (MR 2096) 2021-08-22 20:36:24 +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
Minecrell f62242aeb1
helpers/envkernel.sh: Try harder to not generate Git version suffix (MR 2084)
The Git version suffixes usually generated automatically by the Linux
build system break packaging in Alpine because the flavor (e.g.
"-postmarketos-qcom-msm8916") will no longer match the module and
zImage path. So far setting LOCALVERSION= and disabling
CONFIG_LOCALVERSION_AUTO was sufficient to avoid the Git version
suffixes but this is no longer enough in Linux 5.14.

Instead, add a better fix by creating an empty .scmversion file
that will be used by the kernel instead of checking the Git status.
The advantage is that this works on Linux 5.14 and it should even
work when CONFIG_LOCALVERSION_AUTO is set.

The .scmversion code can be found here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/setlocalversion?h=v5.14-rc1#n38
2021-07-12 10:56:36 -07: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