Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprinkle some custom hooks in multiple key moments during build. #2799

Closed

Conversation

@rpardini
Copy link
Contributor

@rpardini rpardini commented Apr 25, 2021

These allow for more substantial changes to the build in a custom configuration (userpatches/config-xxx.conf), without having to change Armbian sources. Essentially it allows for more customization points (using functions). It should be safe, eg, every hook point tests for the existence of the hook function before calling it.
Having written those around 6 months ago and having done countless rebasing, I'm trying to offload them unto upstream.

Some possible uses:

  • Override family-set values without changing family/include
  • Replacing the onboarding process (eg, with cloud-init)
  • Replacing NetworkManager with netplan
  • Preconfiguring zram, zswap and some services
  • Customizing the BSP package contents
  • Dynamic calculation of image size
  • Capturing the rootfs as an e2image dump for fast flashing
  • Copy kernel-headers .deb to rootfs, but don't install it

Signed-off-by: Ricardo Pardini ricardo@pardini.net

Examples of usage

Mostly a mess, but some examples of usage can be seen on https://github.com/rpardini/armbian-build/tree/rpardini-stable/userpatches - for example:

Hope this is enough to warrant a merge, thanks

@lanefu lanefu requested a review from igorpecovnik May 1, 2021
@lanefu lanefu self-assigned this May 1, 2021
@lanefu
Copy link
Member

@lanefu lanefu commented May 1, 2021

@rpardini this is awesome...

Please confirm my understanding... The changes are all Conditionals checking for the existence of additional functions in a user patches file and not overriding/replacing existing functions correct?

Requested Changes:

If the functions the new code is checking for all reside in userpatches, can we prefix all the function names with user_config to make it more apparent these are optional overrides as was done [here]https://github.com/armbian/build/pull/2799/files#diff-e0cd262e64e226acc09b70a455b981c6e29544a4210f83e42e74796dfa9f9974R611l)

Could you modify example and create it as a template here, and assure all the possible functions are listed, and clearly documented above them?

Extra Credit:

Once merged, I'll do my best to update the documentation from your example, but if you'd like to add additional documentation here It would be greatly appreciated.

@lanefu lanefu self-requested a review May 1, 2021
@rpardini rpardini force-pushed the rpardini:add_many_hooks_via_functions branch from d526427 to 20e90e1 May 1, 2021
These allow for more substantial changes to the build in a custom configuration (userpatches/config-xxx.sh), without having to change Armbian sources.
Some possible uses:
- Override family-set values without changing family/include
- Copy kernel-headers .deb to rootfs, but don't install it
- Dynamic calculation of image size
- Capturing the rootfs as an e2image dump for fast flashing
- Replacing the onboarding process (eg, with cloud-init)
- Preconfiguring zram, zswap

Signed-off-by: Ricardo Pardini <ricardo@pardini.net>
@rpardini rpardini force-pushed the rpardini:add_many_hooks_via_functions branch from 20e90e1 to fa82077 May 1, 2021
@rpardini
Copy link
Contributor Author

@rpardini rpardini commented May 1, 2021

@lanefu thanks for the review.
I just pushed another hook (pre initramfs), but that did not take your review into account.
There are a few changes that are not "only adds functions that are called if they exist" already in that I will try to review. I also need to be able to skip u-boot compilation and installation for some boards.
I have not paid attention to the naming of the funcions, some are user_config while others are config_ and others just a mess. I will try to review it all.
Thanks

@rpardini
Copy link
Contributor Author

@rpardini rpardini commented May 6, 2021

Closing this in favor of #2807 - a more complex implemention of this that should address most of the questions raised here.

@rpardini rpardini closed this May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants