Commit graph

118 commits

Author SHA1 Message Date
Clayton Craft
0f1c765e10
postmarketos-mkinitfs: don't depend on osk-sdl, add to initfs conditionally (MR 2242)
This replaces the dependency on osk-sdl with a dependency on a
postmarketos-fde-unlocker virt. package

osk-sdl and its dependencies are also added contitionally to the initfs,
based on whether the osk-sdl exe is installed in the rootfs

Also see:
https://gitlab.com/postmarketOS/pmbootstrap/-/merge_requests/2066
2021-06-26 16:33:35 -07:00
Clayton Craft
c6a5e885c0
postmarketos-mkinitfs: disable correct shellcheck test (MR 2260)
Shellcheck 0.7.2 has a change that gives many error conditions their own
SC30** codes, instead of including them in SC2039. This updates the
scripts in this package that "disable SC2039" to disable the new code.

New codes added in shellcheck: cfd68ee0c2ebfd0ab08a1d4bf628162b454dc207
2021-06-17 18:09:44 -07:00
Caleb Connolly
70b0cf24e5
postmarketos-mkinitfs: flash new boot image (MR 2215)
On Android devices that support kernel updates (marked by the deviceinfo
variable "deviceinfo_flash_kernel_on_update") lets flash the kernel and
initramfs automatically!
2021-06-08 10:44:41 -07:00
Caleb Connolly
48e8b93ac6
postmarketos-mkinitfs: use variable for bootimg (MR 2215)
Use a variable for "bootimg" in create_bootimg rather than repeat the
same pattern replacement.
2021-06-08 10:44:41 -07:00
Clayton Craft
9088fbb6b9
postmarketos-mkinitfs: disable ps2mouse module when running directfb (MR 2201)
On my librem 5 when using directfb in initfs, touch input is really
inconsistent... the cursor seems to jump around and it's hard to enter
keys in osk-sdl. This is completely 'fixed' by disabling the ps2mouse
input module in dfb.

