Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) # Small script that refreshes the kernel feature support status in place.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) for F_FILE in Documentation/features/*/*/arch-support.txt; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 	F=$(grep "^#         Kconfig:" "$F_FILE" | cut -c26-)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 	# Each feature F is identified by a pair (O, K), where 'O' can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	# be either the empty string (for 'nop') or "not" (the logical
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	# negation operator '!'); other operators are not supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	O=""
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	K=$F
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	if [[ "$F" == !* ]]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 		O="not"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		K=$(echo $F | sed -e 's/^!//g')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	# F := (O, K) is 'valid' iff there is a Kconfig file (for some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	# arch) which contains K.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	# Notice that this definition entails an 'asymmetry' between
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	# the case 'O = ""' and the case 'O = "not"'. E.g., F may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	# _invalid_ if:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	# [case 'O = ""']
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	#   1) no arch provides support for F,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	#   2) K does not exist (e.g., it was renamed/mis-typed);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	# [case 'O = "not"']
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	#   3) all archs provide support for F,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	#   4) as in (2).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	# The rationale for adopting this definition (and, thus, for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	# keeping the asymmetry) is:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	#       We want to be able to 'detect' (2) (or (4)).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	# (1) and (3) may further warn the developers about the fact
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	# that K can be removed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	F_VALID="false"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	for ARCH_DIR in arch/*/; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 		K_FILES=$(find $ARCH_DIR -name "Kconfig*")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		K_GREP=$(grep "$K" $K_FILES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		if [ ! -z "$K_GREP" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 			F_VALID="true"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 			break
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	if [ "$F_VALID" = "false" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		printf "WARNING: '%s' is not a valid Kconfig\n" "$F"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	T_FILE="$F_FILE.tmp"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	grep "^#" $F_FILE > $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	echo "    -----------------------" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	echo "    |         arch |status|" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	echo "    -----------------------" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	for ARCH_DIR in arch/*/; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 		ARCH=$(echo $ARCH_DIR | sed -e 's/arch//g' | sed -e 's/\///g')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 		K_FILES=$(find $ARCH_DIR -name "Kconfig*")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 		K_GREP=$(grep "$K" $K_FILES)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		# Arch support status values for (O, K) are updated according
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 		# to the following rules.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 		#   - ("", K) is 'supported by a given arch', if there is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		#     Kconfig file for that arch which contains K;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 		#   - ("not", K) is 'supported by a given arch', if there is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		#     no Kconfig file for that arch which contains K;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		#   - otherwise: preserve the previous status value (if any),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 		#                default to 'not yet supported'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 		# Notice that, according these rules, invalid features may be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 		# updated/modified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 		#
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 		if [ "$O" = "" ] && [ ! -z "$K_GREP" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 			printf "    |%12s: |  ok  |\n" "$ARCH" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 		elif [ "$O" = "not" ] && [ -z "$K_GREP" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) 			printf "    |%12s: |  ok  |\n" "$ARCH" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 			S=$(grep -v "^#" "$F_FILE" | grep " $ARCH:")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 			if [ ! -z "$S" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 				echo "$S" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) 				printf "    |%12s: | TODO |\n" "$ARCH" \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) 					>> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) 	echo "    -----------------------" >> $T_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) 	mv $T_FILE $F_FILE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) done