2 # Small script that refreshes the kernel feature support status in place.
5 for F_FILE
in Documentation
/features
/*/*/arch-support.txt
; do
6 F
=$
(grep "^# Kconfig:" "$F_FILE" | cut
-c26-)
9 # Each feature F is identified by a pair (O, K), where 'O' can
10 # be either the empty string (for 'nop') or "not" (the logical
11 # negation operator '!'); other operators are not supported.
15 if [[ "$F" == !* ]]; then
17 K
=$
(echo $F |
sed -e 's/^!//g')
21 # F := (O, K) is 'valid' iff there is a Kconfig file (for some
22 # arch) which contains K.
24 # Notice that this definition entails an 'asymmetry' between
25 # the case 'O = ""' and the case 'O = "not"'. E.g., F may be
29 # 1) no arch provides support for F,
30 # 2) K does not exist (e.g., it was renamed/mis-typed);
33 # 3) all archs provide support for F,
36 # The rationale for adopting this definition (and, thus, for
37 # keeping the asymmetry) is:
39 # We want to be able to 'detect' (2) (or (4)).
41 # (1) and (3) may further warn the developers about the fact
42 # that K can be removed.
45 for ARCH_DIR
in arch
/*/; do
46 K_FILES
=$
(find $ARCH_DIR -name "Kconfig*")
47 K_GREP
=$
(grep "$K" $K_FILES)
48 if [ ! -z "$K_GREP" ]; then
53 if [ "$F_VALID" = "false" ]; then
54 printf "WARNING: '%s' is not a valid Kconfig\n" "$F"
58 grep "^#" $F_FILE > $T_FILE
59 echo " -----------------------" >> $T_FILE
60 echo " | arch |status|" >> $T_FILE
61 echo " -----------------------" >> $T_FILE
62 for ARCH_DIR
in arch
/*/; do
63 ARCH
=$
(echo $ARCH_DIR |
sed -e 's/arch//g' |
sed -e 's/\///g')
64 K_FILES
=$
(find $ARCH_DIR -name "Kconfig*")
65 K_GREP
=$
(grep "$K" $K_FILES)
67 # Arch support status values for (O, K) are updated according
68 # to the following rules.
70 # - ("", K) is 'supported by a given arch', if there is a
71 # Kconfig file for that arch which contains K;
73 # - ("not", K) is 'supported by a given arch', if there is
74 # no Kconfig file for that arch which contains K;
76 # - otherwise: preserve the previous status value (if any),
77 # default to 'not yet supported'.
79 # Notice that, according these rules, invalid features may be
82 if [ "$O" = "" ] && [ ! -z "$K_GREP" ]; then
83 printf " |%12s: | ok |\n" "$ARCH" >> $T_FILE
84 elif [ "$O" = "not" ] && [ -z "$K_GREP" ]; then
85 printf " |%12s: | ok |\n" "$ARCH" >> $T_FILE
87 S
=$
(grep -v "^#" "$F_FILE" |
grep " $ARCH:")
88 if [ ! -z "$S" ]; then
91 printf " |%12s: | TODO |\n" "$ARCH" \
96 echo " -----------------------" >> $T_FILE