-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path07_build_busybox.sh
executable file
·58 lines (43 loc) · 1.84 KB
/
07_build_busybox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
set -e
# Load common properties and functions in the current script.
. ./common.sh
echo "*** BUILD BUSYBOX BEGIN ***"
# Remove the old Busybox install area.
echo "Removing old Busybox artifacts. This may take a while."
rm -rf $BUSYBOX_INSTALLED
# Change to the source directory ls finds, e.g. 'busybox-1.24.2'.
cd `ls -d $WORK_DIR/busybox/busybox-*`
# Remove previously generated artifacts.
echo "Preparing Busybox work area. This may take a while."
make distclean -j $NUM_JOBS
# Read the 'USE_PREDEFINED_BUSYBOX_CONFIG' property from '.config'
USE_PREDEFINED_BUSYBOX_CONFIG=`read_property USE_PREDEFINED_BUSYBOX_CONFIG`
if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" -a ! -f $SRC_DIR/ignite_config/busybox.config ] ; then
echo "Config file $SRC_DIR/ignite_config/busybox.config does not exist."
USE_PREDEFINED_BUSYBOX_CONFIG="false"
fi
if [ "$USE_PREDEFINED_BUSYBOX_CONFIG" = "true" ] ; then
# Use predefined configuration file for Busybox.
echo "Using config file $SRC_DIR/ignite_config/busybox.config"
cp -f $SRC_DIR/ignite_config/busybox.config .config
else
# Create default configuration file.
echo "Generating default Busybox configuration."
make defconfig -j $NUM_JOBS
fi
# Now we tell Busybox to use the sysroot area.
sed -i "s|.*CONFIG_SYSROOT.*|CONFIG_SYSROOT=\"$SYSROOT\"|" .config
# Configure the compiler flags and explicitly link Busybox with GLIBC from sysroot.
sed -i "s|.*CONFIG_EXTRA_CFLAGS.*|CONFIG_EXTRA_CFLAGS=\"$CFLAGS -L$SYSROOT/lib\"|" .config
# Compile busybox with optimization for "parallel jobs" = "number of processors".
echo "Building Busybox."
make \
busybox -j $NUM_JOBS
# Create the symlinks for busybox. The file 'busybox.links' is used for this.
echo "Generating Busybox based initramfs area."
make \
CONFIG_PREFIX="$BUSYBOX_INSTALLED" \
install -j $NUM_JOBS
cd $SRC_DIR
echo "*** BUILD BUSYBOX END ***"