new_variant: add support for Dedede
The Dedede baseboard has two reference boards, Waddledee and
Waddledoo. Both are supported as the reference for creating a new
variant.
BUG=b:157183582
TEST=Create a new variant of Waddledee named Acro by following the
instructions in testdata/acro.md. After the build succeeds, clean up
as instructed.
Repeat the same procedure, except use --board=waddledoo instead of
--board=waddledee, to create Acro as a variant of Waddledoo. After
the build succeeds, clean up as instructed.
Either reference board works as a base for the new variant.
Change-Id: I88d20b9c47179914639b2dca22693336c4eccb7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2212956
Tested-by: Paul Fagerburg <pfagerburg@chromium.org>
Reviewed-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Commit-Queue: Paul Fagerburg <pfagerburg@chromium.org>
diff --git a/contrib/variant/kconfig.py b/contrib/variant/kconfig.py
index 8f5e9e1..ab92b21 100755
--- a/contrib/variant/kconfig.py
+++ b/contrib/variant/kconfig.py
@@ -32,7 +32,8 @@
"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--board', type=str, required=True,
- choices=('hatch', 'volteer', 'trembyle', 'dalboz'),
+ choices=('hatch', 'volteer', 'trembyle', 'dalboz',
+ 'waddledee', 'waddledoo'),
help='Name of the baseboard')
parser.add_argument('--variant', type=str, required=True,
help='Name of the board variant')
@@ -135,6 +136,21 @@
print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
print('\tbool "-> ' + capitalized + '"', file=outfile)
print('\tselect BOARD_GOOGLE_BASEBOARD_DALBOZ', file=outfile)
+ elif baseboard_name == 'waddledee':
+ print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
+ print('\tbool "-> ' + capitalized + '"', file=outfile)
+ print('\tselect BOARD_GOOGLE_BASEBOARD_DEDEDE', file=outfile)
+ print('\tselect BASEBOARD_DEDEDE_LAPTOP', file=outfile)
+ print('\tselect BOARD_ROMSIZE_KB_32768', file=outfile)
+ elif baseboard_name == 'waddledoo':
+ print('\nconfig ' + 'BOARD_GOOGLE_' + uppercase, file=outfile)
+ print('\tbool "-> ' + capitalized + '"', file=outfile)
+ print('\tselect BOARD_GOOGLE_BASEBOARD_DEDEDE', file=outfile)
+ print('\tselect BASEBOARD_DEDEDE_LAPTOP', file=outfile)
+ print('\tselect BOARD_ROMSIZE_KB_32768', file=outfile)
+ print('\tselect DRIVERS_GENERIC_MAX98357A', file=outfile)
+ print('\tselect DRIVERS_I2C_DA7219', file=outfile)
+ print('\tselect VARIANT_HAS_CAMERA_ACPI', file=outfile)
else:
raise ValueError(f'Unsupported board {baseboard_name}')
diff --git a/contrib/variant/testdata/acro.md b/contrib/variant/testdata/acro.md
new file mode 100644
index 0000000..395eeae
--- /dev/null
+++ b/contrib/variant/testdata/acro.md
@@ -0,0 +1,123 @@
+# Test creating a new variant of Waddledee or Waddledoo (Dedede)
+
+This document describes the steps to test the process of creating a new
+variant of the Waddledee or Waddledoo reference boards in the Dedede program.
+Most of these steps are done inside the chroot environment.
+
+## Create per-project config
+
+Normally, a new variant would have a per-project configuration repo created
+by the CrOS gerrit admins. For the purposes of this test, create a directory
+and populate it as if the repo existed.
+
+```
+(cr) $ mkdir -p ~/trunk/src/project/dedede/acro
+(cr) $ cd ~/trunk/src/project/dedede/acro
+(cr) $ cp -r ~/trunk/src/project/dedede/waddledee .
+```
+
+### Edit src/project/dedede/acro/config.star
+
+Change all occurences of Waddledee to Acro, respecting capitalization. There
+are all-lowercase, all-uppercase, and initial-uppercase versions of the name
+in the config.star file.
+
+```
+(cr) $ cd ~/trunk/src/project/dedede/acro
+(cr) $ sed -i -e "s/waddledee/acro/g" -e "s/WADDLEDEE/ACRO/g" -e "s/Waddledee/Acro/g" config.star
+```
+
+### Generate the config
+
+```
+(cr) $ cd ~/trunk/src/project/dedede/acro
+(cr) $ ~/trunk/src/config/bin/gen_config config.star
+```
+
+## Update the PROJECTS list
+
+Add "acro" to the `PROJECTS` list in
+
+`src/private-overlays/overlay-dedede-private/chromeos-base/chromeos-config-bsp-dedede-private/chromeos-config-bsp-dedede-private-9999.ebuild`
+
+
+```
+ PROJECTS=(
+ "waddledoo"
+ "waddledee"
+ "jslrvp"
+ "wheelie"
++ "acro"
+ )
+```
+
+## Ensure CLs do not get uploaded
+
+Insert the step 'quit' in waddledee.py after step_names.EMERGE, so that
+the test CLs are not uploaded.
+
+```
+ step_list = [
+ step_names.EC_IMAGE,
+ step_names.EC_BUILDALL,
+ step_names.EMERGE,
++ 'quit',
+ step_names.PUSH,
+ step_names.UPLOAD,
+ step_names.CALC_CQ_DEPEND,
+ step_names.ADD_CQ_DEPEND,
+ step_names.RE_UPLOAD,
+ step_names.CLEAN_UP]
+```
+
+## Create the 'acro' variant
+
+`(cr) $ ./new_variant.py --board=waddledee --variant=acro --bug=b:157183582`
+
+The program begins by building the project configuration to ensure that the
+variant is included. If this step fails, you may have forgotten to update
+`chromeos-config-bsp-dedede-private-9999.ebuild`
+
+After building the project configuration, the program creates the coreboot
+variant, coreboot configuration, and the files needed for generating the
+fitimage. The program asks the user to generate the fitimage outside the
+chroot, and then the program exits.
+
+### Waddledee vs. Waddledoo
+
+These steps work equally well if the new variant is based on the Waddledoo
+reference board. The command to start the creation would be:
+
+`(cr) $ ./new_variant.py --board=waddledoo --variant=acro --bug=b:157183582`
+
+The rest of the process is the same regardless of the reference board chosen.
+
+## Generate the fitimage
+
+Open a new terminal. Assuming that you have the correct version of Intel FIT
+installed (currently version 13.50.0.7049, but this will likely change in
+the future) in `~/TXE/JSL`, the command would be:
+
+```
+$ cd ~/chromiumos/src/private-overlays/baseboard-dedede-private/sys-boot/coreboot-private-files-baseboard-dedede/asset_generation
+$ ./gen_fit_image.sh acro ~/TXE/JSL -b
+```
+
+## Continue the 'acro' variant creation
+
+Switch back to the terminal in the chroot and run `new_variant.py` again
+with the `--continue` option:
+
+`(cr) $ ./new_variant.py --continue`
+
+The program will successfully build the 'acro' firmware, and then stop with
+an error that it doesn't understand the 'quit' step. That is the desired
+behavior, as we don't want to upload these CLs.
+
+## Clean up
+
+`./new_variant.py --abort` to delete all of the commits.
+
+`rm -R ~/trunk/src/project/dedede/acro` to delete the per-project config
+
+Use `git restore` to discard changes to `chromeos-config-bsp-dedede-private-9999.ebuild`
diff --git a/contrib/variant/waddledee.py b/contrib/variant/waddledee.py
new file mode 100644
index 0000000..804236d
--- /dev/null
+++ b/contrib/variant/waddledee.py
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+"""Define steps, package names, and directories for creating a Dedede variant
+
+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.
+"""
+
+from __future__ import print_function
+import step_names
+
+# Name of the baseboard
+base = 'dedede'
+
+# List of steps (named in step_names.py) to run in sequence to create
+# the new variant of the baseboard
+step_list = [
+ step_names.PROJECT_CONFIG,
+ step_names.CB_VARIANT,
+ step_names.CB_CONFIG,
+ step_names.ADD_FIT,
+ step_names.GEN_FIT,
+ step_names.COMMIT_FIT,
+ step_names.EC_IMAGE,
+ step_names.EC_BUILDALL,
+ step_names.EMERGE,
+ step_names.PUSH,
+ step_names.UPLOAD,
+ step_names.FIND,
+ step_names.CALC_CQ_DEPEND,
+ step_names.ADD_CQ_DEPEND,
+ step_names.RE_UPLOAD,
+ step_names.CLEAN_UP]
+
+# Base directory for coreboot
+coreboot_dir = 'third_party/coreboot'
+
+# Base directory for coreboot configs (None=use default)
+cb_config_dir = None
+
+# Package name for FSP
+fsp = 'intel-jslfsp'
+
+# Package name for the fitimage
+fitimage_pkg = 'coreboot-private-files-baseboard-dedede'
+
+# Directory for fitimage; append '~/trunk/src/'' in chroot, '~/chromiumos/src' outside
+fitimage_dir = 'private-overlays/baseboard-dedede-private/sys-boot/'\
+ 'coreboot-private-files-baseboard-dedede'
+
+# Explanation of gen_fit_image command
+fitimage_cmd = './gen_fit_image.sh %s <path_to_fit_kit> -b'
+
+# List of packages to cros_workon
+workon_pkgs = [
+ 'coreboot', 'libpayload', 'vboot_reference', 'depthcharge', fsp,
+ fitimage_pkg, 'chromeos-ec', 'chromeos-config-bsp-dedede-private']
+
+# The emerge command
+emerge_cmd = 'emerge-dedede'
+
+# List of packages to emerge
+emerge_pkgs = [
+ 'coreboot', 'libpayload', 'vboot_reference', 'depthcharge', fsp,
+ fitimage_pkg, 'chromeos-ec', 'chromeos-config-bsp-dedede-private',
+ 'chromeos-config', 'chromeos-config-bsp', 'coreboot-private-files',
+ 'chromeos-bootimage']
+
+# List of packages to cros_workon to build the project config
+config_workon_pkgs = ['chromeos-config-bsp-dedede-private']
+
+# List of packages to emerge to build the project config
+config_emerge_pkgs = ['chromeos-config-bsp-dedede-private']
+
+# Directory for the private yaml file
+# None; dedede doesn't use model.yaml
+private_yaml_dir = None
+
+# List of commits that will be uploaded with `repo upload`
+repo_upload_list = [
+ step_names.CB_CONFIG, step_names.COMMIT_FIT,
+ step_names.EC_IMAGE, step_names.ADD_PRIV_YAML]
+
+# List of commits that will be pushed to review.coreboot.org
+coreboot_push_list = [step_names.CB_VARIANT]
+
+# List of steps that depend on other steps, and what those are.
+# This list gets used for setting up Cq-Depend on the uploaded CLs.
+depends = {
+ step_names.CB_CONFIG: [step_names.FIND],
+}
diff --git a/contrib/variant/waddledoo.py b/contrib/variant/waddledoo.py
new file mode 120000
index 0000000..9d25c04
--- /dev/null
+++ b/contrib/variant/waddledoo.py
@@ -0,0 +1 @@
+waddledee.py
\ No newline at end of file