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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
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
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
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
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
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
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
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