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

Unified Diff: image_to_vm.sh

Issue 5271010: Factored out the code to copy an image and modify it for test (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Rebased to ToT Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « image_to_usb.sh ('k') | mod_image_for_test.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: image_to_vm.sh
diff --git a/image_to_vm.sh b/image_to_vm.sh
index dff302303f5caef887837550b14883efca73b17f..f37e39fa121aec80b921f0a39a2f20e0c7762b96 100755
--- a/image_to_vm.sh
+++ b/image_to_vm.sh
@@ -64,7 +64,7 @@ DEFINE_string state_image "" \
DEFINE_integer statefulfs_size 2048 \
"Stateful partition size in MBs."
DEFINE_boolean test_image "${FLAGS_FALSE}" \
- "Copies normal image to chromiumos_test_image.bin, modifies it for test."
+ "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test."
DEFINE_string to "" \
"Destination folder for VM output file(s)"
DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \
@@ -108,39 +108,13 @@ if [ -z "${FLAGS_to}" ] ; then
FLAGS_to="${FLAGS_from}"
fi
-# Use this image as the source image to copy
-SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin"
-
-# 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 install 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" --board=${FLAGS_board} --image \
- "${FLAGS_from}/chromiumos_test_image.bin" ${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 - this returns the test filename in CHROMEOS_RETURN_VAL
+ prepare_test_image "${FLAGS_from}" "${CHROMEOS_IMAGE_NAME}"
sosa 2011/02/09 02:58:52 Need to add FLAGS_force_copy=$FLAGS_TRUE here or a
+ SRC_IMAGE="${CHROMEOS_RETURN_VAL}"
+else
+ # Use the standard image
+ SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}"
fi
# Memory units are in MBs
@@ -308,7 +282,7 @@ fi
if [ "${FLAGS_format}" == "qemu" ]; then
echo "If you have qemu-kvm installed, you can start the image by:"
- echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=virtio " \
+ echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=e1000 " \
sosa 2011/02/09 02:58:52 This got accidentally reverted
"-net user,hostfwd=tcp::9222-:22 \\"
echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}"
fi
« no previous file with comments | « image_to_usb.sh ('k') | mod_image_for_test.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698