Add ability to pass in specific images you want built rather than use flags.

This CL does two things.

First it introduces an argument interface that works with all the following
combinations:

factory_install | [base|dev[test|factory_test]] rather than use --test etc.

This does not build extra images.  If you just want a test image you can
run build_image --board=<board> test and all that's in your latest_dir is
chromiumos_test_image.bin.

Second, we only build what we ask and only finalize what we ask so on
an invocation of build_image test we only actually run cros_make_image_bootable
once saving 2 minutes on my machine (from 6:50->4:50 on multiple iterations).

BUG=chromium-os:22048
TEST=build_image test, all possible combinations of args through to start of
build.  Built factory_install using new and old methods and dev test with both
methods.  Also verified mod_image_for_test still works as advertises stand-alone.

Change-Id: I9fe2feb50a941c007214decd9ba1627012c050af
Reviewed-on: https://gerrit.chromium.org/gerrit/10621
Commit-Ready: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
This commit is contained in:
Chris Sosa 2011-10-25 03:07:23 +00:00 committed by Gerrit
parent 9cd98ea2dc
commit b0f5732449
7 changed files with 221 additions and 118 deletions

View File

@ -96,41 +96,7 @@ OVERLAY_CHROMEOS_DIR="${SRC_ROOT}/third_party/chromiumos-overlay/chromeos"
. "${BUILD_LIBRARY_DIR}/test_image_util.sh" || exit 1
. "${BUILD_LIBRARY_DIR}/test_image_content.sh" || exit 1
# Look at flags to determine which image types we should build
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --factory and --factory_install cannot both be \
set to True. Resetting --factory to False."
FLAGS_factory=${FLAGS_FALSE}
fi
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --test and --factory_install cannot both be \
set to True. Resetting --test to False."
FLAGS_test=${FLAGS_FALSE}
fi
# Disable --withdev flag when --factory_install is set to True. Otherwise, the
# dev image produced will be based on install shim, rather than a pristine
# image
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --withdev and --factory_install cannot both be \
set to True. Resetting --withdev to False."
FLAGS_withdev=${FLAGS_FALSE}
fi
fi
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then
info "Incompatible flags: --factory implies --test. Resetting --test to \
True."
FLAGS_test=${FLAGS_TRUE}
fi
fi
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then
info "Incompatible flags: --test implies --withdev. Resetting --withdev \
to True."
FLAGS_withdev=${FLAGS_TRUE}
fi
fi
parse_build_image_args
# Tweak flags for factory install.
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
@ -156,25 +122,17 @@ fi
# If we are creating a developer image, also create a pristine image with a
# different name.
# TODO(vlaviano): fix all image names to match those in uploaded archive
DEVELOPER_IMAGE_NAME=
PRISTINE_IMAGE_NAME=chromiumos_image.bin
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
PRISTINE_IMAGE_NAME=chromiumos_base_image.bin
DEVELOPER_IMAGE_NAME=chromiumos_image.bin
# Rename pristine image for factory install shim
PRISTINE_IMAGE_NAME=${CHROMEOS_BASE_IMAGE_NAME}
# Rename pristine image for factory install shim.
elif [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
PRISTINE_IMAGE_NAME=factory_install_shim.bin
PRISTINE_IMAGE_NAME=${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}
fi
PRISTINE_IMG="${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}"
DEVELOPER_IMG="${OUTPUT_DIR}/${DEVELOPER_IMAGE_NAME}"
TEST_IMG="${OUTPUT_DIR}/${CHROMEOS_TEST_IMAGE_NAME}"
FACTORY_IMG="${OUTPUT_DIR}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
ROOT_FS_DIR="${OUTPUT_DIR}/rootfs"
STATEFUL_FS_DIR="${OUTPUT_DIR}/stateful_partition"
ESP_FS_DIR=${OUTPUT_DIR}/esp
ROOT_FS_DIR="${BUILD_DIR}/rootfs"
STATEFUL_FS_DIR="${BUILD_DIR}/stateful_partition"
ESP_FS_DIR=${BUILD_DIR}/esp
DEVKEYSDIR="/usr/share/vboot/devkeys"
@ -196,19 +154,18 @@ PACKAGES_FILE="${BOARD_ROOT}/packages/Packages"
sudo sed -e "s/CHOST: x86_64-pc-linux-gnu//" -i "${PACKAGES_FILE}"
# Handle existing directory.
if [[ -e "${OUTPUT_DIR}" ]]; then
if [[ -e "${BUILD_DIR}" ]]; then
if [[ ${FLAGS_replace} -eq ${FLAGS_TRUE} ]]; then
sudo rm -rf "${OUTPUT_DIR}"
sudo rm -rf "${BUILD_DIR}"
else
echo "Directory ${OUTPUT_DIR} already exists."
echo "Use --build_attempt option to specify an unused attempt."
echo "Or use --replace if you want to overwrite this directory."
exit 1
error "Directory ${BUILD_DIR} already exists."
error "Use --build_attempt option to specify an unused attempt."
die "Or use --replace if you want to overwrite this directory."
fi
fi
# Create the output directory and temporary mount points.
mkdir -p "${OUTPUT_DIR}"
mkdir -p "${BUILD_DIR}"
mkdir -p "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}"
# Create the boot.desc file which stores the build-time configuration
@ -216,7 +173,7 @@ mkdir -p "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}"
# cros_make_image_bootable.
create_boot_desc
create_base_image "$PRISTINE_IMAGE_NAME"
create_base_image ${PRISTINE_IMAGE_NAME}
BOOT_FLAG=
@ -226,23 +183,26 @@ if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
load_kernel_test"
fi
# Verify the final image.
load_kernel_test "${OUTPUT_DIR}/${PRISTINE_IMAGE_NAME}" \
"${DEVKEYSDIR}/recovery_key.vbpubk" ${BOOT_FLAG}
# Verify pristine image if we built it.
if should_build_image "${PRISTINE_IMAGE_NAME}"; then
load_kernel_test "${BUILD_DIR}/${PRISTINE_IMAGE_NAME}" \
"${DEVKEYSDIR}/recovery_key.vbpubk" ${BOOT_FLAG}
fi
# Create a developer image based on the chromium os base image.
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
copy_image "$PRISTINE_IMG" "$DEVELOPER_IMG"
install_dev_packages "$DEVELOPER_IMAGE_NAME"
copy_image ${CHROMEOS_BASE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME}
install_dev_packages ${CHROMEOS_DEVELOPER_IMAGE_NAME}
fi
# Create a test or factory test image if desired
# Create a test or factory test image if desired.
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
copy_image "$DEVELOPER_IMG" "$FACTORY_IMG"
mod_image_for_test "${FACTORY_IMG}"
copy_image ${CHROMEOS_DEVELOPER_IMAGE_NAME} \
${CHROMEOS_FACTORY_TEST_IMAGE_NAME}
mod_image_for_test ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}
elif [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
copy_image "$DEVELOPER_IMG" "$TEST_IMG"
mod_image_for_test "${TEST_IMG}"
copy_image ${CHROMEOS_DEVELOPER_IMAGE_NAME} ${CHROMEOS_TEST_IMAGE_NAME}
mod_image_for_test ${CHROMEOS_TEST_IMAGE_NAME}
fi
rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}"
@ -252,12 +212,12 @@ generate_au_zip || echo "Failed generating AU zip file - ignoring Error..."
# Create a named symlink.
LINK_NAME="${FLAGS_output_root}/${BOARD}/${FLAGS_symlink}"
ln -sfT $(basename ${OUTPUT_DIR}) ${LINK_NAME}
ln -sfT $(basename ${BUILD_DIR}) ${LINK_NAME}
echo "Done. Image created in ${OUTPUT_DIR}"
echo "Done. Image created in ${BUILD_DIR}"
echo "Chromium OS image created as ${PRISTINE_IMAGE_NAME}"
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
echo "Developer image created as ${DEVELOPER_IMAGE_NAME}"
echo "Developer image created as ${CHROMEOS_DEVELOPER_IMAGE_NAME}"
fi
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
echo "Factory test image created as ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"

View File

@ -31,9 +31,9 @@ fi
ROOT_LOOP_DEV=
STATEFUL_LOOP_DEV=
ROOT_FS_IMG="${OUTPUT_DIR}/rootfs.image"
STATEFUL_FS_IMG="${OUTPUT_DIR}/stateful_partition.image"
ESP_FS_IMG=${OUTPUT_DIR}/esp.image
ROOT_FS_IMG="${BUILD_DIR}/rootfs.image"
STATEFUL_FS_IMG="${BUILD_DIR}/stateful_partition.image"
ESP_FS_IMG=${BUILD_DIR}/esp.image
cleanup_rootfs_loop() {
sudo umount -d "${ROOT_FS_DIR}"
@ -72,6 +72,7 @@ zero_free_space() {
|| true ) 2>&1 | grep -v "No space left on device"
}
# Takes as an arg the name of the image to be created.
create_base_image() {
local image_name=$1
@ -250,7 +251,7 @@ ${BOARD} to update the version of libc installed on that board."
sudo umount -d "${ROOT_FS_DIR}"
# Create the GPT-formatted image.
build_gpt "${OUTPUT_DIR}/${image_name}" \
build_gpt "${BUILD_DIR}/${image_name}" \
"${ROOT_FS_IMG}" \
"${STATEFUL_FS_IMG}" \
"${ESP_FS_IMG}"
@ -259,7 +260,7 @@ ${BOARD} to update the version of libc installed on that board."
rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${ESP_FS_IMG}"
# Emit helpful scripts for testers, etc.
emit_gpt_scripts "${OUTPUT_DIR}/${image_name}" "${OUTPUT_DIR}"
emit_gpt_scripts "${BUILD_DIR}/${image_name}" "${BUILD_DIR}"
trap - EXIT
@ -268,8 +269,10 @@ ${BOARD} to update the version of libc installed on that board."
USE_DEV_KEYS="--use_dev_keys"
fi
# Place flags before positional args
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \
"${PRISTINE_IMAGE_NAME}" \
${USE_DEV_KEYS}
# Place flags before positional args.
if should_build_image ${image_name}; then
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${BUILD_DIR}" \
${image_name} \
${USE_DEV_KEYS}
fi
}

