Commit Graph

8 Commits

Author SHA1 Message Date
Kees Cook
9ea1347ed9 update_partition_table: dynamically handle resize
When changing the size of the stateful partition, we must be able to
operate on any image, with any arrangement of partitions. The static
templates cannot be used because we don't know what we're starting with.
As such, this change makes the update function walk the list of
partitions, duplicating all their details, and moves any located after
stateful by the change in size, and copies in the new stateful contents.

BUG=chromium-os:37080
TEST=link build and decryption recovery tested

Change-Id: I1131dd8ee91e5db2556bdf8f7ca12b08f35da32b
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39424
Reviewed-by: Will Drewry <wad@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2012-12-10 13:56:46 -08:00
Mike Frysinger
ff73cef8a6 build_image: fall back to ro-mount automatically
A rootfs built with verification cannot be mounted rw, so have the
mount script try to mount things ro if the rw mount failed.

BUG=None
TEST=`./build_image && ./mount.sh` work

Change-Id: I291ece366e03e218b3cd9ff8f30bd9a6e9cf879d
Reviewed-on: https://gerrit.chromium.org/gerrit/35065
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
2012-11-15 11:31:29 -08:00
Liam McLoughlin
12a9a84de9 Add adjust_part flag
BUG=chromium-os:35003
TEST=Build an image specifying above flag, verify image is correct size

Change-Id: I36df212bf1dac41717044da011552d459645d523
Reviewed-on: https://gerrit.chromium.org/gerrit/35105
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2012-10-30 04:44:53 -07:00
David James
18a9c2513a Move board overlay calculation into chromite (part 3 of 5)
This CL adjusts all scripts to use cros_list_overlays from chromite
instead of cros_overlay_list.

BUG=chromium-os:35514
TEST=Trybot runs with all callers adjusted to use
     cros_list_overlays instead of cros_overlay_list.
CQ-DEPEND=CL:36191

Change-Id: I6b147a64744015f6b199b2a00493e6f1e030376b
Reviewed-on: https://gerrit.chromium.org/gerrit/36167
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: David James <davidjames@chromium.org>
2012-10-23 08:52:03 -07:00
Kees Cook
a242b0a7cd build_library: move update_partition_table to common location
The "update_partition_table" routine is used by mod_image_for_recovery.sh
and ~/trunk/src/platform/dev/host/tests/mod_recovery_for_decryption.sh.

This moves the routine into a common location so future changes will not
break things. Additional removes the duplicate okboat/failboat
definitions from mod_image_for_recovery.sh since those are in a common
place already.

This change does not fix the stateful resize logic part of the bug, but
does move the code into a single place so mod_recovery_for_decryption.sh
can use it once it has been fixed.

BUG=chromium-os:35003
TEST=created working recovery image

Change-Id: Ibcd5289389dcadf58ccf0678ecfb29095848b247
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34678
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
2012-10-04 15:15:49 -07:00
Mike Frysinger
b344800aa6 build_image: clean up emit_gpt_scripts a bit
Looks like the func was copy & pasted, so delete the first one (which
doesn't get used).  Then expand on the existing func to also generate
a mount and an umount script.

BUG=None
TEST=ran build_image, then tested the mount/umount and unpack/pack scripts

Change-Id: I34a372c7b4858b8e9057a29b2eb58c38d547eadd
Reviewed-on: https://gerrit.chromium.org/gerrit/33929
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2012-09-26 15:35:03 -07:00
Liam McLoughlin
aca5e1edfe Fix up OEM partition during image build
BUG=chrome-os-partner:14340
BUG=chromium-os:34688
TEST=Build an image, verify OEM partition has filesystem

Change-Id: Ie3e51427a36f5e8ea288abb7ac3ceeefb20cdb6f
Reviewed-on: https://gerrit.chromium.org/gerrit/33866
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
2012-09-23 17:00:37 -07:00
Liam McLoughlin
5b37c5443a Simplify and add flexibility to image creation process
This change adds support for building the disk layout from a
configuration file. It also cleans up much of the image creation
code.

install_gpt no longer exists, and has been replaced by cgpt.py's
write action. This spits out a file that has two functions that can
be called to write a partition layout to a disk/file. This gets rid
of the gigantic nest of calculations that built the layout previously.

All instances of partition/filesystem sizes in build scripts should now
be gone in favour of calls to the cgpt.py tool.

create_boot_desc has moved inside the base image creation, in an effort
to simplify build_image.

load_kernel_test is gone since it's apparently not supposed to be called
here anyway (asked wfrichar/rspangler about this one).

Base image creation now uses files rather than loop devices when
building an image. This means we can simply umount them once we're
done and not worry about cleaning up the loop device, since it's
been done for us.

Hash pad calculation has been removed. This is now set manually inside
the partition config file.

Hybrid MBR creation is gone, since it's now possible to do that in a board
specific hook (see overlay-beaglebone/scripts/board_specific_setup.sh).

OEM partition now has a filesystem, which is mounted at /usr/share/oem
during emerge so that packages can stash files here.

root_fs_dir and friends are still globals, but the long-term idea
is to make this not the case.

BUG=chromium-os:33817
TEST=All types of images and their respective flows
  (VM, recovery, test, factory etc)

Change-Id: I8a596728a4d1845c930e837bea627f5b6a11c098
Reviewed-on: https://gerrit.chromium.org/gerrit/29931
Commit-Ready: Liam McLoughlin <lmcloughlin@chromium.org>
Reviewed-by: Liam McLoughlin <lmcloughlin@chromium.org>
Tested-by: Liam McLoughlin <lmcloughlin@chromium.org>
2012-09-23 10:05:12 -07:00