3rdparty/fsp: Update submodule to upstream master
[coreboot.git] / util / vboot_list / vboot_list.sh
blob8c6a1a17aa3e040acf7baf0ef47408804cc13a08
1 #!/usr/bin/env bash
3 TOP="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. >/dev/null 2>&1 && pwd )"
4 MAINBOARDS="src/mainboard"
5 OUTPUT_FILE=${1:-$TOP/Documentation/security/vboot/list_vboot.md}
7 function has_vboot
9 local DIR=$1
11 grep -rq "config VBOOT" $DIR
12 return $?
15 function get_vendor_name
17 local VENDORDIR=$1
19 sed -n '/config VENDOR/{n;s/^[\t[:space:]]\+bool "\(.*\)"/\1/;p;}' \
20 $VENDORDIR/Kconfig.name
23 function get_board_name
25 local BOARDDIR=$1
27 sed -n '/config BOARD/{n;s/^[\t[:space:]]\+bool "\(->\s\+\)\?\(.*\)"/\2/;p;}' \
28 $BOARDDIR/Kconfig.name
31 function list_vboot_boards
33 local VENDORDIR=$1
34 for BOARD in $(ls -d $VENDORDIR/*/)
36 has_vboot $BOARD || continue
37 get_board_name $BOARD
38 done
41 function generate_vboot_list
43 for VENDOR in $(ls -d $TOP/$MAINBOARDS/*/)
45 has_vboot $VENDOR || continue
46 echo -e "\n## $(get_vendor_name $VENDOR)"
47 IFS=$'\n'
48 for BOARD in $(list_vboot_boards $VENDOR)
50 echo "- $BOARD"
51 done
52 done
55 (echo "# vboot-enabled devices"; generate_vboot_list) > $OUTPUT_FILE