From fbc89da362c867ba37b6d21ec83cbf6cc2149251 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Tue, 31 May 2011 18:09:10 +0800 Subject: [PATCH] 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 Tested-by: Hung-Te Lin --- make_factory_package.sh | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/make_factory_package.sh b/make_factory_package.sh index 04366d79b1..30e244c61f 100755 --- a/make_factory_package.sh +++ b/make_factory_package.sh @@ -50,6 +50,8 @@ DEFINE_string factory "" \ "Directory and file containing factory image: /path/chromiumos_test_image.bin" DEFINE_string firmware_updater "" \ "If set, include the firmware shellball into the server configuration" +DEFINE_string hwid_updater "" \ + "If set, include the component list updater for HWID validation" DEFINE_string release "" \ "Directory and file containing release image: /path/chromiumos_image.bin" DEFINE_string subfolder "" \ @@ -80,6 +82,12 @@ if [ -n "${FLAGS_firmware_updater}" ] && exit 1 fi +if [ -n "${FLAGS_hwid_updater}" ] && + [ ! -f "${FLAGS_hwid_updater}" ]; then + echo "Cannot find HWID component list updater ${FLAGS_hwid_updater}" + exit 1 +fi + # Convert args to paths. Need eval to un-quote the string so that shell # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. OMAHA_DIR="${SRC_ROOT}/platform/dev" @@ -340,17 +348,18 @@ generate_omaha() { popd >/dev/null if [ -n "${FLAGS_firmware_updater}" ]; then - SHELLBALL="${FLAGS_firmware_updater}" - if [ ! -f "$SHELLBALL" ]; then - echo "Failed to find firmware updater: $SHELLBALL." - exit 1 - fi - - firmware_hash="$(compress_and_hash_file "$SHELLBALL" "firmware.gz")" + firmware_hash="$(compress_and_hash_file "${FLAGS_firmware_updater}" \ + "firmware.gz")" mv firmware.gz "${OMAHA_DATA_DIR}" echo "firmware: ${firmware_hash}" fi + if [ -n "${FLAGS_hwid_updater}" ]; then + hwid_hash="$(compress_and_hash_file "${FLAGS_hwid_updater}" "hwid.gz")" + mv hwid.gz "${OMAHA_DATA_DIR}" + echo "hwid: ${hwid_hash}" + fi + # If the file does exist and we are using the subfolder flag we are going to # append another config. if [ -n "${FLAGS_subfolder}" ] && @@ -404,6 +413,12 @@ generate_omaha() { 'firmware_checksum': '${firmware_hash}'," >>"${OMAHA_CONF}" fi + if [ -n "${FLAGS_hwid_updater}" ] ; then + echo -n " + 'hwid_image': '${subfolder}hwid.gz', + 'hwid_checksum': '${hwid_hash}'," >>"${OMAHA_CONF}" + fi + echo -n " }, ]