I guess this might cause mice to stop working (?), but I can't think of
any situation where someone would run osk-sdl in initfs on a device that
has a ps2 mouse but no keyboard (which would make more sense to use for
entry than the mouse..)
2021-05-27 22:28:57 +02:00
Martijn Braam
e0136b2abc
main/postmarketos-mkinitfs: allow osk-sdl user overrides (MR 2184) 2021-05-27 22:24:00 +02:00
Bart Ribbers
27b8ef368f
*/*: replace uboot-tools dependency for u-boot-tools (MR 2141)
uboot-tools is provided by u-boot-tools but sometimes apk still gets
confused. This change prevents errors such as

pine64-pinephone:~$ sudo apk upgrade --verbose
WARNING: Failed to perform initial self-upgrade, continuing with full upgrade.
ERROR: unable to select packages:
  uboot-tools (virtual):
	    provided by: u-boot-tools
			    required by: device-pine64-pinephone-0.25-r1[uboot-tools]
[ci:ignore-count]
[ci:skip-build]: already built in CI successfully
2021-04-27 22:01:06 +02:00
Luca Weiss
70173bde87
main/postmarketos-mkinitfs: disable charging-sdl (MR 2111)
See also #1064
2021-04-17 22:53:10 -07:00
Bobby The Builder
9ea2e7e828
main/postmarketos-mkinitfs: show resizefs splash (MR 1996)
[ci:ignore-count] [ci:skip-build]
2021-04-11 20:03:33 +02:00
Oliver Smith
a61cae84a5
main/postmarketos-mkinitfs: add sync before exit (MR 1850)
[ci:skip-vercheck]
2021-04-11 19:44:54 +02:00
Bobby The Builder
c4f050ffcd
main/postmarketos-mkinitfs: add f2fs (MR 1850) 2021-04-11 19:43:23 +02:00
Bobby The Builder
9eb97c73df
main/postmarketos-mkinitfs: avoid unneeded resizefs (MR 1850) 2021-04-11 19:43:23 +02:00
kekzoz
4e4230093c
main/postmarketos-mkinitfs: add postprocess scripts (MR 2056)
[ci:skip-build]: already built successfully in CI
2021-04-05 09:32:19 +02:00
Oliver Smith
31ed6f21ef
main/postmarketos-mkinitfs: fix space issues (MR 2051)
In order to have hardware acceleration in osk-sdl, we have included mesa
for some devices (like the PinePhone) in initfs-extra. Mesa drags in
libLLVM, which got a size increase of 27 MB in the last version. This
leads to running out of space on the boot partition:

  ==> initramfs: creating /boot/initramfs-postmarketos-allwinner-extra
  gzip: write error: No space left on device
  cpio: write error: Broken pipe

Improve the situation by not directly writing initfs-extra to /boot
(next to the old version), but to a temporary directory first. Replace
the old version with the new version afterwards (like before).

This is a rather minimal fix for this specific issue. The mkinitfs
script needs more fixing (it's one of the oldest pieces of code in
postmarketOS and could use a rewrite...), but that's out of scope for
this patch.
2021-03-21 17:22:44 +01:00
Clayton Craft
4243b95bd0
main/postmarketos-mkinitfs: refactor osk-sdl config/running (MR 1870)
- Simplified logic for setup/running osk-sdl in initfs
- include libGLESv2 when running osk-sdl w/ mesa
- depends on osk-sdl >=0.62
2021-02-22 15:40:44 +03:00
Oliver Smith
e8c76175f6
main/postmarketos-mkinitfs: add pmOS_inst_boot (MR 1820)
Find partitions with the label "pmOS_inst_boot" too, and prefer using
them as boot partition over ones with label "pmOS_boot". (I'd use
"pmOS_install_boot", but there is a character limit in the label.)

Without this, the initramfs may choose the wrong boot partition if
postmarketOS is available once as install OS (on device installer) on
the SD card and once on the eMMC (installed).

I just had this problem with QEMU when simulating the install from SD to
eMMC use case with pmbootstrap qemu --second-storage. The pmOS initramfs
scripts would detect the previously created eMMC boot partition as the
proper one and mount it. It would boot into the right root partition,
because that already has a different label (pmOS_install instead of
pmOS_root), but because the wrong boot partition is already mounted,
during the install it would not be possible to run mkfs on it.
2021-01-27 16:12:27 +01:00
Ion Agorria
4351a5bc1c
main/mkinitfs: Pass signing flag to blobpack (MR 1803)
This patch checks if deviceinfo_bootimg_blobpack is "sign"
in that case it passes signing flag for devices that require.

Devices (tf101) that don't use signing will continue working
when passing "true" as now.
2020-12-28 15:04:07 +01:00
El Koulali András
676f86fd43
main/postmarketos-mkinitfs: include support for pxa-mkbootimg (MR 1823)
[ci:skip-build]: already built successfully in CI
2020-12-27 21:39:43 -08:00
Oliver Smith
2f4a2ea087
main/postmarketos-mkinitfs: improve keyboard-font check (MR 1782)
Fix failure in the osk-sdl "keyboard-font" check when there is a second
key starting with "keyboard-font" (as in osk-sdl MR 105):

	==> initramfs: creating /boot/initramfs-postmarketos-allwinner-extra
	ERROR: Font specified in /etc/osk.conf does not exist!
	ERROR: postmarketos-mkinitfs-0.17-r0.trigger: script exited with error 1
2020-12-03 20:02:02 -08:00
Oliver Smith
c108a5a8d1
main/postmarketos-mkinitfs: allow splash override (MR 1776)
Make it possible to set a custom splash screen by placing a
splash.ppm.gz file on the boot partition.
2020-12-03 11:30:25 +03:00
Bart Ribbers
7573f5fce4
main/postmarketos-mkinitfs: workaround for not being able to find provider of kpartx (MR 1732)
Because of
https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/10725,
cmd:kpartx can not be found. That bug obviously needs to be fixed, but
let's workaround it for now by just depending on the package that
provides it.
2020-11-17 21:08:03 +01:00
clayton craft
0e30c6f760
postmarketos-mkinitfs: fallback to directfb if osk-sdl fails w/ mesa (1625) (MR 1625) 2020-11-12 23:42:39 -08:00
clayton craft
13fbb3e501
main/postmarketos-mkinitfs: set no_supertile for osk with mesa (MR 1625)
This is needed by the librem 5, else the graphics are
distorted/unusable.
2020-11-12 23:41:29 -08:00
Luca Weiss
a6ec22b9a4
main/postmarketos-mkinitfs: use kmsdrm sdl backend for osk-sdl (MR 1625) 2020-11-12 23:41:28 -08:00
Luca Weiss
0fac39abe1
main/postmarketos-mkinitfs: fix incorrect cpio usage (MR 1619)
cpio expects a newline-separated list of files from stdin by default,
and you can change that to a NULL-terminated list of files by using the
'-0' switch.

Previously we were passing a NULL-terminated list ('-print0') and using
cpio with the default setting. For some reason busybox cpio works with
that but GNU cpio doesn't like that and generates an initramfs without
any files (as it only gets "a single file").

With this change the initramfs generation works fine with both busybox
cpio and gnu cpio.

Fixes #815
2020-10-06 18:52:09 +02:00
Bart Ribbers
01019884fb
main/postmarketos-mkinitfs: add new trigger for osk-sdl (MR 1563)
We now trigger on files in /usr/share/postmarketos-mkinitfs-triggers.
This can be used by other packages like osk-sdl for which an updated
version would otherwise never be used in the initramfs
2020-09-19 17:14:20 +03:00
Luca Weiss
37e43bcaac
main/postmarketos-mkinitfs: add mediatek header in mkinitfs (MR 1483)
Previously we added the header in the kernel packages but as we already
add the ramdisk header here and to simplify the process we also add the
addition of the kernel header into mkinitfs.
2020-08-22 10:38:53 +02:00
Martijn Braam
87a009a9b8
main/postmarketos-mkinitfs: fix error on missing dtb (MR 1491) 2020-08-11 10:52:14 +02:00
Oliver Smith
bfa705b745
main/postmarketos-mkinitfs: fix device sed regex (MR 1436)
The p? is not redundant. Without it, the p in mmcblk0p2 for example does
not get cut off, meaning the resulting device is not "mmcblk0" but
"mmcblk0p". My bad, sorry for the breakage.

Fixes: 9f6600ba ("main/postmarketos-mkinitfs: rm pmOS_deleteme")
Fixes: 9d86f6fe ("main/postmarketos-mkinitfs: resize: unallocated space check, even if forced")
2020-07-22 09:18:10 +02:00
Oliver Smith
9f6600ba18
main/postmarketos-mkinitfs: rm pmOS_deleteme (MR 1428)
Remove the "pmOS_deleteme" partition left behind by the on-device
installer, if it exists. Let the existing resize_root_partition() extend
the root partition over the newly gained space (and rest of the storage
device) right afterwards.
2020-07-21 22:53:03 +02:00
Oliver Smith
b55d95f3a9
main/postmarketos-mkinitfs: resize_root_partition: update comment (cosmetic) (MR 1428) 2020-07-21 22:53:02 +02:00
Oliver Smith
9d86f6fe92
main/postmarketos-mkinitfs: resize: unallocated space check, even if forced (MR 1428)
In resize_root_partition(), put the unallocated space check into an
extra function has_unallocated_space(). Run it even if
PMOS_FORCE_PARTITION_RESIZE is used, so we don't attempt to resize the
partition if there is no free space.

While at it, change "sed 's/p?2$//'" to "sed 's/2$//' in an already
modified line, because it means the same thing and is less confusing
(? in regex means: 0 or 1 time).
2020-07-21 22:53:02 +02:00
Martijn Braam
2fb6d11f91
main/postmarketos-mkinitfs: allow multiple dtbs (MR 1163)
Allow setting multiple dtb filenames in the deviceinfo seperated
by spaces
2020-07-16 23:14:54 +02:00
Oliver Smith
863ec713ba
main/postmarketos-mkinitfs: mount /sysroot/boot (MR 1398)
Mount the boot partition at /sysroot/boot and keep it mounted, when
running the switch_root command. This way, OpenRC doesn't need to mount
it and possibly use the wrong partition. The OpenRC service does not use
the same logic to find the boot partition, in particular it does not
support the pmos_boot kernel parameter.

While at it, print the mountpoint and read-only/read-write arguments in
the mounting log message for both root and boot.

Fixes: #664
2020-07-08 18:02:49 +02:00
Oliver Smith
9be8b59a00
main/postmarketos-mkinitfs: support pmOS_install (MR 1296)
Prefer booting from a pmOS_install partition if it exists, but do not
resize it.

Related: https://wiki.postmarketos.org/wiki/On-device_installer
2020-06-17 21:41:06 +02:00
Antoine Fontaine
41c2e1a307
main/postmarketos-mkinitfs: add mkinitfs to replaces (MR 1300)
fixes pmbootstrap#1851.
2020-06-15 02:32:25 +03:00
Niklas Cathor
6e75bf0e40
main/postmarketos-mkinitfs: fix mkbootimg call for devices w/o dtb (MR 1148)
Don't pass empty arguments to mkbootimg, when _second or _dt are not set.
2020-04-12 19:51:22 +02:00
Oliver Smith
23c58a681f
main/postmarketos-mkinitfs: modules from files (!1123)
Read kernel module names from files in
/etc/postmarketos-mkinitfs/modules and print out which modules are
required by which of these files as the initramfs gets generated. Put
the default modules into a new 00-default.modules. This allows mkinitfs
hooks to add modules to the initramfs.

Parse the modules from a file similar to modules-load.d, with commented
lines and empty lines ignored. Add a simple test script for that and run
it in check().
2020-04-12 00:56:22 +02:00
Oliver Smith
3e7604601a
main/postmarketos-mkinitfs: split mkinitfs funcs (!1123)
Split mkinitfs.sh into two files, so the functions (now in
mkinitfs_functions.sh) can be sourced in a test. Such a test will be
added in the next commit.

Move $BINARIES_EXTRA into the get_binaries_extra() function, so its
$(find...) does not get executed when sourcing the functions file. Move
$BINARIES into get_binaries() too for consistency.
2020-04-12 00:56:22 +02:00
Oliver Smith
74f42ebeb0
main/postmarketos-mkinitfs: pass shellcheck (!1123)
Make it pass shellcheck by fixing obvious mistakes like '==' instead of
'='. Add "shellcheck disable" lines for things that are intentionally done
or would be a bit more complicated to rewrite. It would be nice to
refactor some things like '${outfile/initramfs-/uImage-}', but this should
be done in a separate change (patches welcome).

Remove unused variable "modules_path". While at it, add two new fatal
error messages instead of just "exit 1" without any comment and remove
redundant mkdir in APKBUILD.
2020-04-12 00:56:17 +02:00
Daniele Debernardi
bd15afc217
main/postmarketos-mkinitfs: execute lddtree without privileges (!1133)
The lddtree script uses the scanelf utility which has some security check that causes a slowdown of the operation, executing it without privileges it's really faster.
2020-04-09 10:35:06 +02:00
Daniele Debernardi
36f15b58f6
main/postmarketos-mkinitfs: remove initramfs-extra cache (!1133) 2020-04-09 10:35:03 +02:00
Daniele Debernardi
de6deb8201
main/postmarketos-mkinitfs: check if initramfs-extra is missing (!1046) 2020-03-10 01:23:14 +01:00
Martijn Braam
ec83ab9a06
postmarketos-mkinitfs: fix unlocking with pmos_root (!943)
Fix --fde on the PinePhone (actually it fixes it for devices that
uses the pmos_root cmdline).
2020-03-01 00:43:08 +01:00
Minecrell
ed3eeeeebb
main/postmarketos-mkinitfs: append extra initfs hash to file contents (!983)
Partial revert of 24fa68c9 ("avoid storing initramfs-extra twice").

Some people have (rightfully) complained that including the hash
in the filename of the initramfs-extra prevents the device from booting
whenever the boot partition gets out of sync with the boot image.

In general we should assume that those two are in sync, but there is
no need to unnecessarily break this if previously booting the outdated
extra initramfs worked just fine.

At the end, the hash is just an implementation detail for the caching
mechanism - we need it when (re-)generating the initramfs, but it does
not have to be within the filename. Instead, we can simply append the
hash to the file contents. GZIP will simply ignore the trailing garbage.

The boot partition will then look like:
    $ cat /boot/initramfs-<flavor>-extra
    <GZIP data>d3c7b449c6fc811d97351bbc46852b66 (the hash)

This makes the filename of initramfs-extra nice and stable again.
It also fixes a regression where the initramfs-extra would no longer
get symlinked by "pmbootstrap export" (I was going to fix that in
pmbootstrap but now this solution is more appealing...)

While we're at it: Make the script more resilient again by writing
to a temporary file first, then move it (atomically) to the real path.
2020-03-01 00:31:27 +01:00
Dolphin von Chips
2bb9599dce
main/postmarketos-mkinitfs: add option to append SEANDROIDENFORCE to boot.img (!1000) 2020-02-27 20:19:21 +03:00
Minecrell
24fa68c9b6
main/postmarketos-mkinitfs: avoid storing initramfs-extra twice (!932)
At the moment we store the same initramfs-extra twice on the file system:
  - /boot/initramfs-<flavor>-extra
  - /var/cache/postmarketos-mkinitfs/initramfs-<flavor>-extra_<hash>

The second copy is exactly the same file, just with the <hash> (for caching)
appended to the filename.

We can avoid this by appending the hash directly to the filename
on the boot partition, i.e.
  - /boot/initramfs-<flavor>-extra_<hash>

This is possible because we only reference initramfs-extra from the main
initramfs, and we already replace the path in it dynamically.
It will just let the main initramfs load -extra_<hash> instead of just -extra.

This saves a few megabytes of disk space on the rootfs.
2020-02-10 01:38:18 +03:00
Minecrell
e3d07c832c
main/{devicepkg-dev,postmarketos-mkinitfs}: statically generate splash screens (!899)
We need to generate the splash screens separately for each device,
because they are specific to the device's display resolution.

At the moment we do this dynamically during the installation process.
This has the advantage that there is no need to re-build all device
packages when one of the splash screen is changed (or a new one is added).

In reality, however, the splash screens do not change very frequently.
On the other hand, generating the splash screens dynamically has signficant
disk usage overhead for a minimal ("none" UI) rootfs:

The Python interpreter together with the necessary libraries requires
about ~60 MB of disk space on aarch64.
The splash screens itself require about ~100 KB for 720x1280.

This is not necessary if we move the splash screen generation into
devicepkg-dev, which is used to build the device package for all devices.
Another advantage is that we no longer need the (rather complicated)
caching mechanism for splash screens - so we actually end up with less
lines than before.

rootfs size for samsung-a5ulte ("none" UI):
  Before: 450M
  After:  388M (-62M)

After this change, every(!) device package needs to be rebuilt once.
No changes are necessary in device packages.
2020-01-28 15:33:40 +01:00
Pops Dylan
8760409717
main/postmarketos-mkinitfs: enable profiling with bootchart (!852)
If (a) the kernel command line parameters include PMOS_BOOTCHART2 and
(b) /sbin/bootchartd exists (i.e., the bootchart2 package has been
installed), run /sbin/bootchartd instead of /sbin/init.
2020-01-13 15:44:51 +03:00
Martijn Braam
cfcf1e6d7d
main/postmarketos-mkinitfs: added pmos_boot and pmos_root (!756) 2019-11-24 20:16:41 +01:00