All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
@ 2013-01-31  9:41 ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-01-31  9:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: James Hogan, Michal Marek, linux-kbuild, Mike Frysinger,
	Yoshinori Sato, uclinux-dist-devel

On architectures which have symbol prefixes, depmod emits lots of false
warnings like this:

WARNING: $module.ko needs unknown symbol $symbol

This is because depmod isn't being passed the -P <symbol_prefix>
arguments to specify the symbol prefix to ignore. This option is
included since the 3.13 release of module-init-tools.

Update scripts/depmod.sh to take extra arguments which are passed
through directly to depmod, and update the main Makefile to pass
-P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
CONFIG_SYMBOL_PREFIX is set and non-empty.

scripts/depmod.sh also drops the -P arguments if depmod --version
reports module-init-tools with a version number < 3.13.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---
My shell-fu isn't great, so all comments for improvements appreciated.

 Makefile          |    6 +++++-
 scripts/depmod.sh |   27 +++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 2d3c92c..89e41d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1394,10 +1394,14 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
       cmd_rmfiles = rm -f $(rm-files)
 
+ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
+  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
+endif
+
 # Run depmod only if we have System.map and depmod is executable
 quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
+                   $(KERNELRELEASE) $(depmod_args)
 
 # Create temporary dir for module support files
 # clean it up only when building all modules
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 2ae4817..4f3747f 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -2,16 +2,35 @@
 #
 # A depmod wrapper used by the toplevel Makefile
 
-if test $# -ne 2; then
-	echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
+if test $# -lt 2; then
+	echo "Usage: $0 /sbin/depmod <kernelrelease> [args]" >&2
 	exit 1
 fi
 DEPMOD=$1
-KERNELRELEASE=$2
+shift
+KERNELRELEASE=$1
+shift
 
 if ! test -r System.map -a -x "$DEPMOD"; then
 	exit 0
 fi
+
+# older versions of depmod don't support -P <symbol-prefix>
+# support was added in module-init-tools 3.13
+if test "$1" = "-P"; then
+	release=$("$DEPMOD" --version)
+	package=$(echo "$release" | cut -d' ' -f 1)
+	if test "$package" = "module-init-tools"; then
+		version=$(echo "$release" | cut -d' ' -f 2)
+		later=$({ echo "$version"; echo "3.13"; } | sort -V | tail -n 1)
+		if test "$later" != "$version"; then
+			# module-init-tools < 3.13, drop the next 2 args
+			shift
+			shift
+		fi
+	fi
+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
@@ -30,7 +49,7 @@ if $depmod_hack_needed; then
 	KERNELRELEASE=99.98.$KERNELRELEASE
 fi
 
-set -- -ae -F System.map
+set -- -ae -F System.map "$@"
 if test -n "$INSTALL_MOD_PATH"; then
 	set -- "$@" -b "$INSTALL_MOD_PATH"
 fi
-- 
1.7.7.6



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
@ 2013-01-31  9:41 ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-01-31  9:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: James Hogan, Michal Marek, linux-kbuild, Mike Frysinger,
	Yoshinori Sato, uclinux-dist-devel

On architectures which have symbol prefixes, depmod emits lots of false
warnings like this:

WARNING: $module.ko needs unknown symbol $symbol

This is because depmod isn't being passed the -P <symbol_prefix>
arguments to specify the symbol prefix to ignore. This option is
included since the 3.13 release of module-init-tools.

Update scripts/depmod.sh to take extra arguments which are passed
through directly to depmod, and update the main Makefile to pass
-P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
CONFIG_SYMBOL_PREFIX is set and non-empty.

scripts/depmod.sh also drops the -P arguments if depmod --version
reports module-init-tools with a version number < 3.13.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: uclinux-dist-devel@blackfin.uclinux.org
---
My shell-fu isn't great, so all comments for improvements appreciated.

 Makefile          |    6 +++++-
 scripts/depmod.sh |   27 +++++++++++++++++++++++----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 2d3c92c..89e41d4 100644
--- a/Makefile
+++ b/Makefile
@@ -1394,10 +1394,14 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN   $(wildcard $(rm-dirs)))
 quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
       cmd_rmfiles = rm -f $(rm-files)
 
+ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
+  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
+endif
+
 # Run depmod only if we have System.map and depmod is executable
 quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
-                   $(KERNELRELEASE)
+                   $(KERNELRELEASE) $(depmod_args)
 
 # Create temporary dir for module support files
 # clean it up only when building all modules
diff --git a/scripts/depmod.sh b/scripts/depmod.sh
index 2ae4817..4f3747f 100755
--- a/scripts/depmod.sh
+++ b/scripts/depmod.sh
@@ -2,16 +2,35 @@
 #
 # A depmod wrapper used by the toplevel Makefile
 
-if test $# -ne 2; then
-	echo "Usage: $0 /sbin/depmod <kernelrelease>" >&2
+if test $# -lt 2; then
+	echo "Usage: $0 /sbin/depmod <kernelrelease> [args]" >&2
 	exit 1
 fi
 DEPMOD=$1
-KERNELRELEASE=$2
+shift
+KERNELRELEASE=$1
+shift
 
 if ! test -r System.map -a -x "$DEPMOD"; then
 	exit 0
 fi
+
+# older versions of depmod don't support -P <symbol-prefix>
+# support was added in module-init-tools 3.13
+if test "$1" = "-P"; then
+	release=$("$DEPMOD" --version)
+	package=$(echo "$release" | cut -d' ' -f 1)
+	if test "$package" = "module-init-tools"; then
+		version=$(echo "$release" | cut -d' ' -f 2)
+		later=$({ echo "$version"; echo "3.13"; } | sort -V | tail -n 1)
+		if test "$later" != "$version"; then
+			# module-init-tools < 3.13, drop the next 2 args
+			shift
+			shift
+		fi
+	fi
+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
@@ -30,7 +49,7 @@ if $depmod_hack_needed; then
 	KERNELRELEASE=99.98.$KERNELRELEASE
 fi
 
-set -- -ae -F System.map
+set -- -ae -F System.map "$@"
 if test -n "$INSTALL_MOD_PATH"; then
 	set -- "$@" -b "$INSTALL_MOD_PATH"
 fi
-- 
1.7.7.6



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-01-31  9:41 ` James Hogan
  (?)
@ 2013-01-31 10:37 ` Michal Marek
  2013-01-31 10:50     ` James Hogan
  -1 siblings, 1 reply; 10+ messages in thread
From: Michal Marek @ 2013-01-31 10:37 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-kernel, linux-kbuild, Mike Frysinger, Yoshinori Sato,
	uclinux-dist-devel

On 31.1.2013 10:41, James Hogan wrote:
> On architectures which have symbol prefixes, depmod emits lots of false
> warnings like this:
> 
> WARNING: $module.ko needs unknown symbol $symbol
> 
> This is because depmod isn't being passed the -P <symbol_prefix>
> arguments to specify the symbol prefix to ignore. This option is
> included since the 3.13 release of module-init-tools.
> 
> Update scripts/depmod.sh to take extra arguments which are passed
> through directly to depmod, and update the main Makefile to pass
> -P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
> CONFIG_SYMBOL_PREFIX is set and non-empty.

OK.


> scripts/depmod.sh also drops the -P arguments if depmod --version
> reports module-init-tools with a version number < 3.13.

You can replace the test with a simple

"$DEPMOD" -P _ --help 2>/dev/null >/dev/null

Michal

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-01-31 10:37 ` Michal Marek
@ 2013-01-31 10:50     ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-01-31 10:50 UTC (permalink / raw)
  To: Michal Marek
  Cc: linux-kernel, linux-kbuild, Mike Frysinger, Yoshinori Sato,
	uclinux-dist-devel

Hi Michal,

On 31/01/13 10:37, Michal Marek wrote:
> On 31.1.2013 10:41, James Hogan wrote:
>> On architectures which have symbol prefixes, depmod emits lots of false
>> warnings like this:
>>
>> WARNING: $module.ko needs unknown symbol $symbol
>>
>> This is because depmod isn't being passed the -P <symbol_prefix>
>> arguments to specify the symbol prefix to ignore. This option is
>> included since the 3.13 release of module-init-tools.
>>
>> Update scripts/depmod.sh to take extra arguments which are passed
>> through directly to depmod, and update the main Makefile to pass
>> -P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
>> CONFIG_SYMBOL_PREFIX is set and non-empty.
> 
> OK.
> 
> 
>> scripts/depmod.sh also drops the -P arguments if depmod --version
>> reports module-init-tools with a version number < 3.13.
> 
> You can replace the test with a simple
> 
> "$DEPMOD" -P _ --help 2>/dev/null >/dev/null

Thanks for the suggestion. It would be much cleaner, but unfortunately I
tried this on module-init-tools 3.3-pre2 and module-init-tools 3.9 and
both still return success.

Cheers
James


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
@ 2013-01-31 10:50     ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-01-31 10:50 UTC (permalink / raw)
  To: Michal Marek
  Cc: linux-kernel, linux-kbuild, Mike Frysinger, Yoshinori Sato,
	uclinux-dist-devel

