VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  1) #!/bin/sh
b24413180f560 (Greg Kroah-Hartman 2017-11-01 15:07:57 +0100  2) # SPDX-License-Identifier: GPL-2.0
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  3) #
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  4) # A depmod wrapper used by the toplevel Makefile
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  5) 
5a144a1acd0b4 (Masahiro Yamada    2018-05-09 16:23:48 +0900  6) if test $# -ne 2; then
5a144a1acd0b4 (Masahiro Yamada    2018-05-09 16:23:48 +0900  7) 	echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  8) 	exit 1
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200  9) fi
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 10) DEPMOD=$1
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 11) KERNELRELEASE=$2
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 12) 
934193a654c1f (Randy Dunlap       2018-07-01 19:46:06 -0700 13) if ! test -r System.map ; then
f0b0d88a82514 (Randy Dunlap       2018-09-06 16:37:24 -0700 14) 	echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 15) 	exit 0
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 16) fi
8937e897181a4 (James Hogan        2013-02-06 12:56:59 +0000 17) 
cedd1862be7e6 (Linus Torvalds     2020-12-28 11:40:22 -0800 18) # legacy behavior: "depmod" in /sbin, no /sbin in PATH
cedd1862be7e6 (Linus Torvalds     2020-12-28 11:40:22 -0800 19) PATH="$PATH:/sbin"
934193a654c1f (Randy Dunlap       2018-07-01 19:46:06 -0700 20) if [ -z $(command -v $DEPMOD) ]; then
914b087ff9e0e (Randy Dunlap       2018-08-28 12:59:10 -0700 21) 	echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2
934193a654c1f (Randy Dunlap       2018-07-01 19:46:06 -0700 22) 	echo "This is probably in the kmod package." >&2
914b087ff9e0e (Randy Dunlap       2018-08-28 12:59:10 -0700 23) 	exit 0
934193a654c1f (Randy Dunlap       2018-07-01 19:46:06 -0700 24) fi
934193a654c1f (Randy Dunlap       2018-07-01 19:46:06 -0700 25) 
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 26) # older versions of depmod require the version string to start with three
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 27) # numbers, so we cheat with a symlink here
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 28) depmod_hack_needed=true
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 29) tmp_dir=$(mktemp -d ${TMPDIR:-/tmp}/depmod.XXXXXX)
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 30) mkdir -p "$tmp_dir/lib/modules/$KERNELRELEASE"
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 31) if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev/null; then
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 32) 	if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 33) 		-e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 34) 		depmod_hack_needed=false
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 35) 	fi
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 36) fi
8fc62e5942538 (Michal Marek       2011-07-12 11:54:48 +0200 37) rm -rf "$tmp_dir"
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 38) if $depmod_hack_needed; then
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 39) 	symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 40) 	ln -s "$KERNELRELEASE" "$symlink"
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 41) 	KERNELRELEASE=99.98.$KERNELRELEASE
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 42) fi
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 43) 
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 44) set -- -ae -F System.map
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 45) if test -n "$INSTALL_MOD_PATH"; then
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 46) 	set -- "$@" -b "$INSTALL_MOD_PATH"
fc4da9a3e68b1 (Michal Marek       2011-06-09 15:35:22 +0200 47) fi
5a144a1acd0b4 (Masahiro Yamada    2018-05-09 16:23:48 +0900 48) "$DEPMOD" "$@" "$KERNELRELEASE"
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 49) ret=$?
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 50) 
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 51) if $depmod_hack_needed; then
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 52) 	rm -f "$symlink"
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 53) fi
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 54) 
bfe5424a8b316 (Michal Marek       2011-06-09 16:35:41 +0200 55) exit $ret