annotate sources/more/native-build.sh @ 972:cfa6262528f3

Genericize native build. Break out dropbear and strace packages from download.sh (and clean up what remains, mirror list is now in include.sh). New script setup-native.build.sh downloads, extracts, and creates a system image with "here document" build script to build dropbear and strace. New native-build.sh script works on arbitrary hdc image, providing FTP upload to a directory. The setup/fork logic to build all architectures is now in buildall.sh for this, just like everything else. Update buildall.sh to take optional list of architectures to build on command line. Factor out unique-port.sh (in embeddable manner) so distcc (in run-emulator.sh) and ftp server (in native-build.sh) can both use it. Upgrade to new busybox version while we're there. HGi removed sources/more/setup-native-static-build.sh
author Rob Landley <rob@landley.net>
date Fri, 05 Feb 2010 10:33:06 -0600
parents
children 6d3db5bf731a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
972
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
1 #!/bin/bash
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
2
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
3 # setup hdc.sqf
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
4 # find build -name "hdb.img" | xargs rm
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
5
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
6 # Launch a system image under the emulator under the control of a filesystem
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
7 # image, with an FTP server to upload results to.
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
8
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
9 . sources/functions.sh || exit 1
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
10
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
11 # Parse arguments
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
12
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
13 if [ $# -ne 3 ]
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
14 then
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
15 echo "usage: $0 ARCH HDCFILE OUTPUTDIR" >&2
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
16 exit 1
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
17 fi
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
18
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
19 ARCH="$1"
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
20 if [ ! -f "$2" ]
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
21 then
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
22 echo "Filesystem image $2 missing" >&2
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
23 exit 1
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
24 fi
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
25 HDCFILE="$(readlink -f $2)"
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
26 mkdir -p "$3" || dienow
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
27 STAGE_DIR="$(readlink -f $3)"
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
28
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
29 # Fire off the ftp daemon, making sure it's killed when this script exits
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
30
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
31 . sources/toys/unique-port.sh || exit 1
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
32 PORT=$(unique_port)
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
33 build/host/netcat -s 127.0.0.1 -p $PORT -L build/host/ftpd -w "$STAGE_DIR" &
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
34 trap "kill $(jobs -p)" EXIT
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
35 disown $(jobs -p)
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
36
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
37 # Run emulator as a child process, feeding in -hdc and some extra environment
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 # variables so it auto-launches the build process.
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
39
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
40 echo === Begin native build for $ARCH
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
41
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
42 rm -f sources/system-image-"$ARCH"/hdb.img
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
43 HDC="$HDCFILE" KERNEL_EXTRA="OUTPORT=$PORT ARCH=$ARCH" \
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
44 sources/timeout.sh 60 ./run-from-build.sh "$ARCH"
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
45
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents:
diff changeset
46 echo === End native build for $ARCH