Commit Graph

32 Commits

Author SHA1 Message Date
Nick Sanders
0126898d23 Cache sudo in make_factory_package
BUG=chrome-os-partner:2827
TEST=observe sudo cache

Change-Id: Idf0d63ab07ee2e60f028e44ace4cd9707c2e4d6c
Reviewed-on: http://gerrit.chromium.org/gerrit/7580
Tested-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-09-12 22:43:12 -07:00
Chinyue Chen
67594116c0 Read script parameters from config file.
make_factory_package.sh needs many parameters and to support multi-board
installation it has to be run twice (without and with --subfolder). This
change adds the functionality to read sections of parameters from a
config file and executes them in order.

BUG=chrome-os-partner:5850
TEST=1. Create a config file (mp_factory.conf) with the following
        content:
       [x86-zgb]
        --factory ~/trunk/src/build/images/${BOARD}/latest/chromiumos_factory_image.bin
        --release ~/trunk/src/build/images/${BOARD}/latest/chromiumos_image.bin
        --hwid_updater ~/trunk/src/platform/chromeos-hwid/hwid_bundle_zgb.sh
        --firmware_updater none
        --detect_release_image

       [x86-zgb-he]
        --subfolder x86-zgb-he
        --factory ~/trunk/src/build/images/${BOARD}/latest/chromiumos_factory_image.bin
        --release ~/trunk/src/build/images/${BOARD}/latest/chromiumos_image.bin
        --hwid_updater ~/trunk/src/platform/chromeos-hwid/hwid_bundle_zgb.sh
        --firmware_updater none
        --detect_release_image

     2. BOARD=x86-zgb ./make_factory_package.sh --config mp_factory.conf

Change-Id: I3435f3afbf40ec3b8bd02a3514f599a7a535510e
Reviewed-on: http://gerrit.chromium.org/gerrit/7473
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-09-09 09:23:26 -07:00
Hung-Te Lin
8dd73fc105 make_factory_package.sh: force assigning --hwid and --firmware.
The --hwid and --firmware should be assigned with real files by default.

BUG=chromium-os:16751
TEST=./make_factory_package.sh --release RELEASE --factory FACTORY # see error
     ./make_factory_package.sh --help # see hints to 'none'
     ./make_factory_package.sh --release RELEASE --factory FACTORY \
       --hwid HWID --firmware FIRMWARE # see mini-omaha configured correctly

Change-Id: Ib797cd66e864bd2105622c989b4b03443f361a69
Reviewed-on: http://gerrit.chromium.org/gerrit/6461
Reviewed-by: Tammo Spalink <tammo@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-22 20:21:46 -07:00
Hung-Te Lin
eef76808c6 crosutils: support recovery image as release image param for make_factory_package
This CL makes --usbimg (RMA shim mode) supporting recovery image as --release
image source, by creating a temporary disk image.

BUG=chromium-os:15050
TEST=./make_factory_package.sh ... --release RECOVERY_IMAGE --usbimg rma.bin

Change-Id: I5295053ac204869616fc82e2c7a514506082426f
Reviewed-on: http://gerrit.chromium.org/gerrit/5982
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-15 21:58:36 -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
7d164d20fc crosutils: clean up make_factory_package
This is part of clean-up in factory related scripts.

Calling mk_memento_images does not need sudo, and some pushd can be removed
because most operations take full path now.

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

Change-Id: I323c9abbc4a98b22736c755669f8ecd18b05cfd5
Reviewed-on: http://gerrit.chromium.org/gerrit/5964
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-14 23:33:17 -07:00
Hung-Te Lin
6e885f2e84 make_factory_package: always require partition tools (cgpt or parted)
When there're more and more advanced features landed into make_factory_package,
supporting the "unpacked mode" (use unpack_partition.sh to extract all
partitions) becomes a problem.

cgpt is mandatory in chroot, and parted is installed by default for most Linux
distributions, so I think it may be safe now to force using partition tools,
which is also more robust than unpack_partition.

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

Change-Id: I865aebdf3ce2cbd21b0fe22fdce8612810ee78f7
Reviewed-on: http://gerrit.chromium.org/gerrit/5963
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-08-14 23:33:04 -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
1926874a19 make_factory_package: support --firmware in RMA (--usbimg) mode
Support using --firmware in RMA (usbimg) mode.
The firmware updater will be copied into partition 1 (statefu-partition) on RMA
shim.

BUG=chrome-os-partner:5000
TEST=./make_factory_package.sh --release RELEASE.bin --factory FACTORY.bin \
    --install FACTORY_INSTALLER.bin --firmware FIRMWAREUPDATER \
    --usbimg rma_image.bin
    # Then, mount partition 1 in rma_image.bin, find "chromeos-firmwareupdate"
    # file. Also a # "FACTORY_INSTALL_FIRMWARE=/mnt/stateful_partition/chromeos-firmwareupdate"
    # entry is found in dev_image/etc/lsb-factory file.

