Skip to content

Commit 6edfaf5

Browse files
committed
go.sh: target updates
* Removed all target * Have cmake, crosstool, and tools targets exit after running * Added crosstool target - only builds if there isn't an install already of ct-ng - will create a tarball of crosstools if we build something Signed-off-by: Kumar Gala <[email protected]>
1 parent 4c69350 commit 6edfaf5

File tree

1 file changed

+42
-27
lines changed

1 file changed

+42
-27
lines changed

go.sh

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,13 @@
22

33
TARGETS=${@}
44

5-
65
if [ -z "$TARGETS" ]; then
76
echo "Please specify target"
87
exit 1
98
fi
10-
if [ "$TARGETS" == "all" ]; then
11-
TARGETS=$(ls -1 configs/ | sed 's/.config//')
12-
TARGETS=${TARGETS}" tools"
13-
fi
149

15-
COMMIT="4d5660e34e7c5f522e8b07ded82d7a6a15b787ef"
1610
GITDIR=${PWD}
11+
TARBALL_DIR=${GITDIR}
1712
JOBS=$(python -c 'import multiprocessing as mp; print(mp.cpu_count())')
1813

1914
unameOut="$(uname -s)"
@@ -28,6 +23,32 @@ esac
2823

2924
SDK_NG_HOME=${PWD}
3025

26+
CROSSTOOL_COMMIT="4d5660e34e7c5f522e8b07ded82d7a6a15b787ef"
27+
build_crosstool()
28+
{
29+
# only build if we don't already have a built binary
30+
31+
if [ ! -x "${SDK_NG_HOME}/bin/ct-ng" ]; then
32+
# Checkout crosstool-ng if we haven't already
33+
if [ ! -d "${SDK_NG_HOME}/crosstool-ng" ]; then
34+
pushd ${SDK_NG_HOME}
35+
git clone https://github.com/zephyrproject-rtos/crosstool-ng.git
36+
pushd crosstool-ng
37+
git checkout ${CROSSTOOL_COMMIT}
38+
popd
39+
popd
40+
fi
41+
42+
pushd ${SDK_NG_HOME}/crosstool-ng
43+
./bootstrap
44+
CFLAGS="-DKBUILD_NO_NLS" ./configure --prefix=${SDK_NG_HOME}
45+
make && make install
46+
popd
47+
48+
tar -jcvf ${TARBALL_DIR}/${t}.${os}.${machine}.tar.bz2 -C ${SDK_NG_HOME} bin libexec share
49+
fi
50+
}
51+
3152
if [ "$os" == "macos" ]; then
3253
if [ -x "/opt/homebrew/bin/brew" ]; then
3354
export HOMEBREW_ROOT="/opt/homebrew"
@@ -54,35 +75,26 @@ if [ "$os" == "macos" ]; then
5475
fi
5576
fi
5677

57-
cp -a ${GITDIR}/patches-arc64 ${SDK_NG_HOME} 2>/dev/null
58-
cd ${SDK_NG_HOME}
78+
CT_NG=${SDK_NG_HOME}/bin/ct-ng
5979

6080
for t in ${TARGETS}; do
6181
if [ "${t}" = "tools" ]; then
62-
./meta-zephyr-sdk/scripts/meta-zephyr-sdk-clone.sh;
63-
./meta-zephyr-sdk/scripts/meta-zephyr-sdk-build.sh tools;
64-
mv ./meta-zephyr-sdk/scripts/toolchains/zephyr-sdk-${machine}-hosttools-standalone-0.9.sh .
82+
${GITDIR}/meta-zephyr-sdk/scripts/meta-zephyr-sdk-clone.sh
83+
${GITDIR}/meta-zephyr-sdk/scripts/meta-zephyr-sdk-build.sh tools
84+
mv ${GITDIR}/meta-zephyr-sdk/scripts/toolchains/zephyr-sdk-${machine}-hosttools-standalone-0.9.sh ${TARBALL_DIR}
85+
exit $?
6586
elif [ "${t}" = "cmake" ]; then
66-
tar -jcvf ${t}.${os}.${machine}.tar.bz2 -C ${GITDIR} cmake
87+
tar -jcvf ${TARBALL_DIR}/${t}.${os}.${machine}.tar.bz2 -C ${GITDIR} cmake
88+
exit $?
89+
elif [ "${t}" = "crosstool" ]; then
90+
build_crosstool
91+
exit $?
6792
fi
6893
done
6994

70-
if [ ! -d "crosstool-ng" ]; then
71-
git clone https://github.com/zephyrproject-rtos/crosstool-ng.git
72-
pushd crosstool-ng
73-
git checkout ${COMMIT}
74-
popd
75-
fi
76-
77-
if [ ! -e "${SDK_NG_HOME}/bin/ct-ng" ]; then
78-
pushd crosstool-ng
79-
./bootstrap
80-
CFLAGS="-DKBUILD_NO_NLS" ./configure --prefix=${SDK_NG_HOME}
81-
make && make install
82-
popd
83-
fi
95+
# prep
96+
cp -a ${GITDIR}/patches-arc64 ${SDK_NG_HOME} 2>/dev/null
8497

85-
CT_NG=${SDK_NG_HOME}/bin/ct-ng
8698
OUTPUT_DIR=${SDK_NG_HOME}/build/output
8799

88100
mkdir -p ${OUTPUT_DIR}/sources
@@ -99,6 +111,9 @@ for t in ${TARGETS}; do
99111
echo "Target configuration does not exist"
100112
exit 1
101113
fi
114+
115+
build_crosstool
116+
102117
echo "Building ${t}"
103118
TARGET_BUILD_DIR=${SDK_NG_HOME}/build/build_${t}
104119
mkdir -p ${TARGET_BUILD_DIR}

0 commit comments

Comments
 (0)