2 # SPDX-License-Identifier: GPL-2.0
4 # A depmod wrapper used by the toplevel Makefile
7 echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
13 if ! test -r System.map
-a -x "$DEPMOD"; then
17 # older versions of depmod require the version string to start with three
18 # numbers, so we cheat with a symlink here
19 depmod_hack_needed
=true
20 tmp_dir
=$
(mktemp
-d ${TMPDIR:-/tmp}/depmod.XXXXXX
)
21 mkdir
-p "$tmp_dir/lib/modules/$KERNELRELEASE"
22 if "$DEPMOD" -b "$tmp_dir" $KERNELRELEASE 2>/dev
/null
; then
23 if test -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep" -o \
24 -e "$tmp_dir/lib/modules/$KERNELRELEASE/modules.dep.bin"; then
25 depmod_hack_needed
=false
29 if $depmod_hack_needed; then
30 symlink
="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
31 ln -s "$KERNELRELEASE" "$symlink"
32 KERNELRELEASE
=99.98.
$KERNELRELEASE
35 set -- -ae -F System.map
36 if test -n "$INSTALL_MOD_PATH"; then
37 set -- "$@" -b "$INSTALL_MOD_PATH"
39 "$DEPMOD" "$@" "$KERNELRELEASE"
42 if $depmod_hack_needed; then