Patchwork [v2,16/28] kernel.bbclass: use ${base_libdir} and ${sysconfdir} instead of /lib and /etc

login
register
mail settings
Submitter Javier Martinez Canillas
Date Aug. 5, 2012, 7:48 p.m.
Message ID <1344196136-7643-17-git-send-email-javier@dowhile0.org>
Download mbox | patch
Permalink /patch/33933/
State New
Headers show

Comments

Javier Martinez Canillas - Aug. 5, 2012, 7:48 p.m.
It is considered good practice to use the build system provided
variables instead of directly specify hardcoded paths.

Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
---
 meta/classes/kernel.bbclass |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
Darren Hart - Aug. 6, 2012, 4:14 p.m.
On 08/05/2012 12:48 PM, Javier Martinez Canillas wrote:

Hi Javier,

> It is considered good practice to use the build system provided
> variables instead of directly specify hardcoded paths.

Have you tested this with a build using a base_libdir other than /lib ?

> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
> ---
>  meta/classes/kernel.bbclass |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 1d8dff9..b434093 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -109,10 +109,10 @@ kernel_do_install() {
>  	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>  	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>  		oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install

The install doesn't specify base_libdir, so does the kernel make system
honor it?

> -		rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.order"
> -		rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.builtin"
> -		rm "${D}/lib/modules/${KERNEL_VERSION}/build"
> -		rm "${D}/lib/modules/${KERNEL_VERSION}/source"
> +		rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.order"
> +		rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.builtin"
> +		rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/build"
> +		rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/source"

if not, these will fail.
Javier Martinez Canillas - Aug. 6, 2012, 5:26 p.m.
On Mon, Aug 6, 2012 at 6:14 PM, Darren Hart <dvhart@linux.intel.com> wrote:
> On 08/05/2012 12:48 PM, Javier Martinez Canillas wrote:
>
> Hi Javier,
>
>> It is considered good practice to use the build system provided
>> variables instead of directly specify hardcoded paths.
>
> Have you tested this with a build using a base_libdir other than /lib ?
>
>> Signed-off-by: Javier Martinez Canillas <javier@dowhile0.org>
>> ---
>>  meta/classes/kernel.bbclass |   12 ++++++------
>>  1 files changed, 6 insertions(+), 6 deletions(-)
>>
>> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
>> index 1d8dff9..b434093 100644
>> --- a/meta/classes/kernel.bbclass
>> +++ b/meta/classes/kernel.bbclass
>> @@ -109,10 +109,10 @@ kernel_do_install() {
>>       unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
>>       if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
>>               oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
>
> The install doesn't specify base_libdir, so does the kernel make system
> honor it?
>
>> -             rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.order"
>> -             rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.builtin"
>> -             rm "${D}/lib/modules/${KERNEL_VERSION}/build"
>> -             rm "${D}/lib/modules/${KERNEL_VERSION}/source"
>> +             rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.order"
>> +             rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.builtin"
>> +             rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/build"
>> +             rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/source"
>
> if not, these will fail.
>
> --
> Darren Hart
> Intel Open Source Technology Center
> Yocto Project - Technical Lead - Linux Kernel

Hi Darren,

Yes, you are right I didn't think about it.

The kernel is a special case since you just specify the root of the
file system with INSTALL_MOD_PATH the kernel build system will
*always* create lib/modules/${KERNEL_VERSION}.

In fact now that I think about it, I don't know if you can even change
the path were the kernel modules gets installed.

So, yes the kernel is a special case and using a ${base_libdir} other
than /lib will definitely break loadable kernel modules installation.

Richard, Darren is correct and this patch is wrong, this is one of the
cases which is acceptable (and necessary) to hardcode /lib.

Thanks a lot for pointing me out this and sorry for not realizing this
before sending the patch-set.

Best regards,
Javier
Khem Raj - Aug. 7, 2012, 8:04 p.m.
On Mon, Aug 6, 2012 at 9:14 AM, Darren Hart <dvhart@linux.intel.com> wrote:
> if not, these will fail.

and it does.
McClintock Matthew-B29882 - Aug. 7, 2012, 8:19 p.m.
On Tue, Aug 7, 2012 at 3:04 PM, Khem Raj <raj.khem@gmail.com> wrote:
> On Mon, Aug 6, 2012 at 9:14 AM, Darren Hart <dvhart@linux.intel.com> wrote:
>> if not, these will fail.
>
> and it does.

This is already reverted.

-M

>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 1d8dff9..b434093 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -109,10 +109,10 @@  kernel_do_install() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
 		oe_runmake DEPMOD=echo INSTALL_MOD_PATH="${D}" modules_install
-		rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.order"
-		rm -f "${D}/lib/modules/${KERNEL_VERSION}/modules.builtin"
-		rm "${D}/lib/modules/${KERNEL_VERSION}/build"
-		rm "${D}/lib/modules/${KERNEL_VERSION}/source"
+		rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.order"
+		rm -f "${D}${base_libdir}/modules/${KERNEL_VERSION}/modules.builtin"
+		rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/build"
+		rm "${D}${base_libdir}/modules/${KERNEL_VERSION}/source"
 	else
 		bbnote "no modules to install"
 	fi
@@ -127,8 +127,8 @@  kernel_do_install() {
 	install -m 0644 .config ${D}/boot/config-${KERNEL_VERSION}
 	install -m 0644 vmlinux ${D}/boot/vmlinux-${KERNEL_VERSION}
 	[ -e Module.symvers ] && install -m 0644 Module.symvers ${D}/boot/Module.symvers-${KERNEL_VERSION}
-	install -d ${D}/etc/modules-load.d
-	install -d ${D}/etc/modprobe.d
+	install -d ${D}${sysconfdir}/modules-load.d
+	install -d ${D}${sysconfdir}/modprobe.d
 
 	#
 	# Support for external module building - create a minimal copy of the