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
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
On Android devices that support kernel updates (marked by the deviceinfo
variable "deviceinfo_flash_kernel_on_update") lets flash the kernel and
initramfs automatically!
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..)
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
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.
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.
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.
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
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
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
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.
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")
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.
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).
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
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().
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.
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.
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.
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.
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.
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.
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.