Mercurial > hg > aboriginal
comparison build.sh @ 1817:92d542aa6ceb draft
Teach system-image.sh to handle its own dependencies, rebuilding kernel and
repackaging cpio/squashfs as appropraite, and _not_ doing so when unneeded.
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 22 Nov 2015 14:54:16 -0600 |
parents | fb05f99ffcce |
children |
comparison
equal
deleted
inserted
replaced
1816:fb05f99ffcce | 1817:92d542aa6ceb |
---|---|
79 do | 79 do |
80 rm -f "$BUILD/$i-$ARCH.tar.gz" | 80 rm -f "$BUILD/$i-$ARCH.tar.gz" |
81 done | 81 done |
82 } | 82 } |
83 | 83 |
84 # If $AFTER set, skip stages until we match $AFTER to implement $2="start here" | |
84 do_stage() | 85 do_stage() |
85 { | 86 { |
86 STAGE="$1" | 87 STAGE="$1" |
87 shift | 88 shift |
88 | 89 |
93 time ./"$STAGE".sh "$@" || exit 1 | 94 time ./"$STAGE".sh "$@" || exit 1 |
94 fi | 95 fi |
95 } | 96 } |
96 | 97 |
97 # The first two stages (download.sh and host-tools.sh) are architecture | 98 # The first two stages (download.sh and host-tools.sh) are architecture |
98 # independent. In order to allow multiple builds in parallel, re-running | 99 # independent. In order to allow multiple builds in parallel, re-running |
99 # them after they've already completed must be a safe NOP. | 100 # them after they've already completed must be a safe NOP. |
100 | 101 |
101 # Download source code. | 102 # Download source code. If tarballs already there, verify sha1sums and |
103 # delete/redownload if they don't match (to handle interrupted partial | |
104 # download). | |
102 | 105 |
103 do_stage download | 106 do_stage download |
104 | 107 |
105 # Build host tools. This populates a single directory with every command the | 108 # Build host tools. This populates a single directory with every command the |
106 # build needs, so we can ditch the host's $PATH afterwards. | 109 # build needs, so we can ditch the host's $PATH afterwards. |
114 | 117 |
115 if [ -z "$MY_CROSS_PATH" ] && not_already simple-cross-compiler | 118 if [ -z "$MY_CROSS_PATH" ] && not_already simple-cross-compiler |
116 then | 119 then |
117 # If we need to build cross compiler, assume root filesystem is stale. | 120 # If we need to build cross compiler, assume root filesystem is stale. |
118 | 121 |
119 zap root-filesystem cross-compiler native-compiler system-image | 122 zap root-filesystem cross-compiler native-compiler |
120 | 123 |
121 do_stage simple-cross-compiler "$ARCH" | 124 do_stage simple-cross-compiler "$ARCH" |
122 fi | 125 fi |
123 | 126 |
124 # Optionally, we can build a more capable statically linked compiler via | 127 # Optionally, we can build a more capable statically linked compiler via |
126 # to use the cross compiler in other contexts this is probably what you want.) | 129 # to use the cross compiler in other contexts this is probably what you want.) |
127 | 130 |
128 if [ -z "$MY_CROSS_PATH" ] && [ ! -z "$CROSS_COMPILER_HOST" ] && | 131 if [ -z "$MY_CROSS_PATH" ] && [ ! -z "$CROSS_COMPILER_HOST" ] && |
129 not_already cross-compiler | 132 not_already cross-compiler |
130 then | 133 then |
131 zap root-filesystem native-compiler system-image | 134 zap root-filesystem native-compiler |
132 | 135 |
133 # Build the host compiler if necessary | 136 # Build the host compiler if necessary |
134 | 137 |
135 if ARCH="$CROSS_COMPILER_HOST" not_already simple-cross-compiler | 138 if ARCH="$CROSS_COMPILER_HOST" not_already simple-cross-compiler |
136 then | 139 then |
147 | 150 |
148 # Build the basic root filesystem. | 151 # Build the basic root filesystem. |
149 | 152 |
150 if not_already root-filesystem | 153 if not_already root-filesystem |
151 then | 154 then |
152 zap system-image | |
153 [ "$SYSIMAGE_TYPE" == rootfs ] && zap system-image | |
154 | |
155 do_stage root-filesystem "$ARCH" | 155 do_stage root-filesystem "$ARCH" |
156 fi | 156 fi |
157 | 157 |
158 # Build a native compiler. It's statically linked by default so it can | 158 # Build a native compiler. It's statically linked by default so it can |
159 # run on an arbitrary host system. | 159 # run on an arbitrary host system. |
161 # Not trying to build nommu native compilers for the moment. | 161 # Not trying to build nommu native compilers for the moment. |
162 | 162 |
163 if [ -z "$MY_CROSS_PATH" ] && ! grep -q ELF2FLT sources/targets/"$ARCH" && | 163 if [ -z "$MY_CROSS_PATH" ] && ! grep -q ELF2FLT sources/targets/"$ARCH" && |
164 not_already native-compiler | 164 not_already native-compiler |
165 then | 165 then |
166 zap system-image | |
167 | |
168 do_stage native-compiler "$ARCH" | 166 do_stage native-compiler "$ARCH" |
169 fi | 167 fi |
170 | 168 |
171 # Package it all up into something qemu can boot. | 169 # Package it all up into something qemu can boot. Like host-tools.sh, |
170 # this is always called and handles its own dependencies internally. | |
172 | 171 |
173 if not_already system-image | 172 do_stage system-image "$ARCH" |
174 then | |
175 do_stage system-image "$ARCH" | |
176 fi |