mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-11 15:06:58 +02:00
Allow build of shim
BUG=4547 TEST="run archive build" Change-Id: I716fbd2f648b8e5137ee515aaed7be89a6af8f37 Review URL: http://codereview.chromium.org/3828015
This commit is contained in:
parent
f66c6d614e
commit
9a9ba1f769
@ -58,20 +58,26 @@ DEFAULT_USED=
|
|||||||
# Reset "default" FLAGS_from based on passed-in board if not set on cmd-line
|
# Reset "default" FLAGS_from based on passed-in board if not set on cmd-line
|
||||||
if [ "$FLAGS_from" = "$DEFAULT_FROM" ]
|
if [ "$FLAGS_from" = "$DEFAULT_FROM" ]
|
||||||
then
|
then
|
||||||
FLAGS_from="${IMAGES_DIR}/$FLAGS_board/$(ls -t1 \
|
# Keep the directory name of the current image set (*.bin).
|
||||||
$IMAGES_DIR/$FLAGS_board 2>&-| head -1)"
|
IMG_DIR="$(ls -t1 ${IMAGES_DIR}/${FLAGS_board} 2>&-| head -1)"
|
||||||
|
FLAGS_from="${IMAGES_DIR}/${FLAGS_board}/${IMG_DIR}"
|
||||||
DEFAULT_USED=1
|
DEFAULT_USED=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Die on any errors.
|
# Die on any errors.
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ -z $DEFAULT_USED ] && [ $FLAGS_test_mod -eq $FLAGS_TRUE ]
|
if [ -z $DEFAULT_USED ]
|
||||||
then
|
then
|
||||||
|
if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] || \
|
||||||
|
[ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ] || \
|
||||||
|
[ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ]
|
||||||
|
then
|
||||||
echo "test_mod requires that the default from path be used."
|
echo "test_mod requires that the default from path be used."
|
||||||
echo "If non default behavior is desired, run mod_image_for_test manually"
|
echo "If non default behavior is desired, run mod_image_for_test manually"
|
||||||
echo "re-run archive build without test_mod"
|
echo "re-run archive build without test_mod"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d "$FLAGS_from" ]
|
if [ ! -d "$FLAGS_from" ]
|
||||||
@ -152,13 +158,6 @@ then
|
|||||||
"--factory"
|
"--factory"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
|
|
||||||
then
|
|
||||||
echo "Modifying image for factory install"
|
|
||||||
do_chroot_mod "${FLAGS_from}/chromiumos_factory_install_image.bin" \
|
|
||||||
"--factory_install"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Modify for recovery
|
# Modify for recovery
|
||||||
if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
|
if [ $FLAGS_official_build -eq $FLAGS_TRUE ]
|
||||||
then
|
then
|
||||||
@ -173,6 +172,19 @@ if [ $FLAGS_test_mod -eq $FLAGS_TRUE ] ; then
|
|||||||
rm -f ${SRC_IMAGE}
|
rm -f ${SRC_IMAGE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build differently sized shims. Currently only factory install shim is
|
||||||
|
# supported, TODO(tgao): Add developer shim.
|
||||||
|
if [ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
|
||||||
|
then
|
||||||
|
echo "Building factory install shim."
|
||||||
|
./enter_chroot.sh -- ./build_image --board $FLAGS_board --factory_install
|
||||||
|
|
||||||
|
# Get the install shim dir: It is the newest build.
|
||||||
|
# This is the output dir for the factory shim, the factory test and
|
||||||
|
# release umages will remain in IMG_DIR, defined previously.
|
||||||
|
SHIM_DIR="$(ls -t1 $IMAGES_DIR/$FLAGS_board 2>&-| head -1)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Zip the build
|
# Zip the build
|
||||||
echo "Compressing and archiving build..."
|
echo "Compressing and archiving build..."
|
||||||
cd "$FLAGS_from"
|
cd "$FLAGS_from"
|
||||||
@ -182,8 +194,17 @@ zip -r "${ZIPFILE}" ${MANIFEST}
|
|||||||
if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \
|
if [ $FLAGS_factory_test_mod -eq $FLAGS_TRUE ] || \
|
||||||
[ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
|
[ $FLAGS_factory_install_mod -eq $FLAGS_TRUE ]
|
||||||
then
|
then
|
||||||
FACTORY_MANIFEST=`ls | grep factory`
|
# We need to have directory structure for factory package, as
|
||||||
zip -r "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST}
|
# signing and packaging utilities need unpack_partitions.sh.
|
||||||
|
echo "Compressing factory software"
|
||||||
|
pushd ..
|
||||||
|
[ -n "${SHIM_DIR}" ] && ln -sf "${SHIM_DIR}" factory_shim
|
||||||
|
[ -n "${IMG_DIR}" ] && ln -sf "${IMG_DIR}" factory_test
|
||||||
|
FACTORY_MANIFEST=`find factory_shim factory_test -follow \
|
||||||
|
-type f | grep -E "(factory_image|factory_install|partition)"`
|
||||||
|
zip "${FACTORY_ZIPFILE}" ${FACTORY_MANIFEST}
|
||||||
|
echo "Zipped"
|
||||||
|
popd
|
||||||
chmod 644 "${FACTORY_ZIPFILE}"
|
chmod 644 "${FACTORY_ZIPFILE}"
|
||||||
fi
|
fi
|
||||||
cd -
|
cd -
|
||||||
|
Loading…
Reference in New Issue
Block a user