Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/scripts/build_image

Issue 998002: Build image part of http://codereview.chromium.org/913004/show (Closed)
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to build a bootable keyfob-based chromeos system image from within 7 # Script to build a bootable keyfob-based chromeos system image from within
8 # a chromiumos setup. This assumes that all needed packages have been built into 8 # a chromiumos setup. This assumes that all needed packages have been built into
9 # the given target's root with binary packages turned on. This script will 9 # the given target's root with binary packages turned on. This script will
10 # build the Chrome OS image using only pre-built binary packages. 10 # build the Chrome OS image using only pre-built binary packages.
(...skipping 19 matching lines...) Expand all
30 DEFINE_boolean replace $FLAGS_FALSE \ 30 DEFINE_boolean replace $FLAGS_FALSE \
31 "Overwrite existing output, if any." 31 "Overwrite existing output, if any."
32 DEFINE_boolean withdev $FLAGS_TRUE \ 32 DEFINE_boolean withdev $FLAGS_TRUE \
33 "Include useful developer friendly utilities in the image." 33 "Include useful developer friendly utilities in the image."
34 DEFINE_boolean installmask $FLAGS_TRUE \ 34 DEFINE_boolean installmask $FLAGS_TRUE \
35 "Use INSTALL_MASK to shrink the resulting image." 35 "Use INSTALL_MASK to shrink the resulting image."
36 DEFINE_integer jobs -1 \ 36 DEFINE_integer jobs -1 \
37 "How many packages to build in parallel at maximum." 37 "How many packages to build in parallel at maximum."
38 DEFINE_boolean statefuldev $FLAGS_FALSE \ 38 DEFINE_boolean statefuldev $FLAGS_FALSE \
39 "Install development packages on stateful partition -- still experimental" 39 "Install development packages on stateful partition -- still experimental"
40 DEFINE_boolean withtest $FLAGS_TRUE \
41 "Include packages required for testing and prepare image for testing"
40 42
41 # Parse command line. 43 # Parse command line.
42 FLAGS "$@" || exit 1 44 FLAGS "$@" || exit 1
43 eval set -- "${FLAGS_ARGV}" 45 eval set -- "${FLAGS_ARGV}"
44 46
45 # Only now can we die on error. shflags functions leak non-zero error codes, 47 # Only now can we die on error. shflags functions leak non-zero error codes,
46 # so will die prematurely if 'set -e' is specified before now. 48 # so will die prematurely if 'set -e' is specified before now.
47 set -e 49 set -e
48 50
49 if [ -z "$FLAGS_board" ] ; then 51 if [ -z "$FLAGS_board" ] ; then
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 sudo mount -n --bind "$DEV_IMAGE_ROOT" "$ROOT_FS_DIR/usr/local" 266 sudo mount -n --bind "$DEV_IMAGE_ROOT" "$ROOT_FS_DIR/usr/local"
265 fi 267 fi
266 268
267 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the 269 # We "emerge --root=$ROOT_FS_DIR --root-deps=rdeps --usepkgonly" all of the
268 # runtime packages for chrome os. This builds up a chrome os image from binary 270 # runtime packages for chrome os. This builds up a chrome os image from binary
269 # packages with runtime dependencies only. We use INSTALL_MASK to trim the 271 # packages with runtime dependencies only. We use INSTALL_MASK to trim the
270 # image size as much as possible. 272 # image size as much as possible.
271 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 273 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
272 --root="$ROOT_FS_DIR" --root-deps=rdeps \ 274 --root="$ROOT_FS_DIR" --root-deps=rdeps \
273 --usepkgonly chromeos $EMERGE_JOBS 275 --usepkgonly chromeos $EMERGE_JOBS
276
277 # Determine the root dir for development packages.
278 ROOT_DEV_DIR="$ROOT_FS_DIR"
279 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local"
280
281 # Install development packages.
274 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then 282 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]] ; then
275 # Determine the root dir for development packages
276 ROOT_DIR="$ROOT_FS_DIR"
277 [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] && ROOT_DIR="$ROOT_FS_DIR/usr/local"
278
279 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \ 283 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
280 --root="$ROOT_DIR" --root-deps=rdeps \ 284 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
281 --usepkgonly chromeos-dev $EMERGE_JOBS 285 --usepkgonly chromeos-dev $EMERGE_JOBS
282
283 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then
284 # Fix symlinks so they work on live system.
285 for path in bin include lib libexec sbin share; do
286 sudo unlink $DEV_IMAGE_ROOT/usr/$path
287 sudo ln -s /usr/local/$path $DEV_IMAGE_ROOT/usr/$path
288 done
289
290 # Fix exceptions.
291 sudo unlink "$DEV_IMAGE_ROOT/usr/lib64"
292 sudo unlink "$DEV_IMAGE_ROOT/usr/local"
293
294 sudo ln -s "/usr/local/lib" "$DEV_IMAGE_ROOT/usr/lib64"
295 sudo ln -s "/usr/local" "$DEV_IMAGE_ROOT/usr/local"
296 fi
297 286
298 # The ldd tool is a useful shell script but lives in glibc; just copy it. 287 # The ldd tool is a useful shell script but lives in glibc; just copy it.
299 sudo cp -a "$(which ldd)" "${ROOT_FS_DIR}/usr/bin" 288 sudo cp -a "$(which ldd)" "${ROOT_DEV_DIR}/usr/bin"
289 fi
290
291 # Install packages required for testing.
292 if [[ $FLAGS_withtest -eq $FLAGS_TRUE ]] ; then
293 sudo INSTALL_MASK="$INSTALL_MASK" emerge-${BOARD} \
294 --root="$ROOT_DEV_DIR" --root-deps=rdeps \
295 --usepkgonly chromeos-test $EMERGE_JOBS
296 fi
297
298 # Clean up links setup for stateful install of extra packages.
299 if [ $FLAGS_statefuldev -eq $FLAGS_TRUE ] ; then
300 # Fix symlinks so they work on live system.
301 for path in bin include lib libexec sbin share; do
302 sudo unlink $DEV_IMAGE_ROOT/usr/$path
303 sudo ln -s /usr/local/$path $DEV_IMAGE_ROOT/usr/$path
304 done
305
306 # Fix exceptions.
307 sudo unlink "$DEV_IMAGE_ROOT/usr/lib64"
308 sudo unlink "$DEV_IMAGE_ROOT/usr/local"
309
310 sudo ln -s "/usr/local/lib" "$DEV_IMAGE_ROOT/usr/lib64"
311 sudo ln -s "/usr/local" "$DEV_IMAGE_ROOT/usr/local"
300 fi 312 fi
301 313
302 # Perform any customizations on the root file system that are needed. 314 # Perform any customizations on the root file system that are needed.
303 WITH_DEV="" 315 WITH_DEV=""
304 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]]; then 316 if [[ $FLAGS_withdev -eq $FLAGS_TRUE ]]; then
305 WITH_DEV="--withdev" 317 WITH_DEV="--withdev"
306 fi 318 fi
307 319
308 #TODO(sosa@chromium.org) - Does it make sense to leave /usr/local bound here? 320 #TODO(sosa@chromium.org) - Does it make sense to leave /usr/local bound here?
309 "${SCRIPTS_DIR}/customize_rootfs" \ 321 "${SCRIPTS_DIR}/customize_rootfs" \
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 385
374 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}" 386 OUTSIDE_OUTPUT_DIR="../build/images/${FLAGS_board}/${IMAGE_SUBDIR}"
375 echo "Done. Image created in ${OUTPUT_DIR}" 387 echo "Done. Image created in ${OUTPUT_DIR}"
376 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:" 388 echo "To copy to USB keyfob, OUTSIDE the chroot, do something like:"
377 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb" 389 echo " ./image_to_usb.sh --from=${OUTSIDE_OUTPUT_DIR} --to=/dev/sdb"
378 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:" 390 echo "To convert to VMWare image, OUTSIDE the chroot, do something like:"
379 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}" 391 echo " ./image_to_vmware.sh --from=${OUTSIDE_OUTPUT_DIR}"
380 echo "from the scripts directory where you entered the chroot." 392 echo "from the scripts directory where you entered the chroot."
381 393
382 trap - EXIT 394 trap - EXIT
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698