Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ STILL UNDER DEVELOPMENT; NOT RELEASED YET.

* Fixed option parsing to detect missing arguments to options.

* Added support to build specific architectures within a machine type.
This is done via new syntax in the MACHINE variable, which can now
take pairs like evbarm-aarch64.


Changes in version 2.7
======================
Expand Down
8 changes: 7 additions & 1 deletion sysbuild.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.Dd February 6, 2017
.Dd December 31, 2024
.Dt SYSBUILD.CONF 5
.Os
.Sh NAME
Expand Down Expand Up @@ -134,6 +134,12 @@ Default:
.It Va MACHINES
Whitespace-separated list of machine types to build for.
.Pp
Every entry in this list can be a simple machine name like
.Sq amd64
or it can be a pair of the form
.Sq evbarm-aarch64
to indicate the architecture to target for a particular machine type.
.Pp
Default: the name of the host machine type.
.It Va MKVARS
Whitespace-separated list of
Expand Down
22 changes: 18 additions & 4 deletions sysbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,24 @@ sysbuild_set_defaults() {

# Performs a build for a single machine type.
#
# \param machine The type of the machine to build for.
# \param machine_pair The type of the machine to build for. Can optionally
# contain the architecture in the "machine-arch" form.
do_one_build() {
local machine="${1}"; shift
local machine_pair="${1}"; shift

local aflag=
local mflag=
case "${machine_pair}" in
*-*)
mflag="-m${machine_pair%%-*}" # First word in pair.
aflag="-a${machine_pair#*-}" # Other words in pair.
;;
*)
mflag="-m${machine_pair}"
;;
esac

local basedir="$(shtk_config_get BUILD_ROOT)/${machine}"
local basedir="$(shtk_config_get BUILD_ROOT)/${machine_pair}"

local njobs="$(shtk_config_get NJOBS)"
local jflag=
Expand Down Expand Up @@ -147,7 +160,8 @@ do_one_build() {
${Vflags} \
${Xflag} \
${jflag} \
-m"${machine}" \
${aflag} \
${mflag} \
${uflag} \
${xflag} \
${targets} )
Expand Down
82 changes: 82 additions & 0 deletions sysbuild_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,72 @@ EOF
}


shtk_unittest_add_test build__machine_arch_targets__ok
build__machine_arch_targets__ok_test() {
mock_cvsroot=":local:$(pwd)/cvsroot"
create_mock_cvsroot "${mock_cvsroot}"

create_mock_binary cvs yes
PATH="$(pwd):${PATH}"

assert_command -o save:stdout -e save:stderr sysbuild \
-c /dev/null -o CVSROOT="${mock_cvsroot}" \
-o MACHINES="evbarm-aarch64 evbarm-earmv7hf fake-multi-dashes" \
-o NJOBS=2 build evbarm-aarch64:sets release

assert_file stdin commands.log <<EOF
Command: cvs
Directory: ${HOME}/sysbuild/src/.cvs-checkout
Arg: -d${mock_cvsroot}
Arg: -q
Arg: checkout
Arg: -P
Arg: src

Command: build.sh
Directory: ${HOME}/sysbuild/src
Arg: -D${HOME}/sysbuild/evbarm-aarch64/destdir
Arg: -M${HOME}/sysbuild/evbarm-aarch64/obj
Arg: -N2
Arg: -R${HOME}/sysbuild/release
Arg: -T${HOME}/sysbuild/evbarm-aarch64/tools
Arg: -U
Arg: -j2
Arg: -aaarch64
Arg: -mevbarm
Arg: sets
Arg: release

Command: build.sh
Directory: ${HOME}/sysbuild/src
Arg: -D${HOME}/sysbuild/evbarm-earmv7hf/destdir
Arg: -M${HOME}/sysbuild/evbarm-earmv7hf/obj
Arg: -N2
Arg: -R${HOME}/sysbuild/release
Arg: -T${HOME}/sysbuild/evbarm-earmv7hf/tools
Arg: -U
Arg: -j2
Arg: -aearmv7hf
Arg: -mevbarm
Arg: release

Command: build.sh
Directory: ${HOME}/sysbuild/src
Arg: -D${HOME}/sysbuild/fake-multi-dashes/destdir
Arg: -M${HOME}/sysbuild/fake-multi-dashes/obj
Arg: -N2
Arg: -R${HOME}/sysbuild/release
Arg: -T${HOME}/sysbuild/fake-multi-dashes/tools
Arg: -U
Arg: -j2
Arg: -amulti-dashes
Arg: -mfake
Arg: release

EOF
}


shtk_unittest_add_test build__machine_targets__unmatched
build__machine_targets__unmatched_test() {
mock_cvsroot=":local:$(pwd)/cvsroot"
Expand Down Expand Up @@ -826,6 +892,22 @@ EOF
}


shtk_unittest_add_test env__explicit_machine_arch
env__explicit_machine_arch_test() {
cat >expout <<EOF
. "${SYSBUILD_SHAREDIR}/env.sh" ;
PATH="/my/root/evbarm-aarch64/tools/bin:\${PATH}"
D="/my/root/evbarm-aarch64/destdir"
O="/my/root/evbarm-aarch64/obj/usr/src"
S="/usr/src"
T="/my/root/evbarm-aarch64/tools"
EOF
assert_command -s exit:0 -o file:expout sysbuild -c /dev/null \
-o BUILD_ROOT=/my/root -o MACHINES="amd64 evbarm evbarm:aarch64 i386" \
-o SRCDIR=/usr/src env evbarm-aarch64
}


shtk_unittest_add_test env__eval
env__eval_test() {
make_one() {
Expand Down
Loading