Hi Michal,

On 31/01/13 10:37, Michal Marek wrote:
> On 31.1.2013 10:41, James Hogan wrote:
>> On architectures which have symbol prefixes, depmod emits lots of false
>> warnings like this:
>>
>> WARNING: $module.ko needs unknown symbol $symbol
>>
>> This is because depmod isn't being passed the -P <symbol_prefix>
>> arguments to specify the symbol prefix to ignore. This option is
>> included since the 3.13 release of module-init-tools.
>>
>> Update scripts/depmod.sh to take extra arguments which are passed
>> through directly to depmod, and update the main Makefile to pass
>> -P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
>> CONFIG_SYMBOL_PREFIX is set and non-empty.
> 
> OK.
> 
> 
>> scripts/depmod.sh also drops the -P arguments if depmod --version
>> reports module-init-tools with a version number < 3.13.
> 
> You can replace the test with a simple
> 
> "$DEPMOD" -P _ --help 2>/dev/null >/dev/null

Thanks for the suggestion. It would be much cleaner, but unfortunately I
tried this on module-init-tools 3.3-pre2 and module-init-tools 3.9 and
both still return success.

Cheers
James


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-01-31 10:50     ` James Hogan
  (?)
@ 2013-01-31 11:11     ` Michal Marek
  -1 siblings, 0 replies; 10+ messages in thread
From: Michal Marek @ 2013-01-31 11:11 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-kernel, linux-kbuild, Mike Frysinger, Yoshinori Sato,
	uclinux-dist-devel

