Martin Roth | 65a0e5a | 2022-04-23 15:19:11 -0600 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # SPDX-License-Identifier: GPL-2.0-only |
| 4 | # |
| 5 | # This script finds all of the top-level mainboards, then goes through |
| 6 | # and finds the date the directory was added, the processor type, and |
| 7 | # the board type. |
| 8 | # |
| 9 | # This could be improved by finding all of the variants, then figuring |
| 10 | # out when those veriants were added. |
| 11 | # It's also very slow, but only needs to be run once in a while... |
| 12 | |
| 13 | readarray -t platforms < <(find src/mainboard -mindepth 3 -name 'Kconfig' | sort) |
| 14 | |
| 15 | echo '```eval_rst' |
| 16 | echo "+-------------------------------+------------------------+------------+-----------+" |
| 17 | echo "| Vendor/Board | Processor | Date added | Brd type |" |
| 18 | echo "+===============================+========================+============+===========+" |
| 19 | |
| 20 | for file in "${platforms[@]}"; do |
| 21 | platformname="$(echo "${file}" | sed 's|.*/mainboard/||;s|/Kconfig||')" |
| 22 | if [[ ! -f "${file/Kconfig/board_info.txt}" ]]; then |
| 23 | continue |
| 24 | fi |
| 25 | chips="$(grep "CPU_\|SOC_\|NORTHBRIDGE" "${file}" | |
| 26 | grep -v "SUBTYPE\|COMMON\|SOCKET\|ENABLE\|CONSOLE\|SMU\|depends on\|ESPI\|INTEL_CSE\|NORTHBRIDGE_AMD_AGESA\|INTEL_SLOT\|REBOOT\|DISABLE" | |
| 27 | sed -e 's|\s\+select\s\+||' \ |
| 28 | -e 's|\s\+if.*||' \ |
| 29 | -e 's|SKYLAKE_SOC_PCH|INTEL_SKYLAKE|' \ |
| 30 | -e 's|CPU_AMD_AGESA|AMD|' \ |
| 31 | -e 's|SOC_INTEL_ALDERLAKE_PCH_|INTEL_ALDERLAKE|' \ |
| 32 | -e 's|QC_|QUALCOMM_|' \ |
| 33 | -e 's/SOC_\|NORTHBRIDGE_\|PCH_\|CPU_//g' | |
| 34 | sort -u)" |
| 35 | if [[ ! -f ${file/Kconfig/board_info.txt} ]]; then |
| 36 | continue |
| 37 | fi |
| 38 | create_date="$(git log --format="format:%cs" -- "${file}" | tail -n1)" |
| 39 | platform_type="$(sed -nE -e 's/Category: (.*)/\1/p' "${file/Kconfig/board_info.txt}" 2>/dev/null)" |
| 40 | for chip in ${chips}; do |
| 41 | |
| 42 | printf "| %-29s | %-22s | %-10s | %-9s |\n" "${platformname}" "${chip}" "${create_date}" "${platform_type}" |
| 43 | done |
| 44 | done |
| 45 | |
| 46 | echo "+-------------------------------+------------------------+------------+-----------+" |
| 47 | echo '```' |