1#!/bin/sh 2# Copyright 2018, Data61 3# Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4# ABN 41 687 119 230. 5# 6# This software may be distributed and modified according to the terms of 7# the BSD 2-Clause license. Note that NO WARRANTY is provided. 8# See "LICENSE_BSD2.txt" for details. 9# 10# @TAG(DATA61_BSD) 11 12# @rumprun_binary_file@ Is the full path to the posix binary to be baked 13# @rumprunbake_config@ is the config to use when baking 14# @tools_gcc@ is the rumprun platform compiler 15# @tools_objcopy@ is the rumprun platform objcopy 16# @rumprun_bake@ is the rumprun-bake tool 17set -e 18 19 20nuketmpdir () 21{ 22 23 nukeme="${TMPDIR}" 24 TMPDIR='' 25 rm -rf ${nukeme} 26} 27 28# Extract the last variable from the arguments 29for last in "$@"; do true; done 30 31@cl_tools_gcc@ "$@" 32@cl_tools_objcopy@ -w -G "bmk_*" -G "rumpuser_*" -G "jsmn_*" -G __assert_fail \ 33 -G rumprun_platform_rumpuser_init -G _start -G env -G _zf_log_write_d -G _zf_log_write \ 34 -G _zf_log_output_lvl -G "rumpns_*" @cl_extra_public_symbols@ $last 35 36TMPDIR=$(mktemp -d /tmp/camkesrump-XXXXXX) 37trap nuketmpdir 0 INT TERM 38 39mkdir -p $PWD/rumprun/$(basename "${last}")_ 40cp $last $TMPDIR/rumprun.o 41RUMPRUN_BASEDIR=$TMPDIR @cl_rumprun_bake@ @cl_rumprunbake_config@ $last @cl_rumprun_binary_file@ 42