Jump to content

[Solved] Adding custom applications/packages to build


g40

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

Link to comment
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

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines