14

I would like my pi zero to boot quickly (under 1 second) using Linux. In that case we can pretend it is embedded controller and not standard full blown (but slow) computer.

Do you have any (additional) tips how to achieve this goal?

What I have already tried:

  • various options (like kernel parameters, custom kernels on std. distributions - arch, raspbian, tuning the systemd stuff etc.) - all slow in general
  • I have found some resources about altering the chain of bootloaders, but currently I'm unable to tweak it at this level
  • best results I could reach were provided by buildroot

Using following rules, I'm able to boot within (approx.) 4 seconds, but still, it is slow:

  • don't use initrd
  • don't use modules (embed required drivers into kernel)
  • don't use multiple devices (lvm)
  • don't use raid
  • don't use debug
    • debugfs
    • kernel debug (in kernel hacks)
  • don't use PCI/PCMCIA
  • don't use SATA/ATA
  • don't use bootup logo
  • don't use full blown C library like glibc
  • don't use optimization for size
  • configuration
    • cmdline.txt
      • don't use serial console:
        • delete console=xxx, where xxx is serial port
        • edit /etc/inittab (getty spawn)
      • setup root fs type: rootfstype=ext4
    • config.txt
      • don't use boot delay: boot_delay=0
      • don't use rainbow: disable_splash=1
      • don't care about safe mode: avoid_safe_mode=1
sharpener
  • 329
  • 1
  • 2
  • 8
  • 1
    I doubt you are ever going to get the Pi to boot anywhere near 1 sec. – Steve Robillard Mar 10 '17 at 21:00
  • I think the best you could get is under 1 minute. If you really need a fast startup for your application to initialize something, you could try interfacing any sensors to a microcontroller and have it do the setup, but then have the Pi start controlling the microcontroller (over serial?) once it boots. – anonymoose Mar 10 '17 at 21:44
  • 3
    piCore (made by Tiny Core Linux) may be able to go a bit faster. – lights0123 Mar 10 '17 at 22:00
  • 1
    I am not a pro in this matter but, apart from what you have mentioned in your post, one thing to speed up is to run your application after kernel and before systemd init, then call systemd init from within your application. One nice post I found which details optimization in various levels is this one. Note: I would like to learn from you how you managed to get 4seconds in a detailed post. – spockshr Aug 11 '20 at 12:42
  • @sharpener did you manage to achieve your goal or further reduce the 4s? – eglasius Jan 18 '23 at 11:16

1 Answers1

4

You can build linux from scratch on the pi (http://www.intestinate.com/pilfs/guide.html). With a custom kernel, you can boot into systemd in < 1s.

Brian
  • 141
  • 3