Feature: Allow controller program to operate directly as "init program" by default.
The controller program already supports operating as an "init" program.
The design is generic enough to do this and a parameter exists already to explicitly set paths.
When running as "init" under normally circumstances, parameters might not be passed to it.
This is a good argument to support operating natively as an "init" without requiring the init parameter.
The design of the FLL programs allows them to be used as a library.
Take advantage of this and rewrite some of the code to save the "init" related differences in the main.c file.
The main.c file is not shared in the library and is therefore a safe candidate for holding differences.
This results in two programs "controller" and "init" which use the same library.
A stripped binary size of these two programs is each ~23K.
The stripped library shared between them is ~235K.
Having both programs on the system therefore only costs and additional ~23k.
To make this easy, provide an "as_init" mode that can be added to compile in this mode.
A compilation as "controller" might look like:
- "fake clean build -m monolithic"
A compilation as "init" might look like:
- "fake clean build -m monolithic -m as_init"
In both cases the program is built as "controller" under "build/programs/shared/controller".
When compiling "as_init", just rename this program when installing, such as:
- "cp -v build/programs/shared/controller /sbin/init".
The libraries and headers need only be installed once between the two programs.
This situation is a great example of the design principles of this project in use and working well.