Recommendation to boot / resume Linux in less than a second...

Hi BBB gurus!

I’m trying to setup my BBB to wake-up from cold-boot to a functional user-space Linux app in the shortest amount of time. (Like 0.5 seconds)

I understand that it is technically impossible to boot Linux this fast, thereby requiring a ‘hibernate’ type of solution…

Could you point me toward the right direction? What lib / technique is best?

Thanks a bunch!

Jean-Pierre

You’re going to need a 3.14.x kernel, and it would probably be best to build your own rootfs using Robert Nelsons netinstall.

Build your own kernel and disable everything not needed module wise.

As it is, just building my own kernel with little to no modifications compared to RCN’s instructions - I get ~12 second boot times.

You’re also going to have to set a static IP for any networking interfaces. OR perhaps set a cronjob to configure the interface after the system is up and running.

However, even with all this taken care of, and whatever else you can glean from the web - Realistically ~5 seconds or slightly less is the best you’re going to. Of course, this is speculation on my own behalf, and I’m not an expert on that matter either.

JP,

if you can afford twice your budget (1s!), you can try the path I went two years ago when I demonstrated fast boot on imx6, from power-on to V4L user app in less than 1s (915ms).

What I did for this demo might apply to BBB/your_project, or not (I let you decide):

  • U-boot: use DMA to read from SDCard (eMMC sb. very similar, possibly better)
  • U-boot: load Kernel directly at its execution address (avoid memmove)
  • Load Linux uncompressed
  • no SMP, no power management
  • Compile as much as you can as modules
  • Build kernel with an early user space inside
  • The user application is init (bare Linux user app)

These conditions may not met your design, at least it can brings you generic insights on Linux boot optimisations.

Cheers,

Laurent.

Hi William and Laurent, thank you for taking the time!

What different results between the two of you! That 1 sec boot appears incredible! I’ve done similar efforts to William’s approach a few years back and remember similar results but these were unfortunately quite far to our target.

But that 1s to user-app on MX6 is really something… I wonder if the less powerful Sitara processor can approach such performance.

Thank you for listing these steps… I’ll try this out as soon as I can and hopefully can greatly reduce boot time.

If this can be pulled off, then a hibernate solution would not be needed!

Thanks again!!

Jean-Pierre

Hi RH,

Thank you for your valuable input. I’m glad to see awesome results like Laurent was posting validated by another user. 1.6s is still incredible and totally useful for what we’re doing. Are these results reported from a stock BBB?

Are your sequence of steps similar to Laurent?

Thank you again for sharing!

Jean-Pierre

Hi Richard, thanks for those precisions…

But what’s your boot time?

The last time I tested on older BB hardware felt around 12 sec +/- 1 sec. (Have to set it up again to get precise time via dmesg) Have to try this on BBB and I’m very encouraged to read about these sub-2 sec times!!

FYI, I found an excellent TI resource on how to reduce boot time on Sitara chips here. Very detailed step-by-step instructions that appear very valuable for what we need to do.

(Really worth a ready everyone!)

Hi Richard, thanks for pointing this out… we can probably make our own but its good to know this right away.

Will continue to investigate… looks like 3 sec is reasonable to attain but getting closer to 1 going to require external help and some hard structural choices on our part… :slight_smile:

systemd is supposed to make boot times even faster compared to the older / std debian init daemon. The problem I personally have with systemd, is that I’m oldschool Linux, know init fairly well, and can not find very good information about systemd on the web.

Ok, and child can make systemd do these neeto little tricks that help do exactly NOTHING. but where arethe detailed inner working docks ? thats problem I have it with all . . .

systemd has a ton of documentation. Some useful bits:

http://0pointer.de/blog/projects/blame-game.html
http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks/
http://www.freedesktop.org/wiki/Software/systemd/

Using "systemd-analyze plot > plot.svg" is hugely useful for identifying startup bottlenecks.

- Mike

Mike, Hi,

Yes, I found all of that stuff, and it is great, but basically still is a toy. By this I mean outside of graphing startup times etc, that is not very useful. Perhaps what I am really after is syscntl information, but with the limited time I’ve had lately, I have not been able to find much of anything of use.

For instance, I found the newer method of startup scripts( services ) really fast, and mostly painless to setup. https://wiki.debian.org/LSBInitScripts Trying to do the same with the latest init daemon for me so far has proven to be futile on my own behalf.

Most probably I need to do more reading, this is expected. But short term I tend to just use LSB init scripts rather than reading yet more frustrating documentation.

Probably what I need is an exact steps simple example to give me that “ah ha!” moment.

Hi all, many thanks for this insightful discussion.

Q: Is systemd a viable option to optimize boot-time on ARM embedded platforms? (Given its steeper learning curve are the results worth the extra work / risk over ‘init’?)

"option"? systemd is a 'requirement' for fast bootup...

Regards,

I've attached the output of "systemd-analyze plot > plot.svg" on my BBB system for your reference. My systems need to boot in 10 seconds or less, and that is easily achieved.

There is really no reason not to use systemd, that I am aware of. (There is a lot of FUD about it, though.)

- Mike

plot.svg

Hi MJC, thank you very much for that plot… impressive results and an insightful test to do to identify what can be sped up.

Robert: thanks for that comment… we’ll go systemd for sure now! :slight_smile:

If you really look back, pre-systemd there was lots of different
projects trying to minimize boot times. They all got faster then
sys-v.. Then Lennart released systemd and really just blew them out of
the water...

I did see a demo of timesys showing off something that booted even
faster then systemd, but you'll pay lots of $ for it.

Regards,

Supercool. We’re hoping to reduce boot-time by using open-source based solutions so following the latest systemd-based efforts appears as the next logical step. Thanks a bunch for that useful advice!!

Q: Have you guys ever tried reducing boot-times through a hibernate-based solution? (e.g. Warp) How do these stackup versus efforts to fast-boot Linux as detailed in this thread?

Yeah, what Robert said is pretty much what I’ve read. SYSV is partially parallel loading, where systemd is “fully” parallel.

My own problems with getting used to it is mostly due to not knowing how to do the equivalent of a Debian LSB init script ( service ) work.

I wonder if systemd is so magical why it is not used by any of PC’s Linux distributions?