Commit Graph

34 Commits

Author SHA1 Message Date
Liam McLoughlin
c9f1dab46e Added sudo to VBoxManage call, to fix permission denied error when building a VirtualBox image
BUG=None
TEST=Run image_to_vm.sh to build a VirtualBox image for the x86-generic board, confirm image builds successfully

Change-Id: I3ce9aac1eef6dfa695747e92e7d7e75ddd524027
Reviewed-on: https://gerrit.chromium.org/gerrit/12449
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Tested-by: Liam McLoughlin <hexxeh@hexxeh.net>
Commit-Ready: Jon Kliegman <kliegs@chromium.org>
Reviewed-by: Jon Kliegman <kliegs@chromium.org>
2012-01-09 16:25:34 -08:00
Kees Cook
84a4c7a620 Use fully qualified path for helpers.
Change helper invocation to use discovered script path so image_to_vm.sh
and mount_gpt_image.sh can be run outside of ~/trunk/src/scripts.

Additionally, minimize SCRIPT_ROOT boilerplate to not potentially mix
execution locations, as suggested by David James.

BUG=None
TEST=Built images from outside of ~/trunk/src/scripts

Change-Id: I4851cc74e7da8e08b4e7be79651fb41ce8868aed
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10241
Reviewed-by: David James <davidjames@chromium.org>
2011-10-24 14:04:24 -07:00
David James
596520acd9 Resize image without using a loop device to avoid sync.
To resize an image, there's no need to use a loop device. We can just operate
on the image directly. This is simpler and avoids doing a sync which can
noticeably delay the build.

BUG=chromium-os:19150
TEST=Run image_to_vm.sh --board=x86-mario

Change-Id: Idbfc99cee9fd890aaad6379fbde511b273cc1d41
Reviewed-on: http://gerrit.chromium.org/gerrit/6036
Reviewed-by: Anush Elangovan <anush@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: David James <davidjames@chromium.org>
2011-08-15 17:18:05 -07:00
David James
63f62623d4 Update image_to_vm to run sync again prior to detaching loop device.
Prevents errors like this:
  loop: can't delete device /dev/loop0: Device or resource busy

See http://build.chromium.org/p/chromiumos/builders/x86%20pineview%20full/builds/119/steps/BuildTarget/logs/stdio

BUG=chromium-os:19150
TEST=Ran image_to_vm.sh

Change-Id: I8300b4770e1b194045fc068b08ff549984361897
Reviewed-on: http://gerrit.chromium.org/gerrit/6024
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
2011-08-15 15:21:33 -07:00
David James
b01cc8d2d3 Remove unnecessary sync calls from build_image and image_to_vm.sh.
Calling sync in build scripts pauses the build unnecessarily, particularly
when other steps are running in parallel.

BUG=chromium-os:19150
TEST=Run cbuildbot release build and watch faster performance.

Change-Id: Ia2469e3be68fdd38474ab4e6f67b06339c04822f
Reviewed-on: http://gerrit.chromium.org/gerrit/5966
Reviewed-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: <taysom@google.com>
Tested-by: David James <davidjames@chromium.org>
2011-08-15 10:07:09 -07:00
Brian Harring
d5d5dbffa1 Fix/standardize exiting if common.sh can't be found
The problem here is that most were doing their exiting w/in a subshell;
exit within a subshell kills the subshell, not the parent.  Not all scripts
were using set -e (which would pick up the failing subshell); as such
just rewriting them to remove the potential via eliminateing the subshelling.

Beyond that, removed a couple of custom (working, although non-standard)
approaches, and removed a duplicate common.sh sourc'ing w/in mk_memento_images.sh

TEST=force 'find_common_sh' to fail, note the scripts fails to exit
BUG=none

Change-Id: Ia1108a091a6399ad6aedd3cade4a107f4411686c
Reviewed-on: http://gerrit.chromium.org/gerrit/3905
Reviewed-by: Brian Harring <ferringb@chromium.org>
Tested-by: Brian Harring <ferringb@chromium.org>
2011-07-22 12:06:59 -07:00
David James
8b9643f7d8 Fix losetup race condition.
The following pattern creates a race condition:

   LOOP_DEV=$(sudo losetup -f)
   ...
   sudo losetup "${LOOP_DEV}" "${ROOT_FS_IMG}"