View File

@ -13,10 +13,121 @@
# Append build attempt to output directory.
IMAGE_SUBDIR="R${CHROME_BRANCH}-${CHROMEOS_VERSION_STRING}-a\
${FLAGS_build_attempt}"
OUTPUT_DIR="${FLAGS_output_root}/${BOARD}/${IMAGE_SUBDIR}"
BUILD_DIR="${FLAGS_output_root}/${BOARD}/${IMAGE_SUBDIR}"
OUTSIDE_OUTPUT_DIR="../build/images/${BOARD}/${IMAGE_SUBDIR}"
IMAGES_TO_BUILD=
# Populates list of IMAGES_TO_BUILD from args passed in.
# Arguments should be the shortnames of images we want to build.
get_images_to_build() {
local image_to_build
for image_to_build in $*; do
# Shflags leaves "'"s around ARGV.
case ${image_to_build} in
\'base\' )
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${CHROMEOS_BASE_IMAGE_NAME}"
;;
\'dev\' )
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${CHROMEOS_DEVELOPER_IMAGE_NAME}"
;;
\'test\' )
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${CHROMEOS_TEST_IMAGE_NAME}"
;;
\'factory_test\' )
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"
;;
\'factory_install\' )
IMAGES_TO_BUILD="${IMAGES_TO_BUILD} \
${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}"
;;
* )
die "${image_to_build} is not an image specification."
;;
esac
done
info "The following images will be built ${IMAGES_TO_BUILD}."
}
# Look at flags to determine which image types we should build.
parse_build_image_args() {
# If argv is specified, we use the new parsing method to determine exactly
# which images we need to build and the flags to set.
if [ -n "${FLAGS_ARGV}" ]; then
info "Ignoring image flags since image(s) in $FLAGS_ARGV specified."
get_images_to_build ${FLAGS_ARGV}
if should_build_image ${CHROMEOS_BASE_IMAGE_NAME}; then
FLAGS_factory_install=${FLAGS_FALSE}
fi
if should_build_image ${CHROMEOS_DEVELOPER_IMAGE_NAME}; then
FLAGS_withdev=${FLAGS_TRUE}
FLAGS_factory_install=${FLAGS_FALSE}
fi
if should_build_image ${CHROMEOS_TEST_IMAGE_NAME}; then
FLAGS_withdev=${FLAGS_TRUE}
FLAGS_test=${FLAGS_TRUE}
FLAGS_factory_install=${FLAGS_FALSE}
if should_build_image "${CHROMEOS_FACTORY_TEST_IMAGE_NAME}"; then
die "Cannot build both the test and factory_test images."
fi
fi
if should_build_image ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; then
FLAGS_withdev=${FLAGS_TRUE}
FLAGS_test=${FLAGS_FALSE}
FLAGS_factory=${FLAGS_TRUE}
FLAGS_factory_install=${FLAGS_FALSE}
fi
if should_build_image ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}; then
for image in ${CHROMEOS_BASE_IMAGE_NAME} ${CHROMEOS_DEVELOPER_IMAGE_NAME}\
${CHROMEOS_TEST_IMAGE_NAME} ${CHROMEOS_FACTORY_TEST_IMAGE_NAME}; do
should_build_image ${image} && die \
"Can't build both $image and ${CHROMEOS_FACTORY_INSTALL_SHIM_NAME}."
done
FLAGS_withdev=${FLAGS_FALSE}
FLAGS_test=${FLAGS_FALSE}
FLAGS_factory=${FLAGS_FALSE}
FLAGS_factory_install=${FLAGS_TRUE}
fi
else
# Legacy method for tweaking flags to do the right thing.
if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --factory and --factory_install cannot both \
be set to True. Resetting --factory to False."
FLAGS_factory=${FLAGS_FALSE}
fi
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --test and --factory_install cannot both be \
set to True. Resetting --test to False."
FLAGS_test=${FLAGS_FALSE}
fi
# Disable --withdev flag when --factory_install is set to True. Otherwise,
# the dev image produced will be based on install shim, rather than a
# pristine image.
if [ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]; then
info "Incompatible flags: --withdev and --factory_install cannot both \
be set to True. Resetting --withdev to False."
FLAGS_withdev=${FLAGS_FALSE}
fi
fi
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_test} -eq ${FLAGS_FALSE} ]; then
info "Incompatible flags: --factory implies --test. Resetting --test \
to True."
FLAGS_test=${FLAGS_TRUE}
fi
fi
if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ]; then
if [ ${FLAGS_withdev} -eq ${FLAGS_FALSE} ]; then
info "Incompatible flags: --test implies --withdev. Resetting \
--withdev to True."
FLAGS_withdev=${FLAGS_TRUE}
fi
fi
fi
}
check_blacklist() {
info "Verifying that the base image does not contain a blacklisted package."
info "Generating list of packages for chromeos-base/chromeos."
@ -51,7 +162,7 @@ create_boot_desc() {
fi
[ -z "${FLAGS_verity_salt}" ] && FLAGS_verity_salt=$(make_salt)
cat <<EOF > ${OUTPUT_DIR}/boot.desc
cat <<EOF > ${BUILD_DIR}/boot.desc
--arch="${ARCH}"
--boot_args="${FLAGS_boot_args}"
--rootfs_size="${FLAGS_rootfs_size}"
@ -81,17 +192,17 @@ delete_prompt() {
echo "Running in non-interactive mode so deleting output directory."
fi
if [ "${SURE}" == "y" ] ; then
sudo rm -rf "${OUTPUT_DIR}"
echo "Deleted ${OUTPUT_DIR}"
sudo rm -rf "${BUILD_DIR}"
echo "Deleted ${BUILD_DIR}"
else
echo "Not deleting ${OUTPUT_DIR}."
echo "Not deleting ${BUILD_DIR}."
fi
}
generate_au_zip () {
local lgenerateauzip="${BUILD_LIBRARY_DIR}/generate_au_zip.py"
local largs="-o ${OUTPUT_DIR}"
test ! -d "${OUTPUT_DIR}" && mkdir -p "${OUTPUT_DIR}"
local largs="-o ${BUILD_DIR}"
test ! -d "${BUILD_DIR}" && mkdir -p "${BUILD_DIR}"
info "Running ${lgenerateauzip} ${largs} for generating AU updater zip file"
$lgenerateauzip $largs
}

View File

@ -7,7 +7,8 @@
# library is 'install_dev_packages'.
# Modifies an existing image to add development packages
# Modifies an existing image to add development packages.
# Takes as an arg the name of the image to be created.
install_dev_packages() {
local image_name=$1
@ -15,7 +16,7 @@ install_dev_packages() {
trap "unmount_image ; delete_prompt" EXIT
mount_image "${OUTPUT_DIR}/${image_name}" "${ROOT_FS_DIR}" \
mount_image "${BUILD_DIR}/${image_name}" "${ROOT_FS_DIR}" \
"${STATEFUL_FS_DIR}" "${ESP_FS_DIR}"
# Determine the root dir for developer packages.
@ -92,7 +93,9 @@ install_dev_packages() {
unmount_image
trap - EXIT
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${OUTPUT_DIR}" \
"${DEVELOPER_IMAGE_NAME}" \
--force_developer_mode
if should_build_image ${image_name}; then
${SCRIPTS_DIR}/bin/cros_make_image_bootable "${BUILD_DIR}" \
${image_name} \
--force_developer_mode
fi
}

View File

@ -31,15 +31,18 @@ export INSTALL_MASK="${DEFAULT_INSTALL_MASK}"
# Utility function for creating a copy of an image prior to
# modification:
# $1: source image path
# $2: destination image path
# modification from the BUILD_DIR:
# $1: source filename
# $2: destination filename
copy_image() {
local src_base=$(basename "$1")
local dst_base=$(basename "$2")
echo "Creating $dst_base from $src_base..."
$COMMON_PV_CAT "$1" >"$2" ||
die "Cannot copy $src_base to $dst_base"
local src="${BUILD_DIR}/$1"
local dst="${BUILD_DIR}/$2"
if should_build_image $1; then
echo "Creating $2 from $1..."
$COMMON_PV_CAT "$src" >"$dst" || die "Cannot copy $1 to $2"
else
mv "${src}" "${dst}" || die "Cannot move $1 to $2"
fi
}
# Basic command to emerge binary packages into the target image.
@ -50,6 +53,22 @@ emerge_to_image() {
"$@" ${EMERGE_JOBS}
}
# Returns 0 if this image was requested to be built, 1 otherwise.
# $1 The name of the image to build.
should_build_image() {
# Fast pass back if we should build all incremental images.
local image_name=$1
local image_to_build
[ -z "${IMAGES_TO_BUILD}" ] && return 0
for image_to_build in ${IMAGES_TO_BUILD}; do
[ ${image_to_build} = ${image_name} ] && return 0
done
return 1
}
# ----
# From here down, the main exported function is
# 'mod_image_for_test'. The remainder of the code is not used
@ -110,15 +129,13 @@ install_autotest_for_factory() {
sudo chown -R 1000:1000 "${autotest_client}"
}
# convert a dev image into a test or factory test image
# Converts a dev image into a test or factory test image
# Takes as an arg the name of the image to be created.
mod_image_for_test () {
local test_pathname="$1"
local image_dir=$(dirname ${test_pathname})
local image_name=$(basename ${test_pathname})
local image_name="$1"
trap unmount_image EXIT
mount_image "${image_dir}/${image_name}" \
mount_image "${BUILD_DIR}/${image_name}" \
"${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}"
emerge_chromeos_test
@ -137,7 +154,7 @@ mod_image_for_test () {
if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then
emerge_to_image --root="${ROOT_FS_DIR}" factorytest-init
prepare_hwid_for_factory "${image_dir}"
prepare_hwid_for_factory "${BUILD_DIR}"
install_autotest_for_factory
local mod_factory_script
@ -153,8 +170,10 @@ mod_image_for_test () {
unmount_image
trap - EXIT
# Now make it bootable with the flags from build_image
"${SCRIPTS_DIR}/bin/cros_make_image_bootable" "${image_dir}" \
"${image_name}" \
--force_developer_mode
# Now make it bootable with the flags from build_image.
if should_build_image ${image_name}; then
"${SCRIPTS_DIR}/bin/cros_make_image_bootable" "${BUILD_DIR}" \
${image_name} \
--force_developer_mode
fi
}

View File

@ -148,11 +148,16 @@ DEFAULT_BOARD=$(echo $ALL_BOARDS | awk '{print $NF}')
# Enable --fast by default.
DEFAULT_FAST=${FLAGS_TRUE}
# Directory to store built images. Should be set by sourcing script when used.
BUILD_DIR=
# Standard filenames
CHROMEOS_BASE_IMAGE_NAME="chromiumos_base_image.bin"
CHROMEOS_IMAGE_NAME="chromiumos_image.bin"
CHROMEOS_DEVELOPER_IMAGE_NAME="chromiumos_image.bin"
CHROMEOS_TEST_IMAGE_NAME="chromiumos_test_image.bin"
CHROMEOS_FACTORY_TEST_IMAGE_NAME="chromiumos_factory_image.bin"
CHROMEOS_FACTORY_INSTALL_SHIM_NAME="factory_install_shim.bin"
# Directory locations inside the dev chroot
CHROOT_TRUNK_DIR="/home/$USER/trunk"

View File

@ -61,19 +61,21 @@ fi
# Turn path into an absolute path.
FLAGS_image=$(eval readlink -f "$FLAGS_image")
IMAGE_DIR=$(dirname "$FLAGS_image")
ROOT_FS_DIR="${IMAGE_DIR}/rootfs"
STATEFUL_FS_DIR="${IMAGE_DIR}/stateful_partition"
# Setting for build scripts.
BUILD_DIR="$(dirname "$FLAGS_image")"
ROOT_FS_DIR="${BUILD_DIR}/rootfs"
STATEFUL_FS_DIR="${BUILD_DIR}/stateful_partition"
# Copy the image to a test location if required
if [ $FLAGS_inplace -eq $FLAGS_FALSE ]; then
if [ $FLAGS_factory -eq $FLAGS_TRUE ]; then
TEST_PATHNAME="$IMAGE_DIR/$CHROMEOS_FACTORY_TEST_IMAGE_NAME"
TEST_PATHNAME="$BUILD_DIR/$CHROMEOS_FACTORY_TEST_IMAGE_NAME"
else
TEST_PATHNAME="$IMAGE_DIR/$CHROMEOS_TEST_IMAGE_NAME"
TEST_PATHNAME="$BUILD_DIR/$CHROMEOS_TEST_IMAGE_NAME"
fi
if [ ! -f "$TEST_PATHNAME" -o $FLAGS_force_copy -eq $FLAGS_TRUE ]; then
copy_image "$FLAGS_image" "$TEST_PATHNAME"
copy_image $(basename "$FLAGS_image") $(basename "$TEST_PATHNAME")
FLAGS_image="$TEST_PATHNAME"
else
echo "Using cached $(basename "$FLAGS_image")"
@ -102,6 +104,6 @@ else
echo "Modifying image $FLAGS_image for test..."
fi
mod_image_for_test "$FLAGS_image"
mod_image_for_test $(basename "$FLAGS_image")
print_time_elapsed