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-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) # Script to update include/generated/autoksyms.h and dependency files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) # Copyright:	(C) 2016  Linaro Limited
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) # Created by:	Nicolas Pitre, January 2016
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # Update the include/generated/autoksyms.h file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # For each symbol being added or removed, the corresponding dependency
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) # file's timestamp is updated to force a rebuild of the affected source
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # file. All arguments passed to this script are assumed to be a command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # to be exec'd to trigger a rebuild of those files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) set -e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) cur_ksyms_file="include/generated/autoksyms.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) new_ksyms_file="include/generated/autoksyms.h.tmpnew"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) info() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	if [ "$quiet" != "silent_" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 		printf "  %-7s %s\n" "$1" "$2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) info "CHK" "$cur_ksyms_file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) # Use "make V=1" to debug this script.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) case "$KBUILD_VERBOSE" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) *1*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	set -x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) # We need access to CONFIG_ symbols
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) . include/config/auto.conf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) # Generate a new symbol list file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) $CONFIG_SHELL $srctree/scripts/gen_autoksyms.sh "$new_ksyms_file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) # Extract changes between old and new list and touch corresponding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) # dependency files.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) changed=$(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) count=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) sort "$cur_ksyms_file" "$new_ksyms_file" | uniq -u |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) sed -n 's/^#define __KSYM_\(.*\) 1/\1/p' | tr "A-Z_" "a-z/" |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) while read sympath; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	if [ -z "$sympath" ]; then continue; fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	depfile="include/ksym/${sympath}.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	mkdir -p "$(dirname "$depfile")"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	touch "$depfile"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	# Filesystems with coarse time precision may create timestamps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	# equal to the one from a file that was very recently built and that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	# needs to be rebuild. Let's guard against that by making sure our
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	# dep files are always newer than the first file we created here.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	while [ ! "$depfile" -nt "$new_ksyms_file" ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 		touch "$depfile"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	echo $((count += 1))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) done | tail -1 )
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) changed=${changed:-0}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) if [ $changed -gt 0 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	# Replace the old list with tne new one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	old=$(grep -c "^#define __KSYM_" "$cur_ksyms_file" || true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	new=$(grep -c "^#define __KSYM_" "$new_ksyms_file" || true)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	info "KSYMS" "symbols: before=$old, after=$new, changed=$changed"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	info "UPD" "$cur_ksyms_file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	mv -f "$new_ksyms_file" "$cur_ksyms_file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	# Then trigger a rebuild of affected source files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	exec $@
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	rm -f "$new_ksyms_file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) fi