2014-08-04, 06:16
I've got a raspberry pi 2 with OpenELEC in my van which holds my daughter's video collection and also my music. I haven't connected a battery to it to keep the pi running when the van is off and don't plan to, so I've been looking for ways to reduce the boot time so my music is accessible quickly. Here's a summary of what I've done and the relative benefits of each step. The steps are in the order of decreasing returns, so the ones at the top are easy/beneficial and the ones at the bottom are harder or have less benefits in decreasing boot time. Any suggestions are welcome.
Note: all times are measured using the stopwatch on my phone. I'll estimate a margin of error of about +/-0.5 seconds. Times are from when I power up to when the kodi menu appears.
One more thing to try:
I've seen some SSD optimization recommendations that include using tmpfs for logging. So, if I can't disable logging in OE, perhaps adding the following to fstab:
would yield some benefit.
I hope this helps any others using Raspberry Pis for their car PC and hope I get a few suggestions back too.
Note: all times are measured using the stopwatch on my phone. I'll estimate a margin of error of about +/-0.5 seconds. Times are from when I power up to when the kodi menu appears.
- Edit for RPi2. I now have a RPi2 to replace the old B+ for my van. This cut 2.5s off my previous best boot time (15.5 seconds).
- Next is overclocking
After installing a brand new OE 4.1.2, booting up, and letting it "settle" for a couple minutes, I shutdown and did a fresh boot. It took almost 37 seconds. That's not too surprising given it wasn't overclocked. We all know the benefits of overclocking for a faster GUI; boot speeds also benefit. Here's a summary of my results:
No overclock - 37s
"1000,500,500,6" - 28s
"1100,600,600,8" - 24.5s
"1125,600,600,8" - 23.25s - note, this wasn't stable for me, so I backed off to 1100 for the CPU overclock. It's for reference only of the incremental benefit.
lrusak gave a tip to set force_turbo=1 in config.txt (possibly voiding your warranty depending on your overclock). This keeps the RPi at the maximum overclock all the time, rather than allowing the governer to throttle it back sometimes. That setting didn't directly decrease my boot time, but it did allow me to increase my overclock a little which lead to a faster boot
So it's easy to get a faster boot with some overclocking. Use a quality power supply so you can get the highest overclock possible.
- Use a fast SD card.
This is pretty obvious. If your card is fast you'll get faster boots. I am using the NOOBS card that I ordered when I bought the B+. As posted elsewhere in these forums, it's got pretty good 4k random read and write speeds and that is what matters. For the cost, it's very good. There are faster cards or USB3 flash drives at a higher price, but those aren't for me.
- add "noram" to cmdline.txt
I was surprised by this one. I stumbled on this setting in another post and thought I'd give it a try. It dropped my boot time by about 3.5 seconds. Without the option, all of OpenELEC is loaded into RAM. With the noram option, some components are loaded as needed.
- Compile OE and turn off many of the options
This is harder for some, but it's a good learning experience. I know as just a short time ago I didn't know how to use a compiler. I started compiling my own OE because I wanted pyserial included for my bedroom HTPC so I could send serial commands via python to my TV (I couldn't get hex serial commands working in bash...but that's another story). Back to this, I basically removed almost every option I could from the OpenELEC.tv/projects/RPi/options. The result is that my SYSTEM file is 69.7MB instead of 98.3MB. My kernel.img is marginally smaller too. The end result was about 4 seconds shaved off the boot time. (Note: this test was done without the noram option enabled. Because some features are no longer present in this cut-down version, I suspect the benefit of noram is reduced somewhat...but I haven't measured it)
- Use the deadline scheduler
This is another tip from lrusak. I'm not sure of what's going on with this "under the hood" but it leads to a small decrease in boot time. To change it:and add the following on one line:Code:nano /storage/.config/udev.rules.d/80-io-scheduler.rules
Code:ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
- Disable Services
In my custom version, I've removed SSH, but left in Samba. I saw somewhat faster boot times (~1s) by disabling these in System->OpenELEC->Services in a stock OE install.
- Misc.
Smaller returns here, but I've also done these things:- (splash)false(/splash) in advancedsettings.xml Note: I've changed < to ( and > to ) as tapatalk seems to have issues displaying them.
- use (loglevel)-1(/loglevel) in advancedsettings.xml Note: as above.
- I've created a cutdown Confluence. I only use music and videos so I cut out a lot of stuff related to Weather, Pictures, LiveTV, TV Shows, Addons, and Programs.
- I've set kodi to boot directly to Music as I use that most.
- (splash)false(/splash) in advancedsettings.xml Note: I've changed < to ( and > to ) as tapatalk seems to have issues displaying them.
One more thing to try:
I've seen some SSD optimization recommendations that include using tmpfs for logging. So, if I can't disable logging in OE, perhaps adding the following to fstab:
Code:
tmpfs /var/log tmpfs defaults,noatime,mode=0755 0 0
I hope this helps any others using Raspberry Pis for their car PC and hope I get a few suggestions back too.