I’m attending Sketching in Hardware <http://sketching-in-hardware.com/> this weekend and there was a fair bit of discussion regarding how long it takes to boot Linux and barriers it makes to understanding a system. My assertion was that booting Linux on a computer, like PocketBeagle, doesn’t take very long at all and that it generally only gets in the way when you want it.
Here’s what I hacked up in about 10 minutes to show off how we can get a whole lot of distribution code out-of-the-way. In /boot/uEnv.txt, I edited the cmdline: cmdline=coherent_pool=1M net.ifnames=0 rng_core.default_quality=100 quiet *modules-load=g_serial* The point of this is that our boot script that configures the USB gadget won’t be loaded anymore. This causes the Linux kernel to emulate a serial port, providing a way to get to the Python REPL. In /etc/passwd, I edited the shell for the ‘debian’ user: debian:x:1000:1000:Demo User:/home/debian:*/usr/bin/python3* This makes python3 the default shell for the ‘debian’ user, so whenever a user logs in as ‘debian’, they get a python3 REPL. In /lib/systemd/system/[email protected], I enabled a bypass for the user login password request: ExecStart=-/sbin/agetty --keep-baud 115200,38400,9600 %I $TERM* -a debian* This totally insecure, but on PocketBeagle without any augmentation, this just gives access over the USB port. Seems pretty reasonable to me. I executed the following commands to reduce the applications running at startup and enable the terminal on the virtual serial port: sudo systemctl set-default rescue.target sudo ln -s /lib/systemd/system/[email protected] /etc/systemd/system/default.target.wants/[email protected] When you do the above, a reboot will no longer bring up things like the Cloud9 IDE, so be sure to run both commands before rebooting. Use ‘sudo shutdown -r now’ to reboot. Seems like there’s still a fair amount of optimization that can be done, but here’s the behavior I saw when pulling and re-inserting the USB cable after making these changes: jkridner@tupper:~$ *journalctl -f* Sep 28 13:55:52 tupper kernel: usb 1-4: USB disconnect, device number 26 Sep 28 13:55:52 tupper upowerd[2124]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:2.1 Sep 28 13:55:52 tupper upowerd[2124]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4/1-4:2.0 Sep 28 13:55:52 tupper upowerd[2124]: unhandled action 'unbind' on /sys/devices/pci0000:00/0000:00:14.0/usb1/1-4 Sep 28 13:56:08 tupper kernel: usb 1-4: new high-speed USB device number 27 using xhci_hcd Sep 28 13:56:08 tupper kernel: usb 1-4: New USB device found, idVendor=0525, idProduct=a4a7 Sep 28 13:56:08 tupper kernel: usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0 Sep 28 13:56:08 tupper kernel: usb 1-4: Product: Gadget Serial v2.4 Sep 28 13:56:08 tupper kernel: usb 1-4: Manufacturer: Linux 4.14.108-ti-r113 with musb-hdrc Sep 28 13:56:08 tupper kernel: cdc_acm 1-4:2.0: ttyACM0: USB ACM device So, without any other tweaking, it seems to still be taking about 16 seconds. I’m not very happy with this, so I’ll be hooking up a serial cable and figuring out where the time goes soon. jkridner@tupper:~$ *tio /dev/ttyACM0* [tio 14:02:10] tio v1.29 [tio 14:02:10] Press ctrl-t q to quit [tio 14:02:10] Connected File "", line 0 ^ SyntaxError: 'utf-8' codec can't decode byte 0xf0 in position 2: invalid continuation byte >>> quit() Debian GNU/Linux 9 beaglebone ttyGS0 BeagleBoard.org Debian Image 2019-08-03 Support/FAQ: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian default username:password is [debian:temppwd] beaglebone login: debian (automatic login) Last login: Sun Aug 4 02:10:35 UTC 2019 on ttyGS0 The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license" for more information. >>> *import os* >>> *os.system("bash")* debian@beaglebone:~$ I chose to use ‘tio’, but ‘screen’ and other serial utilities would work fine. I don’t actually know that the cause of the stray characters is. Someone can probably enlighten me. I’ll release this as a blog post once I figure out why the boot time is this slow, but I thought this was interesting enough to post here. Enjoy. -- https://beagleboard.org/about -- For more options, visit http://beagleboard.org/discuss --- You received this message because you are subscribed to the Google Groups "BeagleBoard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beagleboard/CA%2BT6QP%3DK6UNOHjzrBV1%3DMDfSiBQb6R3_HMBg76Q_vkA1Z6uxXg%40mail.gmail.com.
