Hope you all are having a pleasant day
I am working on a battery-powered project based on the Pi Zero W where a button (connected to Reset) is pressed to start the Pi, which connects via Bluetooth to a pre-trusted smartphone and uses the oFono telephony service to start a phone call to a predetermined number on said smartphone. Once the call is initiated, the Pi shuts down, disconnecting from the smartphone and allowing the call to be carried out using the phone's speaker/mic.
I've gotten a proof of concept working on Raspbian, where rc.local starts my Python script. In this script I use the subprocess class to issue the terminal commands to establish a Bluetooth connection with the smartphone, run the oFono script which initiates the call, then shutdown the system. My goal now is to optimize boot time.
I define boot time for this application as the time it takes from the pressing of the button to the call being initiated on the smartphone. Currently, on Raspbian, this is about 40-50 seconds. I would ideally like this to be less than 10 seconds, but my expectations may be completely skewed due to my lack of expertise.
I've come up with the following three approaches to reducing boot time:
1) analyze Raspbian's startup services and strip it down,
2) create a custom Linux system (using e.g. Buildroot or piCore) that only does what I need, or
3) a bare metal approach, where I communicate directly with the BCM4348 bluetooth chip
Out of these, 1 would be the easiest but probably be the least effective. 3 would give the best learning value as well as performance, but might be extremely tedious (documentation seems to be lacking). Going the route of 2 might work, but I'm pretty clueless as to what services I would need.
What's the best approach? Any useful resources/pointers? This isn't really a project for commercial use - I've just taken it on for a friend who wants a "physical button" speed dial and am using it for my learning experience more than anything else.
I'm just looking for thoughts, suggestions, and other ideas. Thanks in advance.