jay_eye
Posts: 7
Joined: Sun Mar 01, 2020 2:33 pm

Fast booting rasbian lite

Mon Oct 05, 2020 3:48 pm

Hi!
I am trying to get a raspberry to 4 boot as fast as possible to the console.
I am using rasbian lite 4.19.
I got (by turning of services I didnt need) the systemd-analyze to show 3.424 seconds (kernel 825ms and userspace 2.598s). But it takes 16s to get to the commandline.
There seems to be happening something slow before the kernel starts but I dont get what?

My next step is recompiling the kernel. Not something I really look forward to. But if it is the only way.

I am basiclly following this: http://himeshp.blogspot.com/2018/08/fas ... ry-pi.html and the next steps are 5-8.

But will a recompiled kernel fix this since systemd-analyze tells me the kernel is finished in under 1 second?

HvdW
Posts: 163
Joined: Tue Jun 17, 2014 12:41 pm

Re: Fast booting rasbian lite

Mon Oct 05, 2020 4:35 pm

I am trying to get a raspberry to 4 boot as fast as possible to the console.
My next step is recompiling the kernel. Not something I really look forward to. But if it is the only way.
You give the impression of liking to experiment.
Average users reboot their RPI every now and then, so what's the specific need for fast reboot?

If it is something with certain services you're experimenting with it is much faster to restart the service.
Example

Code: Select all

sudo systemctl restart <name>
systemctl status <name>
or
sudo service <name> status/start/stop/restart
and scan
sudo service --status-all
the [+] are the services running
Who knows knows
Who doesn't doesn't

User avatar
DougieLawson
Posts: 40170
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Fast booting rasbian lite

Mon Oct 05, 2020 4:51 pm

jay_eye wrote:
Mon Oct 05, 2020 3:48 pm
My next step is recompiling the kernel. Not something I really look forward to. But if it is the only way.
...
But will a recompiled kernel fix this since systemd-analyze tells me the kernel is finished in under 1 second?
Rebuilding the kernel will not get it to go any faster.
Most of the time from boot to usable system is in the services that start after the kernel is running.

It's networking that takes most time.

My Zero boots to the GUI in 1min 15seconds. Which ain't bad for a 4 year old board design based on a 13+ year old mobile phone chip.
Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
dividuum
Posts: 228
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Fast booting rasbian lite

Mon Oct 05, 2020 4:58 pm

jay_eye wrote:
Mon Oct 05, 2020 3:48 pm
There seems to be happening something slow before the kernel starts but I dont get what?
Before the kernel has a chance to boot, the EEPROM is in control and is initializing the SDRAM (iirc). I'm not sure there is a way to reduce that other than using a Pi 4 variant with less memory. You should also find some other tips (like boot_delay) in other forum threads.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

jay_eye
Posts: 7
Joined: Sun Mar 01, 2020 2:33 pm

Re: Fast booting rasbian lite

Mon Oct 05, 2020 5:28 pm

Well, I know it will be moved and rebooted multiple times each day. Why is irrelevant, just trust med.
I have a software that is run as a service after the boot.

I just want the boot-time to get sub 5 seconds.

I have a display connected with hdmi, a flirc-adapter, no network, no bluetooth.
I use a sandisk extrem 64gb sd-card for max speed (I use a fraction of that space).

jay_eye
Posts: 7
Joined: Sun Mar 01, 2020 2:33 pm

Re: Fast booting rasbian lite

Mon Oct 05, 2020 5:33 pm

dividuum wrote:
Mon Oct 05, 2020 4:58 pm
jay_eye wrote:
Mon Oct 05, 2020 3:48 pm
There seems to be happening something slow before the kernel starts but I dont get what?
Before the kernel has a chance to boot, the EEPROM is in control and is initializing the SDRAM (iirc). I'm not sure there is a way to reduce that other than using a Pi 4 variant with less memory. You should also find some other tips (like boot_delay) in other forum threads.
Yeah. The boot_delay is set to 0.
Interesting. So a 1 gb rp4 may be faster than a 4gb?

I have a 2gb and a 4gb. I will test if there is a difference.

User avatar
dividuum
Posts: 228
Joined: Sun Jun 16, 2013 1:18 pm
Location: Germany
Contact: Website

Re: Fast booting rasbian lite

Mon Oct 05, 2020 5:56 pm

jay_eye wrote:
Mon Oct 05, 2020 5:33 pm
Interesting. So a 1 gb rp4 may be faster than a 4gb?
I would guess so. The 8GB Pi I have takes a long time (15 seconds or so?) before the first kernel output shows up.
info-beamer hosted - A user and programmer friendly digital signage platform for the Pi: https://info-beamer.com/hosted

jay_eye
Posts: 7
Joined: Sun Mar 01, 2020 2:33 pm

Re: Fast booting rasbian lite

Mon Oct 05, 2020 6:09 pm

dividuum wrote:
Mon Oct 05, 2020 5:56 pm
jay_eye wrote:
Mon Oct 05, 2020 5:33 pm
Interesting. So a 1 gb rp4 may be faster than a 4gb?
I would guess so. The 8GB Pi I have takes a long time (15 seconds or so?) before the first kernel output shows up.
Yeah. Maybe 2 seconds faster. So a bit faster.
This is what I want. But this is on a rp3b.
But I need to be able to output 4k, sometimes.
https://www.youtube.com/watch?v=PjjET56 ... =DanAdrian

trejan
Posts: 2949
Joined: Tue Jul 02, 2019 2:28 pm

Re: Fast booting rasbian lite

Mon Oct 05, 2020 6:20 pm

Memory size won't affect it. The Pi 4 firmware needs time to initialise the new memory controller and then do initial calibration. That process always takes a few seconds and you can't avoid it.

You can try disabling the HAT EEPROM and PoE HAT probes to see if that'll speed it up.

Apart from that there isn't much else you can do. Rewriting your application to run directly on the VPU may speed it up since you don't need to load the Linux kernel etc... but steep learning curve. It also isn't possible for Pi 4 yet AFAIK. cleverca22 will know more about this.

Return to “Advanced users”