Revert "kbuild: Hack for depmod not handling X.Y versions"
[platform/kernel/linux-rpi.git] / scripts / depmod.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3 #
4 # A depmod wrapper used by the toplevel Makefile
5
6 if test $# -ne 2; then
7         echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
8         exit 1
9 fi
10 DEPMOD=$1
11 KERNELRELEASE=$2
12
13 if ! test -r System.map ; then
14         echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
15         exit 0
16 fi
17
18 # legacy behavior: "depmod" in /sbin, no /sbin in PATH
19 PATH="$PATH:/sbin"
20 if [ -z $(command -v $DEPMOD) ]; then
21         echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2
22         echo "This is probably in the kmod package." >&2
23         exit 0
24 fi
25
26 set -- -ae -F System.map
27 if test -n "$INSTALL_MOD_PATH"; then
28         set -- "$@" -b "$INSTALL_MOD_PATH"
29 fi
30 exec "$DEPMOD" "$@" "$KERNELRELEASE"