All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
@ 2019-09-04  1:43 Hongzhi.Song
  2019-09-04  3:55 ` Bruce Ashfield
  0 siblings, 1 reply; 9+ messages in thread
From: Hongzhi.Song @ 2019-09-04  1:43 UTC (permalink / raw)
  To: bruce.ashfield, openembedded-core

There are two errors when compile an out of tree kernel module
using sdk:

1. "In file included from ./include/linux/seqlock.h:36:0,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from kernel-module/char.c:1:
./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
file or directory"

mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.

And there is only generated/ under ${B}/arch/${ARCH}/include/,
so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
in case of other files under generated/ is needed in the future.

2. "/bin/sh: scripts/mod/modpost: No such file or directory"

Copy above files or directory to $kerneldir/build/ fix the errors.

Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
index 3900489..feff9f1 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb
+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
@@ -80,6 +80,12 @@ do_install() {
 
 	cp .config $kerneldir/build
 
+	if [ -d arch/${ARCH}/include ]; then
+	    cp -a --parents arch/${ARCH}/include $kerneldir/build/
+	fi
+
+	cp --parents scripts/mod/modpost $kerneldir/build/
+
 	# This scripts copy blow up QA, so for now, we require a more
 	# complex 'make scripts' to restore these, versus copying them
 	# here. Left as a reference to indicate that we know the scripts must
-- 
2.8.1



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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-04  1:43 [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel Hongzhi.Song
@ 2019-09-04  3:55 ` Bruce Ashfield
  2019-09-04 10:07   ` Hongzhi, Song
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ashfield @ 2019-09-04  3:55 UTC (permalink / raw)
  To: Hongzhi.Song; +Cc: Patches and discussions about the oe-core layer

On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song <hongzhi.song@windriver.com> wrote:
>
> There are two errors when compile an out of tree kernel module
> using sdk:
>

This is not universally true. Can you expand on what kernel version
and architectures you are building ? I'm able to build kernel modules
across all the arches I'm currently testing, so I'd like to capture
your exact config in the long log. Neither is the autobuilder showing
any errors.

> 1. "In file included from ./include/linux/seqlock.h:36:0,
>                  from ./include/linux/time.h:6,
>                  from ./include/linux/stat.h:19,
>                  from ./include/linux/module.h:10,
>                  from kernel-module/char.c:1:
> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
> file or directory"
>
> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
>
> And there is only generated/ under ${B}/arch/${ARCH}/include/,
> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
> in case of other files under generated/ is needed in the future.
>
> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
>
> Copy above files or directory to $kerneldir/build/ fix the errors.
>
> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> ---
>  meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
> index 3900489..feff9f1 100644
> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> @@ -80,6 +80,12 @@ do_install() {
>
>         cp .config $kerneldir/build
>
> +       if [ -d arch/${ARCH}/include ]; then
> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
> +       fi

Just copy the files you need, not the entire directory.

> +
> +       cp --parents scripts/mod/modpost $kerneldir/build/

We shouldn't be copying binaries or scripts. They are regenerated on target.

Bruce

> +
>         # This scripts copy blow up QA, so for now, we require a more
>         # complex 'make scripts' to restore these, versus copying them
>         # here. Left as a reference to indicate that we know the scripts must
> --
> 2.8.1
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-04  3:55 ` Bruce Ashfield
@ 2019-09-04 10:07   ` Hongzhi, Song
  2019-09-04 12:34     ` Bruce Ashfield
  0 siblings, 1 reply; 9+ messages in thread
From: Hongzhi, Song @ 2019-09-04 10:07 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: Patches and discussions about the oe-core layer


On 9/4/19 11:55 AM, Bruce Ashfield wrote:
> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song <hongzhi.song@windriver.com> wrote:
>> There are two errors when compile an out of tree kernel module
>> using sdk:
>>
> This is not universally true. Can you expand on what kernel version
> and architectures you are building ? I'm able to build kernel modules
> across all the arches I'm currently testing, so I'd like to capture
> your exact config in the long log. Neither is the autobuilder showing
> any errors.

Hi Bruce,


kernel version: 5.0.19

git clone poky

echo  TOOLCHAIN_HOST_TASK_append = " nativesdk-openssl-dev 
nativesdk-bison nativesdk-flex"
          TOOLCHAIN_TARGET_TASK_append = " python-dev kernel-dev 
