linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Marek <mmarek@suse.cz>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/5] kbuild: Hack for depmod not handling X.Y versions
Date: Thu,  9 Jun 2011 16:57:27 +0200	[thread overview]
Message-ID: <1307631448-29848-5-git-send-email-mmarek@suse.cz> (raw)
In-Reply-To: <1307631448-29848-1-git-send-email-mmarek@suse.cz>

depmod from module-init-tools < 3.13 and the busybox depmod check if the
kernel release starts with <num>.<num>.<num>. To support these versions,
we create a symlink with two numbers prepended.

Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 scripts/depmod.sh |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 9f205da..3b029cb 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -18,8 +18,31 @@ fi
 if ! test -r System.map -a -x "$DEPMOD"; then
 	exit 0
 fi
+# older versions of depmod require the version string to start with three
+# numbers, so we cheat with a symlink here
+depmod_hack_needed=true
+mkdir -p .tmp_depmod/lib/modules/$KERNELRELEASE
+if "$DEPMOD" -b .tmp_depmod $KERNELRELEASE 2>/dev/null; then
+	if test -e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep -o \
+		-e .tmp_depmod/lib/modules/$KERNELRELEASE/modules.dep.bin; then
+		depmod_hack_needed=false
+	fi
+fi
+if $depmod_hack_needed; then
+	symlink="$INSTALL_MOD_PATH/lib/modules/99.98.$KERNELRELEASE"
+	ln -s "$KERNELRELEASE" "$symlink"
+	KERNELRELEASE=99.98.$KERNELRELEASE
+fi
+
 set -- -ae -F System.map
 if test -n "$INSTALL_MOD_PATH"; then
 	set -- "$@" -b "$INSTALL_MOD_PATH"
 fi
-exec "$DEPMOD" "$@" "$KERNELRELEASE"
+"$DEPMOD" "$@" "$KERNELRELEASE"
+ret=$?
+
+if $depmod_hack_needed; then
+	rm -f "$symlink"
+fi
+
+exit $ret
-- 
1.7.4.2


  parent reply	other threads:[~2011-06-09 14:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-09 14:57 [PATCH v2 0/5] Fixes for X.Y kernel versions Michal Marek
2011-06-09 14:57 ` [PATCH v2 1/5] kbuild: Fix KERNELVERSION for empty SUBLEVEL or PATCHLEVEL Michal Marek
2011-06-09 14:57 ` [PATCH v2 2/5] kbuild: Fix <linux/version.h> " Michal Marek
2011-06-09 14:57 ` [PATCH v2 3/5] kbuild: Move depmod call to a separate script Michal Marek
2011-06-09 14:57 ` Michal Marek [this message]
2011-06-09 14:57 ` [PATCH v2 5/5] perf: Use make kernelversion instead of parsing the Makefile Michal Marek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1307631448-29848-5-git-send-email-mmarek@suse.cz \
    --to=mmarek@suse.cz \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).