annotate build.sh @ 1222:06a4b05971a7

Building util-linux on target needs the program invocation name stuff.
author Rob Landley <rob@landley.net>
date Mon, 23 Aug 2010 00:26:10 -0500
parents 19f3be2b4d04
children 8a88cae14011
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 93
diff changeset
1 #!/bin/bash
137ba51ee993 Delete output directories on re-run, teach build to log and build multiple
Rob Landley <rob@landley.net>
parents: 93
diff changeset
2
888
626288dd5cf3 Lots of comments.
Rob Landley <rob@landley.net>
parents: 873
diff changeset
3 # Run all the steps needed to build a system image from scratch.
626288dd5cf3 Lots of comments.
Rob Landley <rob@landley.net>
parents: 873
diff changeset
4
1212
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
5 # The default set of stages run by this script is (in order):
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
6 # download, host-tools, simple-cross-compiler, simple-root-filesystem,
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
7 # native-compiler, root-filesystem, system-image.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
8
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
9 # That sanitizes the host build environment and builds a cross compiler,
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
10 # cross compiles a root filesystem and a native toolchain for the target,
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
11 # and finally packages the root filesystem up into a system image bootable
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
12 # by qemu.
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
13
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
14 # The simplest set of stages is:
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
15 # download, simple-cross-compiler, simple-root-filesystem, system-image.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
16 #
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
17 # That skips sanitizing the host environment, and skips building the native
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
18 # compiler. It builds a system image containing just enough code to boot to
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
19 # a command prompt. To invoke that, do:
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
20 #
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
21 # NO_HOST_TOOLS=1 NO_NATIVE_COMPILER=1 ./build.sh $TARGET
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
22
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
23 # The optional cross-compiler stage (after simple-cross-compiler but before
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
24 # simple-root-filesystem) creates a more powerful and portable cross compiler
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
25 # that can be used to cross compile more stuff (if you're into that sort of
1212
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
26 # thing). To enable that:
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
27
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
28 # CROSS_HOST_ARCH=i686 ./build.sh $TARGET
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
29
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
30 # Where "i686" is whichever target you want the new cross compiler to run on.
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
31
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
32 # Start with some housekeeping stuff. If this script was run with no
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
33 # arguments, list available architectures out of sources/targets.
108
b66d638a3844 Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents: 105
diff changeset
34
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
35 if [ $# -ne 1 ]
114
304fd441e6a4 Re-teach build.sh to build more than one architecture in sequence.
Rob Landley <rob@landley.net>
parents: 108
diff changeset
36 then
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
37 echo "Usage: $0 TARGET"
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
38
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
39 echo "Supported architectures:"
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
40 cd sources/targets
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
41 ls
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
42
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
43 exit 1
114
304fd441e6a4 Re-teach build.sh to build more than one architecture in sequence.
Rob Landley <rob@landley.net>
parents: 108
diff changeset
44 fi
941
7dd3fb4dd333 Minor cleanups and comments, introduce check_prerequisite function.
Rob Landley <rob@landley.net>
parents: 915
diff changeset
45 ARCH="$1"
108
b66d638a3844 Build User Mode Linux and have that do the ext2 packaging (for now, anyway).
Rob Landley <rob@landley.net>
parents: 105
diff changeset
46
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
47 # Use environment variables persistently set in the config file.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
48
1028
5897a868313e Jean-Christophe Dubois pointed out that if build.sh doesn't source config, it doesn't get things like NO_NATIVE_COMPILER.
Rob Landley <rob@landley.net>
parents: 1007
diff changeset
49 [ -e config ] && source config
5897a868313e Jean-Christophe Dubois pointed out that if build.sh doesn't source config, it doesn't get things like NO_NATIVE_COMPILER.
Rob Landley <rob@landley.net>
parents: 1007
diff changeset
50
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
51 # Allow the output directory to be overridden. This hasn't been tested in
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
52 # forever and probably doesn't work.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
53
984
9840847885e8 Add export_if_blank and make lots of build paths overrideable.
Rob Landley <rob@landley.net>
parents: 944
diff changeset
54 [ -z "$BUILD" ] && BUILD="build"
9840847885e8 Add export_if_blank and make lots of build paths overrideable.
Rob Landley <rob@landley.net>
parents: 944
diff changeset
55
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
56 # Very simple dependency tracking: skip stages that have already been done
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
57 # (because the tarball they create is already there).
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
58
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
59 # If you need to rebuild a stage (and everything after it), delete its
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
60 # tarball out of "build" and re-run build.sh.
941
7dd3fb4dd333 Minor cleanups and comments, introduce check_prerequisite function.
Rob Landley <rob@landley.net>
parents: 915
diff changeset
61
786
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
62 not_already()
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
63 {
984
9840847885e8 Add export_if_blank and make lots of build paths overrideable.
Rob Landley <rob@landley.net>
parents: 944
diff changeset
64 if [ -f "$BUILD/$1-$ARCH.tar.bz2" ]
786
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
65 then
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
66 echo "=== Skipping $1-$ARCH (already there)"
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
67 return 1
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
68 fi
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
69
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
70 return 0
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
71 }
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
72
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
73 # The first two stages (download.sh and host-tools.sh) are architecture
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
74 # independent. In order to allow multiple builds in parallel, re-running
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
75 # them after they've already completed must be a safe NOP.
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
76
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
77 # Download source code.
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
78
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
79 time ./download.sh || exit 1
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
80
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
81 # Build host tools. This populates a single directory with every command the
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
82 # build needs, so we can ditch the host's $PATH afterwards.
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
83
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
84 if [ -z "$NO_HOST_TOOLS" ]
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
85 then
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
86 time ./host-tools.sh || exit 1
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
87 fi
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
88
941
7dd3fb4dd333 Minor cleanups and comments, introduce check_prerequisite function.
Rob Landley <rob@landley.net>
parents: 915
diff changeset
89 # Do we need to build the simple cross compiler?
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
90
944
fc134a13357e Largeish refactoring and cleanup of compiler build:
Rob Landley <rob@landley.net>
parents: 941
diff changeset
91 if not_already simple-cross-compiler
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
92 then
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
93 # If we need to build cross compiler, assume root filesystem is stale.
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
94
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
95 rm -rf "$BUILD/simple-root-filesystem-$ARCH.tar.bz2"
1007
48784ae8533e Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents: 998
diff changeset
96
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
97 time ./simple-cross-compiler.sh "$ARCH" || exit 1
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
98 fi
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
99
1007
48784ae8533e Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents: 998
diff changeset
100 # Optionally, we can build a more capable statically linked compiler via
48784ae8533e Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents: 998
diff changeset
101 # canadian cross. (It's more powerful than we need here, but if you're going
48784ae8533e Move CROSS_SMOKE_TEST implementation out of simple-cross-compiler.sh and into sources/more/cross-smoke-test.sh, called from build.sh. Clean up comments a bit while we're there.
Rob Landley <rob@landley.net>
parents: 998
diff changeset
102 # to use the cross compiler in other contexts this is probably what you want.)
784
037488e9889d New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
Rob Landley <rob@landley.net>
parents: 781
diff changeset
103
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
104 if [ ! -z "$CROSS_HOST_ARCH" ] && not_already cross-compiler
784
037488e9889d New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
Rob Landley <rob@landley.net>
parents: 781
diff changeset
105 then
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
106 rm -rf "$BUILD/simple-root-filesystem-$ARCH.tar.bz2"
784
037488e9889d New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
Rob Landley <rob@landley.net>
parents: 781
diff changeset
107
1212
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
108 # Build the host compiler if necessary
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
109
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
110 if ARCH="$CROSS_HOST_ARCH" not_already simple-cross-compiler
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
111 then
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
112 time ./simple-cross-compiler.sh "$CROSS_HOST_ARCH" || exit 1
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
113 fi
19f3be2b4d04 Teach build.sh to build host compiler if necessary for CROSS_HOST_ARCH.
Rob Landley <rob@landley.net>
parents: 1129
diff changeset
114
1129
3c8d91339f2a Fix typo.
Rob Landley <rob@landley.net>
parents: 1128
diff changeset
115 time ./cross-compiler.sh "$ARCH" || exit 1
784
037488e9889d New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
Rob Landley <rob@landley.net>
parents: 781
diff changeset
116 fi
037488e9889d New build.sh that actually uses the new infrastructure, if STATIC_CROSS_COMPILER_HOST or BUILD_STATIC_NATIVE_COMPILER are set.
Rob Landley <rob@landley.net>
parents: 781
diff changeset
117
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
118 # Build the basic root filesystem.
539
85979aa53fde Teach build.sh not to rerun build stages we already have the result of.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
119
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
120 if not_already simple-root-filesystem
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
121 then
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
122 # If we need to build root filesystem, assume root-filesystem and
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
123 # system-image are stale.
786
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
124
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
125 rm -rf "$BUILD/root-filesystem-$ARCH.tar.bz2"
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
126 rm -rf "$BUILD/system-image-$ARCH.tar.bz2"
539
85979aa53fde Teach build.sh not to rerun build stages we already have the result of.
Rob Landley <rob@landley.net>
parents: 503
diff changeset
127
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
128 time ./simple-root-filesystem.sh "$ARCH" || exit 1
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
129
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
130 fi
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
131
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
132 # Build a native compiler. It's statically linked by default so it can
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
133 # run on an arbitrary host system.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
134
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
135 if not_already native-compiler && [ -z "$NO_NATIVE_COMPILER" ]
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
136 then
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
137 rm -rf "$BUILD/root-filesystem-$ARCH.tar.bz2"
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
138
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
139 time ./native-compiler.sh "$ARCH" || exit 1
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
140 fi
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
141
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
142 # Install the native compiler into the root filesystem, if necessary.
1062
abc8ddd4d9f0 Don't have root-filesystem.sh suck in the native-compiler.sh output, have build.sh collate those instead before calling system-image.sh. (That way the root-filesystem.sh tarball does't include the native compiler output.)
Rob Landley <rob@landley.net>
parents: 1045
diff changeset
143
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
144 if not_already root-filesystem && [ -z "$NO_NATIVE_COMPILER" ]
1062
abc8ddd4d9f0 Don't have root-filesystem.sh suck in the native-compiler.sh output, have build.sh collate those instead before calling system-image.sh. (That way the root-filesystem.sh tarball does't include the native compiler output.)
Rob Landley <rob@landley.net>
parents: 1045
diff changeset
145 then
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
146 rm -rf "$BUILD/system-image-$ARCH.tar.bz2"
1062
abc8ddd4d9f0 Don't have root-filesystem.sh suck in the native-compiler.sh output, have build.sh collate those instead before calling system-image.sh. (That way the root-filesystem.sh tarball does't include the native compiler output.)
Rob Landley <rob@landley.net>
parents: 1045
diff changeset
147
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.
Rob Landley <rob@landley.net>
parents: 1090
diff changeset
148 time ./root-filesystem.sh "$ARCH" || exit 1
1062
abc8ddd4d9f0 Don't have root-filesystem.sh suck in the native-compiler.sh output, have build.sh collate those instead before calling system-image.sh. (That way the root-filesystem.sh tarball does't include the native compiler output.)
Rob Landley <rob@landley.net>
parents: 1045
diff changeset
149 fi
abc8ddd4d9f0 Don't have root-filesystem.sh suck in the native-compiler.sh output, have build.sh collate those instead before calling system-image.sh. (That way the root-filesystem.sh tarball does't include the native compiler output.)
Rob Landley <rob@landley.net>
parents: 1045
diff changeset
150
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
151 # Package it up into something qemu can boot.
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
152
786
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
153 if not_already system-image
781
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
154 then
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
155 time ./system-image.sh $1 || exit 1
d8c780ed3686 Simplify build.sh to take exactly one argument. (Otherwise use buildall.sh.)
Rob Landley <rob@landley.net>
parents: 744
diff changeset
156 fi
786
8b5ea56e7507 Teach build.sh not to rebuild static compilers if they're already there.
Rob Landley <rob@landley.net>
parents: 785
diff changeset
157
1068
31b5d683ecc9 Try again: extract native compiler into usr, not into /.
Rob Landley <rob@landley.net>
parents: 1064
diff changeset
158 # Optionally build a system image with a writeable root filesystem.
31b5d683ecc9 Try again: extract native compiler into usr, not into /.
Rob Landley <rob@landley.net>
parents: 1064
diff changeset
159
1045
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
160 if [ ! -z "$BUILD_RW_SYSTEM_IMAGE" ] && not_already rw-image
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
161 then
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
162 # Optimization: don't rebuild kernel if we don't need to.
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
163 mkdir -p "$BUILD/rw-system-image-$ARCH" &&
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
164 cp "$BUILD/system-image-$ARCH"/zImage-* "$BUILD/rw-system-image-$ARCH"
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
165
1128
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
166 STAGE_NAME=rw-system-image SYSIMAGE_TYPE=ext2 SYSIMAGE_HDA_MEGS=2048 \
e5f9681a8b3c Lots of comment updates. Add a NO_HOST_TOOLS=1 config option, and a few "time" calls to stages that didn't have them. Put native-compiler.sh after root-filesystem.sh in build so it's slightly easier to document.
Rob Landley <rob@landley.net>
parents: 1116
diff changeset
167 time ./system-image.sh $1 || exit 1
1045
a5b0f0a11792 Add BUILD_RW_SYSTEM_IMAGE=1 config option to build 2 gig writeable HDA (new stage named rw-system-image-$ARCH).
Rob Landley <rob@landley.net>
parents: 1028
diff changeset
168 fi