Commit Graph

46 Commits

Author SHA1 Message Date
Hung-Te Lin
19daeedb14 crosutils: move factory setup scripts to ../platform/factory-utils/factory_setup
This CL is the counter part of https://gerrit.chromium.org/gerrit/11190

For creating portable factory archives and simplify scripts folder, we should
move all factory scripts to a tandalone folder. Symlink is set to ease
transition until we've updated all factory documents.

archive_factory was designed for creating bundle so not required anymore.
make_universal_factory_shim and mk_memento_images are only invoked by
make_factory_packages, so they're also simply removed without symlinks.

BUG=chrome-os-partner:5979
TEST=./make_factory_package.sh --config PATH_TO_CONFIG # pass

Change-Id: I1489b012aaf1ade4a9ead91abbb7b625b967dc0f
Reviewed-on: https://gerrit.chromium.org/gerrit/10630
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Reviewed-by: Zdenek Behan <zbehan@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-11-08 23:09:11 -08:00
Hung-Te Lin
9cd98ea2dc make_factory_package: add --run_omaha to simplify factory setup flow
Adds a shortcut to start mini-omaha server directly.

BUG=chrome-os-partner:21512
TEST=./make_factory_package.sh --release RELEASE --factory FACTORY \
       --hwid none --run_omaha
     # omaha server starts after packages are prepared.
 ./make_factory_package.sh --config CONFIG --run_omaha # success

Change-Id: I444d63cb92e6360e0dd95e79153d10dd0f91d4b8
Reviewed-on: https://gerrit.chromium.org/gerrit/10622
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2011-10-26 21:06:58 -07:00
Hung-Te Lin
e7c2d1c82b make_factory_package: support using firmware updater from release rootfs
For most use case, we want to use the firmware updater from release image
rootfs. It'd be more convenient if make_factory_package extracts updater from
release image by default.

BUG=chromium-os:21512
TEST=./make_factory_package --release RELEASE --factory FACTORY --hwid none
     # success, seeing "firmware: XXXX" in output
     ./make_factory_package --release RELEASE --factory FACTORY --hwid none --firmware none
     # success, not seeing firmware in mini-omaha configuration
     ./make_factory_package --release RELEASE --factory FACTORY --hwid none --firmware FIRMWARE
     # success, seeing "firmware: XXXX" in mini-omaha configuration
     ./make_factory_package --release RELEASE --factory FACTORY --hwid none \
       --diskimg ssd.img
     # success, no firmware messages
     ./make_factory_package --release RELEASE --factory FACTORY --hwid none \
       --diskimg ssd.img --firmware FIRMWARE
     # failure as expected - firmware is not supported in --diskimg.

Change-Id: Ic368031a8a5ece89e3e7fd56e2ee4fd1143a67a7
Reviewed-on: https://gerrit.chromium.org/gerrit/10561
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2011-10-26 20:25:20 -07:00
Hung-Te Lin
4c90853861 make_factory_package.sh: fix --diskimg for ARM images
Legacy boot loader like syslinux is only for x86 platforms.
We should ignore the configuration files if they don't exist.

BUG=chromium-os:21887
TEST=./make_factory_package --diskimg OUTPUT \
     --release PATH_TO_ARM_IMAGE \
     --factory PATH_TO_ARM_IMAGE \
     --hwid none  # success
     # do the same for x86 builds, mount ESP (#12)
     # and found 'sda3' in root.A.cfg

Change-Id: I53a8b418045465a69d700298b73793d60187f31a
Reviewed-on: http://gerrit.chromium.org/gerrit/10385
Reviewed-by: Tammo Spalink <tammo@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-10-20 01:45:19 -07:00
Chinyue Chen
342dbdaf10 Escape open bracket when parsing config file.
Section header like [x86-zgb] would match any single-character
file/directory name within 6-z. Escape open brackets to prevent
config section headers from being evaluated to match local files.

BUG=chromium-os:21518
TEST=1. Create a single-character file 'u', under the same
        directory where you'll run make_factory_package.
     2. Create a test.conf with section header "x86-zgb".
     3. ./make_factory_package.sh --config test.conf
     4. Verify u is not part of the executed command.

Change-Id: Ia6178b7fc2f8d707830ee7fed54f9e5ab60d6836
Reviewed-on: http://gerrit.chromium.org/gerrit/10012
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Chinyue Chen <chinyue@chromium.org>
2011-10-13 18:14:44 -07:00
Hung-Te Lin
4474c15e7b crosutils: comments for environment variables in make_factory_package
To help developers knowing the proper usage of such command.

BUG=none
TEST=./make_factory_package --help

Change-Id: I5a5d0efd215d0239bd56830165f0a057ad7c7474
Reviewed-on: http://gerrit.chromium.org/gerrit/9707
Reviewed-by: Tammo Spalink <tammo@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2011-10-11 02:12:45 -07:00
Hung-Te Lin
abfb85f6b2 make_factory_package: sudo if --diskimg is a block device
Usually make_factory_package operates with normal files that does not need root
permission - except if output is a block device.

This CL tries to grant root permission by sudo if a block device is assigned to
--diskimg.

BUG=chrome-os-partner:2827
TEST=(as normal user) ./make_factory_acpakge --factory FACTORY \
     --release RELEASE --hwid none --diskimg /dev/sde  # completed

