Openembedded Core Discussions
 help / color / mirror / Atom feed
* kernel: building target-arch scripts/* to include in kernel-headers package
@ 2012-06-25 23:33 Darren Hart
  2012-06-26  5:19 ` Khem Raj
  0 siblings, 1 reply; 7+ messages in thread
From: Darren Hart @ 2012-06-25 23:33 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

I'm working on a patch series to provide a kernel-headers package which
allows for the compilation of Linux kernel modules on the target. I
currently have something working, but it requires that I first build the
scripts/* binaries on the target, prior to trying to build a module.

	# cd /usr/src/kernel-headers
	# make scripts

Then I can build modules:

	# cd /home/root/hello-mod/files
	# export KERNEL_SRC=/usr/src/kernel-headers
	# make

And test:

	# insmod hello.ko
	# rmmod hello.ko
	# dmesg | tail -n2
	Hello World!
	Goodbye Cruel World!

I would like to package the target-arch scripts binaries with the
kernel-headers package, but I'm not sure how to go about building both
the native and the target binaries as part of the kernel building
process. Does it make sense to build these as part of the do_install()
task after I've moved the files from the linux recipe's workdir and
removed the host-arch binaries from scripts?

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




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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-25 23:33 kernel: building target-arch scripts/* to include in kernel-headers package Darren Hart
@ 2012-06-26  5:19 ` Khem Raj
  2012-06-26  5:53   ` Khem Raj
  2012-06-26 15:58   ` Darren Hart
  0 siblings, 2 replies; 7+ messages in thread
From: Khem Raj @ 2012-06-26  5:19 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
> I'm working on a patch series to provide a kernel-headers package which
> allows for the compilation of Linux kernel modules on the target. I
> currently have something working, but it requires that I first build the
> scripts/* binaries on the target, prior to trying to build a module.
>
>        # cd /usr/src/kernel-headers
>        # make scripts
>
> Then I can build modules:
>
>        # cd /home/root/hello-mod/files
>        # export KERNEL_SRC=/usr/src/kernel-headers
>        # make
>
> And test:
>
>        # insmod hello.ko
>        # rmmod hello.ko
>        # dmesg | tail -n2
>        Hello World!
>        Goodbye Cruel World!
>
> I would like to package the target-arch scripts binaries with the
> kernel-headers package, but I'm not sure how to go about building both
> the native and the target binaries as part of the kernel building
> process. Does it make sense to build these as part of the do_install()
> task after I've moved the files from the linux recipe's workdir and
> removed the host-arch binaries from scripts?
>

the hostprogs there are a bit hairy. you could set HOSTCC to point to
cross compiler and build scripts dir in some O=foo after copying
.config into it but the problem would be that build system expects the
hosttools in build tree at exact same location
e.g. fixdep would be needed even to build other hosttools e.g.
recordmcount etc. and thats where you have to patch kbuild such that
it could reference another fixdep tool which then will be built for
the host you are compiling kernel on.

I have a reverse problem, I want to package the scripts/ for cross building :)

> --
> Darren Hart
> Intel Open Source Technology Center
> Yocto Project - Linux Kernel
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-26  5:19 ` Khem Raj
@ 2012-06-26  5:53   ` Khem Raj
  2012-06-26 16:15     ` Darren Hart
  2012-06-26 15:58   ` Darren Hart
  1 sibling, 1 reply; 7+ messages in thread
From: Khem Raj @ 2012-06-26  5:53 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On Mon, Jun 25, 2012 at 10:19 PM, Khem Raj <raj.khem@gmail.com> wrote:
> On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>> I'm working on a patch series to provide a kernel-headers package which
>> allows for the compilation of Linux kernel modules on the target. I
>> currently have something working, but it requires that I first build the
>> scripts/* binaries on the target, prior to trying to build a module.
>>
>>        # cd /usr/src/kernel-headers
>>        # make scripts
>>
>> Then I can build modules:
>>
>>        # cd /home/root/hello-mod/files
>>        # export KERNEL_SRC=/usr/src/kernel-headers
>>        # make
>>
>> And test:
>>
>>        # insmod hello.ko
>>        # rmmod hello.ko
>>        # dmesg | tail -n2
>>        Hello World!
>>        Goodbye Cruel World!
>>
>> I would like to package the target-arch scripts binaries with the
>> kernel-headers package, but I'm not sure how to go about building both
>> the native and the target binaries as part of the kernel building
>> process. Does it make sense to build these as part of the do_install()
>> task after I've moved the files from the linux recipe's workdir and
>> removed the host-arch binaries from scripts?
>>
>
> the hostprogs there are a bit hairy. you could set HOSTCC to point to
> cross compiler and build scripts dir in some O=foo after copying
> .config into it but the problem would be that build system expects the
> hosttools in build tree at exact same location
> e.g. fixdep would be needed even to build other hosttools e.g.
> recordmcount etc. and thats where you have to patch kbuild such that
> it could reference another fixdep tool which then will be built for
> the host you are compiling kernel on.


another option is to add a completely new makefile to build
the necessary tools the way we want them and not use make scripts target at all



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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-26  5:19 ` Khem Raj
  2012-06-26  5:53   ` Khem Raj
@ 2012-06-26 15:58   ` Darren Hart
  2012-06-26 16:27     ` Koen Kooi
  1 sibling, 1 reply; 7+ messages in thread
From: Darren Hart @ 2012-06-26 15:58 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer



On 06/25/2012 10:19 PM, Khem Raj wrote:
> On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>> I'm working on a patch series to provide a kernel-headers package which
>> allows for the compilation of Linux kernel modules on the target. I
>> currently have something working, but it requires that I first build the
>> scripts/* binaries on the target, prior to trying to build a module.
>>
>>        # cd /usr/src/kernel-headers
>>        # make scripts
>>
>> Then I can build modules:
>>
>>        # cd /home/root/hello-mod/files
>>        # export KERNEL_SRC=/usr/src/kernel-headers
>>        # make
>>
>> And test:
>>
>>        # insmod hello.ko
>>        # rmmod hello.ko
>>        # dmesg | tail -n2
>>        Hello World!
>>        Goodbye Cruel World!
>>
>> I would like to package the target-arch scripts binaries with the
>> kernel-headers package, but I'm not sure how to go about building both
>> the native and the target binaries as part of the kernel building
>> process. Does it make sense to build these as part of the do_install()
>> task after I've moved the files from the linux recipe's workdir and
>> removed the host-arch binaries from scripts?
>>
> 
> the hostprogs there are a bit hairy. you could set HOSTCC to point to
> cross compiler and build scripts dir in some O=foo after copying
> .config into it but the problem would be that build system expects the
> hosttools in build tree at exact same location
> e.g. fixdep would be needed even to build other hosttools e.g.
> recordmcount etc. and thats where you have to patch kbuild such that
> it could reference another fixdep tool which then will be built for
> the host you are compiling kernel on.
> 

Ewe, what a mess.

Another option would be to add:

        # cd /usr/src/kernel-headers
        # make scripts

To the kernel-headers post-inst script. It feels hackish, but perhaps
it's a reasonable path to getting the functionality people are looking
for. I still content one should be building modules as either part of
the kernel build or as recipes styled after hello-mod.

> I have a reverse problem, I want to package the scripts/ for cross building :)

So do you need a kernel-headers-native package then? Do we possibly need
to tackle both these issues at once? I can send out my patches if you
think there is overlap.


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





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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-26  5:53   ` Khem Raj
@ 2012-06-26 16:15     ` Darren Hart
  0 siblings, 0 replies; 7+ messages in thread
From: Darren Hart @ 2012-06-26 16:15 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer



On 06/25/2012 10:53 PM, Khem Raj wrote:
> On Mon, Jun 25, 2012 at 10:19 PM, Khem Raj <raj.khem@gmail.com> wrote:
>> On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>>> I'm working on a patch series to provide a kernel-headers package which
>>> allows for the compilation of Linux kernel modules on the target. I
>>> currently have something working, but it requires that I first build the
>>> scripts/* binaries on the target, prior to trying to build a module.
>>>
>>>        # cd /usr/src/kernel-headers
>>>        # make scripts
>>>
>>> Then I can build modules:
>>>
>>>        # cd /home/root/hello-mod/files
>>>        # export KERNEL_SRC=/usr/src/kernel-headers
>>>        # make
>>>
>>> And test:
>>>
>>>        # insmod hello.ko
>>>        # rmmod hello.ko
>>>        # dmesg | tail -n2
>>>        Hello World!
>>>        Goodbye Cruel World!
>>>
>>> I would like to package the target-arch scripts binaries with the
>>> kernel-headers package, but I'm not sure how to go about building both
>>> the native and the target binaries as part of the kernel building
>>> process. Does it make sense to build these as part of the do_install()
>>> task after I've moved the files from the linux recipe's workdir and
>>> removed the host-arch binaries from scripts?
>>>
>>
>> the hostprogs there are a bit hairy. you could set HOSTCC to point to
>> cross compiler and build scripts dir in some O=foo after copying
>> .config into it but the problem would be that build system expects the
>> hosttools in build tree at exact same location
>> e.g. fixdep would be needed even to build other hosttools e.g.
>> recordmcount etc. and thats where you have to patch kbuild such that
>> it could reference another fixdep tool which then will be built for
>> the host you are compiling kernel on.
> 
> 
> another option is to add a completely new makefile to build
> the necessary tools the way we want them and not use make scripts target at all

While tempting, it sounds like a fragile mechanism with the potential
for maintenance issues.

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





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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-26 15:58   ` Darren Hart
@ 2012-06-26 16:27     ` Koen Kooi
  2012-06-26 17:12       ` Darren Hart
  0 siblings, 1 reply; 7+ messages in thread
From: Koen Kooi @ 2012-06-26 16:27 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer


Op 26 jun. 2012, om 17:58 heeft Darren Hart het volgende geschreven:

> 
> 
> On 06/25/2012 10:19 PM, Khem Raj wrote:
>> On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>>> I'm working on a patch series to provide a kernel-headers package which
>>> allows for the compilation of Linux kernel modules on the target. I
>>> currently have something working, but it requires that I first build the
>>> scripts/* binaries on the target, prior to trying to build a module.
>>> 
>>>       # cd /usr/src/kernel-headers
>>>       # make scripts
>>> 
>>> Then I can build modules:
>>> 
>>>       # cd /home/root/hello-mod/files
>>>       # export KERNEL_SRC=/usr/src/kernel-headers
>>>       # make
>>> 
>>> And test:
>>> 
>>>       # insmod hello.ko
>>>       # rmmod hello.ko
>>>       # dmesg | tail -n2
>>>       Hello World!
>>>       Goodbye Cruel World!
>>> 
>>> I would like to package the target-arch scripts binaries with the
>>> kernel-headers package, but I'm not sure how to go about building both
>>> the native and the target binaries as part of the kernel building
>>> process. Does it make sense to build these as part of the do_install()
>>> task after I've moved the files from the linux recipe's workdir and
>>> removed the host-arch binaries from scripts?
>>> 
>> 
>> the hostprogs there are a bit hairy. you could set HOSTCC to point to
>> cross compiler and build scripts dir in some O=foo after copying
>> .config into it but the problem would be that build system expects the
>> hosttools in build tree at exact same location
>> e.g. fixdep would be needed even to build other hosttools e.g.
>> recordmcount etc. and thats where you have to patch kbuild such that
>> it could reference another fixdep tool which then will be built for
>> the host you are compiling kernel on.
>> 
> 
> Ewe, what a mess.
> 
> Another option would be to add:
> 
>        # cd /usr/src/kernel-headers
>        # make scripts
> 
> To the kernel-headers post-inst script. =

or you could document it and have people do it manually.

regards,

Koen


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

* Re: kernel: building target-arch scripts/* to include in kernel-headers package
  2012-06-26 16:27     ` Koen Kooi
@ 2012-06-26 17:12       ` Darren Hart
  0 siblings, 0 replies; 7+ messages in thread
From: Darren Hart @ 2012-06-26 17:12 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer; +Cc: Koen Kooi



On 06/26/2012 09:27 AM, Koen Kooi wrote:
> 
> Op 26 jun. 2012, om 17:58 heeft Darren Hart het volgende geschreven:
> 
>>
>>
>> On 06/25/2012 10:19 PM, Khem Raj wrote:
>>> On Mon, Jun 25, 2012 at 4:33 PM, Darren Hart <dvhart@linux.intel.com> wrote:
>>>> I'm working on a patch series to provide a kernel-headers package which
>>>> allows for the compilation of Linux kernel modules on the target. I
>>>> currently have something working, but it requires that I first build the
>>>> scripts/* binaries on the target, prior to trying to build a module.
>>>>
>>>>       # cd /usr/src/kernel-headers
>>>>       # make scripts
>>>>
>>>> Then I can build modules:
>>>>
>>>>       # cd /home/root/hello-mod/files
>>>>       # export KERNEL_SRC=/usr/src/kernel-headers
>>>>       # make
>>>>
>>>> And test:
>>>>
>>>>       # insmod hello.ko
>>>>       # rmmod hello.ko
>>>>       # dmesg | tail -n2
>>>>       Hello World!
>>>>       Goodbye Cruel World!
>>>>
>>>> I would like to package the target-arch scripts binaries with the
>>>> kernel-headers package, but I'm not sure how to go about building both
>>>> the native and the target binaries as part of the kernel building
>>>> process. Does it make sense to build these as part of the do_install()
>>>> task after I've moved the files from the linux recipe's workdir and
>>>> removed the host-arch binaries from scripts?
>>>>
>>>
>>> the hostprogs there are a bit hairy. you could set HOSTCC to point to
>>> cross compiler and build scripts dir in some O=foo after copying
>>> .config into it but the problem would be that build system expects the
>>> hosttools in build tree at exact same location
>>> e.g. fixdep would be needed even to build other hosttools e.g.
>>> recordmcount etc. and thats where you have to patch kbuild such that
>>> it could reference another fixdep tool which then will be built for
>>> the host you are compiling kernel on.
>>>
>>
>> Ewe, what a mess.
>>
>> Another option would be to add:
>>
>>        # cd /usr/src/kernel-headers
>>        # make scripts
>>
>> To the kernel-headers post-inst script. =
> 
> or you could document it and have people do it manually.
> 

While I would like it to work "out of the box", that would require me to
either RDEPEND on make and gcc, or gracefully handle the postinst
failure if make and gcc are not available. Perhaps just documenting it
is the best plan for now.

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





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

end of thread, other threads:[~2012-06-26 17:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-25 23:33 kernel: building target-arch scripts/* to include in kernel-headers package Darren Hart
2012-06-26  5:19 ` Khem Raj
2012-06-26  5:53   ` Khem Raj
2012-06-26 16:15     ` Darren Hart
2012-06-26 15:58   ` Darren Hart
2012-06-26 16:27     ` Koen Kooi
2012-06-26 17:12       ` Darren Hart

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