This incorprates the debug-shell functionality directly into the
initramfs, so it's no longer necessary to build and boot a custom
initramfs in order to debug your device.
Additionally, the behaviour of the debug-shell is entirely reworked, It
now creates an ACM serial gadget which can be accessed via any normal
terminal emulator (picocom, minicom, etc; or PuTTY on windows). Rather
than just invoking sh, the debug-shell now creates a respawning getty on
both the new virtual console and the active console (this will either be
the UART console or tty0/1).
It is necessary to spawn these shells via getty since the logging rework
means we can no longer assume that stdin/out/err reference a TTY.
In addition to the above, it is now possible to trigger a log dump by
holding volume up during boot. This can be useful for helping users
debug their devices if the issue doesn't result in a failure that can be
detected in the initramfs.
With these changes, the console-shell and debug-shell hook packages are
reduced to only adding the additional tools/features. console-shell is
still required for fbkeyboard, and debug-shell for the setup_usb_storage
tool.
Co-Developed-by: Clayton Craft <craftyguy@postmarketos.org>
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Crappy workaround, it's better than having DNS broken...
See: https://gitlab.com/postmarketOS/pmaports/-/issues/2601
Also removed it from shellcheck, because SC doesn't like all of the
unused/unreachable things after the `exit 0`. This commit should be
reverted when the issue is actually fixed later...
[ci:skip-build] already built successfully in CI
This configures shellcheck in CI to ignore the use of the 'local'. Using
'local' to support variable scoping can prevent a lot of nasty bugs in
shell scripts.
Ash supports 'local', even though it's not a POSIX sh thing. It's used
extensively in our init.sh script, and many Alpine scripts use it.
1. Move all configs from /etc/NetworkManager/conf.d to
/usr/lib/NetworkManager/conf.d since the latter is more appropriate for
distribution-provided config files. In particular this means apk will
update them when the package file is changed rather than creating
`.apk-new` files. If a user wants to override such a file, they can create
a file with the same name under /etc/NetworkManager/conf.d
2. Move all dispatcher scripts from /etc/NetworkManager/dispatcher.d to
/usr/lib/NetworkManager/dispatcher.d for the same reason.
3. Rename all configs to have a "50-" prefix so that users can add their own
"99-" overrides with a guarantee that they'll be processed after
distribution-provided configs.
4. Rename dispatcher scripts to have a "50-" prefix instead of "85-" and "99-"
since they're distribution-provided files.
5. Move 50-tethering.conf from the base-ui package to
the base-ui-networkmanager package.
There are also some device packages that put config files without a numeric
prefix in /etc/NetworkManager/conf.d . This MR doesn't change those.
[ci:skip-build] already built successfully in CI
USB tethering allows users to use their phone's WiFi or WWAN interface
as an access point for the device they connect the phone with over USB.
This way, they can use their data plan with a laptop or desktop when
regular Internet access is absent.
Configure NetworkManager to manage the usb0 iface from initfs so users
can configure it in GNOME Settings or KDE. Include a NetworkManager
dispatcher script as well to handle postmarketOS' setup with unudhcpd as
we want to provide an SSH login over USB when tethering is disabled. If
tethering is enabled, unudhpcd is stopped and its functionality is taken
over by NetworkManager through an instance of dnsmasq. NetworkManager
will also configure the necessary settings to allow IP forwarding and
firewall rules during tethering. Once disabled, NetworkManager cleans up
these settings and our dispatcher script starts unudhcpd again.
Due to upstream changes, NetworkManager requires networkmanager-dnsmasq
subpackage as dependency as dnsmasq needs DBus support for
NetworkManager. Without it, NetworkManager will silently fail spawning
dnsmasq instances.
[ci:skip-build]: already built successfully in CI
This uses a dispatcher script to configure filtering A and AAAA records
based on which IP versions are routable on the NM primary connection.
gojq is preferred over the 'standard' jq because it's considerably
faster... the dispatcher script took 0.89s on my L5 with jq, and 0.07s
with gojq. the difference is probably greater on slower phones... so it
seemed worth installing it.
fixes#1430
Co-authored-by: Arnavion <me@arnavion.dev>
- Move base files/modules out of package, this package now only provides
the mkinitfs tool.
- Add all required modules, these were copied over from
postmarketos-mkinitfs and sorted
- Use new exe name in trigger
- Update triggers to ignore /etc, add /usr/share/mkinitfs. No packages
should be installing into /etc/mkinitfs/
- Support building/installing docs
- Add vendored deps
- Change trigger path
This package contains base file and module lists for the initramfs /
initramfs-extra archives, along with the init.sh
The primary reason for doing this is so that changes to these
files/lists can be properly versioned (in pkgver), and (re)building
mkinitfs itself is no longer required for these changes.
- Add base file list for initramfs. The dirs at path
/usr/share/postmarketos-mkinitfs/* are "new" in mkinitfs 2.0
- Install default modules to /usr/share
- Install system config to /usr/share/mkinifs
- Add base files for -extra archive
- Create user config dirs
- Update hook dirs in init.sh, change from mkinitfs 2.0
- Remove splash images, obsolete since pbsplash
- Support uncompressed initramfs-extra
Note that the URLs in these scripts are not only for information, but
they are also used as marker by pmbootstrap so it knows these are
compatible with 'pmbootstrap ci'. I just fixed the typo in the
pmbootstrap code as well and made a new release, use pmbootstrap 1.50.0
or above to have it recognize these scripts with 'pmbootstrap ci' again.
Split out the grep for CHANGEME into a separate .ci/grep.sh script, as
it's not related to shellcheck and also there's another grep check that
I'll move there in a follow-up patch.
Adjust to shellcheck removal in Alpine. Currently it's still in edge for
x86_64, but installation fails with:
ERROR: unable to select packages:
so:libffi.so.7 (no such package):
required by: shellcheck-0.7.2-r1[so:libffi.so.7]
Use the official static binary release from shellcheck instead of the
Alpine package. Version 0.7.2 is intentionally used instead of latest
8.0.0, since the latter generates a new warning. Let's unbreak CI first
before adjusting to a newer shellcheck version.
Related: https://lists.alpinelinux.org/~alpine/devel/%3C20211021133615.32f08070%40ncopa-desktop.lan%3E
Many devices need proprietary firmware blobs. So far those blobs were
packaged and installed from the repository but this approach has many
drawbacks:
- The rootfs can only be used on a single device model.
- If a model has multiple variants that have diferent secire-boot key,
each must have it's own firmware blobs.
This makes maintaining packaged firmware very hard and outweights the
benefits of having a repeatable installation in most cases.
Instead we can load blobs dynamically from preexisting firmware
partitions that usually have same structure and contain the blobs we are
interested in.
The proposed scripts place symlinks to the blobs in a special dir that
then given to the kernel. Blobs from firmware/postmarketos (or another
dir that was set as extra path prior the script execution) will take
priority which allows to override some blobs (e.g. for deviecs with no
secure-boot)