15

I am creating a home appliance which uses as Raspberry Pi internally to handle the user interface and necessary WiFi connection. Connected to the R-Pi I have an AdaFruit LCD screen:

Adafruit LCD

and a USB Wifi dongle:

USB WiFi dongle

And also a keyboard. Nothing else. The Operating system is OpenElec, which is quite a slimmed down operating system.

However, when the user turns the device on, the R-Pi takes many seconds before it can accept user input.

Why does it take so long if it's booting off flash? Tens of seconds seems like a great deal of computation.

Is there anything that can be done to make a Raspberry Pi boot in under 5 seconds? Can they go into some kind of hibernate mode where it writes its RAM to FLASH, then read it back again on power up?

Otherwise, is there an alternative to the Raspberry-Pi, with similar capabilities (little LCD screen, USB for the WiFi dongle), which could boot in under 5 seconds?

6
  • Great question, would you be able to pastebin the boot log and link to it? Can't do much w/out knowing what it's doing during boot ;)
    – MDMoore313
    Commented May 23, 2014 at 19:54
  • 2
    What's it booting? Are you running a minimal OS and stripping it to the bare bones-- no desktop, etc. ?? Commented May 23, 2014 at 20:04
  • 2
    @ScottSeidman - Added OpenElec to my question.
    – Rocketmagnet
    Commented May 23, 2014 at 20:23
  • 1
    I agree with @BigHomie. It is not quite possible to suggest any improvement without seeing what is going on during boot-up.
    – gbudan
    Commented May 23, 2014 at 20:52
  • 1
    @NickAlexeev - Aah, the old overlapping Stackexchanges problem. I guess all R-Pi questions would be on-topic over there.
    – Rocketmagnet
    Commented May 24, 2014 at 19:43

4 Answers 4

13

I haven't worked with a Raspberry Pi, but I have reduced boot times with embedded Linux systems so I have some general answers.

1) OpenElec may be a perfectly workable embedded distro, but beginner/demo distros tend to throw in the kitchen sink to give you a wide breadth of capability, but that often means there are services starting that you don't need. So look in the init directories and shut off or defer anything non-essential for your purposes. If you don't need any thing graphical, on slower systems, X windows or graphics processes can be real time hogs. Not necessarily because it can't generate graphics adequately, but getting all the libraries loaded into memory takes time. And it takes time from loading when everything else you want is also loading or waiting to load.

2) SD cards have different read speeds, buy the fastest one that the device can handle. Or maybe see if a USB stick will load faster. You likely won't need the 40Mb/s cards, but going from a cheapie SD card to one that can handle 10Mb/s transfers could make a difference - again depending on what SD cards the Pi can handle). As an tangent: running off an SD card if the filesystem is writable isn't great for long term stability. If you need that, you may need to consider configuring your boot settings to treat the card as read-only or, make other system arrangements entirely.

3) If you really need graphics, the illusion of being booted is sometimes easier to get to than actually being 100% ready for any input. There are console boot splash screen programs that can throw up a graphic really quickly while all the other services you need start up. I've seen instances where a initial control panel graphic is used as a static boot screen which gets swapped out for a live working one when the system is ready - the user rarely truly wants to enter data within 2-3 seconds of the screen showing up.

If you're still looking for faster boot times, look here for a list of areas to look into.

2
  • 2
    Especially concentrate on point 2. Kernel booting and init scripts take roughly 30:70% boot time respectively. Custom kernel will start some 40% faster, custom startup scripts can improve 90% upon originals, meaning you can easily halve the startup time.
    – SF.
    Commented May 24, 2014 at 12:03
  • You're absolutely right, I swapped #1 and #2 because I'd spend time with the init scripts before anything else.
    – Digikata
    Commented May 24, 2014 at 16:58
8

Why does it take so long if it's booting off flash?

Part of the answer may be an issue of sheer throughput. While SD Cards use NAND flash storage, they can only transmit data serially. As compared to, say, a NAND flash chip that was soldered to the board which could communicate to the CPU directly with a parallel bus. The overall transfer rate would be roughly dependent on a few things like the clock speed of the bus and the size of the files you are transferring.

The transfer rate of an SD card is actually quite low in comparison to a modern SATA III or even SATA II hard drive. Short of a SATA port, USB 3.0 is another alternative which has quite a high transfer rate for relatively low cost.

More information can be found here, here, and here.

Is there anything that can be done to make a Raspberry Pi boot in under 5 seconds?

The CPU that the Pi uses is pretty low-end (hence the price). This means that it is lacking in high-speed interfaces like SATA or USB 3.0. Short of software emulation of these protocols (which will also likely suffer from major throughput issues) there isn't much that can be done other than trimming the fat from the OS.

Can they go into some kind of hibernate mode where it writes its RAM to FLASH, then read it back again on power up?

According to OpenElec, the Pi doesn't support hibernation, but if you read a little further down, they have some advice on how to speed up your Pi.

3

Generally speaking, reading from SD is very slow so it affects drastically.

Give it a try bootchart and figure it out whether there is any point to improve the boot time.

Or, you may configure your own kernel so it has very little size. Or, skipping some unnecessary initialization (look up odd or something) may help.

2

You need a minimalistic Linux Pi distro like PiCore. It boots to command prompt after just 7 seconds, and it needs 25 seconds for X. You can play with it in QEMU if you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.