Created
December 7, 2020 23:11
-
-
Save wormyrocks/01497aacb1fec050a0af5994a87eb557 to your computer and use it in GitHub Desktop.
raspi init_debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script is a template for debugging things that run as init (PID=1) | |
test_me () { | |
echo hello world! | |
lsusb | |
} | |
printf '\033[2J\033[0;0H' # clear screen | |
mount -t proc proc /proc | |
mount -t sysfs sys /sys | |
mount -t tmpfs tmp /run | |
mkdir -p run/systemd | |
mount /boot | |
test_me > /boot/log | |
cat /boot/log | |
mount /dev/mmcblk0p2 / -o remount,rw | |
# this gives you an interactive shell on uart0, here you can edit | |
# the contents of this script and read the output of test_me in /boot/log. | |
# ctrl-D to reboot when ready to try again | |
sh | |
# clean up | |
rm -r boot/log | |
sync | |
# reboot | |
echo 1 > /proc/sys/kernel/sysrq | |
echo b > /proc/sysrq-trigger |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment