Skip to content
Snippets Groups Projects
  1. Apr 18, 2024
    • Casey's avatar
      postmarketos-initramfs: better wait_[br]oot_partition · ccdb8bfb
      Casey authored
      
      Rework the messages and avoid re-spawning the splash on every check.
      Additionally, add a call to check_keys, this lets users drop to a debug
      shell or export logs to triage this failure (particularly useful for
      hard-to-reproduce issues).
      
      Finally, add a (liberal) 30 second timeout and dump logs at the end. If
      we're just waiting for a device to show up and it doesn't after 30
      seconds then it's probably never going to...
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      ccdb8bfb
    • Casey's avatar
      postmarketos-initramfs: check for root subpartition · 2975eb81
      Casey authored
      
      In mount_subpartition we currently try to look for the boot partition,
      to see if we're done (either we aren't using subpartitions or we found
      the right one). However it is possible that a device might have
      originally used the subpartition scheme, but was later converted to have
      a real boot partition (for EFI for example).
      
      In this scenario, the boot partition would be found immediately, but the
      root subpartition would not be.
      
      Address this by making mount_subpartition check for success by calling
      find_root_partition instead of find_boot_partition. For most
      installations this has no impact.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      2975eb81
    • Casey's avatar
      postmarketos-initramfs: debug-shell 2.0 · b5a2b019
      Casey authored
      
      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,
      removing the telnet feature. Instead it 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).
      
      If fbkeyboard is available (it can be added by install
      postmarketos-mkinitfs-hook-console-shell) then it will be launched on
      tty0. A getty will also be launched on tty0 in this case even if it
      otherwise wouldn't be (if the active console was the serial port for
      example).
      
      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 (if iskey is available). 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.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      b5a2b019
  2. Apr 17, 2024
    • Casey's avatar
      main/iskey: new aport · d709c3c1
      Casey authored
      
      iskey is a tiny tool that reports if any of the given keys are pressed.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      d709c3c1
    • Casey's avatar
      postmarketos-initramfs: split into tiny + fullsize variants · 1ea77456
      Casey authored
      
      This split is only to handle differing dependencies. At runtime the
      initramfs should have a fall-back for when they're unavailable.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      1ea77456
    • Casey's avatar
      postmarketos-initramfs: mount subpartitions after hooks · b20a9d2d
      Casey authored
      
      This step is the most likely to go wrong or have issues, and it has side
      effects which can make it difficult to run multiple times on one boot.
      Move it to after hooks so that e.g. when dropping to a debug shell, we
      land before the first call.
      
      This also makes booting to hooks a faster in many cases.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      b20a9d2d
    • Casey's avatar
      postmarketos-initramfs: use dd to allocate logs image · d1bf9392
      Casey authored
      
      fallocate seems to cause some strange behaviour where the logs.img file
      is treated like it's empty. Given it's small and in a ramdisk let's just
      create it with dd instead.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      d1bf9392
    • Casey's avatar
      postmarketos-initramfs: check if UDC is configured before clearing · 7fe08aa7
      Casey authored
      
      This fixes the annoying "sh: write error" and "Couldn't write to clear
      UDC" messages that happen on every single boot.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      7fe08aa7
    • Casey's avatar
      postmarketos-initramfs: make CONFIGFS global · 23d3dfce
      Casey authored
      
      This variable is being used in more places, just make it global.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      23d3dfce
    • Casey's avatar
      main/postmarketos-initramfs: log to kernel ringbuffer · ee7b885d
      Casey authored
      
      Rework logging to always log the initramfs output to the kernel
      ringbuffer and deprecate PMOS_NO_OUTPUT_REDIRECT in favour of following
      the kernel loglevel.
      
      I know it seems silly to use syslogd for this, but it's necessary to
      buffer writes to /dev/kmsg per-line if we want to correctly set the log
      level, and "tee" does not do this (it will write multiple lines at once,
      resulting in "<14>" prints in the ringbuffer). The main advantage to
      this is that we won't have kernel logs cut in half by initramfs logs
      anymore, everything will be nicely line buffered!
      
      The previous logging solution of multiple "tail" commands would actually
      fail to log up to the last few lines before a crash due to how tail
      works (it polls the file and buffers lines).
      
      I attempted something like this before, but I stopped after running into
      ratelimiting issues. These are now resolved by configuring the
      printk_devkmsg sysctl.
      
      Dropping PMOS_NO_OUTPUT_REDIRECT:
      
      The general motivations behind PMOS_NO_OUTPUT_REDIRECT was to avoid
      cluttering up the console with initramfs logs when they aren't wanted;
      this is now handled instead by the kernels logging facility. We log to
      the ringbuffer at LOGLEVEL_INFO, so if "quiet" is specified on the
      cmdline (or the loglevel is otherwise set above info) then initramfs
      logs will also not be shown.
      
      Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
      ee7b885d
  3. Apr 16, 2024
  4. Apr 13, 2024
  5. Apr 12, 2024
  6. Apr 11, 2024
  7. Apr 10, 2024
Loading