| #!/bin/bash |
| # Copyright 2020 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. |
| |
| VERSION="1.0.0" |
| SCRIPT=$(basename -- "${0}") |
| |
| export LC_ALL=C |
| |
| if [[ ! -e /etc/cros_chroot_version ]]; then |
| echo "This script must be run inside the chroot." |
| exit 1 |
| fi |
| |
| if [[ "$#" -lt 3 ]]; then |
| echo "Usage: ${SCRIPT} base_name reference_name variant_name [bug_number]" |
| echo "e.g. ${SCRIPT} hatch hatch kohaku b:140261109" |
| echo "e.g. ${SCRIPT} zork trembyle frobozz b:148161697" |
| echo "Copies the new coreboot configuation for the variant from" |
| echo "third_party/chromiumos-overlay to overlays" |
| exit 1 |
| fi |
| |
| # This is the name of the base board. |
| # ${var,,} converts to all lowercase. |
| BASE="${1,,}" |
| # This is the name of the reference board that we're using to make the variant. |
| # ${var,,} converts to all lowercase. |
| REFERENCE="${2,,}" |
| # This is the name of the variant that is being cloned. |
| VARIANT="${3,,}" |
| |
| # Assign BUG= text, or "None" if that parameter wasn't specified. |
| BUG=${4:-None} |
| |
| # For Zork, the new config file that is in |
| # third_party/chromiumos-overlay/sys-boot/coreboot/files/configs |
| # must also be copied to |
| # src/overlays/overlay-zork/sys-boot/coreboot-zork/files/configs |
| # and committed there as well. |
| |
| # Work in src/overlays/overlay-zork/sys-boot/coreboot-zork/files/configs |
| cd "${HOME}/trunk/src/overlays/overlay-${BASE}/sys-boot/coreboot-${BASE}/files/configs" || exit 1 |
| |
| # Start a branch. Use YMD timestamp to avoid collisions. |
| DATE=$(date +%Y%m%d) |
| repo start "create_${VARIANT}_${DATE}" . || exit 1 |
| # add_variant_to_yaml.sh will start a repo of the same name in this dir, |
| # but it will just harmlessly exit, so this is OK. |
| |
| cp "${HOME}/trunk/src/third_party/chromiumos-overlay/sys-boot/coreboot/files/configs/config.${VARIANT}" . |
| git add "config.${VARIANT}" |
| git commit -sm "${BASE}: Add ${VARIANT} coreboot configuration |
| |
| Create a new coreboot configuration for the ${VARIANT} variant |
| of the ${REFERENCE} reference board. The new configuration file is |
| a copy of the reference board, but the name of the baseboard is |
| replaced by the name of the variant where applicable. |
| |
| (Auto-Generated by ${SCRIPT} version ${VERSION}). |
| |
| BUG=${BUG} |
| BRANCH=none |
| TEST=FW_NAME=${VARIANT} emerge-${BASE} coreboot chromeos-bootimage |
| Ensure that image-${VARIANT}.*.bin are created" |
| |