CarPi - <13 secs to Kodi GUI - can it boot faster? - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166) +---- Thread: CarPi - <13 secs to Kodi GUI - can it boot faster? (/showthread.php?tid=201354) Pages:
1
2
|
CarPi - <13 secs to Kodi GUI - can it boot faster? - doug - 2014-08-04 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: 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. RE: CarPi - 16.5 sec.boot to xbmc menu - can it boot faster? - lrusak - 2014-08-04 You could try the deadline scheduler. This will require a udev rule, similar to this, https://github.com/lrusak/OpenELEC.tv/commit/64b28f101829f3d623442cdf5ca58652ba3136d5 Also, if you want a better method of timing, you can use the include systemd-analyze function, however, this requires you to enable ssh. Code: OpenELEC:~ # systemd-analyze time or do something like this for a more visual representation. Code: systemd-analyze plot > /storage/screenshots/OpenELEC-boot-`date +"%Y%m%d-%H%M%S"`.svg https://www.dropbox.com/s/wt3h934mween7ka/OpenELEC-boot-20140803-213653.png From this plot you can see that one way to speed it up is to remove the samba server as this slows down the critical chain. EDIT: OE includes deadline in RPi builds seems deadline provides some improvement Code: Startup finished in 3.147s (kernel) + 6.140s (userspace) = 9.288s RE: CarPi - 16.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-08-04 I'll look into that, but it's a bit beyond my knowledge level atm and I'm to sleepy to google/learn right now. (2014-08-04, 06:40)lrusak Wrote: Wow! Is that the time for the xbmc to fully boot? Is that a Sandisk Extreme or SSD perhaps? Edit: The png isn't working for me (with various applications). I'm getting a header error. RE: CarPi - 16.5 sec.boot to xbmc menu - can it boot faster? - lrusak - 2014-08-04 (2014-08-04, 07:05)doug Wrote: I'll look into that, but it's a bit beyond my knowledge level atm and I'm to sleepy to google/learn right now.Here is how to change the scheduler. (using SSH) 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" (2014-08-04, 07:05)doug Wrote:(2014-08-04, 06:40)lrusak Wrote: Nah, just a some normal sandisk card. This is my overclock Code: arm_freq=1150 I also have force_turbo=1 set This time is until everything starts, so XBMC is started, but it may appear a bit quicker then your visual timing. Doh, the image is actually an SVG, I'll update my other post to reflect. I have now converted it to a png, so here is the new link. https://www.dropbox.com/s/wt3h934mween7ka/OpenELEC-boot-20140803-213653.png RE: CarPi - 16.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-08-04 (2014-08-04, 07:24)lrusak Wrote: [Thanks! Easier than expected. (2014-08-04, 07:24)lrusak Wrote: Nah, just a some normal sandisk card.That will boot a bit faster with that overclock...I'll try force_turbo=1 too...I've already voided my warranty on my other Pi! :-) (2014-08-04, 07:24)lrusak Wrote: This time is until everything starts, so XBMC is started, but it may appear a bit quicker then your visual timing.I guess that's true. I'm not sure how much time the bootloader takes...that might not be in your timing, but is in mine. (2014-08-04, 07:24)lrusak Wrote: Doh, the image is actually an SVG, I'll update my other post to reflect. I have now converted it to a png, so here is the new link.That graph is interesting I'll have to try that with an SSH enabled build. I usually disable Samba in OE settings and only enable it when my daughter is watching a video and I want to access the music via my phone. There are a few services in there I can look at pulling out. Fun stuff! RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-08-04 A follow up on this. I've done a bit more playing around. I've found there is a big difference between what systemd-analyze states as the boot time and how long it take for an xbmc menu to appear. I put a stock 4.1.2 back on the SD card and got a 20.5 second boot. But systemd-analyze states it's: Code: OpenELEC:~ # systemd-analyze time So, with standard OE 4.1.2, it takes roughly 10 more seconds for xbmc to boot into a usable state than what systemd reports. Adding Code: ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline" Code: OpenELEC:~ # systemd-analyze time Changing force_turbo=1 in config.txt didn't realize any measurable increase in boot time to the xbmc menu. With systemd-analyze, boot time actually increased a bit: Code: OpenELEC:~ # systemd-analyze time Setting force_turbo did, however, allow me to increase my overclock just slightly (to 1125). With that and using a cut-down OE, I boot to the xbmc menu in 15.5 seconds! And systemd-analyze reports a wickedly fast: Code: OpenELEC:~ # systemd-analyze time Thanks for those tips...I'm going to update the original post. RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - lrusak - 2014-09-02 Doug, I may have found something else, but have only done limited testing. I've compiled OpenELEC with the BFS cpu scheduler patch. It seems to have an improvement from what I can tell. The only other thing I have done since last time is changed the kernel compression to lz4 (this requires creating an lz4 package and compiling it for the host system). Code: OpenELEC:~ # systemd-analyze time Here is the plot http://i.imgur.com/9P7RE7i.png To do this you just need to run the following command from you openelec build folder. Code: wget http://ck.kolivas.org/patches/bfs/3.0/3.16/3.16-sched-bfs-450.patch -O packages/linux/patches/3.16.1/linux-020-bfs-scheduler.patch Then, Code: PROJECT=RPi ARCH=arm ./scripts/clean linux Hit "Y" when it prompts you Code: cd ../.. Then finally, Code: PROJECT=RPi ARCH=arm ./scripts/clean linux and proof Code: OpenELEC:~ # dmesg | grep BFS Re: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-09-02 Cool! I'll give that a try tonight! RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-09-03 I just tried it and can say it's definitely faster. I can see about a 1/2 second faster boot. I've actually added a few things back into my build of OE that I didn't have before (like wireless drivers). My boot was taking just over 17 seconds and with BFS it is now 16.5s. Nice! Here is systemd-analyze time (samba disabled; ssh and wired internet enabled) Code: xbmc-van:~ # systemd-analyze time Looking at the graph of your boot times...ttyAMA0 is taking a half second to load; could it be disabled if it's not used? RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - MrMC - 2014-09-03 hahahaha, davilla likes that quote RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - lrusak - 2014-09-04 (2014-09-03, 05:44)doug Wrote: Looking at the graph of your boot times...ttyAMA0 is taking a half second to load; could it be disabled if it's not used? I'm not sure where you see that. If you look at the graph anything that is highlighted red means it is part of the critical chain and thus may be holding something up. ttyAMA0 isn't highlighted at all. Something else I just tried was another udev rule, it can be used in the same file as the other. /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" This made a pretty decent gain. Code: Startup finished in 2.538s (kernel) + 4.424s (userspace) = 6.962s I have also overclocked to the max. Code: arm_freq=1200 Re: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-09-04 I'll try that too. That's a pretty big jump. I can't get that high of an overclock from my Pi/power supply. I was reading the graph incorrectly! I'll take a look at that for my boot and try to eliminate some critical path items. RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - doug - 2014-09-04 I tried the same overclock (possibly/probably unstable for me) and the udev rule. Definitely faster: Code: Startup finished in 3.011s (kernel) + 4.529s (userspace) = 7.540s I'm curious if you also have a car/van install and are trying to get the fastest boot or are just trying to optimize it as much as possible for inclusion in OE? RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - lrusak - 2014-09-04 (2014-09-04, 17:24)doug Wrote: It's interesting that your kernel loaded 1/2 second faster with those changes and mine was mostly unaffected. Seems like it takes about ~0.5s longer from a cold boot. For me this means physically plugging in the power. Code: Startup finished in 3.156s (kernel) + 4.453s (userspace) = 7.609s Compared to simply issuing "reboot" from ssh Code: Startup finished in 2.506s (kernel) + 4.340s (userspace) = 6.847s Oh well. (2014-09-04, 17:24)doug Wrote: I'm curious if you also have a car/van install and are trying to get the fastest boot or are just trying to optimize it as much as possible for inclusion in OE? Just for fun I've considered making a car installation, but I really have no use for it right now as I don't have anyone that sits in the backseats of my car. I would like to make a touchscreen music controller, but the subsonic music addon doesn't allow caching like the subsonic app for android does. RE: CarPi - 15.5 sec.boot to xbmc menu - can it boot faster? - goundoulf - 2014-11-06 I have done some tests: OpenELEC 4.2.1 with Wolfson patches : Code: # systemd-analyze time Then with: disable_splash=1 Code: # systemd-analyze time Then with: hdmi_edid_file=1 Code: # systemd-analyze time Then with: noram in cmdline.txt Code: # systemd-analyze time Then with manual net instead of dhcp Code: # systemd-analyze time Then remove "sleep 25" in the following file: Code: # cat .config/autostart.sh Code: # systemd-analyze time Obviously the nfs mount did not work Then with: hdmi_group=1, hdmi_mode=16 Code: # systemd-analyze time I noticed with "systemd-analyze blame" the following: Code: 3.471s connman.service wpa_supplicant could be disabled if not needed. As for show-version.service, is it really needed? And do we need connman.service with a fixed IP address? This would shave nearly 5 seconds for just those 3 services |