Mercurial > hg > aboriginal
annotate sources/toys/native-build.sh @ 1265:918501f802d1
Update squashfs and kernel to current versions.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 21 Oct 2010 19:09:51 -0500 |
parents | 82a4e3d3a5ff |
children | 8e10d025f1a5 |
rev | line source |
---|---|
972 | 1 #!/bin/bash |
2 | |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
3 # Launch a system image in the emulator with a control image to drive an |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
4 # automated native build, plus an FTP server on the host to upload results to. |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
5 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
6 # If you already have an FTP server, export FTP_SERVER and/or FTP_PORT. |
972 | 7 |
8 # Parse arguments | |
9 | |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
10 if [ $# -ne 1 ] |
972 | 11 then |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
12 echo "usage: $0 CONTROL_IMAGE" >&2 |
972 | 13 exit 1 |
14 fi | |
15 | |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
16 if [ ! -f "$1" ] |
972 | 17 then |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
18 echo "Filesystem image $1 missing" >&2 |
972 | 19 exit 1 |
20 fi | |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
21 HDCFILE="$(readlink -f $1)" |
972 | 22 |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
23 TOP="$(pwd)" |
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
24 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
25 # If we're running from the build directory, add build/host and cross compiler |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
26 # to the path. |
1003
6d3db5bf731a
Make the native build timeout configurable.
Rob Landley <rob@landley.net>
parents:
972
diff
changeset
|
27 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
28 [ -d ../host ] && |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
29 PATH="$TOP/../host:$TOP/../cross-compiler-$1/bin:$TOP/../simple-cross-compiler-$1/bin:$PATH" |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
30 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
31 INCLUDE unique-port.sh |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
32 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
33 # Do we already have an FTP daemon? |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
34 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
35 if [ -z "$FTP_SERVER" ] |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
36 then |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
37 FTP_SERVER=127.0.0.1 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
38 elif [ -z "$FTP_PORT" ] |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
39 then |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
40 FTP_PORT=21 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
41 fi |
972 | 42 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
43 if [ -z "$FTP_PORT" ] |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
44 then |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
45 if [ -z "$(which busybox)" ] |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
46 then |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
47 echo "Warning: can't find busybox, no ftp daemon launched." >&2 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
48 else |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
49 FTP_PORT=$(unique_port) |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
50 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
51 echo === launching FTP daemon on port "$FTP_PORT" |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
52 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
53 # Fire off an ftp daemon, making sure it's killed when this script exits. |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
54 # (We use the busybox version because no two ftp daemons have quite the same |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
55 # command line arguments, and this one's a known quantity.) |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
56 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
57 mkdir -p upload |
1218
fd67d5a442c9
Switch from toybox netcat to busybox netcat.
Rob Landley <rob@landley.net>
parents:
1078
diff
changeset
|
58 # Busybox needs -s 127.0.0.1 support here |
fd67d5a442c9
Switch from toybox netcat to busybox netcat.
Rob Landley <rob@landley.net>
parents:
1078
diff
changeset
|
59 busybox nc -p $FTP_PORT -lle busybox ftpd -w upload & |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
60 trap "kill $(jobs -p)" EXIT |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
61 disown $(jobs -p) |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
62 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
63 # QEMU's alias for host loopback |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
64 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
65 FTP_SERVER=10.0.2.2 |
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
66 fi |
1043
d62c5c8734b2
Reduce native-build.sh reliance on run-from-build.sh.
Rob Landley <rob@landley.net>
parents:
1003
diff
changeset
|
67 fi |
972 | 68 |
69 # Run emulator as a child process, feeding in -hdc and some extra environment | |
70 # variables so it auto-launches the build process. | |
71 | |
1263
82a4e3d3a5ff
Teach native-build.sh to pass in the name of the build control image.
Rob Landley <rob@landley.net>
parents:
1218
diff
changeset
|
72 export HDC="$HDCFILE" |
82a4e3d3a5ff
Teach native-build.sh to pass in the name of the build control image.
Rob Landley <rob@landley.net>
parents:
1218
diff
changeset
|
73 NATIVE_BUILD="$(echo "$HDCFILE" | sed -e 's@.*/@@' -e 's@[.]hdc$@@')" |
82a4e3d3a5ff
Teach native-build.sh to pass in the name of the build control image.
Rob Landley <rob@landley.net>
parents:
1218
diff
changeset
|
74 export KERNEL_EXTRA="FTP_SERVER=$FTP_SERVER FTP_PORT=$FTP_PORT NATIVE_BUILD=$NATIVE_BUILD $KERNEL_EXTRA" |
82a4e3d3a5ff
Teach native-build.sh to pass in the name of the build control image.
Rob Landley <rob@landley.net>
parents:
1218
diff
changeset
|
75 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
76 rm -f hdb.img |
1263
82a4e3d3a5ff
Teach native-build.sh to pass in the name of the build control image.
Rob Landley <rob@landley.net>
parents:
1218
diff
changeset
|
77 ./dev-environment.sh |
972 | 78 |
1072
94b0b4ef1157
Add native-build.sh to system-image (it takes only one argument now, the build control system image file). Make system-image.sh script processing understand an INCLUDE syntax to insert unique-port, and trim the unique-port comment to something less distracting.
Rob Landley <rob@landley.net>
parents:
1055
diff
changeset
|
79 echo === End native build |