OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 BusyBoxDisable() { | 5 EXECUTABLES="busybox" |
6 # Switch one option in the busybox config from yes to no. | 6 |
7 sed -i.bak "s/$*=y/$*=n/" .config | 7 NACLPORTS_LDFLAGS+=" ${NACL_CLI_MAIN_LIB}" |
8 } | 8 NACLPORTS_CPPFLAGS+=" -Dmain=nacl_main" |
9 | 9 |
10 ConfigureStep() { | 10 ConfigureStep() { |
11 SetupCrossEnvironment | 11 cp "${START_DIR}/defconfig" . |
12 | |
13 LogExecute make -f ${SRC_DIR}/Makefile defconfig BUILD_LIBBUSYBOX=y \ | |
14 KBUILD_SRC=${SRC_DIR} | |
15 | |
16 BusyBoxDisable CONFIG_ACPID | |
17 BusyBoxDisable CONFIG_ARP | |
18 BusyBoxDisable CONFIG_ARPING | |
19 BusyBoxDisable CONFIG_BLOCKDEV | |
20 BusyBoxDisable CONFIG_BRCTL | |
21 BusyBoxDisable CONFIG_EJECT | |
22 BusyBoxDisable CONFIG_ETHER_WAKE | |
23 BusyBoxDisable CONFIG_FBSPLASH | |
24 BusyBoxDisable CONFIG_FDFLUSH | |
25 BusyBoxDisable CONFIG_FDISK | |
26 BusyBoxDisable CONFIG_FEATURE_IFUPDOWN_IP_BUILTIN | |
27 BusyBoxDisable CONFIG_FEATURE_INETD_RPC | |
28 BusyBoxDisable CONFIG_FEATURE_IP_LINK | |
29 BusyBoxDisable CONFIG_FEATURE_MOUNT_LOOP | |
30 BusyBoxDisable CONFIG_FEATURE_SUID | |
31 BusyBoxDisable CONFIG_FREE | |
32 BusyBoxDisable CONFIG_FREERAMDISK | |
33 BusyBoxDisable CONFIG_FSTRIM | |
34 BusyBoxDisable CONFIG_HDPARM | |
35 BusyBoxDisable CONFIG_IFCONFIG | |
36 BusyBoxDisable CONFIG_IFENSLAVE | |
37 BusyBoxDisable CONFIG_IFPLUGD | |
38 BusyBoxDisable CONFIG_IP | |
39 BusyBoxDisable CONFIG_LOSETUP | |
40 BusyBoxDisable CONFIG_MKFS_EXT2 | |
41 BusyBoxDisable CONFIG_MKFS_VFAT | |
42 BusyBoxDisable CONFIG_MOUNT | |
43 BusyBoxDisable CONFIG_NANDDUMP | |
44 BusyBoxDisable CONFIG_NANDWRITE | |
45 BusyBoxDisable CONFIG_NBDCLIENT | |
46 BusyBoxDisable CONFIG_RAIDAUTORUN | |
47 BusyBoxDisable CONFIG_ROUTE | |
48 BusyBoxDisable CONFIG_SLATTACH | |
49 BusyBoxDisable CONFIG_TUNCTL | |
50 BusyBoxDisable CONFIG_UBIATTACH | |
51 BusyBoxDisable CONFIG_UBIDETACH | |
52 BusyBoxDisable CONFIG_UBIMKVOL | |
53 BusyBoxDisable CONFIG_UBIRMVOL | |
54 BusyBoxDisable CONFIG_UBIRSVOL | |
55 BusyBoxDisable CONFIG_UBIUPDATEVOL | |
56 BusyBoxDisable CONFIG_UDHCPC | |
57 BusyBoxDisable CONFIG_UDHCPD | |
58 BusyBoxDisable CONFIG_UMOUNT | |
59 BusyBoxDisable CONFIG_UPTIME | |
60 BusyBoxDisable CONFIG_WATCHDOG | |
61 | 12 |
62 if [ "${TOOLCHAIN}" = "glibc" -a "${NACL_ARCH}" = "arm" ]; then | 13 if [ "${TOOLCHAIN}" = "glibc" -a "${NACL_ARCH}" = "arm" ]; then |
63 BusyBoxDisable CONFIG_INIT | 14 echo "CONFIG_INIT=n" >> defconfig |
64 BusyBoxDisable CONFIG_LINEEDIT | 15 echo "CONFIG_LINEEDIT=n" >> defconfig |
65 BusyBoxDisable CONFIG_FEATURE_UTMP | 16 echo "CONFIG_FEATURE_UTMP=n" >> defconfig |
66 BusyBoxDisable CONFIG_FEATURE_VI_USE_SIGNALS | 17 echo "CONFIG_FEATURE_VI_USE_SIGNALS=n" >> defconfig |
67 fi | 18 fi |
68 } | |
69 | 19 |
70 BuildStep() { | 20 echo "CONFIG_EXTRA_CFLAGS=\"${NACLPORTS_CPPFLAGS} ${NACLPORTS_CFLAGS}\"" \ |
71 export CROSS_COMPILE=${NACL_CROSS_PREFIX}- | 21 >> defconfig |
72 export CPPFLAGS="${NACLPORTS_CPPFLAGS}" | 22 echo "CONFIG_EXTRA_LDFLAGS=\"${NACLPORTS_LDFLAGS}\"" >> defconfig |
73 export EXTRA_CFLAGS="${NACLPORTS_CPPFLAGS} ${NACLPORTS_CFLAGS}" | 23 echo "CONFIG_EXTRA_LDLIBS=\"${NACLPORTS_LIBS}\"" >> defconfig |
74 export EXTRA_LDFLAGS="${NACLPORTS_LDFLAGS}" | 24 echo "CONFIG_CROSS_COMPILER_PREFIX=\"${NACL_CROSS_PREFIX}-\"" >> defconfig |
75 EXTRA_LDFLAGS+=" -lppapi_simple -lnacl_io -lppapi" | 25 |
76 DefaultBuildStep | 26 SetupCrossEnvironment |
| 27 LogExecute make -f ${SRC_DIR}/Makefile defconfig BUILD_LIBBUSYBOX=y \ |
| 28 KBUILD_SRC=${SRC_DIR} KBUILD_DEFCONFIG=defconfig |
77 } | 29 } |
78 | 30 |
79 InstallStep() { | 31 InstallStep() { |
80 MakeDir ${PUBLISH_DIR} | 32 MakeDir ${PUBLISH_DIR} |
81 local ASSEMBLY_DIR="${PUBLISH_DIR}/busybox" | 33 local ASSEMBLY_DIR="${PUBLISH_DIR}/busybox" |
82 MakeDir ${ASSEMBLY_DIR} | 34 MakeDir ${ASSEMBLY_DIR} |
83 | 35 |
84 cp busybox ${ASSEMBLY_DIR}/busybox_${NACL_ARCH}${NACL_EXEEXT} | 36 cp busybox ${ASSEMBLY_DIR}/busybox_${NACL_ARCH}${NACL_EXEEXT} |
85 | 37 |
86 ChangeDir ${ASSEMBLY_DIR} | 38 ChangeDir ${ASSEMBLY_DIR} |
87 LogExecute python ${NACL_SDK_ROOT}/tools/create_nmf.py \ | 39 LogExecute python ${NACL_SDK_ROOT}/tools/create_nmf.py \ |
88 ${ASSEMBLY_DIR}/busybox_*${NACL_EXEEXT} \ | 40 ${ASSEMBLY_DIR}/busybox_*${NACL_EXEEXT} \ |
89 -s . \ | 41 -s . \ |
90 -o busybox.nmf | 42 -o busybox.nmf |
91 LogExecute python ${TOOLS_DIR}/create_term.py busybox.nmf | 43 LogExecute python ${TOOLS_DIR}/create_term.py busybox.nmf |
92 | 44 |
93 InstallNaClTerm ${ASSEMBLY_DIR} | 45 InstallNaClTerm ${ASSEMBLY_DIR} |
94 LogExecute cp ${START_DIR}/manifest.json ${ASSEMBLY_DIR} | 46 LogExecute cp ${START_DIR}/manifest.json ${ASSEMBLY_DIR} |
95 LogExecute cp ${START_DIR}/icon_16.png ${ASSEMBLY_DIR} | 47 LogExecute cp ${START_DIR}/icon_16.png ${ASSEMBLY_DIR} |
96 LogExecute cp ${START_DIR}/icon_48.png ${ASSEMBLY_DIR} | 48 LogExecute cp ${START_DIR}/icon_48.png ${ASSEMBLY_DIR} |
97 LogExecute cp ${START_DIR}/icon_128.png ${ASSEMBLY_DIR} | 49 LogExecute cp ${START_DIR}/icon_128.png ${ASSEMBLY_DIR} |
98 ChangeDir ${PUBLISH_DIR} | 50 ChangeDir ${PUBLISH_DIR} |
99 CreateWebStoreZip busybox-${VERSION}.zip busybox | 51 CreateWebStoreZip busybox-${VERSION}.zip busybox |
100 } | 52 } |
| 53 |
| 54 TestStep() { |
| 55 if [[ ${TOOLCHAIN} = pnacl ]]; then |
| 56 return |
| 57 fi |
| 58 |
| 59 # Simple test of "cat" command to ensure basic functionality |
| 60 # TODO(sbc): run the full test suite |
| 61 echo "Running ./busybox.sh cat busybox.sh > test.out" |
| 62 $(./busybox.sh cat busybox.sh > test.out) |
| 63 LogExecute diff -u busybox.sh test.out |
| 64 } |
OLD | NEW |