I'm currently trying to reduce the time it takes to boot my beaglebone green and start a python script. My simple python script just turns on a relay on a cape.

I'm using the time it takes for the relay to turn as the time it takes to boot and do something useful.

Previously the relay would take 18 secs and I've gotten it down to 14 secs messing around with systemd.

I've created a simple unit file that will start my python program

Description=Relaycheck run on startup



And here's a cropped picture of the current boot chart: Bootchart

To my understanding, my service is being run quite early and the time consuming services like networking, don't impact my relay service. Is this correct?

Is there anything else I can do reduce the time to boot using systemd?


Does your program need to maintain state (do you need a writeable disk?) The fasting thing you can probably do is not use an init system at all. Instead consider appending this to your Kernel arguments (most likely in your uBoot environment/config):


So instead of running systemd (the process manager) the Linux kernel will run your program as the first process. Now you said this was a Python script. I don't think you can execute a script as init. You may need to write a small wrapper program in a compiled language that will spawn your python application.

Keep in mind your shell/wrapper program also needs to handle signals (init/systemd handle signals for programs that don't have default signal handlers). You might be able to get away with using something like dumb-init which is typically used for Docker containers.

If you need a writeable volume, you can have your wrapper program mount a partition for you as well (it doesn't have to be your root partition. You may want to mount a USB stick for storage).

I'd try this in a desktop VM first as kernel parameters can be a little tricky on embedded systems/uBoot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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