Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
@ 2011-03-15  7:25 Darren Hart
  2011-03-15  8:31 ` Koen Kooi
  0 siblings, 1 reply; 11+ messages in thread
From: Darren Hart @ 2011-03-15  7:25 UTC (permalink / raw)
  To: openembedded-core; +Cc: Darren Hart, Koen Kooi

NOT FOR INCLUSION

Before we include something like this, it needs review from folks like Koen and
Gary to confirm it works in their environment as well.

The existing infrastructure uses an external build tree which references the
kernel source in the work dir. If run with rm work, building external modules
will fail.

This patch places a configured source tree in sysroots. Striking a balance
between minimal size and minimal maintenance is difficult. This version leans
on the side of caution and removes only the obviously unecessary parts of the
source tree to conserve space.

Care is also taken to clean the hostprogs in scripts, and the modules are
responsible for building them as needed.

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
CC: Koen Kooi <koen@beagleboard.org>
CC: Gary Thomas <gary@mlbassoc.com>
---
 meta/classes/kernel.bbclass               |   96 ++++++++++------------------
 meta/classes/module.bbclass               |    9 ++-
 meta/recipes-kernel/linux/linux-yocto.inc |    4 +
 3 files changed, 45 insertions(+), 64 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 90a7d64..c714931 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -110,78 +110,50 @@ kernel_do_install() {
 		install -d ${D}/etc/modprobe.d
 	fi
 
-
+	#
+	# Support for external module building - create a minimal copy of the
+	# kernel source tree.
+	#
+	kerneldir=${STAGING_KERNEL_DIR}
+	install -d $kerneldir
 
 	#
-	# Support for external module building - create a minimal copy of the kernel source tree
+	# Copy the entire source tree. In case an external build directory is
+	# used, copy the build directory over first, then copy over the source
+	# dir. This ensures the original Makefiles are used and not the
+	# redirecting Makefiles in the build directory.
 	#
-	kerneldir=${D}/kernel/
-
-	# Take care of arch specific headers	
-	# Kernel 2.6.27 moved headers from includes/asm-${ARCH} to arch/${ARCH}/include/asm
-	if [ -e arch/${ARCH}/include/asm/ ] ; then 
-		install -d $kerneldir/arch/${ARCH}/
-		cp -fR arch/${ARCH}/* $kerneldir/arch/${ARCH}/
-
-	# Check for arch/x86 on i386
-	elif [ -d arch/x86/include/asm/ ]; then
-		if [ -e include/asm ] ; then
-			install -d $kerneldir/include/asm/
-			cp -fR arch/x86/include/asm/* $kerneldir/include/asm/
-		fi
-		install -d $kerneldir/arch/x86/include
-		cp -fR arch/x86/* $kerneldir/arch/x86/
+	# work and sysroots can be
+	# on different partitions, so we can't rely on hardlinking,
+	# unfortunately.
+	#
+	cp -fR ./ $kerneldir
+	if [ ! "${S}" == "${B}" ]; then
+		cp -fR ${S}/* $kerneldir
 	fi
 
-	# Take care of the rest of the main directories we need
-	for entry in drivers/crypto drivers/media include scripts; do
-		if [ -d $entry ]; then
-			mkdir -p $kerneldir/$entry
-			cp -fR $entry/* $kerneldir/$entry/
-		fi
-	done
-
-	install -m 0644 .config $kerneldir/config-${KERNEL_VERSION}
-	ln -sf config-${KERNEL_VERSION} $kerneldir/.config
-	ln -sf config-${KERNEL_VERSION} $kerneldir/kernel-config
-	echo "${KERNEL_VERSION}" >$kerneldir/kernel-abiversion
-	echo "${S}" >$kerneldir/kernel-source
-	echo "${KERNEL_CCSUFFIX}" >$kerneldir/kernel-ccsuffix
-	echo "${KERNEL_LDSUFFIX}" >$kerneldir/kernel-ldsuffix
-	[ -e vmlinux ] && install -m 0644 vmlinux $kerneldir/	
-	install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
-	install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
-	[ -e Module.symvers ] && install -m 0644 Module.symvers $kerneldir/
-
-	# Copy over the main Makefiles
-	[ -e Rules.make ] && install -m 0644 Rules.make $kerneldir/
-	[ -e Makefile ] && install -m 0644 Makefile $kerneldir/
-	# Check if arch/${ARCH}/Makefile exists and install it
-	if [ -e arch/${ARCH}/Makefile ]; then
-		install -d $kerneldir/arch/${ARCH}
-		install -m 0644 arch/${ARCH}/Makefile* $kerneldir/arch/${ARCH}
-	# Otherwise check arch/x86/Makefile for i386 and x86_64 on kernels >= 2.6.24
-	elif [ -e arch/x86/Makefile ]; then
-		install -d $kerneldir/arch/x86
-		install -m 0644 arch/x86/Makefile* $kerneldir/arch/x86
-	fi
+	#
+	# Clean and remove files not needed for building modules.
+	# Some distributions go through a lot more trouble to strip out
+	# unecessary headers, for now, we just prune the obvious bits.
+	#
+	# We don't want to leave host-arch binaries in /sysroots, so
+	# we clean the scripts dir while leaving the generated config
+	# and include files.
+	#
+	oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean
+	make _mrproper_scripts
+	find $kerneldir -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \;
+	find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
 
 	# Remove the following binaries which cause strip errors
 	# during do_package for cross-compiled platforms
 	bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
-		arch/powerpc/boot/mktree scripts/bin2c scripts/conmakehash \
-		scripts/ihex2fw scripts/kallsyms scripts/pnmtologo scripts/basic/docproc \
-		scripts/basic/fixdep scripts/basic/hash scripts/dtc/dtc \
-		scripts/genksyms/genksyms scripts/kconfig/conf scripts/mod/mk_elfconfig \
-		scripts/mod/modpost scripts/recordmcount"
-	rm -rf $kerneldir/scripts/*.o
-	rm -rf $kerneldir/scripts/basic/*.o
-	rm -rf $kerneldir/scripts/kconfig/*.o
-	rm -rf $kerneldir/scripts/mod/*.o
-	rm -rf $kerneldir/scripts/dtc/*.o
+	           arch/powerpc/boot/mktree"
 	for entry in $bin_files; do
-		rm -f $kerneldir/$entry
-	done	
+	        rm -f $kerneldir/$entry
+	done
+
 }
 
 sysroot_stage_all_append() {
diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
index bbceaf7..572df0d 100644
--- a/meta/classes/module.bbclass
+++ b/meta/classes/module.bbclass
@@ -3,14 +3,19 @@ DEPENDS += "virtual/kernel"
 
 inherit module-base
 
-# Ensure the hostprogs are available for module compilation
-module_do_compile_prepend() {
+#
+# Ensure the hostprogs are available for module compilation. Modules that
+# inherit this recipe and override do_compile() should be sure to call
+# do_make_scripts() or ensure the scripts are built independently.
+#
+do_make_scripts() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 
 	oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
 	           -C ${STAGING_KERNEL_DIR} scripts
 }
 
 module_do_compile() {
+	do_make_scripts
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
 	oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
 		   KERNEL_SRC=${STAGING_KERNEL_DIR}    \
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 0812144..582e386 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -21,3 +21,7 @@ inherit kernel-yocto
 require linux-dtb.inc
 
 B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build"
+
+do_install_append(){
+	rm -rf ${STAGING_KERNEL_DIR}/$KMETA
+}
-- 
1.7.1




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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15  7:25 [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules Darren Hart
@ 2011-03-15  8:31 ` Koen Kooi
  2011-03-15 17:07   ` Darren Hart
  0 siblings, 1 reply; 11+ messages in thread
From: Koen Kooi @ 2011-03-15  8:31 UTC (permalink / raw)
  To: Darren Hart; +Cc: openembedded-core oe-core layer


Op 15 mrt 2011, om 08:25 heeft Darren Hart het volgende geschreven:

> NOT FOR INCLUSION
> 
> Before we include something like this, it needs review from folks like Koen and
> Gary to confirm it works in their environment as well.
> 
> The existing infrastructure uses an external build tree which references the
> kernel source in the work dir. If run with rm work, building external modules
> will fail.
> 
> This patch places a configured source tree in sysroots. Striking a balance
> between minimal size and minimal maintenance is difficult. This version leans
> on the side of caution and removes only the obviously unecessary parts of the
> source tree to conserve space.
> 
> Care is also taken to clean the hostprogs in scripts, and the modules are
> responsible for building them as needed.

I get this:

| cp: cannot open `./.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c' for reading: Permission denied

