summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Fagerburg <pfagerburg@chromium.org>2019-12-20 12:46:50 -0700
committerPatrick Georgi <pgeorgi@google.com>2019-12-27 09:03:48 +0000
commit1fe7dcb047d157de79acafedaab0fe98408aeafc (patch)
tree6d56f533c2a16dae3934441620cba89731a4a12b
parentf71991edc33b5c292da454e68f19bb0c264c0ffe (diff)
downloadcoreboot-1fe7dcb047d157de79acafedaab0fe98408aeafc.tar.xz
util/mainboard/google: add support for Volteer
create_coreboot_variant.sh now supports the Volteer baseboard in addition to Hatch. The shell script and supporting python code are moved up one level, while retaining the ${BASE}/template/* file structure for each supported baseboard. kconfig.py has to add slightly different text to Kconfig.name depending on which baseboard is selected. BRANCH=None BUG=b:146646594 TEST=Create variants of Hatch and Volteer, check that the staged commits are correct. $ ./create_coreboot_variant.sh hatch sushi b:12345 src/mainboard/google/hatch/Kconfig and Kconfig.name will have new sections for SUSHI. src/mainboard/google/hatch/variants/sushi will have a copy of util/mainboard/google/hatch/template $ ./create_coreboot_variant.sh volteer ripto b:12345 src/mainboard/google/volteer/Kconfig and Kconfig.name will have new sections for RIPTO. src/mainboard/google/volteer/variants/ripto will have a copy of util/mainboard/google/volteer/template Also run the script with an existing board name to verify that you can't create a variant that already exists. Change-Id: I084b6c50bb76af0d11dc86a96b3c3c434569a0dd Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37878 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Marco Chen <marcochen@google.com>
-rwxr-xr-xutil/mainboard/google/create_coreboot_variant.sh (renamed from util/mainboard/google/hatch/create_coreboot_variant.sh)34
-rwxr-xr-xutil/mainboard/google/kconfig.py (renamed from util/mainboard/google/hatch/kconfig.py)45
-rw-r--r--util/mainboard/google/volteer/template/Makefile.inc13
3 files changed, 61 insertions, 31 deletions
diff --git a/util/mainboard/google/hatch/create_coreboot_variant.sh b/util/mainboard/google/create_coreboot_variant.sh
index beaf302580..14b2115d18 100755
--- a/util/mainboard/google/hatch/create_coreboot_variant.sh
+++ b/util/mainboard/google/create_coreboot_variant.sh
@@ -13,39 +13,37 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-VERSION="1.0.1"
+VERSION="1.0.2"
SCRIPT=$(basename -- "${0}")
export LC_ALL=C
-if [[ "$#" -lt 1 ]]; then
- echo "Usage: ${SCRIPT} variant_name [b:bug_number]"
- echo "e.g. ${SCRIPT} kohaku b:140261109"
+if [[ "$#" -lt 2 ]]; then
+ echo "Usage: ${SCRIPT} base_name variant_name [bug_number]"
+ echo "e.g. ${SCRIPT} hatch kohaku b:140261109"
echo "* Adds a new variant of the baseboard to Kconfig and Kconfig.name"
echo "* Copies the template files for the baseboard to the new variant"
exit 1
fi
-# Note that this script is specific to Hatch, and so it does not allow
-# you to specify the baseboard as one of the cmdline arguments.
-#
-# This is the name of the base board that we're cloning to make the variant.
-BASE="hatch"
+# This is the name of the base board that we're using to make the variant.
+# ${var,,} converts to all lowercase.
+BASE="${1,,}"
# This is the name of the variant that is being cloned.
# ${var,,} converts to all lowercase; ${var^^} is all uppercase.
-VARIANT="${1,,}"
+VARIANT="${2,,}"
VARIANT_UPPER="${VARIANT^^}"
-# Assign text for the "BUG=" part of the commit, or use "None" if that
-# parameter wasn't specified.
-BUG=${2:-None}
+# Assign BUG= text, or "None" if that parameter wasn't specified.
+BUG=${3:-None}
-# This script and the templates live in util/mainboard/google/hatch
-# We need to create files in src/mainboard/google/hatch
+# This script lives in util/mainboard/google
+# The template files are in util/mainboard/google/${BASE}/templates
+# We need to create files in src/mainboard/google/${BASE}/variants/${VARIANT}
pushd "${BASH_SOURCE%/*}" || exit 1
SRC=$(pwd)
popd || exit 1
-pushd "${SRC}/../../../../src/mainboard/google/${BASE}" || {
+pushd "${SRC}/../../../src/mainboard/google/${BASE}" || {
echo "The baseboard directory for ${BASE} does not exist.";
exit 1; }
@@ -62,12 +60,12 @@ git checkout -b "coreboot_${VARIANT}_${DATE}" || exit 1
# Copy the template tree to the target.
mkdir -p "variants/${VARIANT}/"
-cp -pr "${SRC}/template/." "variants/${VARIANT}/"
+cp -pr "${SRC}/${BASE}/template/." "variants/${VARIANT}/"
git add "variants/${VARIANT}/"
# Now add the new variant to Kconfig and Kconfig.name
# These files are in the current directory, e.g. src/mainboard/google/hatch
-"${SRC}/kconfig.py" --name "${VARIANT}"
+"${SRC}/kconfig.py" --board "${BASE}" --variant "${VARIANT}" || exit 1
mv Kconfig.new Kconfig
mv Kconfig.name.new Kconfig.name
diff --git a/util/mainboard/google/hatch/kconfig.py b/util/mainboard/google/kconfig.py
index f55ceb21e7..6f9fccf1e0 100755
--- a/util/mainboard/google/hatch/kconfig.py
+++ b/util/mainboard/google/kconfig.py
@@ -1,4 +1,5 @@
-#!/usr/bin/python3
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
"""Add a new variant to the Kconfig and Kconfig.name for the baseboard
To start a new variant of an existing baseboard, we need to add
@@ -26,18 +27,26 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
"""
+from __future__ import print_function
import argparse
+import sys
def main():
parser = argparse.ArgumentParser(
- description="Add strings to coreboot Kconfig for a new board variant")
- parser.add_argument('--name', type=str, required=True,
- help='Name of the board variant')
+ description='Add strings to coreboot Kconfig for a new board variant')
+ parser.add_argument('--board', type=str, required=True,
+ help='Name of the baseboard')
+ parser.add_argument('--variant', type=str, required=True,
+ help='Name of the board variant')
args = parser.parse_args()
- add_to_Kconfig(args.name)
- add_to_Kconfig_name(args.name)
+ if args.board not in ['hatch', 'volteer']:
+ print('Unsupported baseboard "' + args.board + '"')
+ sys.exit(1)
+
+ add_to_Kconfig(args.variant)
+ add_to_Kconfig_name(args.board, args.variant)
def add_to_Kconfig(variant_name):
@@ -49,7 +58,8 @@ def add_to_Kconfig(variant_name):
the blank line. The updated lines are written out to Kconfig.new in the
same directory as Kconfig.
- variant_name The name of the board variant, e.g. 'kohaku'"""
+ variant_name The name of the board variant, e.g. 'kohaku'
+ """
# These are the part of the strings that we'll add to the sections
BOARD = 'BOARD_GOOGLE_' + variant_name.upper()
lowercase = variant_name.lower()
@@ -85,13 +95,16 @@ def add_to_Kconfig(variant_name):
print(line, file=outfile)
-def add_to_Kconfig_name(variant_name):
+def add_to_Kconfig_name(baseboard_name, variant_name):
"""Add a config section for the variant to the Kconfig.name
Kconfig.name is easier to modify than Kconfig; it only has a block at
the end with the new variant's details.
- variant_name The name of the board variant, e.g. 'kohaku'"""
+ baseboard_name The name of the baseboard, e.g. 'hatch'
+ We expect the caller to have checked that it is one we support
+ variant_name The name of the board variant, e.g. 'kohaku'
+ """
# Board name for the config section
uppercase = variant_name.upper()
capitalized = variant_name.lower().capitalize()
@@ -106,10 +119,16 @@ def add_to_Kconfig_name(variant_name):
print(line, file=outfile)
# Now add the new section
- print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
- print('\tbool "-> ' + capitalized + '"', file=outfile)
- print('\tselect BOARD_GOOGLE_BASEBOARD_HATCH', file=outfile)
- print('\tselect BOARD_ROMSIZE_KB_16384', file=outfile)
+ if baseboard_name == 'hatch':
+ print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
+ print('\tbool "-> ' + capitalized + '"', file=outfile)
+ print('\tselect BOARD_GOOGLE_BASEBOARD_HATCH', file=outfile)
+ print('\tselect BOARD_ROMSIZE_KB_16384', file=outfile)
+
+ if baseboard_name == 'volteer':
+ print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
+ print('\tbool "-> ' + capitalized + '"', file=outfile)
+ print('\tselect BOARD_GOOGLE_BASEBOARD_VOLTEER', file=outfile)
if __name__ == '__main__':
diff --git a/util/mainboard/google/volteer/template/Makefile.inc b/util/mainboard/google/volteer/template/Makefile.inc
new file mode 100644
index 0000000000..38cf728d8f
--- /dev/null
+++ b/util/mainboard/google/volteer/template/Makefile.inc
@@ -0,0 +1,13 @@
+## This file is part of the coreboot project.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+
+SPD_SOURCES =