• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0
3#
4# A depmod wrapper
5
6if test $# -ne 1 -a $# -ne 2; then
7	echo "Usage: $0 <kernelrelease> [System.map folder]" >&2
8	exit 1
9fi
10
11KERNELRELEASE=$1
12KBUILD_MIXED_TREE=$2
13
14: ${DEPMOD:=depmod}
15
16if ! test -r ${KBUILD_MIXED_TREE}System.map ; then
17	echo "Warning: modules_install: missing 'System.map' file. Skipping depmod." >&2
18	exit 0
19fi
20
21# legacy behavior: "depmod" in /sbin, no /sbin in PATH
22PATH="$PATH:/sbin"
23if [ -z $(command -v $DEPMOD) ]; then
24	echo "Warning: 'make modules_install' requires $DEPMOD. Please install it." >&2
25	echo "This is probably in the kmod package." >&2
26	exit 0
27fi
28
29set -- -ae -F ${KBUILD_MIXED_TREE}System.map
30if test -n "$INSTALL_MOD_PATH"; then
31	set -- "$@" -b "$INSTALL_MOD_PATH"
32fi
33exec "$DEPMOD" "$@" "$KERNELRELEASE"
34