Chromium Code Reviews| Index: image_to_usb.sh |
| diff --git a/image_to_usb.sh b/image_to_usb.sh |
| index 19eefb1f63f6cb1ee95972984b0d17b18995aa63..fd800b4f4c0a43cc36fc238302c286952b3dc9e1 100755 |
| --- a/image_to_usb.sh |
| +++ b/image_to_usb.sh |
| @@ -1,6 +1,6 @@ |
| #!/bin/bash |
| -# Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
| +# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
|
sosa
2010/11/30 22:01:43
2009-2010
|
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| @@ -18,7 +18,7 @@ get_default_board |
| # Flags |
| DEFINE_string board "${DEFAULT_BOARD}" "Board for which the image was built" |
| DEFINE_string from "" \ |
| - "Directory containing chromiumos_image.bin" |
| + "Directory containing ${CHROMEOS_IMAGE_NAME}" |
| DEFINE_string to "/dev/sdX" "${DEFAULT_TO_HELP}" |
| DEFINE_boolean yes ${FLAGS_FALSE} "Answer yes to all prompts" "y" |
| DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image" |
| @@ -31,8 +31,8 @@ DEFINE_boolean factory ${FLAGS_FALSE} \ |
| DEFINE_boolean copy_kernel ${FLAGS_FALSE} \ |
| "Copy the kernel to the fourth partition." |
| DEFINE_boolean test_image "${FLAGS_FALSE}" \ |
| - "Copies normal image to chromiumos_test_image.bin, modifies it for test." |
| -DEFINE_string image_name "chromiumos_image.bin" \ |
| + "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test." |
| +DEFINE_string image_name "${CHROMEOS_IMAGE_NAME}" \ |
| "Base name of the image" i |
| DEFINE_string build_root "/build" \ |
| "The root location for board sysroots." |
| @@ -81,6 +81,8 @@ fi |
| # We have a board name but no image set. Use image at default location |
| if [ -z "${FLAGS_from}" ]; then |
| IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" |
| + |
| + # get latest image directory |
|
sosa
2010/11/30 22:01:43
s/get/Get
|
| FLAGS_from="${IMAGES_DIR}/$(ls -t ${IMAGES_DIR} 2>&-| head -1)" |
| fi |
| @@ -131,9 +133,6 @@ if [ -b "${FLAGS_to}" ]; then |
| fi |
| fi |
| -# Use this image as the source image to copy |
| -SRC_IMAGE="${FLAGS_from}/${FLAGS_image_name}" |
| - |
| STATEFUL_DIR="${FLAGS_from}/stateful_partition" |
| mkdir -p "${STATEFUL_DIR}" |
| @@ -147,41 +146,14 @@ function do_cleanup { |
| fi |
| } |
| +# Use this image as the source image to copy |
| +SRC_IMAGE="${FLAGS_from}/${FLAGS_image_name}" |
|
sjg
2010/11/30 21:07:29
This was moved to make the script more similar to
|
| -# If we're asked to modify the image for test, then let's make a copy and |
| -# modify that instead. |
| if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then |
| - if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \ |
| - [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then |
| - # Copy it. |
| - echo "Creating test image from original..." |
| - cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin" |
| - |
| - # Check for manufacturing image. |
| - if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then |
| - EXTRA_ARGS="--factory" |
| - fi |
| - |
| - # Check for instqall shim. |
| - if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then |
| - EXTRA_ARGS="--factory_install" |
| - fi |
| - |
| - # Modify it. Pass --yes so that mod_image_for_test.sh won't ask us if we |
| - # really want to modify the image; the user gave their assent already with |
| - # --test-image and the original image is going to be preserved. |
| - "${SCRIPTS_DIR}/mod_image_for_test.sh" --image \ |
| - "${FLAGS_from}/chromiumos_test_image.bin" --board=${FLAGS_board} \ |
| - ${EXTRA_ARGS} --yes |
| - echo "Done with mod_image_for_test." |
| - else |
| - echo "Using cached test image." |
| - fi |
| - SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin" |
| - echo "Source test image is: ${SRC_IMAGE}" |
| + # make a test image as requested, this will modify SRC_IMAGE |
|
sosa
2010/11/30 22:01:43
s/make/Make also why are we modifying the src imag
sjg
2010/12/01 00:57:05
We will change it to point to the test image.
|
| + prepare_test_image |
| fi |
| - |
| # Let's do it. |
| if [ -b "${FLAGS_to}" ] |
| then |