FooDeas / raspberrypi-ua-netinst

RaspberryPi (minimal) unattended netinstaller
ISC License
218 stars 45 forks source link

Fastest possible boot time? #203

Closed lukehutch closed 3 years ago

lukehutch commented 4 years ago

I was wondering what work has been done to optimize boot time with this Raspbian distribution. I was going to follow the tips at the following link, then I discovered this fork of raspberrypi-ua-netinst, and decided to try one of the small installs. Can any of the following tips be incorporated to create an ultra-fast-booting distribution?

https://himeshp.blogspot.com/2018/08/fast-boot-with-raspberry-pi.html

(To clarify, I'm going to try optimizing raspberrypi-ua-netinst myself, but I'm posting the above link in the hopes that it may help produce a version of raspberrypi-ua-netinst that is already as highly optimized as possible for boot time.)

kpfleming commented 3 years ago

This is an installer, not a distribution, so it doesn't really control boot time of the installed system. It's certainly possible that 'quick boot' optimizations could be included in the installer script so that the resulting system boots more quickly, but they'll have to be opt-in features if they change the behavior of the system since this installer is supposed provide a system which is very similar to the base Raspbian installation (in minimal form, of course).

lukehutch commented 3 years ago

Fair enough, though I assumed that just as there are small installations that you offer, there could be even smaller installations. If you're not interested in any of the optimizations I linked, or this installer is not the place for them, feel free to close. Thanks!

kpfleming commented 3 years ago

I'm not the keeper of this project, just a happy user who has contributed a bunch of stuff, so my opinion is only mine :-)

If you configure the installer to build a 'minimal' system you're going to get the smallest possible Debian-derived system.

Looking at the link you posted (it's based on starting with a full Raspbian system, which is not what this installer provides):

Overall, starting with this installer is going to give you the best chance to build a minimal system which boots as quickly as any normal Debian-based system can boot; going beyond that point is going to require tailoring the configuration to the specific application you have in mind. If there are specific suggestions you have and can provide evidence that those changes make a measurable difference in startup times, I'm sure everyone here would be happy to discuss them.

lukehutch commented 3 years ago

OK, that's fair, thanks for taking a look and going over the post section by section. I'll close this, since I really don't know enough about Raspbian to suggest anything else. I guess it's too much to hope for Arduino-like startup times with a Raspberry Pi, at least running Raspbian or similar! (The current 30 second-ish startup time is a showstopper for an application I'm trying to use RPi for...)

kpfleming commented 3 years ago

Yes, that's true, there's a huge difference between any Linux-based system and an Arduino. However, if you're using an RPi for a dedicated (single) application which doesn't require a complex system to support it, you could consider using the busybox-based system (which is constructed by build.sh) as a starting point. If you provide a custom 'install' script which doesn't actually do any installation, but instead starts and runs your application, you'd have a very lightweight system with a very fast startup time (and as a bonus, it would run entirely out of RAM, only using the SD card for boot).

lukehutch commented 3 years ago

@kpfleming that actually sounds super useful, and I think many people would benefit from something like that. I don't know Raspbian well enough to put something like this together. Would you be able to write up a quick tutorial about how to build this, please?

kpfleming commented 3 years ago

No, that's a many hour project, and honestly, what you're asking for isn't Raspbian (or Debian, or any other major distribution).

You might find it helpful to read this blog and do some additional Internet searches for 'buildroot Raspberry Pi'. 'buildroot' is a system intended exactly for what you want: building a stripped-down Linux installation for a dedicated application.

kpfleming commented 3 years ago

Yocto is another project in that area, here's a post about that one.

lukehutch commented 3 years ago

@kpfleming Awesome, thanks for the pointers!