comparison simple-root-filesystem.sh @ 1116:2b68517f5b62

Break out simple-root-filesystem.sh and root-filesystem.sh (adding native-compiler.sh output), and use NO_NATIVE_COMPILER to determine which to use. Rename STATIC_CC_HOST to CROSS_HOST_ARCH.
author Rob Landley <rob@landley.net>
date Wed, 16 Jun 2010 08:11:51 -0500
parents root-filesystem.sh@a0bc889b4269
children e5f9681a8b3c
comparison
equal deleted inserted replaced
1115:81bae2e7bc66 1116:2b68517f5b62
1 #!/bin/bash
2
3 # Build a basic busybox+uClibc root filesystem for a given target.
4
5 source sources/include.sh || exit 1
6 read_arch_dir "$1"
7 check_for_base_arch || exit 0
8 check_prerequisite "${ARCH}-cc"
9
10 # Announce start of stage.
11
12 echo "=== Building $STAGE_NAME"
13
14 # Determine which directory layout we're using
15
16 if [ -z "$ROOT_NODIRS" ]
17 then
18 mkdir -p "$STAGE_DIR"/{tmp,proc,sys,dev,home,mnt} &&
19 chmod a+rwxt "$STAGE_DIR/tmp" || dienow
20 for i in bin sbin lib etc
21 do
22 mkdir -p "$STAGE_DIR/usr/$i" &&
23 ln -s "usr/$i" "$STAGE_DIR/$i" || dienow
24 done
25 ln -s share/man "$STAGE_DIR/usr/man" || dienow
26
27 STAGE_DIR="$STAGE_DIR/usr"
28 else
29 mkdir -p "$STAGE_DIR/bin" || dienow
30 fi
31
32 # Copy qemu setup script and so on.
33
34 cp -r "${SOURCES}/native-root/." "$STAGE_DIR/" &&
35 cp "$SRCDIR"/MANIFEST "$STAGE_DIR/src" || dienow
36
37 # Build busybox and toybox
38
39 build_section busybox
40 cp "$WORK"/config-busybox "$STAGE_DIR"/src || dienow
41 build_section toybox
42
43 # Put statically and dynamically linked hello world programs on there for
44 # test purposes.
45
46 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -o "$STAGE_DIR/bin/hello-dynamic" || dienow
47
48 if [ "$BUILD_STATIC" != none ]
49 then
50 "${ARCH}-cc" "${SOURCES}/toys/hello.c" -Os $CFLAGS -static -o "$STAGE_DIR/bin/hello-static" || dienow
51 fi
52
53 # Do we need shared libraries?
54
55 if [ "$BUILD_STATIC" != all ]
56 then
57 echo Copying compiler libraries...
58 mkdir -p "$STAGE_DIR/lib" || dienow
59 (path_search \
60 "$("$ARCH-cc" --print-search-dirs | sed -n 's/^libraries: =*//p')" \
61 "*.so*" 'cp -H "$DIR/$FILE" "$STAGE_DIR/lib/$FILE"' \
62 || dienow) | dotprogress
63 fi
64
65 # Clean up and package the result
66
67 if [ -z "$SKIP_STRIP" ]
68 then
69 "${ARCH}-strip" "$STAGE_DIR"/{bin/*,sbin/*,libexec/gcc/*/*/*}
70 "${ARCH}-strip" --strip-unneeded "$STAGE_DIR"/lib/*.so
71 fi
72
73 create_stage_tarball
74
75 # Color back to normal
76 echo -e "\e[0mBuild complete"