On 31.1.2013 11:50, James Hogan wrote:
> Hi Michal,
> 
> On 31/01/13 10:37, Michal Marek wrote:
>> On 31.1.2013 10:41, James Hogan wrote:
>>> On architectures which have symbol prefixes, depmod emits lots of false
>>> warnings like this:
>>>
>>> WARNING: $module.ko needs unknown symbol $symbol
>>>
>>> This is because depmod isn't being passed the -P <symbol_prefix>
>>> arguments to specify the symbol prefix to ignore. This option is
>>> included since the 3.13 release of module-init-tools.
>>>
>>> Update scripts/depmod.sh to take extra arguments which are passed
>>> through directly to depmod, and update the main Makefile to pass
>>> -P $(CONFIG_SYMBOL_PREFIX to scripts/depmod.sh, but only if
>>> CONFIG_SYMBOL_PREFIX is set and non-empty.
>>
>> OK.
>>
>>
>>> scripts/depmod.sh also drops the -P arguments if depmod --version
>>> reports module-init-tools with a version number < 3.13.
>>
>> You can replace the test with a simple
>>
>> "$DEPMOD" -P _ --help 2>/dev/null >/dev/null
> 
> Thanks for the suggestion. It would be much cleaner, but unfortunately I
> tried this on module-init-tools 3.3-pre2 and module-init-tools 3.9 and
> both still return success.

Indeed, depmod had the modutils fallback, so it did not fail on unknown
options immediately. So the version parsing is inevitable. Thanks for
checking.

Michal

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-01-31  9:41 ` James Hogan
  (?)
  (?)
@ 2013-02-03  6:17 ` Mike Frysinger
  2013-02-05 10:33     ` James Hogan
  -1 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2013-02-03  6:17 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-kernel, Michal Marek, linux-kbuild, Yoshinori Sato,
	uclinux-dist-devel

[-- Attachment #1: Type: Text/Plain, Size: 1725 bytes --]

On Thursday 31 January 2013 04:41:43 James Hogan wrote:
> --- a/Makefile
> +++ b/Makefile
> 
> +ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
> +  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
> +endif
> ...
>  # Run depmod only if we have System.map and depmod is executable
>  quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
>        cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
> -                   $(KERNELRELEASE)
> +                   $(KERNELRELEASE) $(depmod_args)

scripts/Makefile.lib just does:
	ifdef CONFIG_SYMBOL_PREFIX
so you should do the same

that said, cmd_depmod is just a shell command.  and you're running another 
script helper (depmod.sh).  how about passing it unconditionally ?
	cmd_depmod = ... -P "$(CONFIG_SYMBOL_PREFIX)"

since the default will be "no prefix", using -P "" is the same thing.

> --- a/scripts/depmod.sh
> +++ b/scripts/depmod.sh
> 
>  DEPMOD=$1
> -KERNELRELEASE=$2
> +shift
> +KERNELRELEASE=$1
> +shift

you can do:
	DEPMOD=$1
	KERNELRELEASE=$2
	shift 2

> +# older versions of depmod don't support -P <symbol-prefix>
> +# support was added in module-init-tools 3.13
> +if test "$1" = "-P"; then
> +	release=$("$DEPMOD" --version)
> +	package=$(echo "$release" | cut -d' ' -f 1)
> +	if test "$package" = "module-init-tools"; then
> +		version=$(echo "$release" | cut -d' ' -f 2)
> +		later=$({ echo "$version"; echo "3.13"; } | sort -V | tail -n 1)

you could do instead:
	later=$(printf '%s\n' "$version" "3.13" | sort -V | tail -n 1)

> +		if test "$later" != "$version"; then
> +			# module-init-tools < 3.13, drop the next 2 args
> +			shift
> +			shift
> +		fi

shift 2
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-02-03  6:17 ` Mike Frysinger
@ 2013-02-05 10:33     ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-02-05 10:33 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-kernel, Michal Marek, linux-kbuild, Yoshinori Sato,
	uclinux-dist-devel, Jonas

[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]

Hi Mike,

On 03/02/13 06:17, Mike Frysinger wrote:
> On Thursday 31 January 2013 04:41:43 James Hogan wrote:
>> --- a/Makefile
>> +++ b/Makefile
>>
>> +ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
>> +  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
>> +endif
>> ...
>>  # Run depmod only if we have System.map and depmod is executable
>>  quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
>>        cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
>> -                   $(KERNELRELEASE)
>> +                   $(KERNELRELEASE) $(depmod_args)
> 
> scripts/Makefile.lib just does:
> 	ifdef CONFIG_SYMBOL_PREFIX
> so you should do the same

arch/openrisc/Kconfig now defines SYMBOL_PREFIX as "", so this isn't
sufficient (arguably it probably shouldn't be defined empty like that?)

> 
> that said, cmd_depmod is just a shell command.  and you're running another 
> script helper (depmod.sh).  how about passing it unconditionally ?
> 	cmd_depmod = ... -P "$(CONFIG_SYMBOL_PREFIX)"
> 
> since the default will be "no prefix", using -P "" is the same thing.

Yep, I could do this, but depmod.sh would need modifying to drop it if
the prefix is empty, otherwise you get the following from depmod:
FATAL: -P only takes a single char

I don't mind adding that, but what do you think?

> 
>> --- a/scripts/depmod.sh
>> +++ b/scripts/depmod.sh
>>
>>  DEPMOD=$1
>> -KERNELRELEASE=$2
>> +shift
>> +KERNELRELEASE=$1
>> +shift
> 
> you can do:
> 	DEPMOD=$1
> 	KERNELRELEASE=$2
> 	shift 2

neat, thanks

> 
>> +# older versions of depmod don't support -P <symbol-prefix>
>> +# support was added in module-init-tools 3.13
>> +if test "$1" = "-P"; then
>> +	release=$("$DEPMOD" --version)
>> +	package=$(echo "$release" | cut -d' ' -f 1)
>> +	if test "$package" = "module-init-tools"; then
>> +		version=$(echo "$release" | cut -d' ' -f 2)
>> +		later=$({ echo "$version"; echo "3.13"; } | sort -V | tail -n 1)
> 
> you could do instead:
> 	later=$(printf '%s\n' "$version" "3.13" | sort -V | tail -n 1)

yep, definitely better, thanks

> 
>> +		if test "$later" != "$version"; then
>> +			# module-init-tools < 3.13, drop the next 2 args
>> +			shift
>> +			shift
>> +		fi
> 
> shift 2

ok

Thanks for the suggestions

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
@ 2013-02-05 10:33     ` James Hogan
  0 siblings, 0 replies; 10+ messages in thread
From: James Hogan @ 2013-02-05 10:33 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: linux-kernel, Michal Marek, linux-kbuild, Yoshinori Sato,
	uclinux-dist-devel, Jonas

[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]

Hi Mike,

On 03/02/13 06:17, Mike Frysinger wrote:
> On Thursday 31 January 2013 04:41:43 James Hogan wrote:
>> --- a/Makefile
>> +++ b/Makefile
>>
>> +ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
>> +  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
>> +endif
>> ...
>>  # Run depmod only if we have System.map and depmod is executable
>>  quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
>>        cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
>> -                   $(KERNELRELEASE)
>> +                   $(KERNELRELEASE) $(depmod_args)
> 
> scripts/Makefile.lib just does:
> 	ifdef CONFIG_SYMBOL_PREFIX
> so you should do the same

arch/openrisc/Kconfig now defines SYMBOL_PREFIX as "", so this isn't
sufficient (arguably it probably shouldn't be defined empty like that?)

> 
> that said, cmd_depmod is just a shell command.  and you're running another 
> script helper (depmod.sh).  how about passing it unconditionally ?
> 	cmd_depmod = ... -P "$(CONFIG_SYMBOL_PREFIX)"
> 
> since the default will be "no prefix", using -P "" is the same thing.

Yep, I could do this, but depmod.sh would need modifying to drop it if
the prefix is empty, otherwise you get the following from depmod:
FATAL: -P only takes a single char

I don't mind adding that, but what do you think?

> 
>> --- a/scripts/depmod.sh
>> +++ b/scripts/depmod.sh
>>
>>  DEPMOD=$1
>> -KERNELRELEASE=$2
>> +shift
>> +KERNELRELEASE=$1
>> +shift
> 
> you can do:
> 	DEPMOD=$1
> 	KERNELRELEASE=$2
> 	shift 2

neat, thanks

> 
>> +# older versions of depmod don't support -P <symbol-prefix>
>> +# support was added in module-init-tools 3.13
>> +if test "$1" = "-P"; then
>> +	release=$("$DEPMOD" --version)
>> +	package=$(echo "$release" | cut -d' ' -f 1)
>> +	if test "$package" = "module-init-tools"; then
>> +		version=$(echo "$release" | cut -d' ' -f 2)
>> +		later=$({ echo "$version"; echo "3.13"; } | sort -V | tail -n 1)
> 
> you could do instead:
> 	later=$(printf '%s\n' "$version" "3.13" | sort -V | tail -n 1)

yep, definitely better, thanks

> 
>> +		if test "$later" != "$version"; then
>> +			# module-init-tools < 3.13, drop the next 2 args
>> +			shift
>> +			shift
>> +		fi
> 
> shift 2

ok

Thanks for the suggestions

Cheers
James


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX
  2013-02-05 10:33     ` James Hogan
  (?)
@ 2013-02-05 23:18     ` Mike Frysinger
  -1 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2013-02-05 23:18 UTC (permalink / raw)
  To: James Hogan
  Cc: linux-kernel, Michal Marek, linux-kbuild, Yoshinori Sato,
	uclinux-dist-devel, Jonas

[-- Attachment #1: Type: Text/Plain, Size: 1602 bytes --]

On Tuesday 05 February 2013 05:33:19 James Hogan wrote:
> On 03/02/13 06:17, Mike Frysinger wrote:
> > On Thursday 31 January 2013 04:41:43 James Hogan wrote:
> >> --- a/Makefile
> >> +++ b/Makefile
> >> 
> >> +ifneq ($(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)),)
> >> +  depmod_args = -P $(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
> >> +endif
> >> ...
> >>  # Run depmod only if we have System.map and depmod is executable
> >>  quiet_cmd_depmod = DEPMOD  $(KERNELRELEASE)
> >>        cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh
> >>        $(DEPMOD) \
> >> -                   $(KERNELRELEASE)
> >> +                   $(KERNELRELEASE) $(depmod_args)
> > 
> > scripts/Makefile.lib just does:
> > 	ifdef CONFIG_SYMBOL_PREFIX
> > 
> > so you should do the same
> 
> arch/openrisc/Kconfig now defines SYMBOL_PREFIX as "", so this isn't
> sufficient (arguably it probably shouldn't be defined empty like that?)

yes, that should simply be deleted

> > that said, cmd_depmod is just a shell command.  and you're running
> > another script helper (depmod.sh).  how about passing it unconditionally
> > ?
> > 
> > 	cmd_depmod = ... -P "$(CONFIG_SYMBOL_PREFIX)"
> > 
> > since the default will be "no prefix", using -P "" is the same thing.
> 
> Yep, I could do this, but depmod.sh would need modifying to drop it if
> the prefix is empty, otherwise you get the following from depmod:
> FATAL: -P only takes a single char
> 
> I don't mind adding that, but what do you think?

i mean depmod.sh should only pass -P to depmod if the arg is non-empty
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-02-05 23:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-31  9:41 [PATCH 1/1] depmod: pass -P $CONFIG_SYMBOL_PREFIX James Hogan
2013-01-31  9:41 ` James Hogan
2013-01-31 10:37 ` Michal Marek
2013-01-31 10:50   ` James Hogan
2013-01-31 10:50     ` James Hogan
2013-01-31 11:11     ` Michal Marek
2013-02-03  6:17 ` Mike Frysinger
2013-02-05 10:33   ` James Hogan
2013-02-05 10:33     ` James Hogan
2013-02-05 23:18     ` Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.