Skip to content

Commit a2f728f

Browse files
committed
more sophisticated build script
1 parent 117e99a commit a2f728f

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

scripts/build_all_sapphires

+46-13
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,59 @@
11
#!/bin/bash
22

3+
BUILD_CONFIGS="${@}"
4+
5+
# guarantee some basic exported stuffs
36
if [ "${ARCH}" != "arm" ] ; then
4-
echo "you must export ARCH as 'arm'"
5-
exit 1
7+
export ARCH="arm"
8+
echo "ARCH has been set to \"${ARCH}\""
69
fi
7-
810
if [ "${HOST_PLATFORM}" != "zoom2" ] ; then
9-
echo "you must export HOST_PLATFORM as 'zoom2'"
10-
exit 1
11+
export HOST_PLATFORM="zoom2"
12+
echo "HOST_PLATFORM has been set to \"${HOST_PLATFORM}\""
1113
fi
12-
1314
if [ -z "${KERNEL_DIR}" ] ; then
14-
echo "you must export your KERNEL_DIR"
15-
exit 1
15+
export KERNEL_DIR="$(cd "$(dirname "${0}")/../"; pwd)"
16+
echo "KERNEL_DIR has been set to \"${KERNEL_DIR}\""
1617
fi
17-
1818
if [ -z "${CROSS_COMPILE}" ] ; then
19-
echo "you must export CROSS_COMPLIE as 'arm-eabi-'"
20-
exit 1
19+
export CROSS_COMPILE="arm-eabi-"
20+
echo "CROSS_COMPILE has been set to \"${CROSS_COMPILE}\""
2121
fi
2222

23+
# ensure some android build stuff has been defined
2324
if [ -z "${ANDROID_BUILD_TOP}" ] ; then
2425
echo "you must run build/envsetup.sh as well as lunch, to set some android envs"
2526
exit 1
27+
else
28+
echo "ANDROID_BUILD_TOP was found to be \"${ANDROID_BUILD_TOP}\""
29+
fi
30+
31+
REQUIRED_PROPS="etc/wifi/fw_wlan1271.bin \
32+
etc/wifi/tiwlan.ini"
33+
34+
# we now perform a few contingency checks (make sure some props are available that we need)
35+
for prop in ${REQUIRED_PROPS} ; do
36+
if [ ! -f "${ANDROID_BUILD_TOP}/device/motorola/sholes/proprietary/$(basename "${prop}")" ] ; then
37+
echo "Failed to locate a required proprietary file: ${prop}"
38+
exit 1
39+
fi
40+
done
41+
42+
olddir="$(pwd)"
43+
44+
if [ -z "${BUILD_CONFIGS}" ] ; then
45+
BUILD_CONFIGS=$(ls -1 "${KERNEL_DIR}"/arch/arm/configs/*sapphire*_defconfig | sed -r "s/^.*\/([^\/]+)$/\1/")
2646
fi
2747

28-
olddir=$(pwd)
48+
for i in ${BUILD_CONFIGS}; do
49+
# verify the config exists
50+
if [ ! -f "${KERNEL_DIR}/arch/arm/configs/${i}" ] ; then
51+
echo "The specified config [${i}] could not be found. Skipping..."
52+
continue
53+
fi
54+
55+
echo "Building ${i} ..."
2956

30-
for i in $(ls -1 arch/arm/configs/*sapphire*_defconfig | sed -r "s/^.*\/([^\/]+)$/\1/"); do
3157
# move to the kernel directory
3258
cd "${KERNEL_DIR}"
3359

@@ -76,6 +102,13 @@ for i in $(ls -1 arch/arm/configs/*sapphire*_defconfig | sed -r "s/^.*\/([^\/]+)
76102
for j in tmpdir/*.ko; do
77103
cp "${j}" tmpdir/anykernel/system/lib/modules/
78104
done
105+
106+
# copy any required props
107+
for prop in ${REQUIRED_PROPS} ; do
108+
mkdir -p "tmpdir/anykernel/system/$(dirname "${prop}")"
109+
cp "${ANDROID_BUILD_TOP}/device/motorola/sholes/proprietary/$(basename "${prop}")" "tmpdir/anykernel/system/${prop}"
110+
done
111+
79112
# zip the file
80113
cd tmpdir/anykernel
81114
zip -r "${KERNEL_DIR}/${i}.zip" .

0 commit comments

Comments
 (0)