comparison mini-native.sh @ 395:c2b290c1df40

Upgrade BUILD_SHORT to make a small busybox+uClibc system in /usr, with top level symlinks (/bin, /lib, etc) and adjustments to boot script and run-emulator.
author Rob Landley <rob@landley.net>
date Mon, 15 Sep 2008 18:24:27 -0500
parents a9a9eee9e620
children f60b1189c0ea
comparison
equal deleted inserted replaced
394:f6802733e627 395:c2b290c1df40
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Get lots of predefined environment variables and shell functions. 3 # Get lots of predefined environment variables and shell functions.
4 4
5 source include.sh 5 source include.sh
6
7 # Purple. And why not?
8 echo -e "\e[35m"
6 9
7 rm -rf "${NATIVE}" 10 rm -rf "${NATIVE}"
8 11
9 if [ -z "${BUILD_SHORT}" ] 12 if [ -z "${BUILD_SHORT}" ]
10 then 13 then
12 15
13 # Tell the wrapper script where to find the dynamic linker. 16 # Tell the wrapper script where to find the dynamic linker.
14 export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0 17 export UCLIBC_DYNAMIC_LINKER=/tools/lib/ld-uClibc.so.0
15 export UCLIBC_RPATH=/tools/lib 18 export UCLIBC_RPATH=/tools/lib
16 else 19 else
17 TOOLS="${NATIVE}" 20 TOOLS="${NATIVE}/usr" &&
21 mkdir -p "$TOOLS" &&
22 mkdir "${NATIVE}"/{tmp,proc,sys,dev,etc} &&
23 ln -s usr/bin "${NATIVE}/bin" &&
24 ln -s usr/sbin "${NATIVE}/sbin" &&
25 ln -s usr/lib "${NATIVE}/lib" || dienow
18 fi 26 fi
27
19 mkdir -p "${TOOLS}/bin" || dienow 28 mkdir -p "${TOOLS}/bin" || dienow
20
21 # Purple. And why not?
22 echo -e "\e[35m"
23 29
24 # Build and install Linux kernel. 30 # Build and install Linux kernel.
25 31
26 setupfor linux 32 setupfor linux
27 # Install Linux kernel headers (for use by uClibc). 33 # Install Linux kernel headers (for use by uClibc).
84 done 90 done
85 cd .. 91 cd ..
86 92
87 cleanup busybox 93 cleanup busybox
88 94
95 # Copy qemu setup script and so on.
96
97 cp -r "${SOURCES}/native/." "${TOOLS}/" || dienow
98
89 if [ ! -z "${BUILD_SHORT}" ] 99 if [ ! -z "${BUILD_SHORT}" ]
90 then 100 then
101
102 sed -i -e 's@/tools/@/usr/@g' -e 's@/bin/bash@/bin/ash@' \
103 "${TOOLS}/bin/qemu-setup.sh" || dienow
104
91 # If you want to use tinycc, you need to keep the headers but don't need gcc. 105 # If you want to use tinycc, you need to keep the headers but don't need gcc.
92 [ "$BUILD_SHORT" != "headers" ] && rm -rf "${TOOLS}"/include 106 if [ "$BUILD_SHORT" != "headers" ]
107 then
108 rm -rf "${TOOLS}"/include &&
109 rm -rf "${TOOLS}/src" || dienow
110 fi
93 else 111 else
94 112
95 # Build and install native binutils 113 # Build and install native binutils
96 114
97 setupfor binutils build-binutils 115 setupfor binutils build-binutils
199 217
200 [ $? -ne 0 ] && dienow 218 [ $? -ne 0 ] && dienow
201 219
202 fi 220 fi
203 221
204 # Copy qemu setup script and so on.
205
206 cp -r "${SOURCES}/native/." "${TOOLS}/" || dienow
207
208 # Clean up and package the result 222 # Clean up and package the result
209 223
210 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*} 224 "${ARCH}-strip" "${TOOLS}"/{bin/*,sbin/*,libexec/gcc/*/*/*}
211 225
212 cd "${BUILD}" 226 cd "${BUILD}"