If two steps similar to the above run in parallel, and both steps pick up
the same free loop device, they may try to mount different images with the
same loop device and one of the two stages will get a "device is busy" error.

To fix this, we should switch to the following pattern:
   LOOP_DEV=$(sudo losetup --show -f "${ROOT_FS_IMG}")

This CL implements the above.`

BUG=chromium-os:18046
TEST=Run buildbot run. Test case where we run out of loop devices and verify
     logic still works.

Change-Id: Ie457701fda61e5fc3b9112c1bfef9fb9713ea265
Reviewed-on: http://gerrit.chromium.org/gerrit/4555
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
2011-07-22 00:02:53 -07:00
Arkaitz Ruiz Alvarez
2bf8859cf8 Fix test images kernel commandline arguments
By default, "cros_debug" should be included in the kernel commandline for
developer images. This change adds "cros_debug" to the kernel commandline
for test images, which are based on developer images but overwrite the boot
arguments.

TEST=Build test image, install on machine and grep "cros_debug" /proc/cmdline
BUG=chromium-os:17393

Change-Id: Ie0de11baf60a3a69a7fef0639247e2edae455ffb
Reviewed-on: http://gerrit.chromium.org/gerrit/3790
Tested-by: Arkaitz Ruiz Alvarez <arkaitzr@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
2011-07-08 12:19:20 -07:00
Stéphane Marchesin
7e0b3d8d9f Use 1280x1024 resolution when running ChromeOS under qemu.
BUG=none
TEST=Run ChromeOS under qemu, the screen should be 1280x1024 not 800x600.

Review URL: http://codereview.chromium.org/6768009

Change-Id: I9a73025244a85d3b07e98136b373b00bb40cd9dd
2011-03-29 06:58:17 -07:00
Stéphane Marchesin
78bd46d457 Do not enable the use_tablet flag in qemu, as this breaks the mouse.
Change-Id: I52901180e962c463bdaacbc573f93700cf9ab4bd

BUG=None
TEST=Run Chrome OS in qemu, check that the mouse is back.

Review URL: http://codereview.chromium.org/6749020
2011-03-25 16:35:01 -07:00
Chris Sosa
8dad50d97f Update test harness to take in optional public and private keys to sign payloads.
In addition some refactoring to make this cleaner and easier.

Change-Id: I1607700d065c71aff2b2833b10acbd3ebace68ce

BUG=chromium-os:8212
TEST=Ran with Simple ... running now with full

Review URL: http://codereview.chromium.org/6482017
2011-02-14 15:29:32 -08:00
Simon Glass
142ca06512 Factored out the code to copy an image and modify it for test
into mod_image_for_test.sh rather than slightly different versions
of the same in image_to_usb.sh and image_to_vm.sh

Added a function to get a test image into common.sh

Added --inplace option to mod_image_for_test, which is the default,
and preserves the original behaviour. But using --noinplace it will
now do the copy for you.

Found that chromiumos_image.bin appears throughout the scripts, so added it and the test variant to common.sh

BUG=chromiumos-10126
TEST=run mod_image_for_test.sh with and without --noinplace
run image_to_usb.sh and image_to_vm.sh with both options
test on Seaboard that correct image is provided

Really we should have automated testing for these scripts

Change-Id: I5cfa91792c7fded35e7f4ca8f8f27c6b270817fb

Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=4fc5227

Review URL: http://codereview.chromium.org/5271010
2011-02-09 13:39:43 -08:00
Greg Spencer
798d75f3be This starts to fix the scripts so that they load from /usr/lib/crosutils
from within the chroot.

It also fixes a number of style issues.

It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.

It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.

BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.

Review URL: http://codereview.chromium.org/6240018

Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
2011-02-01 22:04:49 -08:00
Anush Elangovan
0de6de66db Enable virtio for tests
Change-Id: I1d0e546f6ea837928ba426e4690007ef2649f68e

BUG=10102
TEST=test KVM with -net virtio and ensure it boots and can copy files in etc

Review URL: http://codereview.chromium.org/5543006
2010-12-07 17:31:48 -08:00
Chris Masone
7d04c7aacb [crosutils] bump default size of VM disk to allow for bigger stateful partition
BUG=8544
TEST=create an VM image with image_to_vm.sh; the stateful partition should be 2GB in size.

Change-Id: I6c0ee9e2cb513e42c25e4f0d1616835a41f378d7

Review URL: http://codereview.chromium.org/4737001
2010-11-09 08:24:13 -08:00
Chris Sosa
1b11f3813f Add sync after resize to avoid /dev/loop- is busy errors.
Change-Id: I7d38b7f78e5d32744ec3a9e1579d09bd16d64888

BUG=
TEST=Ran it.

Review URL: http://codereview.chromium.org/4108001
2010-10-25 15:10:26 -07:00
Chris Sosa
9fe00b9b13 Use minimums if options are too small.
Change-Id: Icd9402aec8a55c613c8fa12e917bf3fd63272271

BUG=
TEST=Ran it and saw minimums change.

Review URL: http://codereview.chromium.org/3956005
2010-10-22 12:34:16 -07:00
Will Drewry
f929c3012c image_to_vm: fix up the rootfs for mounting rw
Use new helper for accessing a verified rootfs.

TEST=ran image_to_vm and it worked
BUG=tree b0rked

Change-Id: I03c1c55d1e1056081078cbdd8797235636d4845d

Review URL: http://codereview.chromium.org/4023001
2010-10-20 18:48:20 -05:00
Olof Johansson
1688a6d416 Change KVM to use e1000
add -net nic,model=e1000 in start_kvm and in the suggested command as
output by image_to_vm.sh

Signed-off-by: Olof Johansson <olofj@chromium.org>

BUG=none
TEST=Boot an image, run lspci in a terminal, see intel nic

Review URL: http://codereview.chromium.org/3779007

Change-Id: Id7f614adec0ae69b8f4de152832538a13ea4cbad
2010-10-14 19:08:44 -05:00
Chris Sosa
020aa69f37 Fixes for cbuild to work with ctest.
1)  image_to_vm aborts because e2fschk requires a terminal to
be connected in order to check whether or not you want to repair the fs.  Since
we always want this to be true, set -p

2)  Clean up test harness to only verify the number of tests that passed on the
base image are the same on the update back to.  This is because older images
have many tests that fail.  I leave 10% as a reasonable number to pass.

3)  Redirect output from autotest in run_remote_tests to stderr so it gets
logged in a calling script that captures stdout.

Change-Id: If412274353683add20d136747113eb9c2bd41330

BUG=4690, 5533, 7287
TEST=Ran with internal tools for builders.

Review URL: http://codereview.chromium.org/3536018
2010-10-08 16:36:20 -07:00
Chris Sosa
bd61304ebe Pass --board to get_latest_image.sh.
Change-Id: Iaa388bc6dd3ef8b07199ee42de6693cad2f4368f

BUG=
TEST=rm src/scripts/default_board and ran image_to_vm --board x86-generic.

Review URL: http://codereview.chromium.org/3530007
2010-10-04 13:29:23 -07:00
Chris Sosa
45bec936f6 Move vm constants into their own file. This will make it easier to share these constants.
Also fixed get latest image logic in image_to_vm and allowed for using the most recent image in cros_run_vm_test to follow other shell convention of using latest.

Change-Id: I60ed4c03d609500da7f6ae34ef57ba2e32f4b0bb

BUG=
TEST=Tested by running image_to_vm with --full and cros_run_vm_test with suite_Smoke

Review URL: http://codereview.chromium.org/3597001
2010-09-29 15:38:53 -07:00
Olof Johansson
3ed8d12f48 image_to_vm: print launch command for qemu images
Change-Id: Id62c28eac319caf15a2bf83a69b4f727f9e9d56b

BUG=none
TEST=sudo emerge qemu-kvm ; image_to_vm <...> ; cut and paste of output

Review URL: http://codereview.chromium.org/3418031
2010-09-27 13:29:40 -05:00
Chris Sosa
cc09f84b5e Update scripts for vm's
Change-Id: I63bdcaa3630c179d407310f6544c102f5353fa4d

BUG=5530
TEST=Ran both cros_run_vm_test and new script and had the latter update successfully.

Review URL: http://codereview.chromium.org/3427011
2010-09-21 17:09:51 -07:00
Ryan Cairns
a7be5ffcc7 pass --board to mod_image_for_test
... again ...
Change-Id: If4c72eb5ff422a74130a62a10d5705f02849acfe

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/3113029
2010-08-23 20:47:07 -07:00
Will Drewry
537caa90c0 Clean up cros_make_image_bootable and image_to_vm
image_to_vm.sh was running chromeos-setimage.  This script
was not meant to be run outside of a CrOS environment, but
its use here predates the cros_make_image_bootable script.

The change converts the rehashing and imaging over to using
cros_make_image_bootable.  The vm image uses the usb boot target but defaults
the usb drive to sda3.

update_bootloaders is fixed to not clobber existing syslinux
templates.

cros_make_image_bootable flag override support was broken and this fixes it.

TEST=build a new image wtih rootfs checking and without and ensure both woth with image_to_vm.  Also make sure they still boot normally on available hardware.
BUG=chromium-os:5939

Review URL: http://codereview.chromium.org/3189018

Change-Id: Ib4ac25f1a76f25ac7ce4538614ba247df9caea91
2010-08-20 20:30:56 -05:00
Tan Gao
0d5f948934 clean up install_gpt args to use number of sectors
Change-Id: I7d17db3cb522a52ec2dac688f4bf83fb5ae6a2d1

related CL: http://codereview.chromium.org/3031049/show

TEST=(1)Manually built an image using build_image script, which exercised "build_gpt.sh"; (2) manually built a Qemu VM image using "image_to_vm.sh" and verified the VM is bootable (up to login screen); (3) manually built a dev recovery image using "mod_image_for_dev_recovery.sh" and verified image functions properly for dev recovery purpose

Review URL: http://codereview.chromium.org/3050039
2010-08-06 08:28:20 -07:00
Tan Gao
97117a9d97 remove obsolete arg kern_img from install_gpt() call
Change-Id: I62a7e85f098327404f52752d85450ff24f2a7e78

Review URL: http://codereview.chromium.org/3014050
2010-08-03 17:01:25 -07:00
Will Drewry
efce66880f image_to_vm: convert to calling setimage directly
The last changes to the installer broke image_to_vm.  Since image_to_vm
doesn't need to run postinst, but just change the active image, it
now just calls chromeos-setimage and passes in its needed flags (already
supported by the last installer change).  It will also detect whether
the image was built with verification of the rootfs enabled or not
by looking at the default.cfg file.

Also updates the location of where you should run the command in
build_image.

TEST=built a new image with --enable_rootfs_verification and started with qemu -curses -hda [output]; did the same without verification
BUG=chromium-os:2963

Review URL: http://codereview.chromium.org/3034030

Change-Id: I265d6ad8971f9427b78cc07d784fced9cceb5974
2010-07-23 19:43:27 -05:00
Rahul Chaturvedi
e79e88eb0e Changes to use the postinst --esp-part-file flag; postinst fixups removed
Added the flags required for mounted images to the postinst call.
Scripts no longer need to fixup postinst hence that code is removed.

Review URL: http://codereview.chromium.org/3027012
2010-07-21 02:04:59 +05:30
Rahul Chaturvedi
e770e16379 Resize stateful partition flag
Added flag to resize stateful partition that we put onto the VM image.

Review URL: http://codereview.chromium.org/2964011
2010-07-15 00:35:11 +05:30
Zelidrag Hornung
478a0d44a4 Renamed VM image to match naming convention of other images.
Review URL: http://codereview.chromium.org/2955014
2010-07-14 11:47:39 -07:00
Zelidrag Hornung
42ca818d3b fixed vm scripts
Review URL: http://codereview.chromium.org/2973005
2010-07-12 18:08:44 -07:00
Rahul Chaturvedi
b5643e8bf6 Final set of VM scripts - integrated with changes from Zelidrag to create a test image if specified.
Integrated comments from http://codereview.chromium.org/2604001/show
[the git repository that commit was on was deleted and replaced, hence this new commit]

Review URL: http://codereview.chromium.org/2803015
2010-07-09 10:46:05 +05:30