Change-Id: Id77ab7c8faa5f8e646a07c319d496947949ffa63
Reviewed-on: http://gerrit.chromium.org/gerrit/4637
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-07-31 19:28:52 -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
Hung-Te Lin
10d572f8c8 make_factory_package: add --usbimg for USB installation images
To make "USB installation image" (useful for RMA images), make_factory_package
now supports --usbimg and --install_shim for the new type of image.

Some internal refactoring is also included in this CL to ease adding new
generation methods.

BUG=chrome-os-partner:4108
TEST=make_factory_package --usbimg rma.bin --factory PATH_TO_FACTORY \
     --release PATH_TO_RELEASE --install PATH_TO_INSTALL_SHIM
     # then turn on developer switch, hold recovery button to boot by the
     # rma.bin. Seeing installation from USB works fine.

Change-Id: I65789bfea92cf04e89ea2b3319fc9beb59a17bd8
Reviewed-on: http://gerrit.chromium.org/gerrit/4026
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-07-14 19:03:45 -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
Tom Wai-Hong Tam
06165e0880 Add complete script channel in make_factory_package.sh
A new parameter --complete_script is added a script to support the last-step
execution of factory install. This script is supported by a separated channel
in mini-omaha server.

BUG=chrome-os-partner:4229
TEST=./make_factory_package --release RELEASE --factory FACTORY \
  --firmware FIRMWARE --complete complete.sh # success
$ cat ../platform/dev/miniomaha.conf
config = [
{
   'qual_ids': set(["tegra2_kaen"]),
   'factory_image': 'rootfs-test.gz',
   'factory_checksum': 'jNk+g6VurGVmnW7kehvIK1gpkjw=',
   'release_image': 'rootfs-release.gz',
   'release_checksum': 'vkds6CqN8M+gTofM8VFefeG2o1Y=',
   'oempartitionimg_image': 'oem.gz',
   'oempartitionimg_checksum': '8ED3wHGIrxy/g81StZhJvHy7fJA=',
   'efipartitionimg_image': 'efi.gz',
   'efipartitionimg_checksum': 'eyoAysb4WkLmKagb515mlM3jhts=',
   'stateimg_image': 'state.gz',
   'stateimg_checksum': 'MD7X6Yc5Gipkqt3i7jMn5hoWBvM=',
   'firmware_image': 'firmware.gz',
   'firmware_checksum': 'yAdtPbG7vjwsCPO6AUJ+fyw8z78=',
   'complete_image': 'complete.gz',
   'complete_checksum': '8Nq3fhtK+mTZk3PkaVS47tqEHCI=',
 },
]
$ ls -l ../platform/dev/static/
total 473828
drwxr-xr-x 2 waihong eng       4096 May  5 15:43 cache/
-rw-r--r-- 1 waihong eng         56 Jun  2 17:25 complete.gz
-rw-r--r-- 1 waihong eng      26606 Jun  2 17:25 efi.gz
-rw-r--r-- 1 waihong eng     827934 Jun  2 17:25 firmware.gz
-rw-r--r-- 1 waihong eng      26125 Jun  2 17:25 oem.gz
lrwxrwxrwx 1 waihong eng          6 May  5 11:35 pkgroot -> /build
-rw-rw-rw- 1 root    root 222747636 Jun  2 17:25 rootfs-release.gz
-rw-rw-rw- 1 root    root 222767859 Jun  2 17:25 rootfs-test.gz
-rw-r--r-- 1 waihong eng   38284201 Jun  2 17:25 state.gz

Change-Id: I3ab36835c3d1cd564429d6d646dca80501986b14
Reviewed-on: http://gerrit.chromium.org/gerrit/2026
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Tom Wai-Hong Tam <waihong@chromium.org>
2011-06-03 01:31:33 -07:00
Hung-Te Lin
fbc89da362 crosutils: add --hwid_updater in make_factory_package.sh
A new parameter --hwid_updater is added to support updating
HWID component list by mini-omaha server.

BUG=chrome-os-partner:4276
TEST=./make_factory_package --release RELEASE --factory FACTORY \
     --firmware FIRMWARE --hwid hwid_updater.sh # success

Change-Id: I5889bf63545f0ed118320b60963e22ebc00c76f7
Reviewed-on: http://gerrit.chromium.org/gerrit/1826
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-06-01 21:26:46 -07:00
Zdenek Behan
aabded5941 make_factory_package: allow calling from outside the chroot
As documented by the developer workflow, this script need to be
called from outside the chroot. This adds a temporary reference to
the new location of chromeos-common.sh, unbreaking the factory
workflow, and giving us time to come up with a better solution.

TEST=run inside the chroot and outside the chroot
BUG=chromium-os:11769

