blob: cbe09092a805a764102da18387bcd604b8415809 [file] [log] [blame]
# /bin/bash
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Loads script libraries.
SCRIPT_ROOT=$(dirname "$(readlink -f "$0")")
. "${SCRIPT_ROOT}/common.sh" || exit 1
FLAGS_HELP="
Command to rebuild firmware after a config change.
After you make a change to the firmware version in the master configuration,
run this script to test it. It will rebuild the master configuration, update
the Manifest and build the new firmware. You can then submit your CL to update
the master configuration, safe in the knowledge that you have tested it.
Usage:
cros_update_firmware <board>
where <board> is the board whose firmware needs updating (e.g. 'coral').
"
# Script must be run inside the chroot.
restart_in_chroot_if_needed "$@"
# Flags
DEFINE_string board "${DEFAULT_BOARD}" "Which board the firmware is for" b
# Parse command line.
FLAGS "$@" || exit 1
eval set -- "${FLAGS_ARGV}"
switch_to_strict_mode
update_firmware() {
local board="$1"
local base ebuild
cros_workon --board="${board}" start chromeos-config-bsp \
"chromeos-firmware-${board}"
base="${GCLIENT_ROOT}/src/private-overlays/overlay-${board}-private/chromeos-base"
ebuild="${base}/chromeos-firmware-${board}/chromeos-firmware-${board}-9999.ebuild"
touch "${ebuild}"
"ebuild-${board}" "${ebuild}" manifest
"emerge-${board}" -q chromeos-config-bsp chromeos-config \
"chromeos-firmware-${board}"
}
main() {
if [[ -z "${FLAGS_board}" ]]; then
die_notrace "-b or --board required."
fi
update_firmware "${FLAGS_board}"
}
main "$@"