Hey Folks,
I need your help with making the boot time as fast as possible on my Raspberry Pi 5, from getting plugged-in to script execution.
Essentially, since the pi will be in a very power-scarce environment, is power will be cut for 99% of the time. However, upon restoring the power to it, I need it to boot as fast as possible and run a python script (all within 5 seconds). I've seen it is possible on YouTube.
My OS is running from a fast NVME and PCIE3 enabled. The boot order is set up as 416 and unessential services, i.e. wait_for_network and bluetooth have been disabled. EEprom is upgraded to latest version. While my systemd-analyze output is 2.794 seconds (see below) and script execution time is 0.75s, (when manually run), it's still taking about 15 seconds from power being supplied to script running.
I understand there is a hardware stabilization phase at the beginning, though that should not be for longer than 2s right? As I am new to boot optimizations, there may be something I'm missing here.
Here is the systemd-analyze output:
Startup finished in 1.139s (kernel) + 1.655s (userspace) = 2.794s
graphical.target reached after 1.642s in userspace.
Here is the systemd script:
[Unit]
Description=Main Service for Code
After=multi-user.target
[Service]
Type=simple
User=brian
WorkingDirectory=/home/brian/vision
ExecStart=/home/brian/vision/venv/bin/python /home/brian/vision/code.py
[Install]
WantedBy=multi-user.target
Any help/suggestions will be appreciated. Thank you in advance!
P.s. additional info: my script involves turning an LED on (so GPIO setup is involved). I am using a virtual environment called vision.
I need your help with making the boot time as fast as possible on my Raspberry Pi 5, from getting plugged-in to script execution.
Essentially, since the pi will be in a very power-scarce environment, is power will be cut for 99% of the time. However, upon restoring the power to it, I need it to boot as fast as possible and run a python script (all within 5 seconds). I've seen it is possible on YouTube.
My OS is running from a fast NVME and PCIE3 enabled. The boot order is set up as 416 and unessential services, i.e. wait_for_network and bluetooth have been disabled. EEprom is upgraded to latest version. While my systemd-analyze output is 2.794 seconds (see below) and script execution time is 0.75s, (when manually run), it's still taking about 15 seconds from power being supplied to script running.
I understand there is a hardware stabilization phase at the beginning, though that should not be for longer than 2s right? As I am new to boot optimizations, there may be something I'm missing here.
Here is the systemd-analyze output:
Startup finished in 1.139s (kernel) + 1.655s (userspace) = 2.794s
graphical.target reached after 1.642s in userspace.
Here is the systemd script:
[Unit]
Description=Main Service for Code
After=multi-user.target
[Service]
Type=simple
User=brian
WorkingDirectory=/home/brian/vision
ExecStart=/home/brian/vision/venv/bin/python /home/brian/vision/code.py
[Install]
WantedBy=multi-user.target
Any help/suggestions will be appreciated. Thank you in advance!
P.s. additional info: my script involves turning an LED on (so GPIO setup is involved). I am using a virtual environment called vision.
Statistics: Posted by CMC_Coffee — Mon Feb 10, 2025 6:04 pm