Change-Id: Ie1285e6b6f46f1af286e795a02a83294fce4eeaa
Reviewed-on: http://gerrit.chromium.org/gerrit/8789
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Tammo Spalink <tammo@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Ready: Hung-Te Lin <hungte@chromium.org>
2011-10-11 02:12:31 -07:00
Hung-Te Lin
17eeff6fcb crosutils: add boilerplate comments for factory scripts
Adding boilerplate comments for factory scripts that may be executed inside
CrOS source tree or a limited factory bundle extraction.

BUG=chrome-os-partner:5979
TEST=none, only comment update

Change-Id: Ifd5b07e9d44f4ce74073e5e32370040d2d6728d8
Reviewed-on: http://gerrit.chromium.org/gerrit/7908
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Tested-by: Hung-Te Lin <hungte@chromium.org>
2011-09-19 00:44:48 -07:00
Hung-Te Lin
ab4c4e1c69 crosutils: Revert "crosutils: refine make_factory_package"
This partially reverts commit cfc4720c28
( http://gerrit.chromium.org/gerrit/7904 )

Currently we store the hash generated by compress_and_hash_memento_image in a
shell variable, and sub shell "(cmd)" can't export the variables. It would
require more rewriting of scripts to fix this issue, so let's first revert it.

BUG=chrome-os-partner:5979
TEST=./make_factory_package --config config/mp_factory.config
     cd ../platform/dev; python deverserver.py --factory_config mini_omaha.conf
     # then start whole factory installation process on DUT, and passed.

Change-Id: I1c7d8de61427733b1dff61dcd7e1c01fea7c4de6
Reviewed-on: http://gerrit.chromium.org/gerrit/7916
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Tammo Spalink <tammo@chromium.org>
2011-09-19 00:32:12 -07:00
Hung-Te Lin
545dc57e97 crosutils: allow factory scripts to be executed in a limited bundle environment
This CL allows factory related scripts to be executed in a prepared and limited
environment which can be made by extracting a factory bundle:
 - always load scripts from $SCRIPT_ROOT
 - allow running bundled binary programs from $SCRIPT_ROOT/../bin
 - override GCLIENT_ROOT for the layout of a bundle

BUG=chrome-os-partner:5979
TEST=(outside cros environment)
     ./make_factory_package --config mp_factory.conf  # test omaha
     ./make_factory_package --config rma.conf  # test --usbimg
     ./make_factory_package --config mp_ssd.conf  # test --diskimg

Change-Id: Ibf85fa267f6fe53ae88e41fd7f62ef7110b2b0bf
Reviewed-on: http://gerrit.chromium.org/gerrit/7905
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-09-18 21:24:11 -07:00
Hung-Te Lin
cfc4720c28 crosutils: refine make_factory_package
Change non-posix pushd and popd into posix sub commands.
Added a check of --board to be non-zero for omaha setup.

BUG=chrome-os-partner:5979
TEST=./make_factory_package.sh --config bundle/mp_factory.conf

Change-Id: I1aa847ae2df28460319ca0b574ca4921993e41e1
Reviewed-on: http://gerrit.chromium.org/gerrit/7904
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-09-18 21:02:13 -07:00
Hung-Te Lin
882cae5df4 crosutils: Revert "Cache sudo in make_factory_package"
This reverts commit 0126898d23.

When "sudo -v" is executed inside chroot, it prompts for password; however the
user account inside chroot may be using a different password (ex, "chronos")
from the same account outside chroot.  The /etc/sudoers file inside chroot has
explicitly specified "userid ALL=NOPASSWD: ALL" for the account, so we should
keep doing nothing inside chroot.

BUG=chrome-os-partner:2827
TEST=(inside chroot) ./make_factory_package --release ...... # success

Change-Id: Ibadd5d539df83d70aba0daabc40bb9edba842f07
Reviewed-on: http://gerrit.chromium.org/gerrit/7847
Tested-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
2011-09-16 06:14:51 -07:00
Chinyue Chen
af9c1d9463 Make the path and folder of config file available when parsing config.
The path and folder of config file is available as env variables and can
be used to reference images and updater scripts in config file.

BUG=chrome-os-partner:5850
TEST=1. Create a config file (mp_factory.conf) under src/mp_bundle with
        the following content:

        [x86-zgb]
        --factory ${MFP_CONFIG_DIR}/../build/images/${BOARD}/latest/chromiumos_factory_image.bin
        --release ${MFP_CONFIG_DIR}/../build/images/${BOARD}/latest/[Cc]hromiumos_image.bin
        --hwid_updater ${MFP_CONFIG_DIR}/../platform/[Cc]hromeos-hwid/hwid_bundle_zgb.sh
        --firmware_updater none
        --detect_release_image  # Comment.

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

     2. Under src, execute
        BOARD=x86-zgb scripts/make_factory_package.sh --config mp_bundle/mp_factory.conf

Change-Id: I3c9693febe1f7f1efc92ab845d63226911114031
Reviewed-on: http://gerrit.chromium.org/gerrit/7764
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-09-15 08:21:09 -07:00
Chinyue Chen
8e6b452f4e Fix config file section header regex.
Fix section header regex so that bracket expansion syntax won't be
recognized as section header. The only requirement is that section
header must start at the beginning of a line.

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/[Cc]hromiumos_image.bin
        --hwid_updater ~/trunk/src/platform/[Cc]hromeos-hwid/hwid_bundle_zgb.sh
        --firmware_updater none
        --detect_release_image  # Comment.

        # More comments.
        [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: I4d1475a5e513e7e0e06a5c3c6d46d13e2120668c
Reviewed-on: http://gerrit.chromium.org/gerrit/7698
Tested-by: Chinyue Chen <chinyue@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
2011-09-14 05:59:32 -07:00
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