annotate sources/toys/dev-environment.sh @ 1445:dfef5afb664e

Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
author Rob Landley <rob@landley.net>
date Wed, 14 Sep 2011 13:09:22 -0500
parents 214b23b707b0
children 29109240fd6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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: 1000
diff changeset
1 #!/bin/bash
972
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents: 944
diff changeset
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: 1000
diff changeset
3 # Wrapper around run-environment.sh that sets up writeable space for /home
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: 1000
diff changeset
4 # and distcc acceleration (if the cross compiler and distcc are available).
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
5
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
6 # The following environment variables affect the behavior of this script:
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
7
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
8 # HDB - Image file to use for -hdb on /home (none if blank)
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
9 # HDBMEGS - Number of megabytes to create
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
10 # HDC - Image file to use for -hdc on /mnt (none of blank)
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
11 # QEMU_MEMORY - number of megabytes of memory for qemu (defaults to 128)
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
12
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
13 # Also, to use the distcc accelerator you need to have distccd and $ARCH-cc
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
14 # in the $PATH.
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
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: 1000
diff changeset
16 INCLUDE unique-port.sh
1343
214b23b707b0 Factor out make-hdb.sh from dev-environment.sh.
Rob Landley <rob@landley.net>
parents: 1194
diff changeset
17 INCLUDE make-hdb.sh
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: 1000
diff changeset
18
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: 1000
diff changeset
19 source ./run-emulator.sh --norun || exit 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: 1000
diff changeset
20
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
21 [ -z "$QEMU_MEMORY" ] && QEMU_MEMORY=256
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
22 QEMU_EXTRA="-m $QEMU_MEMORY $QEMU_EXTRA"
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
23
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
24 # Should we set up an ext3 image as a second virtual hard drive for /home?
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
25
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
26 if [ "$HDBMEGS" != "0" ]
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
27 then
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
28 [ -z "$HDB" ] && HDB=hdb.img
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
29 if [ ! -e "$HDB" ]
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
30 then
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
31
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
32 # If we don't already have an hdb image, should we set up a sparse file and
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
33 # format it ext3?
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
34
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
35 [ -z "$HDBMEGS" ] && HDBMEGS=2048
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
36
1343
214b23b707b0 Factor out make-hdb.sh from dev-environment.sh.
Rob Landley <rob@landley.net>
parents: 1194
diff changeset
37 make_hdb
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
38 fi
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
39 fi
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
40
972
cfa6262528f3 Genericize native build.
Rob Landley <rob@landley.net>
parents: 944
diff changeset
41 # Setup distcc
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
42
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
43 # If the cross compiler isn't in the $PATH, look for it in the current
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: 1000
diff changeset
44 # directory, the parent directory, and the user's home directory.
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
45
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
46 DISTCC_PATH="$(which $ARCH-cc 2>/dev/null | sed 's@\(.*\)/.*@\1@')"
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
47
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
48 if [ -z "$DISTCC_PATH" ]
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
49 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: 1000
diff changeset
50 for i in {"$(pwd)/","$(pwd)/../","$HOME"/}{,simple-}cross-compiler-"$ARCH"/bin
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 939
diff changeset
51 do
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: 1000
diff changeset
52 [ -f "$i/$ARCH-cc" ] && DISTCC_PATH="$i" && break
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 939
diff changeset
53 done
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
54 fi
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
55
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: 1000
diff changeset
56 [ -z "$(which distccd)" ] && [ -e ../host/distccd ] &&
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: 1000
diff changeset
57 PATH="$PATH:$(pwd)/../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: 1000
diff changeset
58
1445
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
59 [ -z "$CPUS" ] && CPUS=1
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
60 if [ -z "$(which distccd)" ]
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
61 then
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
62 echo 'No distccd in $PATH, acceleration disabled.'
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
63 elif [ -z "$DISTCC_PATH" ]
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
64 then
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
65 echo "No $ARCH-cc in "'$PATH'", acceleration disabled."
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
66 else
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
67
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
68 # Populate a directory full of symlinks to the cross compiler using the
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
69 # unprefixed names distccd will try to use.
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
70
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
71 mkdir -p "distcc_links" &&
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
72 for i in $(cd "$DISTCC_PATH"; ls $ARCH-* | sed "s/^$ARCH-//" )
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
73 do
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
74 ln -sf "$DISTCC_PATH/$ARCH-$i" "distcc_links/$i"
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
75 done
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
76 if [ -e "$DISTCC_PATH/$ARCH-rawgcc" ]
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
77 then
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
78 for i in cc gcc g++ c++
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
79 do
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
80 ln -sf "$DISTCC_PATH/$ARCH-rawgcc" distcc_links/$i
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
81 done
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
82 fi
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
83
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
84 # Run the distcc daemon on the host system with $PATH restricted to the
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
85 # cross compiler binaries.
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
86
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
87 # Note that we tell it --no-detach and background it ourselves so jobs -p can
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
88 # find it later to kill it after the emulator exits.
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
89
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
90 PORT=$(unique_port)
1445
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
91 if [ -z "$CPUS" ]
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
92 then
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
93 # Current parallelism limits include:
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
94 # - memory available to emulator (most targets max at 256 megs, which
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
95 # gives about 80 megs/instance).
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
96 # - speed of preprocessor (tcc -E would be faster than gcc -E)
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
97 # - speed of virtual network (switch to virtual gigabit cards).
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
98 #
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
99 # CPUS=$[$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)*2]
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
100 CPUS=3
dfef5afb664e Hardwire CPUS=3 in dev-environment.sh distcc support until scalability limits addressed.
Rob Landley <rob@landley.net>
parents: 1343
diff changeset
101 fi
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
102 PATH="$(pwd)/distcc_links" "$(which distccd)" --no-detach --daemon \
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
103 --listen 127.0.0.1 -a 127.0.0.1 -p $PORT --jobs $CPUS \
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
104 --log-stderr --verbose 2>distccd.log &
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
105
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
106 # Clean up afterwards: Kill child processes we started (I.E. distccd).
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
107 trap "kill $(jobs -p)" EXIT
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
108
835
f0b5901bca48 Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents: 790
diff changeset
109 # When background processes die, they should do so silently.
f0b5901bca48 Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents: 790
diff changeset
110 disown $(jobs -p)
f0b5901bca48 Cosmetic tweaks. (Make title bar changing callable from elsewhere, make run-emulator.sh kill distccd quietly.)
Rob Landley <rob@landley.net>
parents: 790
diff changeset
111
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
112 # Let the QEMU launch know we're using distcc.
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
113
790
188a182b1a7f Remove some leftover /tools residue.
Rob Landley <rob@landley.net>
parents: 751
diff changeset
114 DISTCC_PATH_PREFIX=/usr/distcc:
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
115 KERNEL_EXTRA="DISTCC_HOSTS=10.0.2.2:$PORT/$CPUS $KERNEL_EXTRA"
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
116 fi
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
117
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
118 KERNEL_EXTRA="CPUS=$CPUS $KERNEL_EXTRA"
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
119
751
d0157468f73d Prevent smoketest-all.sh from hanging if an individual smoketest.sh doesn't exit properly.
Rob Landley <rob@landley.net>
parents: 659
diff changeset
120 # Kill our child processes on exit.
d0157468f73d Prevent smoketest-all.sh from hanging if an individual smoketest.sh doesn't exit properly.
Rob Landley <rob@landley.net>
parents: 659
diff changeset
121
d0157468f73d Prevent smoketest-all.sh from hanging if an individual smoketest.sh doesn't exit properly.
Rob Landley <rob@landley.net>
parents: 659
diff changeset
122 trap "pkill -P$$" EXIT
d0157468f73d Prevent smoketest-all.sh from hanging if an individual smoketest.sh doesn't exit properly.
Rob Landley <rob@landley.net>
parents: 659
diff changeset
123
863
4bfe2b34dd9f Largeish refactoring/simplification of run-emulator.sh and associated code. Now automatically sets up the distcc trick if the appropriate $ARCH-cc toolchain is in the $PATH (or the current directory).
Rob Landley <rob@landley.net>
parents: 843
diff changeset
124 # The actual emulator invocation command gets appended here by system-image.sh
499
9d5fd8e1467b Merge run-*.sh so run-emulator.sh takes command line arguments. Rename emulator-build.sh to be more clear what it does.
Rob Landley <rob@landley.net>
parents:
diff changeset
125
1000
6a6a9e8de6ef Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents: 999
diff changeset
126 [ ! -z "$HDC" ] && QEMU_EXTRA="-hdc $HDC $QEMU_EXTRA"
6a6a9e8de6ef Finish previous commit: fix HDB and HDC and make run_emulator() a function. (And finally, if you say DEBUG=1 you get the emulator command output! Yay!)
Rob Landley <rob@landley.net>
parents: 999
diff changeset
127 [ ! -z "$HDB" ] && QEMU_EXTRA="-hdb $HDB $QEMU_EXTRA"
999
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
128
4bd1bc15a744 Move distcc setup to dev-environment.sh. Fix bug where CPUS wasn't defined if distcc wasn't being used (leading to make -j with no limit, and OOM conditions in the emulated system).
Rob Landley <rob@landley.net>
parents: 975
diff changeset
129 run_emulator