util/scripts: Add script to show platforms, CPU, type, and date added

This is the script used to generate the list of platforms that were
removed from the master branch at each release.  Generate a list for the
old branch, another for the new, and compare the two.

Representative output:
```eval_rst
+-------------------------+-------------------+------------+----------+
| Vendor/Board            | Processor         | Date added | Brd type |
+=========================+===================+============+==========+
| 51nb/x210               | INTEL_KABYLAKE    | 2020-03-16 | laptop   |
| acer/aspire_vn7_572g    | INTEL_SKYLAKE     | 2022-01-28 | laptop   |
| acer/g43t-am3           | INTEL_X4X         | 2020-09-28 | desktop  |
| amd/bilby               | AMD_PICASSO       | 2021-02-17 | eval     |
| amd/birman              | AMD_MORGANA       | 2022-10-10 | eval     |
| system76/whl-u          | INTEL_WHISKEYLAKE | 2021-04-14 | laptop   |
| ti/beaglebone           | TI_AM335X         | 2013-05-26 | sbc      |
| up/squared              | INTEL_APOLLOLAKE  | 2019-05-22 | mini     |
+-------------------------+-------------------+------------+----------+
```

Signed-off-by: Martin Roth <gaumless@gmail.com>
Change-Id: I4f7265d95df31f3a74aa2aa164f6a094c1139750
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63799
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nicholas Chin <nic.c3.14@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Martin Roth 2022-04-23 15:19:11 -06:00 committed by Felix Held
parent d55ed57c36
commit 65a0e5a92d
2 changed files with 50 additions and 0 deletions

View File

@ -25,5 +25,8 @@ __scripts__
`Perl` `Perl`
* _rm_unused_code_ - Remove all code not used for a platform from the local * _rm_unused_code_ - Remove all code not used for a platform from the local
git repository for auditing or release `Bash` git repository for auditing or release `Bash`
* _show_platforms.sh_ - Makes a list of platforms in the tree. Does
not show variants.
`Shell`
* _ucode_h_to_bin.sh_ - Microcode conversion tool `Bash` * _ucode_h_to_bin.sh_ - Microcode conversion tool `Bash`
* _update_submodules_ - Check all submodules for updates `Bash` * _update_submodules_ - Check all submodules for updates `Bash`

47
util/scripts/show_platforms.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
#
# SPDX-License-Identifier: GPL-2.0-only
#
# This script finds all of the top-level mainboards, then goes through
# and finds the date the directory was added, the processor type, and
# the board type.
#
# This could be improved by finding all of the variants, then figuring
# out when those veriants were added.
# It's also very slow, but only needs to be run once in a while...
readarray -t platforms < <(find src/mainboard -mindepth 3 -name 'Kconfig' | sort)
echo '```eval_rst'
echo "+-------------------------------+------------------------+------------+-----------+"
echo "| Vendor/Board | Processor | Date added | Brd type |"
echo "+===============================+========================+============+===========+"
for file in "${platforms[@]}"; do
platformname="$(echo "${file}" | sed 's|.*/mainboard/||;s|/Kconfig||')"
if [[ ! -f "${file/Kconfig/board_info.txt}" ]]; then
continue
fi
chips="$(grep "CPU_\|SOC_\|NORTHBRIDGE" "${file}" |
grep -v "SUBTYPE\|COMMON\|SOCKET\|ENABLE\|CONSOLE\|SMU\|depends on\|ESPI\|INTEL_CSE\|NORTHBRIDGE_AMD_AGESA\|INTEL_SLOT\|REBOOT\|DISABLE" |
sed -e 's|\s\+select\s\+||' \
-e 's|\s\+if.*||' \
-e 's|SKYLAKE_SOC_PCH|INTEL_SKYLAKE|' \
-e 's|CPU_AMD_AGESA|AMD|' \
-e 's|SOC_INTEL_ALDERLAKE_PCH_|INTEL_ALDERLAKE|' \
-e 's|QC_|QUALCOMM_|' \
-e 's/SOC_\|NORTHBRIDGE_\|PCH_\|CPU_//g' |
sort -u)"
if [[ ! -f ${file/Kconfig/board_info.txt} ]]; then
continue
fi
create_date="$(git log --format="format:%cs" -- "${file}" | tail -n1)"
platform_type="$(sed -nE -e 's/Category: (.*)/\1/p' "${file/Kconfig/board_info.txt}" 2>/dev/null)"
for chip in ${chips}; do
printf "| %-29s | %-22s | %-10s | %-9s |\n" "${platformname}" "${chip}" "${create_date}" "${platform_type}"
done
done
echo "+-------------------------------+------------------------+------------+-----------+"
echo '```'