Commit Graph

19 Commits

Author SHA1 Message Date
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
Nick Sanders
f9c49add44 Allow file in --from arg
* mount_gpt_image.sh
* image_to_usb.sh

BUG=chromium-os:12367
TEST=mount w/ --from file, check failure with file and -i, block dev and -i, check unmount, check image_to_usb, check --from dir -i file

Change-Id: I8d8604ee7ee83513edd687b0a66cda44f64db1f8

Review URL: http://codereview.chromium.org/6685101
2011-03-21 18:56:04 -07:00
Dale Curtis
d569a90bbd Fix recent change which prevented mount_gpt_image from running outside chroot.
Change-Id: Id58de45b72522077179024ee0310c70d2af1a497

BUG=chromium-os:4230
TEST=Ran mount_gpt_image.sh inside/outside chroot.

Review URL: http://codereview.chromium.org/6312112
2011-02-02 20:30:14 -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
Nick Sanders
867fde26b7 Allow RO rootfs and writeable stateful.
BUG=9423
TEST=mount an image --safe, rootfs OK

Change-Id: I4bc48e742e2438a1d2cae17c752743e02bd124fd

Review URL: http://codereview.chromium.org/4974006
2010-11-16 20:05:06 -08:00
Chris Sosa
c60e567799 Convert rootfs and stateful mountpts to absolute paths.
Change-Id: Ib9b6b9ba7787fba337e71e4968a5c152b5a21e14

BUG=chromiumos:8885
TEST=Ran with default options and setting --rootfs_mountpt and stateful_mountpt
to dirs in my current workig directory ... saw cleanup correctly on unmount

Review URL: http://codereview.chromium.org/4853001
2010-11-12 10:54:25 -08:00
Chris Sosa
142e452d37 Fixing of the symlinks isn't being called because rootfs is being remounted ro.
This is being remounted ro in cros_make_image_bootable so I should be checking
for the stateful mount pt not the rootfs mountpt

Change-Id: I1ee64489516fae10a6246c5d79236c8b5df090ee

BUG=8116
TEST=Ran it and ran bin/cros_start vm and inspected /usr/local

Review URL: http://codereview.chromium.org/4148013
2010-10-29 11:58:15 -07:00
Chris Sosa
3b44f34de7 Fix egrep for checking for rw/ro.
Right now we're not fixing symlinks because mount_gpt_image thinks it's mounted ro.

Change-Id: Ie61536cd8d7bc276831c488e7ab892db14b05a94

BUG=8116
TEST=Mounted image from device and locally with both rw, and ro options.

Review URL: http://codereview.chromium.org/4048006
2010-10-25 13:21:42 -07:00
Chris Sosa
6addb3032c Fix latest to be consistent.
Change-Id: Ic4bc37b9c41e231b3a2448a7fabd1f7a0c163ae3

BUG=
TEST=Ran it and it was correct with -m.

