Commit Graph

25 Commits

Author SHA1 Message Date
Michael Marineau
576c8996f4 fix(disk_util): Remove support for --adjust_part
This isn't a feature we've been using as far as I know and if someone
needs a custom partition layout it's probably better to just add it to
the json file. Removing this avoids some complexity.
2013-12-30 16:12:02 -08:00
Michael Marineau
cc341f856b fix(disk_util): Merge write_mbr into write_gpt
No need for this to be a different command.
2013-12-30 16:10:46 -08:00
Michael Marineau
de9ff4fc8e fix(disk_util): Rework how argument parsing/passing works.
Move from optparse to argparse. Move layout file and layout type to
global options with reasonable default values so every command doesn't
need to them. Adjust calling scripts to match.

For now layout type is being passed via an environment variable
DISK_LAYOUT_TYPE but this is a temporary situation.
2013-12-30 16:10:46 -08:00
Michael Marineau
fdefbf704c add(disk_util): Rename cgpt.py to disk_util.
Use a more generic name so cgpt.py and disk_layout_util.sh can be merged
into one tool. Wrappers around wrappers around wrappers are tedious.
2013-12-30 16:10:46 -08:00
Michael Marineau
6d414d275e fix(*): remove lingering broken support for board overlays.
This is a feature from the chromeos sdk that we haven't used and doesn't
work any more. Clean it up...
2013-12-08 16:02:00 -08:00
Michael Marineau
b5816f7a8d fix(disk_layout_util.sh): Fix changing build_image's disk layout.
Previously the code in base_image_util.sh properly handled the disk
layout command line flag but the spaghetti code later on calls a
function from disk_layout_util.sh which only returned 'base' resulting
in a bit of a mess if something other than 'base' is used. Sync up the
two code paths to avoid that...
2013-11-07 13:28:13 -08:00
Michael Marineau
efac054f54 fix(build_library): Remove usb and factory_layout partition layouts.
These are just cluttering things and adding an element of "how does this
work?" because base_image_util was defaulting to the "usb" layout in
some places and "base" in others.
2013-08-20 21:47:53 -04:00
Michael Marineau
34c324cc3a fix(build_library): Remove GPT writer scripts, call cgpt directly.
This change removes /usr/sbin/write_gpt.sh from images which we have no
use for. This allows us to drop the indirection of writing partition
tables by first writing out a script to call. Now cgpt.py can call cgpt
directly to initialize the partition layout. This opens the way for
further improvements to how disk images are created.
2013-08-20 21:30:22 -04:00
Michael Marineau
a1a1ed830c fix(build_library): Use sparse files for disk images, no useless sudo
Enable sparse files for all dd and cp commands and replace some dd
commands that are really better off being truncate commands.

While in the neighborhood there were a number of useless sudo commands
for things that just happen to be in sbin. Call them directly instead.
2013-07-26 23:45:10 -04:00
Michael Marineau
42a4536d7d fix(*): Rename dev image to coreos_developer_image.bin
Remove hard-coded references and unused scripts that mentioned it.
2013-07-26 22:12:10 -04:00
Brandon Philips
95b2a4b8cd chore(*): use coreos_ everywhere 2013-07-21 23:20:50 -07:00
Michael Marineau
99089076af fix(build_image): Don't unmount when the rootfs isn't mounted
This function is never called when rootfs is mounted but leaving in a
check for it as a just in case sort of thing.
2013-07-19 02:41:52 -04:00
Michael Marineau
3fa29024e1 fix(build_image): Configure legacy bootloaders to set root by UUID.
Make use of the new partition UUIDs for ROOT-A and ROOT-B in the root=
kernel parameters provided by the legacy (non-kexec) bootloaders. This
makes all of our images bootable as-is without having to pass them
through image_to_vm.sh. :-D
2013-07-08 16:28:12 -04:00
Brandon Philips
4057d5590d feat(disk_layout): follow new CoreOS partition layout
As outlined here we need a new partition layout, this patch makes the
necessary changes:
https://groups.google.com/forum/#!topic/coreos-dev/bA7gwGGoTng

The first big change is making all of the scripts obey partition numbers
based on labels in the disk_layout.json. This makes it much easier to
change later on.

The second big change is in the layout itself. The json file was updated
to reflect the document above.

And finally the grub boot configuration needed for pv-grub and pygrub
were added to the create_legacy_bootloader_templates.sh library utlity.

Everything seems to work and boot now.
2013-05-12 12:31:03 -07:00
Brandon Philips
78e2afafea fix(build_library/disk_layout_util.sh): unmount rootfs
Sometimes during the buildprocess we get here and the rootfs is still mounted?!

Change-Id: I6dc044d9d1318be606c1645f925421fa84c1f513
2013-02-14 16:26:48 -08:00
Brandon Philips
11472e5166 common: make safe_umount retry a few times
on Fedora 18 on Gnome 3.0 something is making the first attempt at
unmounting return busy. Unfortunatly, the return code is 32 everytime
so we have to parse the output of umount :( :( :(

Change-Id: I7f94bf6c2059c7e7cb4fb173d9ffbabd59f2b24f
2013-02-14 16:18:56 -08:00
Mike Frysinger
79ae5b4a06 use new status=none with dd
The latest coreutils introduces a status=none option which suppresses
all information which is more than the current status=noxfer.

BUG=None
TEST=`./build_image` no longer spews any dd info

Change-Id: I3cfefed1d38e7e5ff52342c98e6a306d9a48950a
Reviewed-on: https://gerrit.chromium.org/gerrit/41930
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
2013-01-24 13:58:27 -08:00
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