am335x_evm.sh

Like others, I have sought to reduce boot time on the PocketBeagle, and I have run into a few questions that maybe only Robert can answer.

First of all, this line appears to be wrong:

echo CD > os_desc/b_vendor_code

It gives me this error:

Feb 17 21:02:36 V2-2 sh[203]: sh: echo: I/O error

I added a bunch of echo statements to narrow down which line was generating this, and I’m pretty sure this is it. It is the section that sets the Windows 10 attributes.

The bigger issue is the time this script takes to run. I’m booting in a tad under 40 seconds, and this script is the bulk of it. I have narrowed down the offending section to this line:

systemctl restart dnsmasq || true

The log with my additional comments looks like this:

Feb 17 21:02:38 V2-2 sh[203]: am335x_evm: Starting usb1 network
Feb 17 21:02:38 V2-2 sh[203]: am335x_evm: Setting up dnsmasq
Feb 17 21:02:39 V2-2 sh[203]: Stopping udhcpd (via systemctl): udhcpd.service.
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: dnsmasq: setting up for usb0/usb1
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: disable_connman_dnsproxy
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: finished disable_connman_dnsproxy
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: Restarting dnsmasq
Feb 17 21:03:06 V2-2 sh[203]: am335x_evm: LOG: dnsmasq is disabled in this scrip

Now, I have just been going through the script trying to eliminate most of the hardware tests since my board is fixed, and deleting what I don’t think I need. But there are some things that confuse me. This script disables both udhcpd and dnsmasq. Why not just not auto-start those services or set them to start when this script is complete? This script also seems to touch some things that affect hostapd.

Is there any description on how this script interacts with other systemd services? It clearly does some necessary things as disabling it does not improve my boot performance, and the combination clearly gives a brilliant “out of the box” experience for someone just starting out. The combination, however, is a bit confusing when it comes to fine tuning.

Hi Paul,

Thanks for the testing and verification! :wink:

I'd love to refactor and clean up this script. Sadly it's supporting
3.8.x -> 5.10.x based linux kernel's!

Like others, I have sought to reduce boot time on the PocketBeagle, and I have run into a few questions that maybe only Robert can answer.

First of all, this line appears to be wrong:

        echo CD > os_desc/b_vendor_code

It gives me this error:

          Feb 17 21:02:36 V2-2 sh[203]: sh: echo: I/O error

This was either for 4.4.x/4.9.x era, i think for 4.14.x it's actually
set in driver by default..

I added a bunch of echo statements to narrow down which line was generating this, and I'm pretty sure this is it. It is the section that sets the Windows 10 attributes.

The bigger issue is the time this script takes to run. I'm booting in a tad under 40 seconds, and this script is the bulk of it. I have narrowed down the offending section to this line:

                    systemctl restart dnsmasq || true

The log with my additional comments looks like this:

Feb 17 21:02:38 V2-2 sh[203]: am335x_evm: Starting usb1 network
Feb 17 21:02:38 V2-2 sh[203]: am335x_evm: Setting up dnsmasq
Feb 17 21:02:39 V2-2 sh[203]: Stopping udhcpd (via systemctl): udhcpd.service.
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: dnsmasq: setting up for usb0/usb1
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: disable_connman_dnsproxy
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: finished disable_connman_dnsproxy
Feb 17 21:02:39 V2-2 sh[203]: am335x_evm: Restarting dnsmasq
Feb 17 21:03:06 V2-2 sh[203]: am335x_evm: LOG: dnsmasq is disabled in this scrip

So dnsmasq is fun. It doesn't deal with dynamic devices usb0/usb1 &
SoftAp0 in a nice way.. If it is started before usb0/usb1/etc exists
it'll just exit out. I'd love to find a way to trigger it'start after
usb0/usb1 is configured..

Just had a thought, does forking that process help?

systemctl restart dnsmasq || true -> systemctl restart dnsmasq & || true ???

Now, I have just been going through the script trying to eliminate most of the hardware tests since my board is fixed, and deleting what I don't think I need. But there are some things that confuse me. This script disables both udhcpd and dnsmasq. Why not just not auto-start those services or set them to start when this script is complete? This script also seems to touch some things that affect hostapd.

So udhcpd only supports one interface.. usb0, we've long switched to
dhsmasq, so it's more convenient to get udhcp out of the way..
hostapd is only for the wifi devices, it also requires dnsmasq up and
running..

Is there any description on how this script interacts with other systemd services? It clearly does some necessary things as disabling it does not improve my boot performance, and the combination clearly gives a brilliant "out of the box" experience for someone just starting out. The combination, however, is a bit confusing when it comes to fine tuning.

PS, if you nuke the initrd

sudo rm /boot/initrd.img-*

you'll get another boot speed up..

Regards,