guysoft / CustomPiOS

A Raspberry Pi and other ARM devices distribution builder
GNU General Public License v3.0
516 stars 150 forks source link

CustomPiOS v2 - suport for meta modules and remote modules #221

Closed guysoft closed 1 month ago

guysoft commented 4 months ago

Related issue #214

Features

In the docker container of CustomPiOS you can now use:

Download flag

build -d

To download the latest tested image automatically.

Board flag

build --board list

To list available boards.

Then:

build -d -b [board]

for example:

build -d -b raspberrypiarm64

Will download the latest image and build on Official Raspberrypi lite 64bit image

New Internals

These flags required some bigger changes under the hood: The two major features are "meta modules" and "remote modules". There are also new files to contain all the board configuration and remote modules configuration. A small extra change is that all the python code has been moved in to a custompios_core module, and you could install it and use it for other projects too if you wish.

What are meta modules?

There is a now "meta" file that could be added to the modules folder (for example). Which lets you change what modules are added, and add in sub modules based on if they are needed in a board. Its an executable script that can hold any logic you like. It prints out the result to be used. So for example:

base(octopi)

Could be turned by a meta file that prints out:

base(armbian(octopi))

What are remote modules?

You can have modules that are stored on other repositories, currently implemented only for git repositories. The modules would be downloaded and used at build time. They are saved in to a new cache folder at CUSTOM_PI_OS_PATH/remotes They are configured in this yaml file: https://github.com/guysoft/CustomPiOS/blob/feature/meta-modules/src/modules_remote.yml It should be possible to add a local yaml that a repo can add in their repository that would let you set extra modules per-repo.

images.yaml

Images configuration is stored in a file images.yml. Its used for the --download flag and also has special settings per-board.

New BASE_BOARD variable

The way that the board information is passed across CustomPiOS is an environment variable the build --board flag passes.

custompios_core python module

currently can be installed by:

pip install git+https://github.com/guysoft/custompios.git@feature/meta-modules

Its mostly internals, but it does include code to download images, download remote modules. Calculate the modules execution order, etc.

More info about what mainsail are doing

Partly this started because I am trying to organize what Mainsail are doing here: https://github.com/mainsail-crew/MainsailOS/blob/develop/config/orangepi/default#L26 Namely how we handle base for armbian and orangepi and other boards