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) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) # SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) # Copyright (C) 2017 Imagination Technologies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) # Author: Paul Burton <paul.burton@mips.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) # This script merges configuration fragments for boards supported by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) # generic MIPS kernel. It checks each for requirements specified using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) # formatted comments, and then calls merge_config.sh to merge those
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # fragments which have no unmet requirements.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # An example of requirements in your board config fragment might be:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # # require CONFIG_CPU_MIPS32_R2=y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # # require CONFIG_CPU_LITTLE_ENDIAN=y
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) # This would mean that your board is only included in kernels which are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) # configured for little endian MIPS32r2 CPUs, and not for example in kernels
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) # configured for 64 bit or big endian systems.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) srctree="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) objtree="$2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) ref_cfg="$3"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) cfg="$4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) boards_origin="$5"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) shift 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) # Only print Skipping... lines if the user explicitly specified BOARDS=. In the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # general case it only serves to obscure the useful output about what actually
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) # was included.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) case ${boards_origin} in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) "command line")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	print_skipped=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) environment*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	print_skipped=1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	print_skipped=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) for board in $@; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	board_cfg="${srctree}/arch/mips/configs/generic/board-${board}.config"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	if [ ! -f "${board_cfg}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 		echo "WARNING: Board config '${board_cfg}' not found"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 		continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	# For each line beginning with # require, cut out the field following
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	# it & search for that in the reference config file. If the requirement
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	# is not found then the subshell will exit with code 1, and we'll
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	# continue on to the next board.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	grep -E '^# require ' "${board_cfg}" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	    cut -d' ' -f 3- | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	    while read req; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		case ${req} in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		*=y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 			# If we require something =y then we check that a line
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 			# containing it is present in the reference config.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 			grep -Eq "^${req}\$" "${ref_cfg}" && continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 		*=n)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 			# If we require something =n then we just invert that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 			# check, considering the requirement met if there isn't
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 			# a line containing the value =y in the reference
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 			# config.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 			grep -Eq "^${req/%=n/=y}\$" "${ref_cfg}" || continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 		*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 			echo "WARNING: Unhandled requirement '${req}'"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		[ ${print_skipped} -eq 1 ] && echo "Skipping ${board_cfg}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 		exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	done || continue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 	# Merge this board config fragment into our final config file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 	${srctree}/scripts/kconfig/merge_config.sh \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 		-m -O ${objtree} ${cfg} ${board_cfg} \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 		| grep -Ev '^(#|Using)'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) done