kernel-devsrc")

          >> conf/local.conf

Other config is default.


bitbake core-image-minimal &&  bitbake core-image-minimal -c populate_sdk

./tmp/deploy/sdk/xxx.sh

cd ${Your SDK path}/sysroots/xxx/usr/src/kernel

make scripts

Then you can build yourself module. And you will meet missing some head 
files and scripts/mod/modpost.


I test qemux86-64 and qemuarm.

Both of above arch miss different head files, which all of them 
generated in ${B}/arch/${ARCH}/include/generated/asm

(qemux86-64 needs asm/early_ioremap.h and asm/mmiowb.h

qemuarm needs asm/bitsperlong.h)


>
>> 1. "In file included from ./include/linux/seqlock.h:36:0,
>>                   from ./include/linux/time.h:6,
>>                   from ./include/linux/stat.h:19,
>>                   from ./include/linux/module.h:10,
>>                   from kernel-module/char.c:1:
>> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
>> file or directory"
>>
>> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
>>
>> And there is only generated/ under ${B}/arch/${ARCH}/include/,
>> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
>> in case of other files under generated/ is needed in the future.
>>
>> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
>>
>> Copy above files or directory to $kerneldir/build/ fix the errors.
>>
>> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
>> ---
>>   meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>>   1 file changed, 6 insertions(+)
>>
>> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
>> index 3900489..feff9f1 100644
>> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
>> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
>> @@ -80,6 +80,12 @@ do_install() {
>>
>>          cp .config $kerneldir/build
>>
>> +       if [ -d arch/${ARCH}/include ]; then
>> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
>> +       fi
> Just copy the files you need, not the entire directory.


Just as explained above, exactly speaking I think include/generated is 
necessary.

ps: only generated/ under include/.



>
>> +
>> +       cp --parents scripts/mod/modpost $kerneldir/build/
> We shouldn't be copying binaries or scripts. They are regenerated on target.
>
> Bruce


But scripts/mod/modpost is needed when compile a module by sdk.

Otherwise it will show error info:

"

/bin/sh: scripts/mod/modpost: No such file or directory
scripts/Makefile.modpost:92: recipe for target '__modpost' failed

"


--Hongzhi

>
>> +
>>          # This scripts copy blow up QA, so for now, we require a more
>>          # complex 'make scripts' to restore these, versus copying them
>>          # here. Left as a reference to indicate that we know the scripts must
>> --
>> 2.8.1
>>
>


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-04 10:07   ` Hongzhi, Song
@ 2019-09-04 12:34     ` Bruce Ashfield
  2019-09-06  3:10       ` Hongzhi, Song
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ashfield @ 2019-09-04 12:34 UTC (permalink / raw)
  To: Hongzhi, Song; +Cc: Patches and discussions about the oe-core layer

On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song <hongzhi.song@windriver.com> wrote:
>
>
> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
> > On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song <hongzhi.song@windriver.com> wrote:
> >> There are two errors when compile an out of tree kernel module
> >> using sdk:
> >>
> > This is not universally true. Can you expand on what kernel version
> > and architectures you are building ? I'm able to build kernel modules
> > across all the arches I'm currently testing, so I'd like to capture
> > your exact config in the long log. Neither is the autobuilder showing
> > any errors.
>
> Hi Bruce,
>
>
> kernel version: 5.0.19
>
> git clone poky
>
> echo  TOOLCHAIN_HOST_TASK_append = " nativesdk-openssl-dev
> nativesdk-bison nativesdk-flex"
>           TOOLCHAIN_TARGET_TASK_append = " python-dev kernel-dev
> kernel-devsrc")
>
>           >> conf/local.conf
>
> Other config is default.
>
>
> bitbake core-image-minimal &&  bitbake core-image-minimal -c populate_sdk
>
> ./tmp/deploy/sdk/xxx.sh
>
> cd ${Your SDK path}/sysroots/xxx/usr/src/kernel
>
> make scripts
>
> Then you can build yourself module. And you will meet missing some head
> files and scripts/mod/modpost.
>
>
> I test qemux86-64 and qemuarm.
>
> Both of above arch miss different head files, which all of them
> generated in ${B}/arch/${ARCH}/include/generated/asm
>
> (qemux86-64 needs asm/early_ioremap.h and asm/mmiowb.h
>
> qemuarm needs asm/bitsperlong.h)
>
>
> >
> >> 1. "In file included from ./include/linux/seqlock.h:36:0,
> >>                   from ./include/linux/time.h:6,
> >>                   from ./include/linux/stat.h:19,
> >>                   from ./include/linux/module.h:10,
> >>                   from kernel-module/char.c:1:
> >> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
> >> file or directory"
> >>
> >> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
> >>
> >> And there is only generated/ under ${B}/arch/${ARCH}/include/,
> >> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
> >> in case of other files under generated/ is needed in the future.
> >>
> >> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
> >>
> >> Copy above files or directory to $kerneldir/build/ fix the errors.
> >>
> >> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> >> ---
> >>   meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
> >>   1 file changed, 6 insertions(+)
> >>
> >> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
> >> index 3900489..feff9f1 100644
> >> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> >> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> >> @@ -80,6 +80,12 @@ do_install() {
> >>
> >>          cp .config $kerneldir/build
> >>
> >> +       if [ -d arch/${ARCH}/include ]; then
> >> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
> >> +       fi
> > Just copy the files you need, not the entire directory.
>
>
> Just as explained above, exactly speaking I think include/generated is
> necessary.

It shouldn't be. The point of what we include in devsrc is that it can
regenerate all these files either on target, or the SDK.

>
> ps: only generated/ under include/.
>
>
>
> >
> >> +
> >> +       cp --parents scripts/mod/modpost $kerneldir/build/
> > We shouldn't be copying binaries or scripts. They are regenerated on target.
> >
> > Bruce
>
>
> But scripts/mod/modpost is needed when compile a module by sdk.

yes, that is expected. But 'make scripts prepare' should be recreating
them. Is that not working for you ?

We can't copy the binaries, since you'll get QA errors depending on
your host/target arch combination.

Bruce

>
> Otherwise it will show error info:
>
> "
>
> /bin/sh: scripts/mod/modpost: No such file or directory
> scripts/Makefile.modpost:92: recipe for target '__modpost' failed
>
> "
>
>
> --Hongzhi
>
> >
> >> +
> >>          # This scripts copy blow up QA, so for now, we require a more
> >>          # complex 'make scripts' to restore these, versus copying them
> >>          # here. Left as a reference to indicate that we know the scripts must
> >> --
> >> 2.8.1
> >>
> >



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-04 12:34     ` Bruce Ashfield
@ 2019-09-06  3:10       ` Hongzhi, Song
  2019-09-11  9:10         ` Hongzhi, Song
  0 siblings, 1 reply; 9+ messages in thread
From: Hongzhi, Song @ 2019-09-06  3:10 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: Patches and discussions about the oe-core layer


On 9/4/19 8:34 PM, Bruce Ashfield wrote:
> On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song <hongzhi.song@windriver.com> wrote:
>>
>> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
>>> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song <hongzhi.song@windriver.com> wrote:
>>>> There are two errors when compile an out of tree kernel module
>>>> using sdk:
>>>>
>>> This is not universally true. Can you expand on what kernel version
>>> and architectures you are building ? I'm able to build kernel modules
>>> across all the arches I'm currently testing, so I'd like to capture
>>> your exact config in the long log. Neither is the autobuilder showing
>>> any errors.
>> Hi Bruce,
>>
>>
>> kernel version: 5.0.19
>>
>> git clone poky
>>
>> echo  TOOLCHAIN_HOST_TASK_append = " nativesdk-openssl-dev
>> nativesdk-bison nativesdk-flex"
>>            TOOLCHAIN_TARGET_TASK_append = " python-dev kernel-dev
>> kernel-devsrc")
>>
>>            >> conf/local.conf
>>
>> Other config is default.
>>
>>
>> bitbake core-image-minimal &&  bitbake core-image-minimal -c populate_sdk
>>
>> ./tmp/deploy/sdk/xxx.sh
>>
>> cd ${Your SDK path}/sysroots/xxx/usr/src/kernel
>>
>> make scripts
>>
>> Then you can build yourself module. And you will meet missing some head
>> files and scripts/mod/modpost.
>>
>>
>> I test qemux86-64 and qemuarm.
>>
>> Both of above arch miss different head files, which all of them
>> generated in ${B}/arch/${ARCH}/include/generated/asm
>>
>> (qemux86-64 needs asm/early_ioremap.h and asm/mmiowb.h
>>
>> qemuarm needs asm/bitsperlong.h)
>>
>>
>>>> 1. "In file included from ./include/linux/seqlock.h:36:0,
>>>>                    from ./include/linux/time.h:6,
>>>>                    from ./include/linux/stat.h:19,
>>>>                    from ./include/linux/module.h:10,
>>>>                    from kernel-module/char.c:1:
>>>> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
>>>> file or directory"
>>>>
>>>> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
>>>>
>>>> And there is only generated/ under ${B}/arch/${ARCH}/include/,
>>>> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
>>>> in case of other files under generated/ is needed in the future.
>>>>
>>>> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
>>>>
>>>> Copy above files or directory to $kerneldir/build/ fix the errors.
>>>>
>>>> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
>>>> ---
>>>>    meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>>>>    1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb b/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>> index 3900489..feff9f1 100644
>>>> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>> @@ -80,6 +80,12 @@ do_install() {
>>>>
>>>>           cp .config $kerneldir/build
>>>>
>>>> +       if [ -d arch/${ARCH}/include ]; then
>>>> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
>>>> +       fi
>>> Just copy the files you need, not the entire directory.
>>
>> Just as explained above, exactly speaking I think include/generated is
>> necessary.
> It shouldn't be. The point of what we include in devsrc is that it can
> regenerate all these files either on target, or the SDK.
>
>> ps: only generated/ under include/.
>>
>>
>>
>>>> +
>>>> +       cp --parents scripts/mod/modpost $kerneldir/build/
>>> We shouldn't be copying binaries or scripts. They are regenerated on target.
>>>
>>> Bruce
>>
>> But scripts/mod/modpost is needed when compile a module by sdk.
> yes, that is expected. But 'make scripts prepare' should be recreating
> them. Is that not working for you ?


Even without this patch, 'make scripts prepare' works.

So 2.7doc maybe need to be update, because 2.6doc uses 'make scripts'.

https://www.yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#building-out-of-tree-modules-on-the-target


--Hongzhi


>
> We can't copy the binaries, since you'll get QA errors depending on
> your host/target arch combination.
>
> Bruce
>
>> Otherwise it will show error info:
>>
>> "
>>
>> /bin/sh: scripts/mod/modpost: No such file or directory
>> scripts/Makefile.modpost:92: recipe for target '__modpost' failed
>>
>> "
>>
>>
>> --Hongzhi
>>
>>>> +
>>>>           # This scripts copy blow up QA, so for now, we require a more
>>>>           # complex 'make scripts' to restore these, versus copying them
>>>>           # here. Left as a reference to indicate that we know the scripts must
>>>> --
>>>> 2.8.1
>>>>
>
>


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-06  3:10       ` Hongzhi, Song
@ 2019-09-11  9:10         ` Hongzhi, Song
  2019-09-11 11:36           ` Bruce Ashfield
  0 siblings, 1 reply; 9+ messages in thread
From: Hongzhi, Song @ 2019-09-11  9:10 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: Patches and discussions about the oe-core layer


On 9/6/19 11:10 AM, Hongzhi, Song wrote:
>
> On 9/4/19 8:34 PM, Bruce Ashfield wrote:
>> On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song 
>> <hongzhi.song@windriver.com> wrote:
>>>
>>> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
>>>> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song 
>>>> <hongzhi.song@windriver.com> wrote:
>>>>> There are two errors when compile an out of tree kernel module
>>>>> using sdk:
>>>>>
>>>> This is not universally true. Can you expand on what kernel version
>>>> and architectures you are building ? I'm able to build kernel modules
>>>> across all the arches I'm currently testing, so I'd like to capture
>>>> your exact config in the long log. Neither is the autobuilder showing
>>>> any errors.
>>> Hi Bruce,
>>>
>>>
>>> kernel version: 5.0.19
>>>
>>> git clone poky
>>>
>>> echo  TOOLCHAIN_HOST_TASK_append = " nativesdk-openssl-dev
>>> nativesdk-bison nativesdk-flex"
>>>            TOOLCHAIN_TARGET_TASK_append = " python-dev kernel-dev
>>> kernel-devsrc")
>>>
>>>            >> conf/local.conf
>>>
>>> Other config is default.
>>>
>>>
>>> bitbake core-image-minimal &&  bitbake core-image-minimal -c 
>>> populate_sdk
>>>
>>> ./tmp/deploy/sdk/xxx.sh
>>>
>>> cd ${Your SDK path}/sysroots/xxx/usr/src/kernel
>>>
>>> make scripts
>>>
>>> Then you can build yourself module. And you will meet missing some head
>>> files and scripts/mod/modpost.
>>>
>>>
>>> I test qemux86-64 and qemuarm.
>>>
>>> Both of above arch miss different head files, which all of them
>>> generated in ${B}/arch/${ARCH}/include/generated/asm
>>>
>>> (qemux86-64 needs asm/early_ioremap.h and asm/mmiowb.h
>>>
>>> qemuarm needs asm/bitsperlong.h)
>>>
>>>
>>>>> 1. "In file included from ./include/linux/seqlock.h:36:0,
>>>>>                    from ./include/linux/time.h:6,
>>>>>                    from ./include/linux/stat.h:19,
>>>>>                    from ./include/linux/module.h:10,
>>>>>                    from kernel-module/char.c:1:
>>>>> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
>>>>> file or directory"
>>>>>
>>>>> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
>>>>>
>>>>> And there is only generated/ under ${B}/arch/${ARCH}/include/,
>>>>> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
>>>>> in case of other files under generated/ is needed in the future.
>>>>>
>>>>> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
>>>>>
>>>>> Copy above files or directory to $kerneldir/build/ fix the errors.
>>>>>
>>>>> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
>>>>> ---
>>>>>    meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
>>>>>    1 file changed, 6 insertions(+)
>>>>>
>>>>> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb 
>>>>> b/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>>> index 3900489..feff9f1 100644
>>>>> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>>> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
>>>>> @@ -80,6 +80,12 @@ do_install() {
>>>>>
>>>>>           cp .config $kerneldir/build
>>>>>
>>>>> +       if [ -d arch/${ARCH}/include ]; then
>>>>> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
>>>>> +       fi
>>>> Just copy the files you need, not the entire directory.
>>>
>>> Just as explained above, exactly speaking I think include/generated is
>>> necessary.
>> It shouldn't be. The point of what we include in devsrc is that it can
>> regenerate all these files either on target, or the SDK.
>>
>>> ps: only generated/ under include/.
>>>
>>>
>>>
>>>>> +
>>>>> +       cp --parents scripts/mod/modpost $kerneldir/build/
>>>> We shouldn't be copying binaries or scripts. They are regenerated 
>>>> on target.
>>>>
>>>> Bruce
>>>
>>> But scripts/mod/modpost is needed when compile a module by sdk.
>> yes, that is expected. But 'make scripts prepare' should be recreating
>> them. Is that not working for you ?
>
>
> Even without this patch, 'make scripts prepare' works.
>
> So 2.7doc maybe need to be update, because 2.6doc uses 'make scripts'.
>
> https://www.yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#building-out-of-tree-modules-on-the-target 
>
>
>
> --Hongzhi


Hi Bruce,

I found 2.7 and 2.6 doc all use "make scripts". And now "make scripts" 
doesn't work.

Should the doc be change to "make scripts prepare" ?


--Hongzhi


>
>
>>
>> We can't copy the binaries, since you'll get QA errors depending on
>> your host/target arch combination.
>>
>> Bruce
>>
>>> Otherwise it will show error info:
>>>
>>> "
>>>
>>> /bin/sh: scripts/mod/modpost: No such file or directory
>>> scripts/Makefile.modpost:92: recipe for target '__modpost' failed
>>>
>>> "
>>>
>>>
>>> --Hongzhi
>>>
>>>>> +
>>>>>           # This scripts copy blow up QA, so for now, we require a 
>>>>> more
>>>>>           # complex 'make scripts' to restore these, versus 
>>>>> copying them
>>>>>           # here. Left as a reference to indicate that we know the 
>>>>> scripts must
>>>>> -- 
>>>>> 2.8.1
>>>>>
>>
>>


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-11  9:10         ` Hongzhi, Song
@ 2019-09-11 11:36           ` Bruce Ashfield
  2020-01-17 15:49             ` Ruslan Bilovol
  0 siblings, 1 reply; 9+ messages in thread
From: Bruce Ashfield @ 2019-09-11 11:36 UTC (permalink / raw)
  To: Hongzhi, Song; +Cc: Patches and discussions about the oe-core layer

On Wed, Sep 11, 2019 at 5:10 AM Hongzhi, Song
<hongzhi.song@windriver.com> wrote:
>
>
> On 9/6/19 11:10 AM, Hongzhi, Song wrote:
> >
> > On 9/4/19 8:34 PM, Bruce Ashfield wrote:
> >> On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song
> >> <hongzhi.song@windriver.com> wrote:
> >>>
> >>> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
> >>>> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song
> >>>> <hongzhi.song@windriver.com> wrote:
> >>>>> There are two errors when compile an out of tree kernel module
> >>>>> using sdk:
> >>>>>
> >>>> This is not universally true. Can you expand on what kernel version
> >>>> and architectures you are building ? I'm able to build kernel modules
> >>>> across all the arches I'm currently testing, so I'd like to capture
> >>>> your exact config in the long log. Neither is the autobuilder showing
> >>>> any errors.
> >>> Hi Bruce,
> >>>
> >>>
> >>> kernel version: 5.0.19
> >>>
> >>> git clone poky
> >>>
> >>> echo  TOOLCHAIN_HOST_TASK_append = " nativesdk-openssl-dev
> >>> nativesdk-bison nativesdk-flex"
> >>>            TOOLCHAIN_TARGET_TASK_append = " python-dev kernel-dev
> >>> kernel-devsrc")
> >>>
> >>>            >> conf/local.conf
> >>>
> >>> Other config is default.
> >>>
> >>>
> >>> bitbake core-image-minimal &&  bitbake core-image-minimal -c
> >>> populate_sdk
> >>>
> >>> ./tmp/deploy/sdk/xxx.sh
> >>>
> >>> cd ${Your SDK path}/sysroots/xxx/usr/src/kernel
> >>>
> >>> make scripts
> >>>
> >>> Then you can build yourself module. And you will meet missing some head
> >>> files and scripts/mod/modpost.
> >>>
> >>>
> >>> I test qemux86-64 and qemuarm.
> >>>
> >>> Both of above arch miss different head files, which all of them
> >>> generated in ${B}/arch/${ARCH}/include/generated/asm
> >>>
> >>> (qemux86-64 needs asm/early_ioremap.h and asm/mmiowb.h
> >>>
> >>> qemuarm needs asm/bitsperlong.h)
> >>>
> >>>
> >>>>> 1. "In file included from ./include/linux/seqlock.h:36:0,
> >>>>>                    from ./include/linux/time.h:6,
> >>>>>                    from ./include/linux/stat.h:19,
> >>>>>                    from ./include/linux/module.h:10,
> >>>>>                    from kernel-module/char.c:1:
> >>>>> ./include/linux/spinlock.h:60:10: fatal error: asm/mmiowb.h: No such
> >>>>> file or directory"
> >>>>>
> >>>>> mmiowb.h is generated to ${B}/arch/${ARCH}/include/generated/asm/.
> >>>>>
> >>>>> And there is only generated/ under ${B}/arch/${ARCH}/include/,
> >>>>> so I copy whole ${B}/arch/${ARCH}/include/ to $kerneldir/build/
> >>>>> in case of other files under generated/ is needed in the future.
> >>>>>
> >>>>> 2. "/bin/sh: scripts/mod/modpost: No such file or directory"
> >>>>>
> >>>>> Copy above files or directory to $kerneldir/build/ fix the errors.
> >>>>>
> >>>>> Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
> >>>>> ---
> >>>>>    meta/recipes-kernel/linux/kernel-devsrc.bb | 6 ++++++
> >>>>>    1 file changed, 6 insertions(+)
> >>>>>
> >>>>> diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb
> >>>>> b/meta/recipes-kernel/linux/kernel-devsrc.bb
> >>>>> index 3900489..feff9f1 100644
> >>>>> --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
> >>>>> +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
> >>>>> @@ -80,6 +80,12 @@ do_install() {
> >>>>>
> >>>>>           cp .config $kerneldir/build
> >>>>>
> >>>>> +       if [ -d arch/${ARCH}/include ]; then
> >>>>> +           cp -a --parents arch/${ARCH}/include $kerneldir/build/
> >>>>> +       fi
> >>>> Just copy the files you need, not the entire directory.
> >>>
> >>> Just as explained above, exactly speaking I think include/generated is
> >>> necessary.
> >> It shouldn't be. The point of what we include in devsrc is that it can
> >> regenerate all these files either on target, or the SDK.
> >>
> >>> ps: only generated/ under include/.
> >>>
> >>>
> >>>
> >>>>> +
> >>>>> +       cp --parents scripts/mod/modpost $kerneldir/build/
> >>>> We shouldn't be copying binaries or scripts. They are regenerated
> >>>> on target.
> >>>>
> >>>> Bruce
> >>>
> >>> But scripts/mod/modpost is needed when compile a module by sdk.
> >> yes, that is expected. But 'make scripts prepare' should be recreating
> >> them. Is that not working for you ?
> >
> >
> > Even without this patch, 'make scripts prepare' works.
> >
> > So 2.7doc maybe need to be update, because 2.6doc uses 'make scripts'.
> >
> > https://www.yoctoproject.org/docs/2.6/mega-manual/mega-manual.html#building-out-of-tree-modules-on-the-target
> >
> >
> >
> > --Hongzhi
>
>
> Hi Bruce,
>
> I found 2.7 and 2.6 doc all use "make scripts". And now "make scripts"
> doesn't work.
>
> Should the doc be change to "make scripts prepare" ?

Yes they should be. We need to open a bug and get ScottR to look into it.

We've (Richard, myself, and others) have been using make scripts
prepare as a requirement for on kernel building for quite some time
now. The docs should reflect this.

Bruce

>
>
> --Hongzhi
>
>
> >
> >
> >>
> >> We can't copy the binaries, since you'll get QA errors depending on
> >> your host/target arch combination.
> >>
> >> Bruce
> >>
> >>> Otherwise it will show error info:
> >>>
> >>> "
> >>>
> >>> /bin/sh: scripts/mod/modpost: No such file or directory
> >>> scripts/Makefile.modpost:92: recipe for target '__modpost' failed
> >>>
> >>> "
> >>>
> >>>
> >>> --Hongzhi
> >>>
> >>>>> +
> >>>>>           # This scripts copy blow up QA, so for now, we require a
> >>>>> more
> >>>>>           # complex 'make scripts' to restore these, versus
> >>>>> copying them
> >>>>>           # here. Left as a reference to indicate that we know the
> >>>>> scripts must
> >>>>> --
> >>>>> 2.8.1
> >>>>>
> >>
> >>



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2019-09-11 11:36           ` Bruce Ashfield
@ 2020-01-17 15:49             ` Ruslan Bilovol
  2020-01-17 16:40               ` Bruce Ashfield
  0 siblings, 1 reply; 9+ messages in thread
From: Ruslan Bilovol @ 2020-01-17 15:49 UTC (permalink / raw)
  To: Bruce Ashfield, Hongzhi, Song
  Cc: Patches and discussions about the oe-core layer

On 9/11/19 2:36 PM, Bruce Ashfield wrote:
> On Wed, Sep 11, 2019 at 5:10 AM Hongzhi, Song
> <hongzhi.song@windriver.com> wrote:
>>
>>
>> On 9/6/19 11:10 AM, Hongzhi, Song wrote:
>>>
>>> On 9/4/19 8:34 PM, Bruce Ashfield wrote:
>>>> On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song
>>>> <hongzhi.song@windriver.com> wrote:
>>>>>
>>>>> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
>>>>>> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song
>>>>>> <hongzhi.song@windriver.com> wrote:
>>>>>>> There are two errors when compile an out of tree kernel module
>>>>>>> using sdk:
>>>>>>>
>>>>>> This is not universally true. Can you expand on what kernel version
>>>>>> and architectures you are building ? I'm able to build kernel modules
>>>>>> across all the arches I'm currently testing, so I'd like to capture
>>>>>> your exact config in the long log. Neither is the autobuilder showing
>>>>>> any errors.
>>>>> Hi Bruce,
>>>>>
>>>>>
>>>>> kernel version: 5.0.19

I met the same issue with modpost recently. This is because kernel 5.0
commit 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=60df1aee2aecb53efb4218b4dfdf7d6c80a5a3de
moved modpost out of 'scripts' target.

>> Hi Bruce,
>>
>> I found 2.7 and 2.6 doc all use "make scripts". And now "make scripts"
>> doesn't work.
>>
>> Should the doc be change to "make scripts prepare" ?
> 
> Yes they should be. We need to open a bug and get ScottR to look into it.
> 
> We've (Richard, myself, and others) have been using make scripts
> prepare as a requirement for on kernel building for quite some time
> now. The docs should reflect this.
> 

Looking at kernel sources, there is better alternative for "make scripts
prepare" requirement: "modules_prepare". It's a special Linux Kernel
target to prepare building external modules.
What it does is actually "scripts+prepare" for older kernels (like 3.10)
and "prepare" (which has "scripts" as indirect dependency) in recent
kernels (v5.4 for example)

So instead of custom "make scripts prepare" lets change it in the doc to
official "modules_prepare" target for modules building preparations.

Any objections?

Thanks,
Ruslan



























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

* Re: [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel
  2020-01-17 15:49             ` Ruslan Bilovol
@ 2020-01-17 16:40               ` Bruce Ashfield
  0 siblings, 0 replies; 9+ messages in thread
From: Bruce Ashfield @ 2020-01-17 16:40 UTC (permalink / raw)
  To: Ruslan Bilovol
  Cc: Hongzhi, Song, Patches and discussions about the oe-core layer

On Fri, Jan 17, 2020 at 10:49 AM Ruslan Bilovol <rbilovol@cisco.com> wrote:
>
> On 9/11/19 2:36 PM, Bruce Ashfield wrote:
> > On Wed, Sep 11, 2019 at 5:10 AM Hongzhi, Song
> > <hongzhi.song@windriver.com> wrote:
> >>
> >>
> >> On 9/6/19 11:10 AM, Hongzhi, Song wrote:
> >>>
> >>> On 9/4/19 8:34 PM, Bruce Ashfield wrote:
> >>>> On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song
> >>>> <hongzhi.song@windriver.com> wrote:
> >>>>>
> >>>>> On 9/4/19 11:55 AM, Bruce Ashfield wrote:
> >>>>>> On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song
> >>>>>> <hongzhi.song@windriver.com> wrote:
> >>>>>>> There are two errors when compile an out of tree kernel module
> >>>>>>> using sdk:
> >>>>>>>
> >>>>>> This is not universally true. Can you expand on what kernel version
> >>>>>> and architectures you are building ? I'm able to build kernel modules
> >>>>>> across all the arches I'm currently testing, so I'd like to capture
> >>>>>> your exact config in the long log. Neither is the autobuilder showing
> >>>>>> any errors.
> >>>>> Hi Bruce,
> >>>>>
> >>>>>
> >>>>> kernel version: 5.0.19
>
> I met the same issue with modpost recently. This is because kernel 5.0
> commit
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=60df1aee2aecb53efb4218b4dfdf7d6c80a5a3de
> moved modpost out of 'scripts' target.
>
> >> Hi Bruce,
> >>
> >> I found 2.7 and 2.6 doc all use "make scripts". And now "make scripts"
> >> doesn't work.
> >>
> >> Should the doc be change to "make scripts prepare" ?
> >
> > Yes they should be. We need to open a bug and get ScottR to look into it.
> >
> > We've (Richard, myself, and others) have been using make scripts
> > prepare as a requirement for on kernel building for quite some time
> > now. The docs should reflect this.
> >
>
> Looking at kernel sources, there is better alternative for "make scripts
> prepare" requirement: "modules_prepare". It's a special Linux Kernel
> target to prepare building external modules.
> What it does is actually "scripts+prepare" for older kernels (like 3.10)
> and "prepare" (which has "scripts" as indirect dependency) in recent
> kernels (v5.4 for example)
>
> So instead of custom "make scripts prepare" lets change it in the doc to
> official "modules_prepare" target for modules building preparations.
>
> Any objections?

We used to use modules_prepare (and many still do use it), but moved
to scripts/prepare to cover more use cases in our standardized
testing.

Whatever works for people is fine, it is just a documentation question.

Bruce

>
> Thanks,
> Ruslan
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


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

end of thread, other threads:[~2020-01-17 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-04  1:43 [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel Hongzhi.Song
2019-09-04  3:55 ` Bruce Ashfield
2019-09-04 10:07   ` Hongzhi, Song
2019-09-04 12:34     ` Bruce Ashfield
2019-09-06  3:10       ` Hongzhi, Song
2019-09-11  9:10         ` Hongzhi, Song
2019-09-11 11:36           ` Bruce Ashfield
2020-01-17 15:49             ` Ruslan Bilovol
2020-01-17 16:40               ` Bruce Ashfield

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.