After adding 'do_make_scripts' in my module do_compile and applying your patch. So it seems to be tripping on the quilt directory :(

regards,

Koen


> 
> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
> CC: Koen Kooi <koen@beagleboard.org>
> CC: Gary Thomas <gary@mlbassoc.com>
> ---
> meta/classes/kernel.bbclass               |   96 ++++++++++------------------
> meta/classes/module.bbclass               |    9 ++-
> meta/recipes-kernel/linux/linux-yocto.inc |    4 +
> 3 files changed, 45 insertions(+), 64 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index 90a7d64..c714931 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -110,78 +110,50 @@ kernel_do_install() {
> 		install -d ${D}/etc/modprobe.d
> 	fi
> 
> -
> +	#
> +	# Support for external module building - create a minimal copy of the
> +	# kernel source tree.
> +	#
> +	kerneldir=${STAGING_KERNEL_DIR}
> +	install -d $kerneldir
> 
> 	#
> -	# Support for external module building - create a minimal copy of the kernel source tree
> +	# Copy the entire source tree. In case an external build directory is
> +	# used, copy the build directory over first, then copy over the source
> +	# dir. This ensures the original Makefiles are used and not the
> +	# redirecting Makefiles in the build directory.
> 	#
> -	kerneldir=${D}/kernel/
> -
> -	# Take care of arch specific headers	
> -	# Kernel 2.6.27 moved headers from includes/asm-${ARCH} to arch/${ARCH}/include/asm
> -	if [ -e arch/${ARCH}/include/asm/ ] ; then 
> -		install -d $kerneldir/arch/${ARCH}/
> -		cp -fR arch/${ARCH}/* $kerneldir/arch/${ARCH}/
> -
> -	# Check for arch/x86 on i386
> -	elif [ -d arch/x86/include/asm/ ]; then
> -		if [ -e include/asm ] ; then
> -			install -d $kerneldir/include/asm/
> -			cp -fR arch/x86/include/asm/* $kerneldir/include/asm/
> -		fi
> -		install -d $kerneldir/arch/x86/include
> -		cp -fR arch/x86/* $kerneldir/arch/x86/
> +	# work and sysroots can be
> +	# on different partitions, so we can't rely on hardlinking,
> +	# unfortunately.
> +	#
> +	cp -fR ./ $kerneldir
> +	if [ ! "${S}" == "${B}" ]; then
> +		cp -fR ${S}/* $kerneldir
> 	fi
> 
> -	# Take care of the rest of the main directories we need
> -	for entry in drivers/crypto drivers/media include scripts; do
> -		if [ -d $entry ]; then
> -			mkdir -p $kerneldir/$entry
> -			cp -fR $entry/* $kerneldir/$entry/
> -		fi
> -	done
> -
> -	install -m 0644 .config $kerneldir/config-${KERNEL_VERSION}
> -	ln -sf config-${KERNEL_VERSION} $kerneldir/.config
> -	ln -sf config-${KERNEL_VERSION} $kerneldir/kernel-config
> -	echo "${KERNEL_VERSION}" >$kerneldir/kernel-abiversion
> -	echo "${S}" >$kerneldir/kernel-source
> -	echo "${KERNEL_CCSUFFIX}" >$kerneldir/kernel-ccsuffix
> -	echo "${KERNEL_LDSUFFIX}" >$kerneldir/kernel-ldsuffix
> -	[ -e vmlinux ] && install -m 0644 vmlinux $kerneldir/	
> -	install -m 0644 ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE}
> -	install -m 0644 System.map $kerneldir/System.map-${KERNEL_VERSION}
> -	[ -e Module.symvers ] && install -m 0644 Module.symvers $kerneldir/
> -
> -	# Copy over the main Makefiles
> -	[ -e Rules.make ] && install -m 0644 Rules.make $kerneldir/
> -	[ -e Makefile ] && install -m 0644 Makefile $kerneldir/
> -	# Check if arch/${ARCH}/Makefile exists and install it
> -	if [ -e arch/${ARCH}/Makefile ]; then
> -		install -d $kerneldir/arch/${ARCH}
> -		install -m 0644 arch/${ARCH}/Makefile* $kerneldir/arch/${ARCH}
> -	# Otherwise check arch/x86/Makefile for i386 and x86_64 on kernels >= 2.6.24
> -	elif [ -e arch/x86/Makefile ]; then
> -		install -d $kerneldir/arch/x86
> -		install -m 0644 arch/x86/Makefile* $kerneldir/arch/x86
> -	fi
> +	#
> +	# Clean and remove files not needed for building modules.
> +	# Some distributions go through a lot more trouble to strip out
> +	# unecessary headers, for now, we just prune the obvious bits.
> +	#
> +	# We don't want to leave host-arch binaries in /sysroots, so
> +	# we clean the scripts dir while leaving the generated config
> +	# and include files.
> +	#
> +	oe_runmake -C $kerneldir CC="${KERNEL_CC}" LD="${KERNEL_LD}" clean
> +	make _mrproper_scripts
> +	find $kerneldir -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}' \;
> +	find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
> 
> 	# Remove the following binaries which cause strip errors
> 	# during do_package for cross-compiled platforms
> 	bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
> -		arch/powerpc/boot/mktree scripts/bin2c scripts/conmakehash \
> -		scripts/ihex2fw scripts/kallsyms scripts/pnmtologo scripts/basic/docproc \
> -		scripts/basic/fixdep scripts/basic/hash scripts/dtc/dtc \
> -		scripts/genksyms/genksyms scripts/kconfig/conf scripts/mod/mk_elfconfig \
> -		scripts/mod/modpost scripts/recordmcount"
> -	rm -rf $kerneldir/scripts/*.o
> -	rm -rf $kerneldir/scripts/basic/*.o
> -	rm -rf $kerneldir/scripts/kconfig/*.o
> -	rm -rf $kerneldir/scripts/mod/*.o
> -	rm -rf $kerneldir/scripts/dtc/*.o
> +	           arch/powerpc/boot/mktree"
> 	for entry in $bin_files; do
> -		rm -f $kerneldir/$entry
> -	done	
> +	        rm -f $kerneldir/$entry
> +	done
> +
> }
> 
> sysroot_stage_all_append() {
> diff --git a/meta/classes/module.bbclass b/meta/classes/module.bbclass
> index bbceaf7..572df0d 100644
> --- a/meta/classes/module.bbclass
> +++ b/meta/classes/module.bbclass
> @@ -3,14 +3,19 @@ DEPENDS += "virtual/kernel"
> 
> inherit module-base
> 
> -# Ensure the hostprogs are available for module compilation
> -module_do_compile_prepend() {
> +#
> +# Ensure the hostprogs are available for module compilation. Modules that
> +# inherit this recipe and override do_compile() should be sure to call
> +# do_make_scripts() or ensure the scripts are built independently.
> +#
> +do_make_scripts() {
> 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS 
> 	oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
> 	           -C ${STAGING_KERNEL_DIR} scripts
> }
> 
> module_do_compile() {
> +	do_make_scripts
> 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
> 	oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
> 		   KERNEL_SRC=${STAGING_KERNEL_DIR}    \
> diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
> index 0812144..582e386 100644
> --- a/meta/recipes-kernel/linux/linux-yocto.inc
> +++ b/meta/recipes-kernel/linux/linux-yocto.inc
> @@ -21,3 +21,7 @@ inherit kernel-yocto
> require linux-dtb.inc
> 
> B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build"
> +
> +do_install_append(){
> +	rm -rf ${STAGING_KERNEL_DIR}/$KMETA
> +}
> -- 
> 1.7.1
> 




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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15  8:31 ` Koen Kooi
@ 2011-03-15 17:07   ` Darren Hart
  2011-03-15 17:24     ` Khem Raj
  2011-03-15 17:25     ` Koen Kooi
  0 siblings, 2 replies; 11+ messages in thread
From: Darren Hart @ 2011-03-15 17:07 UTC (permalink / raw)
  To: Koen Kooi; +Cc: openembedded-core oe-core layer



On 03/15/2011 01:31 AM, Koen Kooi wrote:
>
> Op 15 mrt 2011, om 08:25 heeft Darren Hart het volgende geschreven:
>
>> NOT FOR INCLUSION
>>
>> Before we include something like this, it needs review from folks
>> like Koen and Gary to confirm it works in their environment as
>> well.
>>
>> The existing infrastructure uses an external build tree which
>> references the kernel source in the work dir. If run with rm work,
>> building external modules will fail.
>>
>> This patch places a configured source tree in sysroots. Striking a
>> balance between minimal size and minimal maintenance is difficult.
>> This version leans on the side of caution and removes only the
>> obviously unecessary parts of the source tree to conserve space.
>>
>> Care is also taken to clean the hostprogs in scripts, and the
>> modules are responsible for building them as needed.
>
> I get this:
>
> | cp: cannot open
> `./.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c'
> for reading: Permission denied
>
> After adding 'do_make_scripts' in my module do_compile and applying
> your patch. So it seems to be tripping on the quilt directory :(

What are the ownership and perms on those?

I suppose we could avoid the .pc directory - but it's going to require 
something more than cp or some additional scripting. Something like 
tar's exclude functionality might be needed - but I hate to add the 
intermediate step as the kernel recipes are already so slow.

--
Darren

>
> regards,
>
> Koen
>
>
>>
>> Signed-off-by: Darren Hart<dvhart@linux.intel.com> CC: Koen
>> Kooi<koen@beagleboard.org> CC: Gary Thomas<gary@mlbassoc.com> ---
>> meta/classes/kernel.bbclass               |   96
>> ++++++++++------------------ meta/classes/module.bbclass
>> |    9 ++- meta/recipes-kernel/linux/linux-yocto.inc |    4 + 3
>> files changed, 45 insertions(+), 64 deletions(-)
>>
>> diff --git a/meta/classes/kernel.bbclass
>> b/meta/classes/kernel.bbclass index 90a7d64..c714931 100644 ---
>> a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@
>> -110,78 +110,50 @@ kernel_do_install() { install -d
>> ${D}/etc/modprobe.d fi
>>
>> - +	# +	# Support for external module building - create a minimal
>> copy of the +	# kernel source tree. +	# +
>> kerneldir=${STAGING_KERNEL_DIR} +	install -d $kerneldir
>>
>> # -	# Support for external module building - create a minimal copy
>> of the kernel source tree +	# Copy the entire source tree. In case
>> an external build directory is +	# used, copy the build directory
>> over first, then copy over the source +	# dir. This ensures the
>> original Makefiles are used and not the +	# redirecting Makefiles
>> in the build directory. # -	kerneldir=${D}/kernel/ - -	# Take care
>> of arch specific headers -	# Kernel 2.6.27 moved headers from
>> includes/asm-${ARCH} to arch/${ARCH}/include/asm -	if [ -e
>> arch/${ARCH}/include/asm/ ] ; then -		install -d
>> $kerneldir/arch/${ARCH}/ -		cp -fR arch/${ARCH}/*
>> $kerneldir/arch/${ARCH}/ - -	# Check for arch/x86 on i386 -	elif [
>> -d arch/x86/include/asm/ ]; then -		if [ -e include/asm ] ; then -
>> install -d $kerneldir/include/asm/ -			cp -fR
>> arch/x86/include/asm/* $kerneldir/include/asm/ -		fi -		install -d
>> $kerneldir/arch/x86/include -		cp -fR arch/x86/*
>> $kerneldir/arch/x86/ +	# work and sysroots can be +	# on different
>> partitions, so we can't rely on hardlinking, +	# unfortunately. +
>> # +	cp -fR ./ $kerneldir +	if [ ! "${S}" == "${B}" ]; then +		cp
>> -fR ${S}/* $kerneldir fi
>>
>> -	# Take care of the rest of the main directories we need -	for
>> entry in drivers/crypto drivers/media include scripts; do -		if [
>> -d $entry ]; then -			mkdir -p $kerneldir/$entry -			cp -fR
>> $entry/* $kerneldir/$entry/ -		fi -	done - -	install -m 0644
>> .config $kerneldir/config-${KERNEL_VERSION} -	ln -sf
>> config-${KERNEL_VERSION} $kerneldir/.config -	ln -sf
>> config-${KERNEL_VERSION} $kerneldir/kernel-config -	echo
>> "${KERNEL_VERSION}">$kerneldir/kernel-abiversion -	echo
>> "${S}">$kerneldir/kernel-source -	echo
>> "${KERNEL_CCSUFFIX}">$kerneldir/kernel-ccsuffix -	echo
>> "${KERNEL_LDSUFFIX}">$kerneldir/kernel-ldsuffix -	[ -e vmlinux ]&&
>> install -m 0644 vmlinux $kerneldir/ -	install -m 0644
>> ${KERNEL_OUTPUT} $kerneldir/${KERNEL_IMAGETYPE} -	install -m 0644
>> System.map $kerneldir/System.map-${KERNEL_VERSION} -	[ -e
>> Module.symvers ]&&  install -m 0644 Module.symvers $kerneldir/ - -
>> # Copy over the main Makefiles -	[ -e Rules.make ]&&  install -m
>> 0644 Rules.make $kerneldir/ -	[ -e Makefile ]&&  install -m 0644
>> Makefile $kerneldir/ -	# Check if arch/${ARCH}/Makefile exists and
>> install it -	if [ -e arch/${ARCH}/Makefile ]; then -		install -d
>> $kerneldir/arch/${ARCH} -		install -m 0644 arch/${ARCH}/Makefile*
>> $kerneldir/arch/${ARCH} -	# Otherwise check arch/x86/Makefile for
>> i386 and x86_64 on kernels>= 2.6.24 -	elif [ -e arch/x86/Makefile
>> ]; then -		install -d $kerneldir/arch/x86 -		install -m 0644
>> arch/x86/Makefile* $kerneldir/arch/x86 -	fi +	# +	# Clean and
>> remove files not needed for building modules. +	# Some
>> distributions go through a lot more trouble to strip out +	#
>> unecessary headers, for now, we just prune the obvious bits. +	# +
>> # We don't want to leave host-arch binaries in /sysroots, so +	# we
>> clean the scripts dir while leaving the generated config +	# and
>> include files. +	# +	oe_runmake -C $kerneldir CC="${KERNEL_CC}"
>> LD="${KERNEL_LD}" clean +	make _mrproper_scripts +	find $kerneldir
>> -path $kerneldir/scripts -prune -o -name "*.[csS]" -exec rm '{}'
>> \; +	find $kerneldir/Documentation -name "*.txt" -exec rm '{}' \;
>>
>> # Remove the following binaries which cause strip errors # during
>> do_package for cross-compiled platforms
>> bin_files="arch/powerpc/boot/addnote arch/powerpc/boot/hack-coff \
>> -		arch/powerpc/boot/mktree scripts/bin2c scripts/conmakehash \ -
>> scripts/ihex2fw scripts/kallsyms scripts/pnmtologo
>> scripts/basic/docproc \ -		scripts/basic/fixdep scripts/basic/hash
>> scripts/dtc/dtc \ -		scripts/genksyms/genksyms scripts/kconfig/conf
>> scripts/mod/mk_elfconfig \ -		scripts/mod/modpost
>> scripts/recordmcount" -	rm -rf $kerneldir/scripts/*.o -	rm -rf
>> $kerneldir/scripts/basic/*.o -	rm -rf
>> $kerneldir/scripts/kconfig/*.o -	rm -rf $kerneldir/scripts/mod/*.o
>> -	rm -rf $kerneldir/scripts/dtc/*.o +
>> arch/powerpc/boot/mktree" for entry in $bin_files; do -		rm -f
>> $kerneldir/$entry -	done +	        rm -f $kerneldir/$entry +	done
>> + }
>>
>> sysroot_stage_all_append() { diff --git
>> a/meta/classes/module.bbclass b/meta/classes/module.bbclass index
>> bbceaf7..572df0d 100644 --- a/meta/classes/module.bbclass +++
>> b/meta/classes/module.bbclass @@ -3,14 +3,19 @@ DEPENDS +=
>> "virtual/kernel"
>>
>> inherit module-base
>>
>> -# Ensure the hostprogs are available for module compilation
>> -module_do_compile_prepend() { +# +# Ensure the hostprogs are
>> available for module compilation. Modules that +# inherit this
>> recipe and override do_compile() should be sure to call +#
>> do_make_scripts() or ensure the scripts are built independently.
>> +# +do_make_scripts() { unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS
>> oe_runmake CC="${KERNEL_CC}" LD="${KERNEL_LD}" AR="${KERNEL_AR}" \
>> -C ${STAGING_KERNEL_DIR} scripts }
>>
>> module_do_compile() { +	do_make_scripts unset CFLAGS CPPFLAGS
>> CXXFLAGS LDFLAGS oe_runmake KERNEL_PATH=${STAGING_KERNEL_DIR}   \
>> KERNEL_SRC=${STAGING_KERNEL_DIR}    \ diff --git
>> a/meta/recipes-kernel/linux/linux-yocto.inc
>> b/meta/recipes-kernel/linux/linux-yocto.inc index 0812144..582e386
>> 100644 --- a/meta/recipes-kernel/linux/linux-yocto.inc +++
>> b/meta/recipes-kernel/linux/linux-yocto.inc @@ -21,3 +21,7 @@
>> inherit kernel-yocto require linux-dtb.inc
>>
>> B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build" +
>> +do_install_append(){ +	rm -rf ${STAGING_KERNEL_DIR}/$KMETA +} --
>> 1.7.1
>>
>

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 17:07   ` Darren Hart
@ 2011-03-15 17:24     ` Khem Raj
  2011-03-15 18:23       ` Richard Purdie
  2011-03-15 17:25     ` Koen Kooi
  1 sibling, 1 reply; 11+ messages in thread
From: Khem Raj @ 2011-03-15 17:24 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart, Koen Kooi

On Tue, Mar 15, 2011 at 10:07 AM, Darren Hart <dvhart@linux.intel.com> wrote:
>
> What are the ownership and perms on those?
>
> I suppose we could avoid the .pc directory - but it's going to require
> something more than cp or some additional scripting. Something like tar's
> exclude functionality might be needed - but I hate to add the intermediate
> step as the kernel recipes are already so slow.


hmmm I wonder why those are marked non readable in .pc directory  that
seems wrong to me



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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 17:07   ` Darren Hart
  2011-03-15 17:24     ` Khem Raj
@ 2011-03-15 17:25     ` Koen Kooi
  2011-03-16  6:50       ` Darren Hart
  1 sibling, 1 reply; 11+ messages in thread
From: Koen Kooi @ 2011-03-15 17:25 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 15 mrt 2011, om 18:07 heeft Darren Hart het volgende geschreven:

> 
> 
> On 03/15/2011 01:31 AM, Koen Kooi wrote:
>> 
>> Op 15 mrt 2011, om 08:25 heeft Darren Hart het volgende geschreven:
>> 
>>> NOT FOR INCLUSION
>>> 
>>> Before we include something like this, it needs review from folks
>>> like Koen and Gary to confirm it works in their environment as
>>> well.
>>> 
>>> The existing infrastructure uses an external build tree which
>>> references the kernel source in the work dir. If run with rm work,
>>> building external modules will fail.
>>> 
>>> This patch places a configured source tree in sysroots. Striking a
>>> balance between minimal size and minimal maintenance is difficult.
>>> This version leans on the side of caution and removes only the
>>> obviously unecessary parts of the source tree to conserve space.
>>> 
>>> Care is also taken to clean the hostprogs in scripts, and the
>>> modules are responsible for building them as needed.
>> 
>> I get this:
>> 
>> | cp: cannot open
>> `./.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c'
>> for reading: Permission denied
>> 
>> After adding 'do_make_scripts' in my module do_compile and applying
>> your patch. So it seems to be tripping on the quilt directory :(
> 
> What are the ownership and perms on those?

drwxr-xr-x 126 koen koen   16384 2011-03-10 15:42 .pc/

and

drwxr-xr-x   5 koen koen  4096 2011-03-10 15:42 0001-Added-Crane-Board-support.patch/
drwxr-xr-x   3 koen koen  4096 2011-03-10 15:42 0001-BeagleBoard-Adjust-USER-button-pin-for-xM.patch/
drwxr-xr-x   4 koen koen  4096 2011-03-10 15:42 0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch/

etc.

and finally:

---------- 1 koen koen 0 2011-03-10 15:42 git/.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c

> I suppose we could avoid the .pc directory - but it's going to require something more than cp or some additional scripting. Something like tar's exclude functionality might be needed - but I hate to add the intermediate step as the kernel recipes are already so slow.

It's that or forbidding people to apply patches to the kernel :)

regards,

Koen


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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 17:24     ` Khem Raj
@ 2011-03-15 18:23       ` Richard Purdie
  2011-03-15 19:27         ` Darren Hart
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2011-03-15 18:23 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Darren Hart, Koen Kooi

On Tue, 2011-03-15 at 10:24 -0700, Khem Raj wrote:
> On Tue, Mar 15, 2011 at 10:07 AM, Darren Hart <dvhart@linux.intel.com> wrote:
> >
> > What are the ownership and perms on those?
> >
> > I suppose we could avoid the .pc directory - but it's going to require
> > something more than cp or some additional scripting. Something like tar's
> > exclude functionality might be needed - but I hate to add the intermediate
> > step as the kernel recipes are already so slow.
> 
> 
> hmmm I wonder why those are marked non readable in .pc directory  that
> seems wrong to me

Its quilt that does this. Kind of annoying but its been doing that for a
few versions now...

Cheers,

Richard




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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 18:23       ` Richard Purdie
@ 2011-03-15 19:27         ` Darren Hart
  2011-03-15 19:34           ` Richard Purdie
  2011-03-16  2:02           ` Khem Raj
  0 siblings, 2 replies; 11+ messages in thread
From: Darren Hart @ 2011-03-15 19:27 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Koen Kooi, Patches and discussions about the oe-core layer



On 03/15/2011 11:23 AM, Richard Purdie wrote:
> On Tue, 2011-03-15 at 10:24 -0700, Khem Raj wrote:
>> On Tue, Mar 15, 2011 at 10:07 AM, Darren Hart<dvhart@linux.intel.com>  wrote:
>>>
>>> What are the ownership and perms on those?
>>>
>>> I suppose we could avoid the .pc directory - but it's going to require
>>> something more than cp or some additional scripting. Something like tar's
>>> exclude functionality might be needed - but I hate to add the intermediate
>>> step as the kernel recipes are already so slow.
>>
>>
>> hmmm I wonder why those are marked non readable in .pc directory  that
>> seems wrong to me
>
> Its quilt that does this. Kind of annoying but its been doing that for a
> few versions now...

I recall purging .pc for this reason (just in other development, outside 
of poky).

I take it deleting .pc from the build dir would be bad as it would make 
build/hack/build fail to work on the workdir tree. That leaves changing 
the permissions and copying it, or just avoiding the copy. I'm leaning 
towards avoiding the copy - but I hate to add a ton of scripting logic 
in the copy, but that may be the best solution.

>
> Cheers,
>
> Richard
>

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 19:27         ` Darren Hart
@ 2011-03-15 19:34           ` Richard Purdie
  2011-03-15 20:01             ` Darren Hart
  2011-03-16  2:02           ` Khem Raj
  1 sibling, 1 reply; 11+ messages in thread
From: Richard Purdie @ 2011-03-15 19:34 UTC (permalink / raw)
  To: Darren Hart; +Cc: Koen Kooi, Patches and discussions about the oe-core layer

On Tue, 2011-03-15 at 12:27 -0700, Darren Hart wrote:
> 
> On 03/15/2011 11:23 AM, Richard Purdie wrote:
> > On Tue, 2011-03-15 at 10:24 -0700, Khem Raj wrote:
> >> On Tue, Mar 15, 2011 at 10:07 AM, Darren Hart<dvhart@linux.intel.com>  wrote:
> >>>
> >>> What are the ownership and perms on those?
> >>>
> >>> I suppose we could avoid the .pc directory - but it's going to require
> >>> something more than cp or some additional scripting. Something like tar's
> >>> exclude functionality might be needed - but I hate to add the intermediate
> >>> step as the kernel recipes are already so slow.
> >>
> >>
> >> hmmm I wonder why those are marked non readable in .pc directory  that
> >> seems wrong to me
> >
> > Its quilt that does this. Kind of annoying but its been doing that for a
> > few versions now...
> 
> I recall purging .pc for this reason (just in other development, outside 
> of poky).
> 
> I take it deleting .pc from the build dir would be bad as it would make 
> build/hack/build fail to work on the workdir tree. That leaves changing 
> the permissions and copying it, or just avoiding the copy. I'm leaning 
> towards avoiding the copy - but I hate to add a ton of scripting logic 
> in the copy, but that may be the best solution.

Can't you just do a "cp -r xxx/*" and if you need any . files "cp
xxx/.*" ?

Cheers,

Richard




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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 19:34           ` Richard Purdie
@ 2011-03-15 20:01             ` Darren Hart
  0 siblings, 0 replies; 11+ messages in thread
From: Darren Hart @ 2011-03-15 20:01 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Koen Kooi, Patches and discussions about the oe-core layer



On 03/15/2011 12:34 PM, Richard Purdie wrote:
> On Tue, 2011-03-15 at 12:27 -0700, Darren Hart wrote:
>>
>> On 03/15/2011 11:23 AM, Richard Purdie wrote:
>>> On Tue, 2011-03-15 at 10:24 -0700, Khem Raj wrote:
>>>> On Tue, Mar 15, 2011 at 10:07 AM, Darren Hart<dvhart@linux.intel.com>   wrote:
>>>>>
>>>>> What are the ownership and perms on those?
>>>>>
>>>>> I suppose we could avoid the .pc directory - but it's going to require
>>>>> something more than cp or some additional scripting. Something like tar's
>>>>> exclude functionality might be needed - but I hate to add the intermediate
>>>>> step as the kernel recipes are already so slow.
>>>>
>>>>
>>>> hmmm I wonder why those are marked non readable in .pc directory  that
>>>> seems wrong to me
>>>
>>> Its quilt that does this. Kind of annoying but its been doing that for a
>>> few versions now...
>>
>> I recall purging .pc for this reason (just in other development, outside
>> of poky).
>>
>> I take it deleting .pc from the build dir would be bad as it would make
>> build/hack/build fail to work on the workdir tree. That leaves changing
>> the permissions and copying it, or just avoiding the copy. I'm leaning
>> towards avoiding the copy - but I hate to add a ton of scripting logic
>> in the copy, but that may be the best solution.
>
> Can't you just do a "cp -r xxx/*" and if you need any . files "cp
> xxx/.*" ?

Well yes, I suppose I can. Duh. Sorry, forest for the trees and all that.

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 19:27         ` Darren Hart
  2011-03-15 19:34           ` Richard Purdie
@ 2011-03-16  2:02           ` Khem Raj
  1 sibling, 0 replies; 11+ messages in thread
From: Khem Raj @ 2011-03-16  2:02 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Koen Kooi

On (15/03/11 12:27), Darren Hart wrote:
> 
> I recall purging .pc for this reason (just in other development,
> outside of poky).
> 
> I take it deleting .pc from the build dir would be bad as it would
> make build/hack/build fail to work on the workdir tree. That leaves
> changing the permissions and copying it, or just avoiding the copy.
> I'm leaning towards avoiding the copy - but I hate to add a ton of
> scripting logic in the copy, but that may be the best solution.

I would vote for excluding it from copying.



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

* Re: [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules
  2011-03-15 17:25     ` Koen Kooi
@ 2011-03-16  6:50       ` Darren Hart
  0 siblings, 0 replies; 11+ messages in thread
From: Darren Hart @ 2011-03-16  6:50 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Koen Kooi



On 03/15/2011 10:25 AM, Koen Kooi wrote:
>
> Op 15 mrt 2011, om 18:07 heeft Darren Hart het volgende geschreven:
>
>>
>>
>> On 03/15/2011 01:31 AM, Koen Kooi wrote:
>>>
>>> Op 15 mrt 2011, om 08:25 heeft Darren Hart het volgende geschreven:
>>>
>>>> NOT FOR INCLUSION
>>>>
>>>> Before we include something like this, it needs review from folks
>>>> like Koen and Gary to confirm it works in their environment as
>>>> well.
>>>>
>>>> The existing infrastructure uses an external build tree which
>>>> references the kernel source in the work dir. If run with rm work,
>>>> building external modules will fail.
>>>>
>>>> This patch places a configured source tree in sysroots. Striking a
>>>> balance between minimal size and minimal maintenance is difficult.
>>>> This version leans on the side of caution and removes only the
>>>> obviously unecessary parts of the source tree to conserve space.
>>>>
>>>> Care is also taken to clean the hostprogs in scripts, and the
>>>> modules are responsible for building them as needed.
>>>
>>> I get this:
>>>
>>> | cp: cannot open
>>> `./.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c'
>>> for reading: Permission denied
>>>
>>> After adding 'do_make_scripts' in my module do_compile and applying
>>> your patch. So it seems to be tripping on the quilt directory :(
>>
>> What are the ownership and perms on those?
>
> drwxr-xr-x 126 koen koen   16384 2011-03-10 15:42 .pc/
>
> and
>
> drwxr-xr-x   5 koen koen  4096 2011-03-10 15:42 0001-Added-Crane-Board-support.patch/
> drwxr-xr-x   3 koen koen  4096 2011-03-10 15:42 0001-BeagleBoard-Adjust-USER-button-pin-for-xM.patch/
> drwxr-xr-x   4 koen koen  4096 2011-03-10 15:42 0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch/
>
> etc.
>
> and finally:
>
> ---------- 1 koen koen 0 2011-03-10 15:42 git/.pc/0001-PSP-3.0.1.6-kernel-source-patched-with-OCF-Linux.patch/crypto/ocf/ixp4xx/ixp4xx.c


Interesting, I just did a test patch with quilt to change the Makefile 
(outside the build system) and don't see that kind of wanton abuse of 
permissions:

dvhart@rage:linux$ ls -la .pc
total 28
drwxrwxr-x  3 dvhart dvhart 4096 2011-03-15 23:32 .
drwxrwxr-x 27 dvhart dvhart 4096 2011-03-15 23:33 ..
-rw-rw-r--  1 dvhart dvhart    8 2011-03-15 23:32 .quilt_patches
-rw-rw-r--  1 dvhart dvhart    7 2011-03-15 23:32 .quilt_series
-rw-rw-r--  1 dvhart dvhart    2 2011-03-15 23:32 .version
-rw-rw-r--  1 dvhart dvhart   17 2011-03-15 23:32 applied-patches
drwxrwxr-x  2 dvhart dvhart 4096 2011-03-15 23:33 quilt-test.patch

dvhart@rage:linux$ ls -la .pc/quilt-test.patch/
total 60
drwxrwxr-x 2 dvhart dvhart  4096 2011-03-15 23:33 .
drwxrwxr-x 3 dvhart dvhart  4096 2011-03-15 23:32 ..
-rw-rw-r-- 1 dvhart dvhart     0 2011-03-15 23:33 .timestamp
-rw-rw-r-- 1 dvhart dvhart 52198 2011-03-15 23:32 Makefile
dvhart@rage:linux$

Unfortunately, some versions/scenarios do, so I'll work around it.

>
>> I suppose we could avoid the .pc directory - but it's going to require something more than cp or some additional scripting. Something like tar's exclude functionality might be needed - but I hate to add the intermediate step as the kernel recipes are already so slow.
>
> It's that or forbidding people to apply patches to the kernel :)

Hrm.... interesting notion... do you think people would mind? ;-)

Fix is under test, hope to post yet tonight.

--
Darren

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

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Linux Kernel



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

end of thread, other threads:[~2011-03-16  6:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-15  7:25 [PATCH] [RFC] kernel: rework kernel and module classes to allow for building out-of-tree modules Darren Hart
2011-03-15  8:31 ` Koen Kooi
2011-03-15 17:07   ` Darren Hart
2011-03-15 17:24     ` Khem Raj
2011-03-15 18:23       ` Richard Purdie
2011-03-15 19:27         ` Darren Hart
2011-03-15 19:34           ` Richard Purdie
2011-03-15 20:01             ` Darren Hart
2011-03-16  2:02           ` Khem Raj
2011-03-15 17:25     ` Koen Kooi
2011-03-16  6:50       ` Darren Hart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox