0
g40

[Solved] Adding custom applications/packages to build

Recommended Posts

In case anyone else needs help with this. These steps create an oven-baked .img complete with all custom goodies on board from the get-go.

 

1. rysnc custom code and any other local dependencies into userpatches/overlay

2. Ensure any library dependencies (libv4l-dev in this case) are met by adding 'PACKAGE_LIST="$PACKAGE_LIST libv4l-dev"' to userpatches/lib.config

3. Step 1 ensures that the target image will have content in /tmp/overlay. In userpatches/customize-image.sh one needs to move said content from the read-only directory to somewhere suitable (/test in my case)

4. Finally have customize-image.sh run the relevant build system and optionally install as usual.

 

In order to automate the process end to end I modified compilation.sh so it called an arbitrary set of scripts in the newly created userpatches/custom

 

install_external_applications()
{
#--------------------------------------------------------------------------------------------------------------------------------
# Install external applications example
#--------------------------------------------------------------------------------------------------------------------------------
	display_alert "Installing extra applications and drivers" "" "info"

	for plugin in $SRC/packages/extras/*.sh; do
		source $plugin
	done
	
	# set up any custom packages for cross-compilation
	for plugin in $SRC/userpatches/custom/*.sh; do
		display_alert "Processing custom $plugin" "" "wrn"
		source $plugin
	done
}

An example being

#!/bin/sh
# example of how to build custom stuff in Armbian environment
#
# This sets up the source code we need to build grab so it will
# be automatically copied to /tmp/overlay. 
# it would be great if we could add to $PACKAGE_LIST here
# as we need the V4L2 development stuff to build grab

rsync -rt ~/src/grab ~/armbian/userpatches/overlay
rsync -rt ~/src/g40 ~/armbian/userpatches/overlay

Finally, some trivial modifications to customize_image.sh

# your code here
# create test folder
mkdir /test
# copy from RO temp
cp -r /tmp/overlay/grab /test
cp -r /tmp/overlay/g40 /test
# clean and build on target
make -C /test/grab clean
make -C /test/grab

The target will end up with a binary in /test/grab in this case.

 

The final build step would probably benefit from the more abstracted, modular, mechanism used to rsync.

 

If anyone has ideas for improvement etc, or wants a PR please let me know. HTH

 

Jerry

Share this post


Link to post
Share on other sites
2 minutes ago, g40 said:

In order to automate the process end to end I modified compilation.sh so it called an arbitrary set of scripts in the newly created userpatches/custom

This is why we have an (undocumented) hook for userpatches/customize-image-host.sh before calling userpatches/customize-image.sh

https://github.com/armbian/build/blob/master/lib/compilation.sh#L578

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
0