-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild_busybox.sh
executable file
·46 lines (33 loc) · 992 Bytes
/
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
#!/bin/sh
set -ex
if [ ! -f busybox.tar.bz2 ]; then
wget -q -O busybox.tar.bz2 http://busybox.net/downloads/busybox-$BUSYBOX_VERSION.tar.bz2
fi
if [ -d busybox-$BUSYBOX_VERSION ]; then
rm -rf busybox-$BUSYBOX_VERSION
fi
tar -xjf busybox.tar.bz2
cd busybox-$BUSYBOX_VERSION
make -j5 distclean
make -j5 defconfig
export SYSROOT=`realpath ../glibc_install/`
sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config
sed -i "s|.*CONFIG_SYSROOT.*|CONFIG_SYSROOT=\"$SYSROOT\"|" .config
make -j5 busybox install
cd _install
rm -f linuxrc
cp -Rv ../../rootfs/* .
find . -iname ".gitkeep" -exec rm {} \;
mkdir -p lib
cp ../../glibc_install/lib/libnss* lib/
cp ../../glibc_install/lib/libresolv* lib/
cp ../../glibc_install/lib/libc.* lib/
cp ../../glibc_install/lib/libc-* lib/
cp ../../glibc_install/lib/libthread* lib/
cp ../../glibc_install/lib/ld* lib/
set +e
strip -g lib/*
set -e
find . | cpio -R root:root -H newc -o | xz -9 --check=none > ../../isoimage/rootfs.xz
cd ../../
set +ex