Boot time speedup

Using https://rcn-ee.com/rootfs/release/2023-10-07/bullseye-minimal-armhf/am335x-eMMC-flasher-debian-11.8-minimal-armhf-2023-10-07-2gb.img.xz
I have reduced boot time to this, I need it to be as low as possible. What else can I remove. Can I reduce the kernel bootup? The svg shows a lot of other thing starting like uarts, ttys e2scrub_all.timer, What else can I remove?

debian@BeagleBone:~$ systemd-analyze
Startup finished in 12.511s (kernel) + 25.448s (userspace) = 37.960s
graphical.target reached after 25.144s in userspace

debian@BeagleBone:~$ systemd-analyze blame
17.945s dev-mmcblk1p1.device
4.865s systemd-udev-trigger.service
3.472s systemd-resolved.service
2.645s bb-symlinks.service
2.040s bb-usb-gadgets.service
1.899s systemd-journald.service
1.888s systemd-timesyncd.service
1.703s systemd-logind.service
1.452s user@1000.service
1.269s systemd-networkd.service
1.120s networking.service
830ms systemd-journal-flush.service
709ms systemd-udevd.service
566ms ssh.service
557ms sys-kernel-config.mount
554ms sys-kernel-debug.mount
553ms systemd-tmpfiles-setup.service
543ms sys-fs-fuse-connections.mount
535ms kmod-static-nodes.service
534ms systemd-fsck-root.service
483ms systemd-remount-fs.service
437ms systemd-update-utmp.service
432ms systemd-modules-load.service
366ms rsyslog.service
355ms systemd-sysusers.service
348ms systemd-sysctl.service
341ms systemd-tmpfiles-setup-dev.service
271ms systemd-random-seed.service
267ms systemd-user-sessions.service
219ms systemd-update-utmp-runlevel.service
122ms ifupdown-pre.service
103ms user-runtime-dir@1000.service

First one sets up pwm symlinks…

Second enabled USB gadget (usb0 rndis and flash drive )

Another quick an easy is to remove the initrd… Most of the really important bits are built-in, but the intrd makes other things eaisier…

sudo rm /boot/initrd.img-*

Regards

First thing I did was to remove initrd, Will removing USB gadget stop my usb ssh’ing into it ability?

Correct it’ll remove usb0/usb1, usb serial, and usb flash… So if you remove it, you can only ssh over eth0, or login serialy over the 6 pin ftdi connector…

But if you want speed…

Another thing, are you using hdmi on the Black? You could boot as the Green, then there’s no hdmi probing i2c/etc…

Regards,

Not using hdmi, please explain about booting as Green and what it will do to improve boot up.

/boot/uEnv.txt:

dtb=am335x-bonegreen.dtb

The kernel will not try to load the hdmi (video/audio) drivers as the green doesn’t have that… So bootup will be a little quicker, not waiting for hdmi edid read over i2c/etc.

Regards,

I removed bb-symlinks.service and added the dtb=am335x-bonegreen.dtb but only marginal improvements:
debian@BeagleBone:~$ systemd-analyze
Startup finished in 12.130s (kernel) + 24.723s (userspace) = 36.854s
graphical.target reached after 24.421s in userspace
debian@BeagleBone:~$ systemd-analyze blame >logGreen.txt
debian@BeagleBone:~$ cat logGreen.txt
17.362s dev-mmcblk1p1.device
4.615s systemd-udev-trigger.service
2.795s systemd-resolved.service
1.956s systemd-timesyncd.service
1.895s systemd-journald.service
1.803s bb-usb-gadgets.service
1.532s systemd-logind.service
1.489s user@1000.service
1.378s systemd-networkd.service
1.271s networking.service
854ms ssh.service
840ms systemd-journal-flush.service
745ms systemd-udevd.service
536ms systemd-tmpfiles-setup.service
536ms sys-kernel-config.mount
534ms sys-kernel-debug.mount
531ms sys-fs-fuse-connections.mount
518ms systemd-fsck-root.service
515ms kmod-static-nodes.service
477ms systemd-remount-fs.service
441ms systemd-update-utmp.service
435ms systemd-modules-load.service
366ms systemd-tmpfiles-setup-dev.service
363ms systemd-sysusers.service
362ms systemd-user-sessions.service
337ms systemd-sysctl.service
282ms systemd-random-seed.service
263ms rsyslog.service
233ms systemd-update-utmp-runlevel.service
104ms user-runtime-dir@1000.service
99ms ifupdown-pre.service

I need help, needs to be 20 seconds or lower. What else can be done? I have looked at all posts referencing boot or startup time and made changes appropriately to get here. Thanks for all past and future help!

Time to get a usb-serial adapter and drop bb-usb-gadgets.service

Next is really, grab the kernel source and start disabling things. :wink:

Regards,

1 Like

About the kernel, where do you grab the kernel? Do you mean using buildroot or yacto?

The image you installed using: 5.10.168-ti-r72

The Kernel source / Branch for this is available here:

git clone -b ti-linux-5.10.y https://openbeagle.org/RobertCNelson/ti-linux-kernel-dev.git
cd ./ti-linux-kernel-dev/
./build_deb.sh

That’ll generate a linux-image*.deb under ./deploy/ that you can install directly on your BeagleBone Black:

sudo dpkg -i linux-image*.deb

default kernel config is ./patches/defconfig kernel’s menuconfig comes up right away with the default values…

Regards,

This is cool! now I have a linux-image-5.10.168-ti-r77_1xross_armhf.deb and other stuff in the deploy directory and the defconfig in the patches directory. As I understand it this is just the linux/debian part but now it needs to be put in an BBB image with the BB directory structure, uEnv.txt, uboot and whatever else. Now how do I get it into a flashing image on a SD card? Again this is great stuff!

You can copy the linux-image*.deb to an internal web-server/etc… or use scp to copy it over…

Just install it via: sudo dpkg -i linux-image*.deb we have post-install scripts already setup so all the files will end up in the correct locaiton…

So just sudo reboot and watch the new build boot…

Regards,

It worked! except I must have blasted away the ssh or usb server because I cannot get into it anymore. The LEDs blink correctly though. Round two coming up.
Question: when the kernel configuration if you don’t change anything it should just be the ‘normal’ kernel for this version (5.10-.168) right?

When I make no changes just accept defaults still get no usb ssh connectivity. LEDs appear to blink the normal BBB pattern. Does what build_deb.sh start with a blank slate or is this starting with something that works you can then modify?

it builds the default shipping “patches/defconfig” … usb should come up, after installation and reboot…

Regards,

In the Kernel Configuration menu does the selection mean manually loaded like it is not loaded during boot but can be added later?

the shipping config is stored under, patches/defconfig this is the same config that is loaded by menuconfig when you run build_deb.sh…

Would the serial debug port give clues as to why there is no usb? Sounds like a dumb question because its a debug port but will the log give clues?

the serial port will allow you to login, or go over ethernet…

I’m just betting… you need to run:

sudo depmod -a ; sudo reboot

Regards,

I will try that, also forgot to mention it will not respond to the power button.