diff options
author | Paul Fagerburg <pfagerburg@chromium.org> | 2019-08-23 11:22:14 -0600 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2019-09-19 09:37:12 +0000 |
commit | b4eb02aa8b9e7c479e8cb104197afd326c36f974 (patch) | |
tree | d539bc7cb26cf28ecd0e1c7b5a06525526464dcf /util/mainboard/google/hatch/create_coreboot_variant.sh | |
parent | db7906a57902e4a2a582308f0e2834d335c85805 (diff) |
hatch: automate creating a new variant in coreboot
To create a new variant of the hatch baseboard, we need to
add the variant's GBB_HWID and other information to Kconfig
and Kconfig.name, and set up a skeletal build based on the
hatch baseboard.
BUG=b:140261109
BRANCH=none
TEST=``./create_coreboot_variant.sh sushi && git show``
Kconfig will have three new lines for the SUSHI variant, and
Kconfig.name will have an entirely new section.
New files created are:
variants/sushi/Makefile.inc
variants/sushi/overridetree.cb
variants/sushi/include/ec.h
variants/sushi/include/gpio.h
variants/sushi/include/variant/acpi/dptf.asl
Also run the script with an existing board name to verify that you
can't create a variant that already exists.
Change-Id: I1a5b9c8735faafebb2e4e384cb3346867d64c556
Signed-off-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/35239
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'util/mainboard/google/hatch/create_coreboot_variant.sh')
-rwxr-xr-x | util/mainboard/google/hatch/create_coreboot_variant.sh | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/util/mainboard/google/hatch/create_coreboot_variant.sh b/util/mainboard/google/hatch/create_coreboot_variant.sh new file mode 100755 index 0000000000..32720ca54e --- /dev/null +++ b/util/mainboard/google/hatch/create_coreboot_variant.sh @@ -0,0 +1,78 @@ +#!/bin/bash +# +# This file is part of the coreboot project. +# +# Copyright 2019 Google LLC. +# +# 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. + +if [[ "$#" -ne 1 ]]; then + echo "Usage: $0 variant_name" + echo "e.g. $0 kohaku" + echo "Adds a new variant of Hatch to Kconfig and Kconfig.name, creates the" + echo "skeleton files for acpi, ec, and gpio, copies the makefile for" + echo "SPD sources, and sets up a basic overridetree" + 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 variant that is being cloned +# ${var,,} converts to all lowercase +variant="${1,,}" + +# This script and the templates live in util/mainboard/google/hatch +# We need to create files in src/mainboard/google/hatch +pushd "${BASH_SOURCE%/*}" || exit +SRC=$(pwd) +popd || exit +pushd "${SRC}/../../../../src/mainboard/google/${base}" || { + echo "The baseboard directory for ${base} does not exist."; + exit; } + +# Make sure the variant doesn't already exist +if [[ -e variants/${variant} ]]; then + echo "variants/${variant} already exists." + echo "Have you already created this variant?" + popd || exit + exit 2 +fi + +# Start a branch. Use YMD timestamp to avoid collisions. +DATE=$(date +%Y%m%d) +git checkout -b "create_${variant}_${DATE}" + +# Copy the template tree to the target +cp -r "${SRC}/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}" + +mv Kconfig.new Kconfig +mv Kconfig.name.new Kconfig.name + +git add Kconfig Kconfig.name + +# Now commit the files +git commit -sm "${base}: Create ${variant} variant + +BUG=none +TEST=util/abuild/abuild -p none -t google/${base} -x -a +make sure the build includes GOOGLE_${variant^^}" + +popd || exit + +echo "Please check all the files (git show), make any changes you want," +echo "and then push to coreboot HEAD:refs/for/master" |