Commit Graph

9 Commits

Author SHA1 Message Date
Hung-Te Lin
d7a3503914 crosutils/make_universal_factory_shim.sh: allow creating images in arbitrary layout
We need more flexible image creation tool for various layout, like "RMA with
multiple release images" which needs 4 images (install, test, release A,
release B).

To make the creation of image more flexible, this CL changes
make_universal_factory_shim to using a "layout file" that can describe any disk
image format we want.

Image creation speed is also improved by aligning partition offsets and
restricting oflag=dsync applied only when being used for block devices so that
make_universal_factory_shim (outputs to a normal temporary file) becomes faster
by utilizing system cache.

For a system with every images already cached:
 - Time for building 3 in 1 factory instal shim:
   Before = 8 seconds, After = 5 seconds.
 - Time for full RMA shim creation:
   Before = 1m25s, After = 40-50 seconds.

BUG=chrome-os-partner:4108
TEST=./make_universal_factory_shim.sh image1 image2 image3 image4
     # boots correctly after being imaged to SD card.
     ./make_factory_package.sh --usbimg RMA ....
     # RMA image can install images and works correctly

Change-Id: I645196d6d6e0a24d3dfa4c413a338279df4c0d5b
Reviewed-on: http://gerrit.chromium.org/gerrit/6893
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-08-31 23:37:55 -07:00
Hung-Te Lin
28a753b22c crosutils: refine factory and imaging scripts
In order to support building arbitrary image, the partition copying scripts has
been changed to support "copying partitions in same size" and "overwriting
partitions in different size", and "copying partition from external file".

We need these APIs to create disk/usb image with release images that is using
partition with different size (ex, recovery images).

Image copying buffer selection and disk image creation time are also improved.

BUG=chromium-os:15050
TEST=./make_factory_package.sh ... --diskimg preimage.bin
     ./make_factory_package.sh ... --usbimg rma.bin
     ./make_factory_package.sh ...  # omaha mode

Change-Id: I6a4c820abf59e780985c95dc35f9340b347bd952
Reviewed-on: http://gerrit.chromium.org/gerrit/5981
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-15 21:58:23 -07:00
Hung-Te Lin
5c67986738 make_factory_pack: auto detect release image type (--detect_release_image)
The release image parameter must be an image signed for SSD booting. This CL
adds detection code and allows on-the-fly conversion from recovery to SSD image.

BUG=chromium-os:15050
TEST=./make_factory_package --release RECOVERY --factory FACTORY # success
     # Seeing: INFO    : Image type is [recovery]:...
     ./make_factory_package --release USB --factory FACTORY # success
     # Seeing:  Image type is [usb]:...
     ./make_factory_package --release SSD --factory FACTORY # success
     # Seeing:  Image type is [ssd]:...
     ./make_factory_package --release GARBAGE --factory FACTORY # failure
     # Seeing:  Image type is [invalid]:...
     ./make_factory_package --release GARBAGE --factory FACTORY --nodetect_release_image # success
     # No image type messages

Change-Id: I8530b3f58574a4298b4d6d904a12bb92636c7365
Reviewed-on: http://gerrit.chromium.org/gerrit/5965
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-08-15 21:40:55 -07:00
Hung-Te Lin
40b5b87d98 crosutils: change mk_memento_images.sh to support arbitrary input source
When we want to separate kernel and rootfs, there must be a more flexible syntax
to assign input source.

The partition info parsing code is also improved to detect errors.

BUG=chromium-os:15050
TEST=./make_factory_package --release RECOVERY --factory FACTORY

Change-Id: Ie74b3e23117480a7f503488b39dedceadbfb41e3
Reviewed-on: http://gerrit.chromium.org/gerrit/5962
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-14 22:56:48 -07:00
Hung-Te Lin
e7ea070644 make_factory_package: allow updating HWID for image creation
BUG=chromium-os:16733
TEST=./make_factory_package --release RELEASE \
     --factory FACTORY --hwid HWID_UPDATER \
     --diskimg IMAGE_FILE

Change-Id: I1a817e1f176d22d830bf0ce8a6ccb6956086f749
Reviewed-on: http://gerrit.chromium.org/gerrit/3306
Reviewed-by: Jay Kim <yongjaek@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-06-30 10:30:43 -07:00
Hung-Te Lin
4653cbd0e5 crosutils/make_factory_package.sh: support full SSD image as target outside chroot
When running outside chroot, we should use locate_cgpt + "$GPT" to invoke cgpt;
otherwise it may be not in system PATH.

For dealing with a true SSD image (over USB, for example) this CL also improved
data writing speed from <2M/s to 8M/s+ (over USB).

BUG=chromium-os:10531
TEST=./make_factory_package.sh \
  --factory=../build/images/x86-mario/latest/chromiumos_factory_image.bin \
  --release=../build/images/x86-mario/latest//chromiumos_image.bin \
  --diskimg=/dev/sdb

Also tested:
  --diskimg=blah # local file
  (chroot) --diskimg=/dev/sdd
  (chroot) --diskimg=blah

Change-Id: I647d97fe388f5b6a6223fa8cacfecdf00265f60c

Review URL: http://codereview.chromium.org/6261003
2011-01-13 16:59:42 +08:00
Nick Sanders
607c0780c0 Allow disk image target for copy machine.
BUG=10531
TEST=build and imaged a mario

Change-Id: I60790f178159d707f610ba1668c29179a6c32e61

Review URL: http://codereview.chromium.org/6050006
2010-12-28 22:27:11 -08:00
Hung-Te Lin
062947926e cros_utils: refine factory and imaging related scripts
Major changes are:
 - prefix functions in cros_image_common with 'image' to avoid naming conflicts
 - use awk to replace grep+sed+cut
 - use case to handle board name list
 - factory_setup.sh should return error if applying patch failed
 - refine for shell script coding style guide:
   * replace `` with $()
   * quote variables
   * replace "! -z" by "-n"
   * no space between redirection symbol (>) and target name (eg, >>filename)
   * 1> should be simply >
   * no trailing \ for && and ||

BUG=chrome-os-partner:1583
TEST=manually verified:
 ./image_to_usb.sh --factory # calls mod_image_for_test --factory, and works fine
 ./make_factory_package.sh --factory PATH_TO_IMAGE --release PATH_TO_IMAGE ...
  # factory payloads were created successfully

Change-Id: I6bb10bdfb12cbdb14e9816b3ad72dfe4b7b0472f

Review URL: http://codereview.chromium.org/5168001
2010-11-18 14:47:38 +08:00
Hung-Te Lin
bcc60b625d crosutils: move image_common.sh to lib/cros_image_common.sh
The team is moving utility/library scripts into 'lib' folder.
image_common.sh should follow this policy.

Also refined the parameter check of mk_memento_images.sh

BUG=chromium-os:5208
TEST=./make_factory_package.sh --factory PATH_TO_FACTORY --release PATH_TO_RELEASE;
     # factory bundle created successfully
     ./mk_memento_images.sh PATH_TO_PART2 PATH_TO_PART3
     # update.gz created successfully
     ./mk_memento_images.sh PATH_TO_IMGE 2 3
     # update.gz created successfully

Change-Id: I3afecf05da2832986723f28b595045d0540ea9e9

Review URL: http://codereview.chromium.org/4825004
2010-11-13 05:36:20 +08:00