Review URL: http://codereview.chromium.org/4017005
2010-10-21 16:32:26 -07:00
Will Drewry
55b42c94ca cros_make_image_bootable, mount_gpt_image, common.sh: root filesystem changes: ext2, ro by default
This change makes more of the root filesyste metadata static across builds, but
more can be done there.  It also changes the root filesystem to use ext2 as
we don't need journaling in normal mode.  Optionally we could use ext3 for
non-verified if desired (it's an easy change).

In particular, this change cleans up the following:
- clears the rootfs uuid
- labels it C-ROOT (instead of C-KEYFOB)
- removes reserved inodes and blocks

The major feature of this change, however, is that it adds two simple
helpers to common.sh: disable_rw_mount and enable_rw_mount.  They will
set high order byte (le) in the ro compat field to be 0xff.  This will
tell the kernel that the filesystem uses features R24-R31 which are safe
for use on the running kernel iff the filesystem is mounted read-only.

These functions are called in cros_make_image_bootable and
mount_gpt_image, respectively.  mount_gpt_image will always
enable_rw_mount and cros_make_image_bootable will disable_rw_mount if
--enable_rootfs_verification is true.

The approach is ugly but reasonably well contained.  If ext2 ever gets a
new revision and new features in the same range are introduced, then we
would be getting inconsistent behavior.  That said, it is unlikely that
that churmn will happen and if the impact is negative, it will ideally
show up during testing.

N.B., this will likely result in changes needing to be made to the
signing scripts in vboot_reference to ensure that rw mounting is
enabled/disabled in the same way (E.g., during stamping).

BUG=chromium-os:7468
TEST=- built x86-generic, imaged to usb stick, attempted to mount rw /dev/sdc3 on the host and was properly bounced.
     - booted to the image just fine on a dogfood device.
     - mod'd for recovery, then installed and booted.
     - mod_image_for_test runs with no errors; booted the resulting image as well
     - booted a factory_install with the pending dm changes
     - BVT passed with build_image x86-generic (vboot enabled)
     - [in progress] autotest that checks if the rootdev = /dev/dm-0 and
       then does a dumpe2fs | grep -q FEATURE_R31

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

Change-Id: If4dcba7568a110f4e32627c916d9e5741e5e5414
2010-10-20 15:44:11 -05:00
Chris Sosa
e7f1a2b6bb Add read only flag to mount_gpt_image
Change-Id: I33ea8b2148a3e49a6c5de25f2957306130ff092e

BUG=
TEST=Ran and verified with and without flag.  Checked mount and tried writing
file to rootfs (to verify it was ro).  Also re-ran cros_make_image_bootable
to make sure it worked fine after changes.

Review URL: http://codereview.chromium.org/3479007
2010-09-28 18:24:13 -07:00
Chris Masone
3adf3f71e9 replace test -n ... && clauses with proper ifs
The version of this using test -n syntax didn't work in my chroot.

Review URL: http://codereview.chromium.org/2951007
2010-07-09 16:44:18 -07:00
Will Drewry
fb48fa3500 TBR: mount_gpt_image: fix missing guard for esp
Missing check during mkdir causes failure with -e empty.

The tree broke prior to this commit, but this will break the dev
build so bypassing hooks. sorry.

TEST=reran build_image
BUG=none
TBR=adlr
2010-07-02 16:35:27 -05:00
Will Drewry
61f39fb266 [PATCH 1/5] mount_gpt_image: mount the esp image
Adds support for mounting the esp image.
In the future, all legacy boot loaders will live on
the ESP partition (#12) to avoid modifying the rootfs
partition with bootloader changes in the configuration or
preamble.  This is needed.

TEST=manually reran mount_gpt_image.sh users.
BUG=chromium-os:327

Review URL: http://codereview.chromium.org/2811042
2010-07-02 16:15:22 -05:00
Bill Richardson
fc752ffdfa Use new cgpt tool when creating images and the pack/unpack scripts.
Review URL: http://codereview.chromium.org/2792011
2010-06-11 09:16:09 -07:00
Chris Sosa
d44550272c Cleanup of adding pristine image and fixing of symlinks in developer image.
TEST=Tested with building a new image, looking in the output directory, running
the image and running vi.

Review URL: http://codereview.chromium.org/2075019
2010-05-20 10:14:06 -07:00
Chris Sosa
9673f3b92e Always build pristine image as well as dev/test image.
TEST=Tested build process.  Tested dev image, test image and base image by booting all three and logging in.

Review URL: http://codereview.chromium.org/2106009
2010-05-18 13:24:40 -07:00
Chris Sosa
702618ff2b Move to using chromeos-test to emerge test dependencies in mod_image_for_test.
In addition unifies changes in mount_gpt_image and one-offs in mod_image_for_test
to consolidate gpt / var mounting.

Review URL: http://codereview.chromium.org/2064001
2010-05-14 12:52:32 -07:00
Chris Sosa
fb78b42940 New helper script to mount (and umount) gpt image into image_dir/rootfs and mount /var, /usr/local
Review URL: http://codereview.chromium.org/1648018
2010-04-19 14:56:18 -07:00