Change-Id: Icb90211111629ed037bc40682a94200d949050e0

Review URL: http://codereview.chromium.org/6462007
2011-02-09 01:16:04 +01: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
2a517638ef Add legacy fixup for diskimg
make_factory_package.sh --diskimg can now boot on H2O bios.

BUG=chromeium-os:10915
TEST=boots

Change-Id: I8358247e475fa2d4298e225fa9445b00e4dad253

Review URL: http://codereview.chromium.org/6296001
(cherry picked from commit 10418cc13c298f3514fdc5898655132cb9b09037)

Review URL: http://codereview.chromium.org/6278003
2011-01-18 22:20:03 -08: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
Hung-Te Lin
c584cf0e95 crosutils/make_factory_package.sh: Support relative path
Since there's a pushd call when building images, we have to first retrieve
the complete (full/absolute) path of target disk image.

BUG=chromium-os:10706
TEST=make_factory_package.sh \
     --factory ../build/images/x86-mario/latest/factory_image.bin \
     --release ../build/images/x86-mario/latest/chromiumos_image.bin \
     --diskimg blah_relative.bin

Change-Id: I02e2edb0f76b724337a82dd400297877681bc338

Review URL: http://codereview.chromium.org/6244003
2011-01-13 15:34:59 +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
Kris Rambish
43c22803a1 Make removing the last ] more full-proof
Make removal of last ] more full-proof

Change-Id: I002e5ed513066a214fd6353f66e05bf5458f6ad4

BUG=7115
TEST= No file, with --subfolder
  No file, without --subfolder
  Empty file
  File with one config already in it, with --subfolder
  File with one config and garbage at the end, with --subfolder
  File with one config and newlines at the end, with --subfolder
  File with one config, without subfolder

Review URL: http://codereview.chromium.org/4688004
2010-11-15 11:26:22 -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
Hung-Te Lin
51484a96e9 crosutils: refine memento image / factory package creation
This CL improves creation of memento / factory image payload by:
 - verbose progress report
 - allowing to compress by pigz, the parallel version of gzip
 - prevents unpacking entire image if partition tools (cgpt/parted)
   is available.

BUG=chromium-os:6536,chromium-os:5208
TEST=Verified executing "time ./make_factory_package.sh ..." for ToT factory bundle:
 - before this CL (memento gzip param is not -9): 3m53.126s
 - after this CL, without pigz, with cgpt: 2m34.897s
 - after this CL, with pigz+cgpt, memento_gz=-9: 0m45.603s
 - after this CL, with pigz, without cgpt/parted, memento_gz=-9: 1m49.748s
 Also verified such bundle can be installed on a real netbook device.

Change-Id: Ie182844ea5482d6d321b9549fa584377edf7dfe3

Review URL: http://codereview.chromium.org/4824003
2010-11-13 02:43:14 +08:00
Huyen Nguyen
1330edb593 Fix bug where square bracket is not removed before appending new rule.
Change-Id: I5618b211abd69b4e3774fa6e4009183ef996a8d8

BUG=8815
TEST=run locally

Review URL: http://codereview.chromium.org/4498004
2010-11-05 16:15:46 -07:00
Huyen Nguyen
41a2b700a2 Fix bug where subfolder is not add to path of firmware.
Change-Id: I5521baa3a2b176167f827034166ffcd443a6a793

BUG=8711
TEST=run locally

Review URL: http://codereview.chromium.org/4413004
2010-11-04 12:40:28 -07:00
Kris Rambish
d07981d619 Adding append to make_factory_package
Change-Id: I37f0c93d1285c27731b58a977b91aa85f4fb2e63

BUG=7115
TEST=

Review URL: http://codereview.chromium.org/4006003
2010-10-22 15:32:28 -07:00
Nick Sanders
bfbb74f667 allow firmware fetch
Review URL: http://codereview.chromium.org/3013066
2010-08-09 12:14:56 -07:00
Nick Sanders
ec29805fde Fix firmware packaging
BUG=none
TEST="run make_factory_package.sh --factory=X --release=X, doesn't crash"

Review URL: http://codereview.chromium.org/2858021
2010-06-21 21:52:43 -07:00
Tom Wai-Hong Tam
fe3d8268f9 Pack firmware into an image and do update in factory install (separated git).
Since different platforms have different instructions to update their firmware.
In order not to depend on the install shim, we pack all firmware update files
into a single file, i.e. an executable shell script with embedded files.

The original CL (http://codereview.chromium.org/2366001) is reviewed and is
broken down into 5 CLs. This is one of them.

Review URL: http://codereview.chromium.org/2792013
2010-06-14 09:55:41 +08:00
Nick Sanders
7c982f7398 Update factory installer, factory test
* Fix build breaks
* Update to work with EFI bios

Review URL: http://codereview.chromium.org/2132008
2010-05-19 22:17:08 -07:00