Methods to reduce boot time


#1

Hi. I trying to reduce boot time on Librem 15v3 and now i reach 10 seconds from Power Button to ready desktop without counting cryptsetup password.

Hardware: Purism Librem 15 v3
Software: Debian 10 Buster, Xfce 4.12.
BIOS: coreboot, classic MBR boot.

To achieve this loading time I did the following:

  1. Modify coreboot image. If you want to repeat the manual, think before you do. I’m not responsible for your actions. It looks like a guide to action, but it’s only a report.
    1.1 Delete bootsplash image from coreboot image. (Is it possible not to show Librem logo on boot?)
    1.2 Disable boot menu (https://www.seabios.org/Runtime_config , show-boot-menu=0 parameter)
    1.3 Put usb devices in first position in boot order for recovery goals.
    To disable boot menu you need to create varriable etc/show-boot-menu in your cbfs and flash changed firmware.
$ cbfstool COREBOOT.ROM add-int -i 0 -n etc/show-boot-menu
  1. Install Extlinux instead Grub wIth minimal config. DON’T TYPE THIS COMMANDS IF YOU DON’T KNOW WHAT YOU DOING. This configuration designed for systems with separate /boot/ partition. If you ruined your bootloader for some reasons, you can use Super Grub 2 or Debian Netinstall image (it have recovery mode). Also backup of MBR is good idea.
    Your versions of kernel can be different. Check filenames of vmlinuz* and initrd* in /boot/ directory.
# apt-get install extlinux
# mkdir /boot/extlinux/
# extlinux --install /boot/extlinux/
# cat /usr/lib/EXTLINUX/mbr.bin > /dev/sda
# nano /boot/extlinux.conf
DEFAULT debian

LABEL debian
	LINUX vmlinuz-4.19.0-5-amd64
	INITRD initrd.img-4.19.0-5-amd64
	APPEND root=/dev/mapper/sda5_crypt quiet
  1. Minimize initramfs size. If you use initramfs-tools for initram image (default in Debian and probably PureOS), you can change one parameter in /etc/initramfs-tools/initramfs.conf
    Default is “most”, we will change it to “dep”
MODULES=dep

Then type

# update-initramfs -u
  1. Create systemd service for autologin.
    4.0 Delete or disable (or don’t install) login manager.
# systemctl disable gdm.service

4.1 download mingetty

# apt-get install mingetty

4.2 Create file /etc/systemd/system/autologin-user.service

[Unit]
DefaultDependencies=no
After=apparmor.service

[Service]
ExecStart=/sbin/mingetty --autologin YOURUSERNAME --loginprog=/usr/local/sbin/autologin-user --noclear tty7 38400

[Install]
WantedBy=multi-user.target

4.3 Create file /usr/local/sbin/autologin-user

#!/bin/sh
exec /bin/login "${@}" START_X11=1

4.4 Add this text into start of ~/.bashrc

# autologin
if [[ ${START_X11} == 1 ]]; then
    unset START_X11
    exec startx >/dev/null 2>&1
fi

4.5 Enable autologin service

# systemctl enable autologin-user.service
  1. Convert wallpaper into .png format. In xfce4 .png wallpapers load faster than .jpg

Also i want to ask you, what more can i do to reduce boot time?


Report: flickerless boot with seabios+syslinux+archlinux