Mercurial > hg > aboriginal
annotate build-static-toolchains.sh @ 680:924527b0b454
Fix ppc bios, this is the one from qemu svn 6657.
author | Rob Landley <rob@landley.net> |
---|---|
date | Mon, 30 Mar 2009 04:50:02 -0500 |
parents | ada655f5be21 |
children | 5f9f5ab5d2e5 |
rev | line source |
---|---|
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # This script builds static toolchains linked against uClibc. |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # It boots a system image under qemu, copies the build into it, runs |
639
a93ace5fbfc1
Several small fixes, hopefully works now.
Rob Landley <rob@landley.net>
parents:
627
diff
changeset
|
5 # cross-compiler.sh for each target, and copies out the results. |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 # The first argument is the host to build for. (Which system-image to run |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 # the build under.) |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 # Additional arguments are the targets to build for that host. If no |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 # targets are specified, the script builds all of them. |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 if [ $# -eq 0 ] |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 then |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
15 echo -e "Usage: build-static-toolchains.sh HOST_ARCH [TARGET_ARCH...]\n" >&2 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
16 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
17 # Fall through to show supported architectures. |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 fi |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 source sources/include.sh || exit 1 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
22 # Grab host to build for. (This is the system image we'll run under qemu.) |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 STATIC_HOST="$1" |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 shift |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
26 [ -z "$*" ] && STATIC_TARGETS="$(echo $(cd sources/targets; ls))" || STATIC_TARGETS="$@" |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 # Step 1, make sure the appropriate host files exist. |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 ./download.sh --extract || dienow |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 if [ ! -f build/system-image-$STATIC_HOST.tar.bz2 ] |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
32 then |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 ./build.sh $STATIC_HOST || dienow |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 fi |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 # Kill all the netcat instances if we exit prematurely |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 trap "kill 0" EXIT |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
40 function build_for_static_host() |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
41 { |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
42 # Feed a script into qemu. Pass data back and forth via netcat. |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
43 # This intentionally _doesn't_ use $NICE, so the distcc master node is higher |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
44 # priority than the distccd slave nodes. |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
45 |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
46 KERNEL_EXTRA="ro" ./run-from-build.sh "$STATIC_HOST" << EOF |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
47 # |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
48 export USE_UNSTABLE=$USE_UNSTABLE |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
49 export CROSS_BUILD_STATIC=1 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
50 rm -rf /home/firmware |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
51 mkdir -p /home/firmware && |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
52 cd /home/firmware && |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
53 netcat 10.0.2.2 $(build/host/netcat -s 127.0.0.1 -l tar c *.sh sources build/sources) | tar xv 2>&1 | pipe_progress > /dev/null && |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
54 mkdir -p build/logs || exit 1 |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
55 for i in $STATIC_TARGETS |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
56 do |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
57 ./cross-compiler.sh \$i |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
58 done |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
59 tar cC build cross-compiler-*.tar.bz2 | netcat 10.0.2.2 \ |
639
a93ace5fbfc1
Several small fixes, hopefully works now.
Rob Landley <rob@landley.net>
parents:
627
diff
changeset
|
60 $(mkdir -p build/static; cd build/static; ../host/netcat -s 127.0.0.1 -l tar xv) |
627
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
61 exit |
e6c9da01349a
Take a stab at a cron job script.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
62 EOF |
677
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
63 } |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
64 |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
65 # If FORK, fork one qemu instance for each target |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
66 |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
67 if [ ! -z "$FORK" ] |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
68 then |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
69 for i in $STATIC_TARGETS |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
70 do |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
71 rm -f "${BUILD}/system-image-${STATIC_HOST}/hdb-${i}.img" 2>/dev/null |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
72 (HDB="hdb-$i.img" STATIC_TARGETS="$i" build_for_static_host | tee out-static-$i.txt | grep ===) & |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
73 rm -f "${BUILD}/system-image-${STATIC_HOST}/hdb-${i}.img" 2>/dev/null |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
74 done |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
75 |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
76 wait4background 0 |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
77 else |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
78 build_for_static_host |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
79 fi |
ada655f5be21
Teach build-static-toolchains to FORK multiple qemu instances, conceptually similar to how buildall.sh handles FORK.
Rob Landley <rob@landley.net>
parents:
666
diff
changeset
|
80 |