|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
| 3 | +BUILD_CONFIGS="${@}" |
| 4 | + |
| 5 | +# guarantee some basic exported stuffs |
3 | 6 | 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}\"" |
6 | 9 | fi
|
7 |
| - |
8 | 10 | 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}\"" |
11 | 13 | fi
|
12 |
| - |
13 | 14 | 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}\"" |
16 | 17 | fi
|
17 |
| - |
18 | 18 | 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}\"" |
21 | 21 | fi
|
22 | 22 |
|
| 23 | +# ensure some android build stuff has been defined |
23 | 24 | if [ -z "${ANDROID_BUILD_TOP}" ] ; then
|
24 | 25 | echo "you must run build/envsetup.sh as well as lunch, to set some android envs"
|
25 | 26 | 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/") |
26 | 46 | fi
|
27 | 47 |
|
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} ..." |
29 | 56 |
|
30 |
| -for i in $(ls -1 arch/arm/configs/*sapphire*_defconfig | sed -r "s/^.*\/([^\/]+)$/\1/"); do |
31 | 57 | # move to the kernel directory
|
32 | 58 | cd "${KERNEL_DIR}"
|
33 | 59 |
|
@@ -76,6 +102,13 @@ for i in $(ls -1 arch/arm/configs/*sapphire*_defconfig | sed -r "s/^.*\/([^\/]+)
|
76 | 102 | for j in tmpdir/*.ko; do
|
77 | 103 | cp "${j}" tmpdir/anykernel/system/lib/modules/
|
78 | 104 | 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 | + |
79 | 112 | # zip the file
|
80 | 113 | cd tmpdir/anykernel
|
81 | 114 | zip -r "${KERNEL_DIR}/${i}.zip" .
|
|
0 commit comments