Initramfs/Inspecting: Difference between revisions
update github links to gitlab |
Update nc tutorial with archive.org link |
||
Line 61: | Line 61: | ||
=== Tips and tricks === | === Tips and tricks === | ||
* [[Initramfs development]] has more generalize information about working with initfs. | * [[Initramfs development]] has more generalize information about working with initfs. | ||
* [ | * [https://web.archive.org/web/20230924150444/www.microhowto.info/howto/copy_a_file_from_one_machine_to_another_using_netcat.html copy files to/from the initramfs with <code>nc</code> while it is running] | ||
[[Category:Guide]] | [[Category:Guide]] |
Revision as of 11:32, 12 March 2024
This is considered a security hole. Only use it for debugging, and uninstall the debug-shell hook afterwards. |
TODO: add description about pmbootstrap initfs hooks_ls |
This page explains how to connect to your device when it has booted to the initramfs by installing the debug-shell hook. This is useful if you want to know more about the boot process, simply inspect the initramfs or if you want to debug why something doesn't work.
Enable the debug shell
For devices that the kernel is flashed separately do the following:
$ pmbootstrap initfs hook_add debug-shell
$ pmbootstrap flasher flash_kernel # or however you flash/boot the kernel
If you only need to flash rootfs
for your device (e.g. you use lk2nd
) do the following instead:
$ pmbootstrap install --add postmarketos-mkinitfs-hook-debug-shell
$ pmbootstrap flasher flash_rootfs
Using the debug shell
$ telnet 172.16.42.1
Trying 172.16.42.1...
Connected to 172.16.42.1.
Escape character is '^]'.
Type 'pmos_continue_boot' to continue booting:
If the telnet command does not work out of the box, read connect via USB Networking in the Initramfs.
In the debug shell, the additional programs evtest
, fftest
and fbdebug
are available (see !1358).
To step through the boot process, you can execute commands in order listed in postmarketos-initramfs/init.sh, starting with the line mount_boot_partition /boot
and below (everything above it was already executed before entering debug-shell).
To continue the boot process as normal, run the pmos_continue_boot
command. This will close the telnet connection and continue the boot process.
Enable initramfs-extra
To enable functionality from initramfs-extra
, run the following commands in the telnet shell:
# . /usr/share/misc/source_deviceinfo
# . /init_functions.sh
# mount_boot_partition /boot
Mount boot partition (/dev/dm-0)
# extract_initramfs_extra /boot/initramfs-extra
Extract /boot/initramfs-extra
24128 blocks
Disable the debug shell
For devices that flash the kernel partition separately:
$ pmbootstrap initfs hook_del debug-shell
$ pmbootstrap flasher flash_kernel
For devices that only need to flash the rootfs
re-run pmbootstrap install
without adding the postmarketos-mkinitfs-hook-debug-shell
package.
Tips and tricks
- Initramfs development has more generalize information about working with initfs.
- copy files to/from the initramfs with
nc
while it is running