Re: [OE-core] [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel

2019-09-11 Thread Hongzhi, Song


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 
 wrote:


On 9/4/19 11:55 AM, Bruce Ashfield wrote:
On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song 
 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 
---
   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





--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel

2019-09-05 Thread Hongzhi, Song



On 9/4/19 8:34 PM, Bruce Ashfield wrote:

On Wed, Sep 4, 2019 at 6:07 AM Hongzhi, Song  wrote:


On 9/4/19 11:55 AM, Bruce Ashfield wrote:

On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song  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 
---
   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





--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] kernel-devsrc: copy mmiowb.h and modpost from ${B} of kernel

2019-09-04 Thread Hongzhi, Song


On 9/4/19 11:55 AM, Bruce Ashfield wrote:

On Tue, Sep 3, 2019 at 9:43 PM Hongzhi.Song  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 
---
  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




--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] Bug report: util-linux: circular dependencies occurs when enable systemd in PACKAGECONFIG

2019-08-16 Thread Hongzhi, Song

Hi,


Some DISTRO_FEATURES related to systemd have been enabled in local.conf

    DISTRO_FEATURES_append = " systemd"
    DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
    VIRTUAL-RUNTIME_init_manager = "systemd"
    VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
    KERNEL_FEATURES_append = " cfg/systemd.scc"


1.

meta/recipes-core/util-linux/util-linux.inc has below codes:

(

PACKAGECONFIG[systemd] = "--with-systemd 
--with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd 
--without-systemdsystemunitdir,systemd"


BBCLASSEXTEND = "native nativesdk"

)


2.

Now I want to enable systemd feature, then I add below code to 
util-linux.inc:


(

PACKAGECONFIG_class-target += " systemd"

)


3.

Then bitbake util-linux

You will below errors:(I just cut out a bit)

These are usually caused by circular dependencies and any circular 
dependency chains found will be printed below. Increase the debug level 
to see a list of unbuildable tasks.


Identifying dependency loops (this may take a short while)...

ERROR:
Dependency loop #1 found:
  Task 
/buildarea/raid0/hsong/proj/lykerneldevsrc/layers/oe-core/meta/recipes-core/systemd/systemd_242.bb:do_package 
(dependent Tasks ['base-files_3.0.14.bb:do_packagedata', 
'kmod_git.bb:do_packagedata', 'glibc_2.30.bb:do_packagedata', 
'util-linux_2.34.bb:do_packagedata', 'libcap_2.27.bb:do_packagedata', 
'opkg-utils_0.4.1.bb:do_packagedata', 'libpam_1.3.1.bb:do_packagedata', 
'base-passwd_3.5.29.bb:do_packagedata', 
'pseudo_git.bb:do_populate_sysroot', 'systemd_242.bb:do_install', 
'rpm_4.14.2.1.bb:do_populate_sysroot', 
'dwarfsrcfiles.bb:do_populate_sysroot', 'shadow_4.6.bb:do_packagedata', 
'bash-completion_2.9.bb:do_packagedata', 
'shadow-sysroot_4.6.bb:do_packagedata', 'xz_5.2.4.bb:do_p



4. I tried some other code:

PACKAGECONFIG[systemd] = "--with-systemd 
--with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd 
--without-systemdsystemunitdir,systemd"


>> PACKAGECONFIG[systemd] = "--with-systemd 
--with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd 
--without-systemdsystemunitdir"



or PACKAGECONFIG_append += " systemd"


There are still other errors.


Best Regard,

--Hongzhi

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] kernel-devsrc: cp Documentation/ to sdk kernel

2019-08-14 Thread Hongzhi, Song



On 8/14/19 11:33 PM, Bruce Ashfield wrote:

On Wed, Aug 14, 2019 at 5:48 AM Hongzhi, Song
 wrote:


On 8/14/19 11:48 AM, Bruce Ashfield wrote:

On Tue, Aug 13, 2019 at 11:39 PM Bruce Ashfield
  wrote:

On Tue, Aug 13, 2019 at 11:04 PM Bruce Ashfield
  wrote:

On Tue, Aug 13, 2019 at 11:01 PM Hongzhi, Song  
wrote:

On 8/14/19 10:53 AM, Bruce Ashfield wrote:

On Tue, Aug 13, 2019 at 9:59 PM Hongzhi, Song
mailto:hongzhi.s...@windriver.com>> wrote:


  On 8/13/19 8:27 PM, Bruce Ashfield wrote:
  >
  >
  > On Tue, Aug 13, 2019 at 1:35 AM Hongzhi.Song
  > mailto:hongzhi.s...@windriver.com>
  <mailto:hongzhi.s...@windriver.com
  <mailto:hongzhi.s...@windriver.com>>> wrote:
  >
  > A new patch let kernel source Documentation/Kconfig in top
  Kconfig
  > So kernel-devsrc should include Documentation/ too.
  > Otherwise "make scripts" will fails.
  >
  > patch:
  > commit b1663d7e3a7961fc45262fd68a89253f2803036c
  > Author: Mauro Carvalho Chehab mailto:mchehab%2bsams...@kernel.org>
  > <mailto:mchehab%2bsams...@kernel.org
  <mailto:mchehab%252bsams...@kernel.org>>>
  > Date:   Tue Jun 4 09:26:27 2019 -0300
  >
  > docs: Kbuild/Makefile: allow check for missing docs at
  build time
  >
  > While this doesn't make sense for production Kernels, in
  order to
  > avoid regressions when documents are touched, let's add a
  > check target at the make file.
  >
  > Signed-off-by: Mauro Carvalho Chehab
  > mailto:mchehab%2bsams...@kernel.org>
  <mailto:mchehab%2bsams...@kernel.org
  <mailto:mchehab%252bsams...@kernel.org>>>
  > Signed-off-by: Jonathan Corbet mailto:cor...@lwn.net>
  > <mailto:cor...@lwn.net  <mailto:cor...@lwn.net>>>
  >
  > Signed-off-by: Hongzhi.Song mailto:hongzhi.s...@windriver.com>
  > <mailto:hongzhi.s...@windriver.com
  <mailto:hongzhi.s...@windriver.com>>>
  > ---
  >  meta/recipes-kernel/linux/kernel-devsrc.bb
  <http://kernel-devsrc.bb>
  ><http://kernel-devsrc.bb>  | 2 +-
  >  1 file changed, 1 insertion(+), 1 deletion(-)
  >
  > diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb
  <http://kernel-devsrc.bb>
  ><http://kernel-devsrc.bb>
  > b/meta/recipes-kernel/linux/kernel-devsrc.bb
  <http://kernel-devsrc.bb>  <http://kernel-devsrc.bb>
  > index 5ec5929..a874e06 100644
  > --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
  <http://kernel-devsrc.bb>
  ><http://kernel-devsrc.bb>
  > +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
  <http://kernel-devsrc.bb>
  ><http://kernel-devsrc.bb>
  > @@ -65,7 +65,7 @@ do_install() {
  >  )
  >
  >  # then drop all but the needed Makefiles/Kconfig files
  > -rm -rf $kerneldir/build/Documentation
  > +#rm -rf $kerneldir/build/Documentation
  >
  >
  > In the spirit of keeping kernel-devsrc as small as possible (I have
  > another patch pending if you really want the full kernel
  source), this
  > should only keep the Documentation/ files that are required to pass
  > the check, not keep all of Documentation.


  If you have a better patch, I am pleasure to accept it.


???

This is where you'd typically do a v2 of the patch after getting a
review of a change.

But if you are refusing the feedback, then yes, I'll do a version of
the patch myself rather than just blindly copying in all of the
documentation. I'll submit it myself.

RP/Ross, whoever is taking in patches, drop this version, and I'll do
my own.

I am not very familiar with the kernel-devsrc.bb. I have no objection
for your decision.

At a minimum, we shouldn't leave the commented out #rm -rf 
$kerneldir/build/Documentation, so I can do that and tweak the commit message a 
bit as well.

Leave it with me, and I'll send it to the list (hopefully tomorrow) to be sure 
it still solves your problem.

Aha. Now I see what is actually happening. On reading the patch, I
thought you were requiring the existence of the *entire* Documentation
directory, not just the Kbuild infrastructure that would be triggered
if the documentation warning is enabled.

I still want to change things just a bit, but I'll leave your
Signed-off-by on the patch, since it won't be a structural change as I
thought.

But can you provide me your test steps ? Do you have a tweaked kernel
config that is enabling WARN_MISSING_DOCUMENTS and COMPILE_TEST ?


My steps:

1. 

Re: [OE-core] [PATCH] kernel-devsrc: cp Documentation/ to sdk kernel

2019-08-13 Thread Hongzhi, Song


On 8/14/19 10:53 AM, Bruce Ashfield wrote:



On Tue, Aug 13, 2019 at 9:59 PM Hongzhi, Song 
mailto:hongzhi.s...@windriver.com>> wrote:



On 8/13/19 8:27 PM, Bruce Ashfield wrote:
>
>
> On Tue, Aug 13, 2019 at 1:35 AM Hongzhi.Song
> mailto:hongzhi.s...@windriver.com>
<mailto:hongzhi.s...@windriver.com
<mailto:hongzhi.s...@windriver.com>>> wrote:
>
>     A new patch let kernel source Documentation/Kconfig in top
Kconfig
>     So kernel-devsrc should include Documentation/ too.
>     Otherwise "make scripts" will fails.
>
>     patch:
>     commit b1663d7e3a7961fc45262fd68a89253f2803036c
>     Author: Mauro Carvalho Chehab mailto:mchehab%2bsams...@kernel.org>
>     <mailto:mchehab%2bsams...@kernel.org
<mailto:mchehab%252bsams...@kernel.org>>>
>     Date:   Tue Jun 4 09:26:27 2019 -0300
>
>         docs: Kbuild/Makefile: allow check for missing docs at
build time
>
>         While this doesn't make sense for production Kernels, in
order to
>         avoid regressions when documents are touched, let's add a
>         check target at the make file.
>
>         Signed-off-by: Mauro Carvalho Chehab
>     mailto:mchehab%2bsams...@kernel.org>
<mailto:mchehab%2bsams...@kernel.org
<mailto:mchehab%252bsams...@kernel.org>>>
>         Signed-off-by: Jonathan Corbet mailto:cor...@lwn.net>
>     <mailto:cor...@lwn.net <mailto:cor...@lwn.net>>>
>
>     Signed-off-by: Hongzhi.Song mailto:hongzhi.s...@windriver.com>
>     <mailto:hongzhi.s...@windriver.com
<mailto:hongzhi.s...@windriver.com>>>
>     ---
>      meta/recipes-kernel/linux/kernel-devsrc.bb
<http://kernel-devsrc.bb>
>     <http://kernel-devsrc.bb> | 2 +-
>      1 file changed, 1 insertion(+), 1 deletion(-)
>
>     diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb
<http://kernel-devsrc.bb>
>     <http://kernel-devsrc.bb>
>     b/meta/recipes-kernel/linux/kernel-devsrc.bb
<http://kernel-devsrc.bb> <http://kernel-devsrc.bb>
>     index 5ec5929..a874e06 100644
>     --- a/meta/recipes-kernel/linux/kernel-devsrc.bb
<http://kernel-devsrc.bb>
>     <http://kernel-devsrc.bb>
>     +++ b/meta/recipes-kernel/linux/kernel-devsrc.bb
<http://kernel-devsrc.bb>
>     <http://kernel-devsrc.bb>
>     @@ -65,7 +65,7 @@ do_install() {
>          )
>
>          # then drop all but the needed Makefiles/Kconfig files
>     -    rm -rf $kerneldir/build/Documentation
>     +    #rm -rf $kerneldir/build/Documentation
>
>
> In the spirit of keeping kernel-devsrc as small as possible (I have
> another patch pending if you really want the full kernel
source), this
> should only keep the Documentation/ files that are required to pass
> the check, not keep all of Documentation.


If you have a better patch, I am pleasure to accept it.


???

This is where you'd typically do a v2 of the patch after getting a 
review of a change.


But if you are refusing the feedback, then yes, I'll do a version of 
the patch myself rather than just blindly copying in all of the 
documentation. I'll submit it myself.


RP/Ross, whoever is taking in patches, drop this version, and I'll do 
my own.



I am not very familiar with the kernel-devsrc.bb. I have no objection 
for your decision.


Thanks,

--Hongzhi




Cheers,

Bruce


Thanks,

--Hongzhi


> Bruce
>
>          rm -rf $kerneldir/build/scripts
>          rm -rf $kerneldir/build/include
>
>     --
>     2.8.1
>
>     --
>     ___
>     Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
<mailto:Openembedded-core@lists.openembedded.org>
>     <mailto:Openembedded-core@lists.openembedded.org
<mailto:Openembedded-core@lists.openembedded.org>>
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness
await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>



--
- Thou shalt not follow the NULL pointer, for chaos and madness await 
thee at its end

- "Use the force Harry" - Gandalf, Star Trek II


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] kernel-devsrc: cp Documentation/ to sdk kernel

2019-08-13 Thread Hongzhi, Song


On 8/13/19 8:27 PM, Bruce Ashfield wrote:



On Tue, Aug 13, 2019 at 1:35 AM Hongzhi.Song 
mailto:hongzhi.s...@windriver.com>> wrote:


A new patch let kernel source Documentation/Kconfig in top Kconfig
So kernel-devsrc should include Documentation/ too.
Otherwise "make scripts" will fails.

patch:
commit b1663d7e3a7961fc45262fd68a89253f2803036c
Author: Mauro Carvalho Chehab mailto:mchehab%2bsams...@kernel.org>>
Date:   Tue Jun 4 09:26:27 2019 -0300

    docs: Kbuild/Makefile: allow check for missing docs at build time

    While this doesn't make sense for production Kernels, in order to
    avoid regressions when documents are touched, let's add a
    check target at the make file.

    Signed-off-by: Mauro Carvalho Chehab
mailto:mchehab%2bsams...@kernel.org>>
    Signed-off-by: Jonathan Corbet mailto:cor...@lwn.net>>

Signed-off-by: Hongzhi.Song mailto:hongzhi.s...@windriver.com>>
---
 meta/recipes-kernel/linux/kernel-devsrc.bb
 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/kernel-devsrc.bb

b/meta/recipes-kernel/linux/kernel-devsrc.bb 
index 5ec5929..a874e06 100644
--- a/meta/recipes-kernel/linux/kernel-devsrc.bb

+++ b/meta/recipes-kernel/linux/kernel-devsrc.bb

@@ -65,7 +65,7 @@ do_install() {
     )

     # then drop all but the needed Makefiles/Kconfig files
-    rm -rf $kerneldir/build/Documentation
+    #rm -rf $kerneldir/build/Documentation


In the spirit of keeping kernel-devsrc as small as possible (I have 
another patch pending if you really want the full kernel source), this 
should only keep the Documentation/ files that are required to pass 
the check, not keep all of Documentation.



If you have a better patch, I am pleasure to accept it.

Thanks,

--Hongzhi



Bruce

     rm -rf $kerneldir/build/scripts
     rm -rf $kerneldir/build/include

-- 
2.8.1


-- 
___

Openembedded-core mailing list
Openembedded-core@lists.openembedded.org

http://lists.openembedded.org/mailman/listinfo/openembedded-core



--
- Thou shalt not follow the NULL pointer, for chaos and madness await 
thee at its end

- "Use the force Harry" - Gandalf, Star Trek II


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] lttng-tools: enable manpages option for configure

2019-08-09 Thread Hongzhi, Song

Hi Alex,

Sorry, I will send v2 using 'api-documentation' .


--Hongzhi



On 8/9/19 4:32 PM, Alexander Kanavin wrote:
On Fri, 9 Aug 2019 at 08:49, Hongzhi.Song > wrote:


If disable this option, production will prompt "No manual entry for
lttng-help" when execute "lttng --help" series commands.

Enable the option will make lttng-tools compile manpages and then
package them into lttng-tools-doc/.


Enabling manpages is generally subject to 'api-documentation' 
DISTRO_CONFIG option. Why make an exception here?


Alex

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] ltp: getrlimit03: adjust-a-bit-of-code-to-compatiable-with mips32

2019-07-19 Thread Hongzhi, Song



On 7/19/19 2:41 PM, Petr Vorel wrote:

Hi Hongzhi,


...

--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
@@ -0,0 +1,62 @@
+From e79652a3839869b1983d65999e5d5dcb50bc9cd7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Mon, 15 Jul 2019 03:39:06 -0400
+Subject: [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32

...

+Signed-off-by: Jan Stancek 
+Signed-off-by: Hongzhi.Song 
+
+Upstream-Status: Backport
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)

I have to say I prefer policy when only build fixes are backported / added.
(approach which e.g. buildroot has). Having many patches (25 atm) makes updating
a bit difficult (ok, not that much, 'Upstream-Status: Backport' shows what has
been merged since last release) and sometimes brings users patches which weren't
accepted by upstream (your mips patch [1] was not accepted [2]

Thanks for your kindly remind.
Agree with you. It's time to uprev ltp recipe.



 From now, if the "Submitting or Backport" is appropriate,
I will make sure the patch was merged by ltp before it was sent to oe-core.

Great! Feel free to Cc me when sending patches.


).
But I understand that LTP 3 months release cycle can be to
slow for some LTP users.
Kind regards,
Petr
PS: I'm slowly working on fixing all musl issues in LTP upstream. It's a long
term run but were moving towards that goal.
Patch "build: Add option to select libc implementation" [3] is a not a good
approach.  Instead it's needed to find for each failure why it's not presented
in musl.  Mostly because it uses non POSIX features or deprecated API, which
needs to be avoided or used kernel headers where it's available.
[1] 
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch

I am working on this patch.

Good.



[2] https://patchwork.ozlabs.org/patch/982194/#2012168

This patch has been merge by ltp finally.

To LTP upstream? I don't see it [4]. That's the patch you working on.


Hi Petr,

quote your statement above : "[2] 
https://patchwork.ozlabs.org/patch/982194/#2012168;


https://github.com/linux-test-project/ltp/commit/7a3bca63cd7f059d490b6274f0fdf3247be93fde

--Hongzhi





--Hongzhi

[3] 
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch

[4] 
https://github.com/linux-test-project/ltp/commits/master/testcases/open_posix_testsuite/conformance/interfaces/mmap/24-2.c


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] ltp: getrlimit03: adjust-a-bit-of-code-to-compatiable-with mips32

2019-07-18 Thread Hongzhi, Song



On 7/19/19 5:51 AM, Petr Vorel wrote:

Hi Hongzhi,

...

--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-getrlimit03-adjust-a-bit-of-code-to-compatiable-with.patch
@@ -0,0 +1,62 @@
+From e79652a3839869b1983d65999e5d5dcb50bc9cd7 Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Mon, 15 Jul 2019 03:39:06 -0400
+Subject: [PATCH] getrlimit03: adjust a bit of code to compatiable with mips32

...

+Signed-off-by: Jan Stancek 
+Signed-off-by: Hongzhi.Song 
+
+Upstream-Status: Backport
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/getrlimit/getrlimit03.c | 8 +++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)

I have to say I prefer policy when only build fixes are backported / added.
(approach which e.g. buildroot has). Having many patches (25 atm) makes updating
a bit difficult (ok, not that much, 'Upstream-Status: Backport' shows what has
been merged since last release) and sometimes brings users patches which weren't
accepted by upstream (your mips patch [1] was not accepted [2]


Thanks for your kindly remind.

Agree with you. It's time to uprev ltp recipe.


From now, if the "Submitting or Backport" is appropriate,

I will make sure the patch was merged by ltp before it was sent to oe-core.



).

But I understand that LTP 3 months release cycle can be to
slow for some LTP users.

Kind regards,
Petr

PS: I'm slowly working on fixing all musl issues in LTP upstream. It's a long
term run but were moving towards that goal.
Patch "build: Add option to select libc implementation" [3] is a not a good
approach.  Instead it's needed to find for each failure why it's not presented
in musl.  Mostly because it uses non POSIX features or deprecated API, which
needs to be avoided or used kernel headers where it's available.

[1] 
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-extended/ltp/ltp/0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch


I am working on this patch.



[2] https://patchwork.ozlabs.org/patch/982194/#2012168


This patch has been merge by ltp finally.

--Hongzhi


[3] 
http://cgit.openembedded.org/openembedded-core/tree/meta/recipes-extended/ltp/ltp/0004-build-Add-option-to-select-libc-implementation.patch


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] Is it necessary to fix the Bugzilla – Bug 11807 and 5876 ?

2018-12-05 Thread Hongzhi, Song




On 12/06/2018 11:04 AM, Hongzhi, Song wrote:



On 12/05/2018 06:57 PM, Bruce Ashfield wrote:

On 12/5/18 5:17 AM, Hongzhi, Song wrote:

Hi all,

I don't know if it is necessary to do this enhancement.

1. Bug 11807:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11807


'CONFIG_EXTRA_FIRMWARE' is used to be set to the names of firmware 
files which


should be provided by driver vendors.

'CONFIG_EXTRA_FIRMWARE_DIR' is set to a path which contains above 
firmware


files. The default path is /lib/firmware if the 
'CONFIG_EXTRA_FIRMWARE_DIR' is not set.



The path and firmware files must exist in rootfs eventually.


2. Bug 5876:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=5876


I think it mean that bbclass should check the state of menuconfig.


I don't know if is necessary to fix these bugs. Could you give me help?


I have some enhancements and other things in flight that can already do
what these two bugs are talking about. Paul and I had discussed some of
the config auditing on the list about a year ago, and agreed that
there's no sense duplicating the functionality that already exists
(rather I was going to tweak a few things to make it more easily
accessible).

If you want, you could assign 5876 to me, and I could take care of it.


Hi Bruce,

Thanks, I will assign it to you.



As for 11807, that is simply a kernel configuration option and it should
be handled like any other. I don't see the need for anything special to
be done.



This option is different from the common options. It can only be set 
two types

of value, "" and "filename1 filename2 ...", which depends on customer.

Maybe we can add a variable containing useful firmware in kernel 
recipe for customer.

The variable will eventually set CONFIG_EXTRA_FIRMWARE in .config .


How to translate the variable to CONFIG_EXTRA_FIRMWARE and set the 
option in .config ?

1. Append do_kernel_configme in kernel recipe with sed command inside it.
2. or modify the bbclass.

I am not sure if the requirement in the bug 11807 is reasonable and if 
my above opinion is

practical.

Thanks,
--Hongzhi



--Hongzhi


Bruce





--Honghzi









--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] Is it necessary to fix the Bugzilla – Bug 11807 and 5876 ?

2018-12-05 Thread Hongzhi, Song




On 12/05/2018 06:57 PM, Bruce Ashfield wrote:

On 12/5/18 5:17 AM, Hongzhi, Song wrote:

Hi all,

I don't know if it is necessary to do this enhancement.

1. Bug 11807:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11807


'CONFIG_EXTRA_FIRMWARE' is used to be set to the names of firmware 
files which


should be provided by driver vendors.

'CONFIG_EXTRA_FIRMWARE_DIR' is set to a path which contains above 
firmware


files. The default path is /lib/firmware if the 
'CONFIG_EXTRA_FIRMWARE_DIR' is not set.



The path and firmware files must exist in rootfs eventually.


2. Bug 5876:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=5876


I think it mean that bbclass should check the state of menuconfig.


I don't know if is necessary to fix these bugs. Could you give me help?


I have some enhancements and other things in flight that can already do
what these two bugs are talking about. Paul and I had discussed some of
the config auditing on the list about a year ago, and agreed that
there's no sense duplicating the functionality that already exists
(rather I was going to tweak a few things to make it more easily
accessible).

If you want, you could assign 5876 to me, and I could take care of it.


Hi Bruce,

Thanks, I will assign it to you.



As for 11807, that is simply a kernel configuration option and it should
be handled like any other. I don't see the need for anything special to
be done.



This option is different from the common options. It can only be set two 
types

of value, "" and "filename1 filename2 ...", which depends on customer.

Maybe we can add a variable containing useful firmware in kernel recipe 
for customer.

The variable will eventually set CONFIG_EXTRA_FIRMWARE in .config .

--Hongzhi


Bruce





--Honghzi







--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] Is it necessary to fix the Bugzilla – Bug 11807 and 5876 ?

2018-12-05 Thread Hongzhi, Song

Hi all,

I don't know if it is necessary to do this enhancement.

1. Bug 11807:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=11807


'CONFIG_EXTRA_FIRMWARE' is used to be set to the names of firmware files 
which


should be provided by driver vendors.

'CONFIG_EXTRA_FIRMWARE_DIR' is set to a path which contains above firmware

files. The default path is /lib/firmware if the 
'CONFIG_EXTRA_FIRMWARE_DIR' is not set.



The path and firmware files must exist in rootfs eventually.


2. Bug 5876:

https://bugzilla.yoctoproject.org/show_bug.cgi?id=5876


I think it mean that bbclass should check the state of menuconfig.


I don't know if is necessary to fix these bugs. Could you give me help?


--Honghzi


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] ltp: kernel/syscall/setrlimit05.c: use a legal bad address for mips

2018-11-12 Thread Hongzhi, Song

ping

--Hongzhi


On 11/08/2018 03:31 PM, Hongzhi.Song wrote:

This testcase fails on mips32. The process is killed by SIGBUS which
is not as expect.

This is because:
((void *)-1) is not a legal bad address which causes the process
killed by SIGBUG on mips.

'tst_get_bad_addr()' returns an address that should works on mips
and other arches.

Signed-off-by: Hongzhi.Song 
---
  ...t05-Use-another-method-to-get-bad-address.patch | 61 ++
  meta/recipes-extended/ltp/ltp_20180515.bb  |  1 +
  2 files changed, 62 insertions(+)
  create mode 100644 
meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch

diff --git 
a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
new file mode 100644
index 000..dd688e4
--- /dev/null
+++ 
b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
@@ -0,0 +1,61 @@
+From ff1678f02fdf08e8b7cfca4d0d5aa7815b30957c Mon Sep 17 00:00:00 2001
+From: "Hongzhi.Song" 
+Date: Thu, 8 Nov 2018 01:30:53 -0500
+Subject: [PATCH] setrlimit05: Use another method to get bad address
+
+This testcase fails on mips32. The process is killed by SIGBUS which
+is not as expect.
+
+This is because:
+((void *)-1) is not a legal bad address which causes the process
+killed by SIGBUG on mips.
+
+'tst_get_bad_addr()' returns an address that should works on mips
+and other arches.
+
+Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0]
+
+Signed-off-by: Hongzhi.Song 
+---
+ testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c 
b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+index 7ea7d62..61ac7c6 100644
+--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
 b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+@@ -26,6 +26,8 @@
+
+ #include "tst_test.h"
+
++static void *bad_addr;
++
+ static void verify_setrlimit(void)
+ {
+   int status;
+@@ -33,7 +35,7 @@ static void verify_setrlimit(void)
+
+   pid = SAFE_FORK();
+   if (!pid) {
+-  TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
++  TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
+   if (TEST_RETURN != -1) {
+   tst_res(TFAIL, "setrlimit()  succeeded unexpectedly");
+   exit(0);
+@@ -67,7 +69,13 @@ static void verify_setrlimit(void)
+   tst_res(TBROK, "child %s", tst_strstatus(status));
+ }
+
++static void setup(void)
++{
++  bad_addr = tst_get_bad_addr(NULL);
++}
++
+ static struct tst_test test = {
+   .test_all = verify_setrlimit,
+   .forks_child = 1,
++  .setup = setup,
+ };
+--
+2.8.1
+
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb 
b/meta/recipes-extended/ltp/ltp_20180515.bb
index ff85be7..240222e 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180515.bb
@@ -56,6 +56,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
 
file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
 
file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
 
file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
+  
file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \
 "
  
  S = "${WORKDIR}/git"


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 1/1] systemd: add back alternatives for init utitilies

2018-10-22 Thread Hongzhi, Song



On 10/22/2018 03:01 PM, ChenQi wrote:

On 10/21/2018 05:37 AM, Richard Purdie wrote:

On Fri, 2018-10-19 at 13:19 +0800, Chen Qi wrote:

Add back alternatives for init utilities to avoid regression.

These alternatives were removed when upgradeing systemd to 239.
They were removed out of the logic that init utitilies should be
bound to init manager. However, it turned out that two use cases
were not covered.

1) initramfs using commands like 'reboot' from busybox.
2) Users use customized busybox defconfig which enables init
utilities.

The first use case caused a regression bug in yocto.
   https://bugzilla.yoctoproject.org/show_bug.cgi?id=12914
Patches were sent to fix the reboot problem.

But this is not enough. As we may have the second use case. In such
situation, users will find themselves having regression error when
using 'busybox + systemd' (and busybox is installed after systemd,
overriding the systemd symlinks).

So in order to avoid regression, add back these alternatives.

Signed-off-by

There is something odd going on which this change since it triggers:

https://autobuilder.yoctoproject.org/typhoon/#/builders/35/builds/95/steps/7/logs/step7c 



I've isolated it to this change having initially thought it was Mark's
systemd change...

Cheers,

Richard



Hi Richard,

I saw all those reverts and tests about master-next on oe mailing list 
and I really feel sorry for causing autobuilder failures.
Before I sent out the patch, I did do testimage test with 
'core-image-minimal + systemd + ssh + package-management' and things 
were working well.


Back to this failure, after some investigation, I finally found the 
root cause. It's about udev-extraconf.
Before my patch, udev-extraconf actually does not work as originally 
designed. Check the following codes in mount.sh from udev-extraconf.

BASE_INIT="`readlink "/sbin/init"`"
INIT_SYSTEMD="/lib/systemd/systemd"

if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
    # systemd as init uses systemd-mount to mount block devices
    MOUNT="/usr/bin/systemd-mount"
    UMOUNT="/usr/bin/systemd-umount"
[snip]

In our system, what we have is:
root@qemux86-64:~# ls -l /sbin/init
lrwxrwxrwx    1 root root    22 Oct 22 04:00 /sbin/init -> 
../lib/systemd/systemd


As '../lib/systemd/systemd' does not equal to '/lib/systemd/systemd', 
the mount.sh is not using systemd-mount.


When checking links, we should use `readlnk -f' instead of just 
'readlink'. In other words, things happen to succeed for 
core-image-sato because of some error in the mount.sh script from 
udev-extraconf.


My patch links /sbin/init to /lib/systemd/systemd and that makes the 
mount.sh start to work, thus revealing the error.
In fact, besides the dev-vda.mount problem, I also got 
media-run-hdc.mount failure on core-image-sato. They are both caused 
by the udev-extraconf.


I'm going to remove the 'init' from alternatives and send out V2. But 
udev-extraconf also needs to be fixed.

(CC Hongzhi who did the change.)

Richard, what do you think we should do about the automount udev rule 
from udev-extraconf?
I'd suggest that we do not install the automount udev rule in case of 
systemd. I think the mount.sh script is likely to cause conflicts and 
failures unless it's constructed very carefully in case of systemd. 
Unfortunately, I don't think that script could be easily made 
reliable, considering all the possible .mount and .automount units 
that users may add as custom configuration.

Hongzhi, what's your opinion?


Hi all,

I am so sorry for causing failures. I will send patch to fix the issue 
as soon as possible.


I agree with Chen Qi's suggestions. The "mount.sh" is out-of-date.

--Hongzhi



Best Regards,
Chen Qi



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [oe-core][PATCH] linux-yocto-rt: Add paravirt_kvm support for qemux86-64

2018-09-20 Thread Hongzhi, Song

Hi Bruce,

I just want to confirm that you doesn't forget this patch.

This is not an emergency.


Thanks,

Hongzhi


On 09/11/2018 11:15 AM, Bruce Ashfield wrote:

On 2018-09-09 6:44 AM, Hongzhi.Song wrote:

This feature includes paravirtualized KVM guest support, including
KVMCLOCK for enhancing clock accuracy of guest OS.



This is fine with me. I'll pull it into my queue. I expect my next pull
request to be on Wednesday.

Bruce


Signed-off-by: He Zhe 
Signed-off-by: Hongzhi.Song 
---
  meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb | 2 +-
  meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb 
b/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb

index d9953c32be..ab088f4d18 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.14.bb
@@ -38,4 +38,4 @@ KERNEL_EXTRA_FEATURES ?= 
"features/netfilter/netfilter.scc features/taskstats/ta

  KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
  KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
  KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
-KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"
+KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"
diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb 
b/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb

index 5b102069f1..de3b538b5d 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_4.18.bb
@@ -40,4 +40,4 @@ KERNEL_EXTRA_FEATURES ?= 
"features/netfilter/netfilter.scc features/taskstats/ta

  KERNEL_FEATURES_append = " ${KERNEL_EXTRA_FEATURES}"
  KERNEL_FEATURES_append_qemuall=" cfg/virtio.scc"
  KERNEL_FEATURES_append_qemux86=" cfg/sound.scc cfg/paravirt_kvm.scc"
-KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc"
+KERNEL_FEATURES_append_qemux86-64=" cfg/sound.scc cfg/paravirt_kvm.scc"






--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 0/3 v5] udev-extraconf/mount.sh: add systemd-mount command for systemd

2018-09-19 Thread Hongzhi, Song

Sorry for ping.

The patch has been merged.

--Hongzhi


On 09/19/2018 05:37 PM, Hongzhi, Song wrote:

ping..

--Hongzhi


On 09/16/2018 01:45 PM, Hongzhi.Song wrote:

v5:
 perfect a few codes based on v4
v4:
 fix the recursively dependency for the systemd-mount
v3:
 perfect syntax

Hongzhi.Song (3):
   udev-extraconf/mount.sh: add support to systemd
   udev-extraconf/mount.sh: Fix the recursively dependency for the
 systemd-mount
   udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the
 systemd-moun

  meta/recipes-core/udev/udev-extraconf/mount.sh | 92 
+-

  1 file changed, 74 insertions(+), 18 deletions(-)





--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH 0/3 v5] udev-extraconf/mount.sh: add systemd-mount command for systemd

2018-09-19 Thread Hongzhi, Song

ping..

--Hongzhi


On 09/16/2018 01:45 PM, Hongzhi.Song wrote:

v5:
 perfect a few codes based on v4
v4:
 fix the recursively dependency for the systemd-mount
v3:
 perfect syntax

Hongzhi.Song (3):
   udev-extraconf/mount.sh: add support to systemd
   udev-extraconf/mount.sh: Fix the recursively dependency for the
 systemd-mount
   udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the
 systemd-moun

  meta/recipes-core/udev/udev-extraconf/mount.sh | 92 +-
  1 file changed, 74 insertions(+), 18 deletions(-)



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [oe-core][PATCH v4 1/3] udev-extraconf/mount.sh: add support to systemd

2018-09-10 Thread Hongzhi, Song



On 2018年08月24日 10:00, Randy MacLeod wrote:


First, I have a few changes to make the log more clear.

On 08/01/2018 10:50 PM, Hongzhi.Song wrote:
Udev-extraconf works correctly with sysvinit in the aspect of 
automounting
block devices. But it has a serious problem in case of systemd. Block 
devices

s/. But it/ but it/



automounted by udev is unaccessible to host space(out of udevd's private

s/is unaccessible/are not accessible/

s/host space(out of udevd's private namespace)/
 /host space(out of udevd's private namespace)/

namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a 
filesystem here!


Other distributions has no such problem, because they use a series of 
rules to
manager block devices. Different types of block devices match 
different rules.

s/manager/manage/
But udev-extraconf just use one rule, automount.rules, which results 
in this

s/But udev-extraconf just one rule/
  Note that udev-extraconf has just one file/


problem.

The 'systemd-mount' command is recommended by the systemd community 
to solve such

problems.

This patch makes use of 'systemd-mount' to solve the above problem.


Replace the two sentences above with:

As recommended by members of the systemd community, use the
'systemd-mount' command to resolve this problem since it's
intended purpose is to establish (and destroy) transient mount
or auto-mount points using the service manager job queue thereby
eliminating dependencies loops.


I wouldn't normally be so picky but changes to systemd should
be very clear since it's widely used.


Also, it would be good to explain, near the start of your log,
how you are able to reproduce these this defect.



Hi Randy,

I edited the detail steps of reproduce on [Yocto #12644].
I have attached the link on commit log.

I modified the code with your precious recommend.
And I will send review request within interior before commit patch to 
upstream.


Thanks,
--Hongzhi



If this is a regression identify where the problem was introduced.


systemd-mount was introduced in systemd-232:
   450442cf93
  add a new tool for creating transient mount and automount units

$ git tag --contains 450442cf93
v232
v233
v234
...

so it's puzzling that we're only getting around to such a change now.
Hopefully your use case will explain that.




[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 55 
+++---

  1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328a09..3a72c455e0 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,26 @@
  #
  # Attempt to mount any added block devices and umount any removed 
devices >

+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+    MOUNT="/usr/bin/systemd-mount"
+    UMOUNT="/usr/bin/systemd-umount"
+
+    if [ -x $MOUNT ] && [ -x $UMOUNT ];
+    then
+    logger "Using systemd-mount to finish mount"

Should we be verbose on success?
Do other distros do this?
If not, you could leave the command as a comment for manual debugging,
if you think it's likely to be useful.


+    else
+    logger "Linux init is using systemd, so please 
install systemd-mount to finish mount"


Since systemd-[u]mount is part of the core systemd package,
   packages-split/systemd/usr/bin/systemd-mount
   packages-split/systemd/usr/bin/systemd-umount
this is only possible if we have filesystem corruption.
Best to say so:
   logger "/sbin/init is systemd but /usr/bin/systemd-mount not found."
   logger "Install systemd-mount to be able to mount all filesystems"


Since this will likely never happen, it's tempting to deal with
both systemd-mount and systemd-umount as a group but if by some
strange user error, systemd-umount was removed but systemd-mount
was still present, then we could enable the user to mount the image.
I'm not sure if that's wise since there could be corruption caused
by later failing to umount. It's probably best to require both but
maybe someone has a different point of view.



+    fi
+else
+    MOUNT="/bin/mount"
+    UMOUNT="/bin/umount"
+fi
  -MOUNT="/bin/mount"
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`

  do
  if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +33,33 @@ do
  fi
  done
  +automount_systemd() {
+    name="`basename "$DEVNAME"`"
+
+    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+    # 

Re: [OE-core] [oe-core][PATCH v4 0/3] udev-extraconf/mount.sh: add support to systemd

2018-08-21 Thread Hongzhi, Song

ping

--Hongzhi


On 2018年08月02日 10:50, Hongzhi.Song wrote:

v4:
 Fix the recursively dependency for the systemd-mount
v3:
 perfect syntax

Hongzhi.Song (3):
   udev-extraconf/mount.sh: add support to systemd
   udev-extraconf/mount.sh: Fix the recursively dependency for the
 systemd-mount
   udev-extraconf/mount.sh: Skip the entry in /etc/fstab when using the
 systemd-mount

  meta/recipes-core/udev/udev-extraconf/mount.sh | 84 ++
  1 file changed, 71 insertions(+), 13 deletions(-)



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [oe-core][PATCH v4 0/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi, Song

Please ignore this.

--Hongzhi


On 2018年08月16日 15:36, Hongzhi.Song wrote:

v4:
 modify commit, test cases with kvm, test qemuarm64
v3:
 specify arch for the case of hw breakpoint
v2:
 test_trace_events_sample of ksample.py


Hongzhi.Song (2):
   runtime selftest: test_trace_events_sample of ksample.py
   runtime selftest: limit kernel hw bp arches

  meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
  1 file changed, 17 insertions(+), 2 deletions(-)



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [oe-core][PATCH v4 0/2] runtime selftest: limit kernel hw bp arches

2018-08-16 Thread Hongzhi, Song

Please ignore it.

--Hongzhi


On 2018年08月16日 10:49, Hongzhi.Song wrote:

v4:
 modify commit, test cases with kvm, test qemuarm64
v3:
 specify arch for the case of hw breakpoint
v2:
 test_trace_events_sample of ksample.py

Hongzhi.Song (2):
   runtime selftest: test_trace_events_sample of ksample.py
   runtime selftest: limit kernel hw bp arches

  meta/lib/oeqa/runtime/cases/ksample.py | 19 +--
  1 file changed, 17 insertions(+), 2 deletions(-)



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [oe-core][PATCH v4 1/3] udev-extraconf/mount.sh: add support to systemd

2018-08-03 Thread Hongzhi, Song



On 2018年08月03日 00:15, Martin Hundebøll wrote:

Hi Hongzhi,

I think duplicating all of 'automount' when the only difference is the 
call to 'mount' is unnecessary.


Hi,

The patch is compatible with both systemd and sysvinit.

And generally speaking, there will be no systemd-mount command when 
using sysvinit.



// Hongzhi



It should be possible to check for system inside the existing 
'automount' (see diff below).


When reading the script I couldn't help cleaning up the special 
treatment of mount from util-linux (busybox accepts '-o silent' too), 
and remove the 'rm_dir' function, which can be replaced by 'rmdir'.


// Martin

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328a09..6f013c5afb 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -20,11 +20,12 @@ done
 automount() {
 name="`basename "$DEVNAME"`"

-    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
-    # Silent util-linux's version of mounting auto
-    if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
+    mkdir -p "/run/media/$name"
+
+    # Use systemd-mount to avoid being trapped in udev's mount-namespace
+    if [ "$(readlink /sbin/init)" = "/lib/systemd/systemd" ];
 then
-    MOUNT="$MOUNT -o silent"
+    MOUNT="/usr/bin/systemd-mount --no-block"
 fi

 # If filesystem type is vfat, change the ownership group to 
'disk', and

@@ -41,22 +42,12 @@ automount() {
 if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
 then
 #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"

-    rm_dir "/run/media/$name"
+    rmdir "/run/media/$name"
 else
 logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"

 touch "/tmp/.automount-$name"
 fi
 }
-
-rm_dir() {
-    # We do not want to rm -r populated directories
-    if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
-    then
-    ! test -z "$1" && rm -r "$1"
-    else
-    logger "mount.sh/automount" "Not removing non-empty directory 
[$1]"

-    fi
-}

 # No ID_FS_TYPE for cdrom device, yet it should be mounted
 name="`basename "$DEVNAME"`"

On 2018-08-02 04:50, Hongzhi.Song wrote:
Udev-extraconf works correctly with sysvinit in the aspect of 
automounting
block devices. But it has a serious problem in case of systemd. Block 
devices

automounted by udev is unaccessible to host space(out of udevd's private
namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a 
filesystem here!


Other distributions has no such problem, because they use a series of 
rules to
manager block devices. Different types of block devices match 
different rules.
But udev-extraconf just use one rule, automount.rules, which results 
in this

problem.

The 'systemd-mount' command is recommended by the systemd community 
to solve such

problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 55 
+++---

  1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328a09..3a72c455e0 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,26 @@
  #
  # Attempt to mount any added block devices and umount any removed 
devices

  +BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+    MOUNT="/usr/bin/systemd-mount"
+    UMOUNT="/usr/bin/systemd-umount"
+
+    if [ -x $MOUNT ] && [ -x $UMOUNT ];
+    then
+    logger "Using systemd-mount to finish mount"
+    else
+    logger "Linux init is using systemd, so please 
install systemd-mount to finish mount"

+    fi
+else
+    MOUNT="/bin/mount"
+    UMOUNT="/bin/umount"
+fi
  -MOUNT="/bin/mount"
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`

  do
  if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +33,33 @@ do
  fi
  done
  +automount_systemd() {
+    name="`basename "$DEVNAME"`"
+
+    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+    # Silent util-linux's version of mounting auto
+    MOUNT="$MOUNT -o silent"
+
+    # If filesystem type is vfat, change the ownership group to 
'disk', and

+    # grant it with  w/r/x permissions.
+    case $ID_FS_TYPE in
+    

Re: [OE-core] [meta][PATCH v2] fix the failure test_trace_events of ksample.py

2018-07-29 Thread Hongzhi, Song

ping

--Hongzhi


On 2018年07月20日 17:24, Hongzhi.Song wrote:

v2:
 assert failure when timeout

Hongzhi.Song (1):
   runtime selftest: test_trace_events_sample of ksample.py

  meta/lib/oeqa/runtime/cases/ksample.py | 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-07-24 Thread Hongzhi, Song

ping..

// Hongzhi


On 2018年07月13日 17:15, Hongzhi, Song wrote:

ping. Please.

-- Hongzhi


On 2018年07月03日 11:40, Hongzhi, Song wrote:

ping.

The patch fixes the real problem. Please review it.

//Hongzhi


On 2018年04月24日 04:20, Randy MacLeod wrote:

On 2018-04-22 11:37 PM, Hongzhi, Song wrote:

ping


Please be patient.

0e-core-2.5 rc1 is being tested now and only critical blocking fixes 
are being accepted.


Once the results of 2.5 tests are good, then commits such as this one
can be added to the master[-next] branch and then later 
cherry-picked back to 2.5.1

if needed.

Give people a few days (or more if things don't go well) to get 2.5 
out the door.


../Randy



// Hongzhi


On 2018年04月17日 15:03, Hongzhi.Song wrote:
Udev-extraconf works correctly with sysvinit in the aspect of 
automounting
block devices. But it has a serious problem in case of systemd. 
Block devices
automounted by udev is unaccessible to host space(out of udevd's 
private

namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a 
filesystem here!


Other distributions has no such problem, because they use a series 
of rules to
manager block devices. Different types of block devices match 
different rules.
But udev-extraconf just use one rule, automount.rules, which 
results in this

problem.

The 'systemd-mount' command is recommended by the systemd 
community to solve such

problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 83 
--

  meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
  2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
  #
  # Attempt to mount any added block devices and umount any 
removed devices

  +BASE_INIT="`readlink "@base_sbindir@/init"`"
+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+    # systemd as init uses systemd-mount to mount block devices
+    MOUNT="/usr/bin/systemd-mount"
+    UMOUNT="/usr/bin/systemd-umount"
+
+    if [ -x $MOUNT ] && [ -x $UMOUNT ];
+    then
+    logger "Using systemd-mount to finish mount"
+    else
+    logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"

+    exit 1
+    fi
+else
+    MOUNT="/bin/mount"
+    UMOUNT="/bin/umount"
+fi
  -MOUNT="/bin/mount"
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`

  do
  if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
  fi
  done
  -automount() {
+automount_systemd() {
+    name="`basename "$DEVNAME"`"
+
+    [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+    MOUNT="$MOUNT -o silent"
+
+    # If filesystemtype is vfat, change the ownership group to 
'disk', and

+    # grant it with  w/r/x permissions.
+    case $ID_FS_TYPE in
+    vfat|fat)
+    MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print 
$3}' /etc/group`"

+    ;;
+    # TODO
+    *)
+    ;;
+    esac
+
+    if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+    then
+    #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"

+    rm_dir "/run/media/$name"
+    else
+    logger "mount.sh/automount" "Auto-mount of 
[/run/media/$name] successful"

+    touch "/tmp/.automount-$name"
+    fi
+}
+
+automount() {
  name="`basename "$DEVNAME"`"
    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +72,7 @@ automount() {
  then
  MOUNT="$MOUNT -o silent"
  fi
-
+
  # If filesystem type is vfat, change the ownership group to 
'disk', and

  # grant it with  w/r/x permissions.
  case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] 
&& [ -n "$ID_FS_TYPE" -o "$media_t

  elif [ -x $MOUNT ]; then
  $MOUNT $DEVNAME 2> /dev/null
  fi
-
+
  # If the device isn't mounted at thi

Re: [OE-core] [meta][PATCH] runtime selftest: test_trace_events_sample of ksample.py

2018-07-20 Thread Hongzhi, Song

Please ignore it.

--Hongzhi


On 2018年07月20日 15:42, Hongzhi.Song wrote:

The debug info can not be written to trace buffer immediately
by thread. So we should sleep some seconds.

Signed-off-by: Hongzhi.Song 
---
  meta/lib/oeqa/runtime/cases/ksample.py | 14 --
  1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
index 260bc3c..3e9cfc6 100644
--- a/meta/lib/oeqa/runtime/cases/ksample.py
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -18,7 +18,8 @@ class KSample(OERuntimeTestCase):
  else:
  # check result
  result = ("%s" % match_string) in output
-self.assertTrue(result)
+msg = output
+self.assertTrue(result, msg)
  self.assertEqual(status, 0, cmd)
  
  def check_config(self, config_opt=''):

@@ -126,7 +127,16 @@ class KSampleTest(KSample):
  self.cmd_and_check("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
  self.cmd_and_check("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
  # check result
-self.cmd_and_check("cat /sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut 
-d\':\' -f2", " foo_bar")
+status = 1
+count = 0
+while status != 0:
+time.sleep(1)
+status, output = self.target.run('cat 
/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut -d\':\' -f2')
+if " foo_bar" in output:
+break
+count = count + 1
+if count > 5:
+self.skipTest("Time out for check result")
  # disable trace
  self.cmd_and_check("echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
  # clean up trace


--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-07-13 Thread Hongzhi, Song

ping. Please.

-- Hongzhi


On 2018年07月03日 11:40, Hongzhi, Song wrote:

ping.

The patch fixes the real problem. Please review it.

//Hongzhi


On 2018年04月24日 04:20, Randy MacLeod wrote:

On 2018-04-22 11:37 PM, Hongzhi, Song wrote:

ping


Please be patient.

0e-core-2.5 rc1 is being tested now and only critical blocking fixes 
are being accepted.


Once the results of 2.5 tests are good, then commits such as this one
can be added to the master[-next] branch and then later cherry-picked 
back to 2.5.1

if needed.

Give people a few days (or more if things don't go well) to get 2.5 
out the door.


../Randy



// Hongzhi


On 2018年04月17日 15:03, Hongzhi.Song wrote:
Udev-extraconf works correctly with sysvinit in the aspect of 
automounting
block devices. But it has a serious problem in case of systemd. 
Block devices
automounted by udev is unaccessible to host space(out of udevd's 
private

namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a 
filesystem here!


Other distributions has no such problem, because they use a series 
of rules to
manager block devices. Different types of block devices match 
different rules.
But udev-extraconf just use one rule, automount.rules, which 
results in this

problem.

The 'systemd-mount' command is recommended by the systemd community 
to solve such

problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 83 
--

  meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
  2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
  #
  # Attempt to mount any added block devices and umount any removed 
devices

  +BASE_INIT="`readlink "@base_sbindir@/init"`"
+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+    # systemd as init uses systemd-mount to mount block devices
+    MOUNT="/usr/bin/systemd-mount"
+    UMOUNT="/usr/bin/systemd-umount"
+
+    if [ -x $MOUNT ] && [ -x $UMOUNT ];
+    then
+    logger "Using systemd-mount to finish mount"
+    else
+    logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"

+    exit 1
+    fi
+else
+    MOUNT="/bin/mount"
+    UMOUNT="/bin/umount"
+fi
  -MOUNT="/bin/mount"
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`

  do
  if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
  fi
  done
  -automount() {
+automount_systemd() {
+    name="`basename "$DEVNAME"`"
+
+    [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+    MOUNT="$MOUNT -o silent"
+
+    # If filesystemtype is vfat, change the ownership group to 
'disk', and

+    # grant it with  w/r/x permissions.
+    case $ID_FS_TYPE in
+    vfat|fat)
+    MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print 
$3}' /etc/group`"

+    ;;
+    # TODO
+    *)
+    ;;
+    esac
+
+    if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+    then
+    #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"

+    rm_dir "/run/media/$name"
+    else
+    logger "mount.sh/automount" "Auto-mount of 
[/run/media/$name] successful"

+    touch "/tmp/.automount-$name"
+    fi
+}
+
+automount() {
  name="`basename "$DEVNAME"`"
    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +72,7 @@ automount() {
  then
  MOUNT="$MOUNT -o silent"
  fi
-
+
  # If filesystem type is vfat, change the ownership group to 
'disk', and

  # grant it with  w/r/x permissions.
  case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] 
&& [ -n "$ID_FS_TYPE" -o "$media_t

  elif [ -x $MOUNT ]; then
  $MOUNT $DEVNAME 2> /dev/null
  fi
-
+
  # If the device isn't mounted at this point, it isn't
  # configured in fstab (note the root filesys

Re: [OE-core] [PATCH V2 0/2] kernel-selftest: add it

2018-07-06 Thread Hongzhi, Song

please ignore it.

// Hongzhi


On 2018年07月06日 17:07, Hongzhi.Song wrote:

The following changes since commit 611013a23a0082faa4fda2cd2529668965586a76:

   mesa: add lost Upstream-Status tag (2018-07-05 00:22:08 +0100)

are available in the git repository at:

   https://github.com/csqshz/openembedded-core.git hong/kself
   https://github.com//tree/hong/kself

Dengke Du (1):
   kernel-selftest: add it

Hongzhi.Song (1):
   kernel-selftest: add vm testcase to recipe

  .../kernel-selftest/kernel-selftest.bb | 94 ++
  meta/recipes-kernel/linux/linux-yocto.inc  |  1 +
  2 files changed, 95 insertions(+)
  create mode 100644 meta/recipes-kernel/kernel-selftest/kernel-selftest.bb



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-07-02 Thread Hongzhi, Song

ping.

The patch fixes the real problem. Please review it.

//Hongzhi


On 2018年04月24日 04:20, Randy MacLeod wrote:

On 2018-04-22 11:37 PM, Hongzhi, Song wrote:

ping


Please be patient.

0e-core-2.5 rc1 is being tested now and only critical blocking fixes 
are being accepted.


Once the results of 2.5 tests are good, then commits such as this one
can be added to the master[-next] branch and then later cherry-picked 
back to 2.5.1

if needed.

Give people a few days (or more if things don't go well) to get 2.5 
out the door.


../Randy



// Hongzhi


On 2018年04月17日 15:03, Hongzhi.Song wrote:
Udev-extraconf works correctly with sysvinit in the aspect of 
automounting
block devices. But it has a serious problem in case of systemd. 
Block devices
automounted by udev is unaccessible to host space(out of udevd's 
private

namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a 
filesystem here!


Other distributions has no such problem, because they use a series 
of rules to
manager block devices. Different types of block devices match 
different rules.
But udev-extraconf just use one rule, automount.rules, which results 
in this

problem.

The 'systemd-mount' command is recommended by the systemd community 
to solve such

problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 83 
--

  meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
  2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh

index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
  #
  # Attempt to mount any added block devices and umount any removed 
devices

  +BASE_INIT="`readlink "@base_sbindir@/init"`"
+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+    # systemd as init uses systemd-mount to mount block devices
+    MOUNT="/usr/bin/systemd-mount"
+    UMOUNT="/usr/bin/systemd-umount"
+
+    if [ -x $MOUNT ] && [ -x $UMOUNT ];
+    then
+    logger "Using systemd-mount to finish mount"
+    else
+    logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"

+    exit 1
+    fi
+else
+    MOUNT="/bin/mount"
+    UMOUNT="/bin/umount"
+fi
  -MOUNT="/bin/mount"
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`

  do
  if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
  fi
  done
  -automount() {
+automount_systemd() {
+    name="`basename "$DEVNAME"`"
+
+    [ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+    MOUNT="$MOUNT -o silent"
+
+    # If filesystemtype is vfat, change the ownership group to 
'disk', and

+    # grant it with  w/r/x permissions.
+    case $ID_FS_TYPE in
+    vfat|fat)
+    MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print 
$3}' /etc/group`"

+    ;;
+    # TODO
+    *)
+    ;;
+    esac
+
+    if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+    then
+    #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"

+    rm_dir "/run/media/$name"
+    else
+    logger "mount.sh/automount" "Auto-mount of 
[/run/media/$name] successful"

+    touch "/tmp/.automount-$name"
+    fi
+}
+
+automount() {
  name="`basename "$DEVNAME"`"
    ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
@@ -26,7 +72,7 @@ automount() {
  then
  MOUNT="$MOUNT -o silent"
  fi
-
+
  # If filesystem type is vfat, change the ownership group to 
'disk', and

  # grant it with  w/r/x permissions.
  case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] 
&& [ -n "$ID_FS_TYPE" -o "$media_t

  elif [ -x $MOUNT ]; then
  $MOUNT $DEVNAME 2> /dev/null
  fi
-
+
  # If the device isn't mounted at this point, it isn't
  # configured in fstab (note the root filesystem can show up as
  # /dev/root in /proc/mounts, so check the 

Re: [OE-core] [meta][PATCH 0/2] Add kernel-sample tests for runtime test

2018-06-28 Thread Hongzhi, Song

ping

-- Hongzhi


On 2018年06月19日 13:54, Hongzhi, Song wrote:

ping

--Hongzhi


On 2018年06月08日 10:03, Hongzhi, Song wrote:

ping...


A bug has been created, but the patch hasn't been adapted.

bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774


We plan to add more tests about kernel in the next time.


If there is no objection, could you adapt my patch?


-- Hongzhi


On 2018年06月05日 10:32, Hongzhi.Song wrote:

V4:
  * add support for qemu by default

V3:
  * remove duplicated code

V2:
  * use shared function to replace similar code

Hongzhi.Song (2):
   meta runtime testcases: enable kernel-sample features for runtime
 tests
   Meta runtime cases: add testcases for kernel sample

  meta/lib/oeqa/runtime/cases/ksample.py    | 213 
++

  meta/recipes-kernel/linux/linux-yocto.inc |   3 +
  2 files changed, 216 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py







--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [meta][PATCH 0/2] Add kernel-sample tests for runtime test

2018-06-18 Thread Hongzhi, Song

ping

--Hongzhi


On 2018年06月08日 10:03, Hongzhi, Song wrote:

ping...


A bug has been created, but the patch hasn't been adapted.

bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774


We plan to add more tests about kernel in the next time.


If there is no objection, could you adapt my patch?


-- Hongzhi


On 2018年06月05日 10:32, Hongzhi.Song wrote:

V4:
  * add support for qemu by default

V3:
  * remove duplicated code

V2:
  * use shared function to replace similar code

Hongzhi.Song (2):
   meta runtime testcases: enable kernel-sample features for runtime
 tests
   Meta runtime cases: add testcases for kernel sample

  meta/lib/oeqa/runtime/cases/ksample.py    | 213 
++

  meta/recipes-kernel/linux/linux-yocto.inc |   3 +
  2 files changed, 216 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py





--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [meta][PATCH 0/2] Add kernel-sample tests for runtime test

2018-06-07 Thread Hongzhi, Song

ping...


A bug has been created, but the patch hasn't been adapted.

bug 12774 : https://bugzilla.yoctoproject.org/show_bug.cgi?id=12774


We plan to add more tests about kernel in the next time.


If there is no objection, could you adapt my patch?


-- Hongzhi


On 2018年06月05日 10:32, Hongzhi.Song wrote:

V4:
  * add support for qemu by default

V3:
  * remove duplicated code

V2:
  * use shared function to replace similar code

Hongzhi.Song (2):
   meta runtime testcases: enable kernel-sample features for runtime
 tests
   Meta runtime cases: add testcases for kernel sample

  meta/lib/oeqa/runtime/cases/ksample.py| 213 ++
  meta/recipes-kernel/linux/linux-yocto.inc |   3 +
  2 files changed, 216 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [meta][lib/oeqa][PATCH v3] Meta runtime cases: add testcases for kernel sample

2018-06-04 Thread Hongzhi, Song

Please ignore this. I will send V4


// Hongzhi


On 2018年06月03日 10:13, Hongzhi.Song wrote:

We are going to let runtime test support kernel tests. Now we just add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13 tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " kernel-sample/kernel-sample.scc" in
local.conf.

kernel-sample feature has been merged into master branch.

Signed-off-by: Hongzhi.Song 
---
  meta/lib/oeqa/runtime/cases/ksample.py | 272 +
  1 file changed, 272 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

diff --git a/meta/lib/oeqa/runtime/cases/ksample.py 
b/meta/lib/oeqa/runtime/cases/ksample.py
new file mode 100644
index 000..719f1a0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/ksample.py
@@ -0,0 +1,272 @@
+import os
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oeid import OETestID
+from oeqa.core.decorator.data import skipIfNotFeature
+
+class KSample(OERuntimeTestCase):
+def send_cmd(self, cmd='', content=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+msg = '%s failed, %s' % (comd, ret)
+self.assertEqual(status, 0, msg=msg)
+
+def check_config(self, config_opt=''):
+cmd = "zcat /proc/config.gz | grep %s" % config_opt
+status, ret = self.target.run(cmd)
+result = ("%s=y" % config_opt) in ret
+if not result:
+self.skipTest("CONFIG error")
+
+def check_module_exist(self, path='', module_name=''):
+status, ret = self.target.run("uname -r")
+cmd = "ls " + "/lib/modules/" + ret + "/kernel/samples/" + path + 
module_name
+status, output = self.target.run(cmd)
+if status != 0:
+error_info = module_name + "doesn't exist"
+self.skipTest(error_info)
+
+def send_check(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+self.assertEqual(ret, comp, comd)
+
+def send_check_in(self, cmd='', content='', comp=''):
+comd = cmd + " " + content
+status, ret = self.target.run(comd)
+result = ("%s" % comp) in ret
+self.assertTrue(result)
+self.assertEqual(status, 0, comd)
+
+class KSampleTest(KSample):
+#trace
+@OETestID(33)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_events(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_events/", "trace-events-sample.ko")
+# modprobe
+self.send_cmd("modprobe", "trace-events-sample")
+# lsmod
+self.send_check("lsmod", "| grep trace_events_sample | cut -d\' \' -f1", 
"trace_events_sample")
+# check dir
+self.send_check("ls", "/sys/kernel/debug/tracing/events/ | grep sample-trace", 
"sample-trace")
+# enable trace
+self.send_cmd("echo 1 > 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+self.send_cmd("cat 
/sys/kernel/debug/tracing/events/sample-trace/enable")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep hello | head -n1 | cut 
-d\':\' -f2", " foo_bar")
+# disable trace
+self.send_cmd('echo 0 > 
/sys/kernel/debug/tracing/events/sample-trace/enable')
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-events-sample')
+
+@OETestID(34)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_trace_printk(self):
+# check config
+self.check_config("CONFIG_TRACING_SUPPORT")
+# make sure if module exists
+self.check_module_exist("trace_printk/", "trace-printk.ko")
+# modprobe
+self.send_cmd('modprobe', 'trace-printk')
+# lsmod
+self.send_check("lsmod", "| grep trace_printk | cut -d\' \' -f1", 
"trace_printk")
+# check result
+self.send_check("cat", "/sys/kernel/debug/tracing/trace | grep trace_printk_irq_work 
| head -n1 | cut -d\':\' -f2", " trace_printk_irq_work")
+# clean up trace
+self.send_cmd('echo > /sys/kernel/debug/tracing/trace')
+# rmmod
+self.send_cmd('rmmod trace-printk')
+# kprobe
+@OETestID(43)
+@OETestDepends(['ssh.SSHTest.test_ssh'])
+def test_kprobe_example(self):
+# check config
+self.check_config("CONFIG_KPROBES")
+# make sure if module exists
+self.check_module_exist("kprobes/", "kprobe_example.ko")
+# modprobe
+self.send_cmd('modprobe', 'kprobe_example')
+# lsmod
+self.send_check("lsmod", "| grep 

Re: [OE-core] [PATCH] Meta runtime cases: add testcases for kernel sample

2018-06-01 Thread Hongzhi, Song

Hi Richard,

I have made patch-v2 with shared functions.
And these kernel-samples are just for testing, so maybe it's unnecessary 
to enable them by default.



On 2018年06月01日 16:12, Richard Purdie wrote:

On Fri, 2018-06-01 at 04:02 -0400, Hongzhi.Song wrote:

We are going to let runtime test support kernel tests. Now we just
add
kernel self-contained sample tests. And we plan to add overall kernel
tests in the future.

This patch is just add kernel samples test which contains about 13
tests
enabled by kernel-sample.scc. So it needs statement,
KERNEL_FEATURES_append += " kernel-sample/kernel-sample.scc" in
local.conf.

Signed-off-by: Hongzhi.Song 
---
  meta/lib/oeqa/runtime/cases/ksample.py | 440
+
  1 file changed, 440 insertions(+)
  create mode 100644 meta/lib/oeqa/runtime/cases/ksample.py

[...]

+# check config
+status, ret = self.target.run('zcat /proc/config.gz | grep 
CONFIG_TRACING_SUPPORT')
+result = "CONFIG_TRACING_SUPPORT=y" in ret
+if not result:
+self.skipTest("CONFIG error")
+# make sure if module exists
+status, ret = self.target.run('uname -r')
+cmd = "ls " + "/lib/modules/" + ret + 
"/kernel/samples/trace_events/trace-events-sample.ko"
+status, output = self.target.run(cmd)
+if status != 0:
+self.skipTest("trace-events-sample.ko doesn't exist")


There looks to be a fair bit of copy and paste code in these tests such
as the code above to look at config.gz. Could you turn some of these
into shared functions please?

Also, do we want to include this kernel-sample feature to the qemu
machines by default so that we enable these tests?

Cheers,

Richard




--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-04-22 Thread Hongzhi, Song

ping

// Hongzhi


On 2018年04月17日 15:03, Hongzhi.Song wrote:

Udev-extraconf works correctly with sysvinit in the aspect of automounting
block devices. But it has a serious problem in case of systemd. Block devices
automounted by udev is unaccessible to host space(out of udevd's private
namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Other distributions has no such problem, because they use a series of rules to
manager block devices. Different types of block devices match different rules.
But udev-extraconf just use one rule, automount.rules, which results in this
problem.

The 'systemd-mount' command is recommended by the systemd community to solve 
such
problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 83 --
  meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
  2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
  #
  # Attempt to mount any added block devices and umount any removed devices
  
+BASE_INIT="`readlink "@base_sbindir@/init"`"

+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+# systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install systemd-mount to 
finish mount"
+exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
  
-MOUNT="/bin/mount"

  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
  do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
fi
  done
  
-automount() {	

+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+[ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" 
failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
  
  	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"

@@ -26,7 +72,7 @@ automount() {
then
MOUNT="$MOUNT -o silent"
fi
-   
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with  w/r/x permissions.
case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n 
"$ID_FS_TYPE" -o "$media_t
elif [ -x $MOUNT ]; then
$MOUNT $DEVNAME 2> /dev/null
fi
-   
+
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show up as
# /dev/root in /proc/mounts, so check the device number too)
-   if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
-   grep -q "^$DEVNAME " /proc/mounts || automount
-   fi
+if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
+if [ "`basename $MOUNT`" = "systemd-mount" ];then
+grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+else
+grep -q "^$DEVNAME " /proc/mounts || automount
+fi
+fi
  fi
  
-

  if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n 
"$DEVNAME" ]; then
-   for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
-   do
-   $UMOUNT $mnt
-   done
-   
-   # Remove empty directories from auto-mounter
-   name="`basename "$DEVNAME"`"
-   test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
+for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d 

Re: [OE-core] [PATCH v3] udev-extraconf: Add systemd-mount to udev-extraconf/mount.sh

2018-04-20 Thread Hongzhi, Song

ping ..

// Hongzhi


On 2018年04月17日 15:03, Hongzhi.Song wrote:

Udev-extraconf works correctly with sysvinit in the aspect of automounting
block devices. But it has a serious problem in case of systemd. Block devices
automounted by udev is unaccessible to host space(out of udevd's private
namespace). For example, we cannot format those block devices.

e.g.
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
 last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Other distributions has no such problem, because they use a series of rules to
manager block devices. Different types of block devices match different rules.
But udev-extraconf just use one rule, automount.rules, which results in this
problem.

The 'systemd-mount' command is recommended by the systemd community to solve 
such
problems.

This patch makes use of 'systemd-mount' to solve the above problem.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 83 --
  meta/recipes-core/udev/udev-extraconf_1.1.bb   |  3 +
  2 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..067d4e2 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -4,10 +4,28 @@
  #
  # Attempt to mount any added block devices and umount any removed devices
  
+BASE_INIT="`readlink "@base_sbindir@/init"`"

+INIT_SYSTEMD="@systemd_unitdir@/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+# systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install systemd-mount to 
finish mount"
+exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
  
-MOUNT="/bin/mount"

  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
  do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,7 +35,35 @@ do
fi
  done
  
-automount() {	

+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+[ -d "/run/media/$name" ] || mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/run/media/$name\" 
failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {
name="`basename "$DEVNAME"`"
  
  	! test -d "/run/media/$name" && mkdir -p "/run/media/$name"

@@ -26,7 +72,7 @@ automount() {
then
MOUNT="$MOUNT -o silent"
fi
-   
+
# If filesystem type is vfat, change the ownership group to 'disk', and
# grant it with  w/r/x permissions.
case $ID_FS_TYPE in
@@ -68,23 +114,26 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n 
"$ID_FS_TYPE" -o "$media_t
elif [ -x $MOUNT ]; then
$MOUNT $DEVNAME 2> /dev/null
fi
-   
+
# If the device isn't mounted at this point, it isn't
# configured in fstab (note the root filesystem can show up as
# /dev/root in /proc/mounts, so check the device number too)
-   if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
-   grep -q "^$DEVNAME " /proc/mounts || automount
-   fi
+if expr $MAJOR "*" 256 + $MINOR != `stat -c %d /`; then
+if [ "`basename $MOUNT`" = "systemd-mount" ];then
+grep -q "^$DEVNAME " /proc/mounts || automount_systemd
+else
+grep -q "^$DEVNAME " /proc/mounts || automount
+fi
+fi
  fi
  
-

  if [ "$ACTION" = "remove" ] || [ "$ACTION" = "change" ] && [ -x "$UMOUNT" ] && [ -n 
"$DEVNAME" ]; then
-   for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " `
-   do
-   $UMOUNT $mnt
-   done
-   
-   # Remove empty directories from auto-mounter
-   name="`basename "$DEVNAME"`"
-   test -e "/tmp/.automount-$name" && rm_dir "/run/media/$name"
+for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 

Re: [OE-core] [PATCH] udev-extraconf: Add systemd-mount to mount.sh

2018-04-11 Thread Hongzhi, Song
I am very sorry, this is my fault. My original idea is to modify 
udev-extraconf/mount.sh.


And I will remake a patch.

Sorry again. Please ignore this patch.



On 2018年04月12日 09:35, Christopher Larson wrote:
Why are you adding a new mount.sh at meta/recipes-core/udev/mount.sh 
rather than updating the existing one 
at meta/recipes-core/udev/udev-extraconf/mount.sh?


On Mon, Apr 9, 2018 at 12:28 AM, Hongzhi.Song 
> wrote:


This patch fixs the problem that block devices unable to be
formatted when
systemd and udev-extraconf recipes added into rootfs.

If we add systemd and udev-extraconf recipes into rootfs:
    VIRTUAL-RUNTIME_init_manager = "systemd"
    DISTRO_FEATURES_append = " systemd"
    DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
    KERNEL_FEATURES_append = " cfg/systemd.scc"
    IMAGE_INSTALL_append = " udev-extraconf"
    IMAGE_FSTYPES += "tar.bz2 ext4"
    IMAGE_INSTALL_append = " e2fsprogs-mke2fs"
then systemd-udevd.service will invoke udev rules to automount
block devices
any probed under itself private namespace, this behavior results
in host space
can't format those devices. And host space can't find where the
device is used.
Such as:
    root@qemux86:~# mkfs.ext4 /dev/sda1
    mke2fs 1.43.8 (1-Jan-2018)
    /dev/sda1 contains a ext4 file system
            last mounted on Tue Apr  3 06:22:41 2018
    Proceed anyway? (y,N) y
    /dev/sda1 is apparently in use by the system; will not make a
filesystem here!

Command systemd-mount recommended by systemd maintainer instead of
command mount
will fix the problem brought with private namespace. Systemd-mount
request the
mount operation to be executed by PID 1, and hence host space can
access the block
devices.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song >
---
 meta/recipes-core/udev/mount.sh | 141

 1 file changed, 141 insertions(+)
 create mode 100644 meta/recipes-core/udev/mount.sh

diff --git a/meta/recipes-core/udev/mount.sh
b/meta/recipes-core/udev/mount.sh
new file mode 100644
index 000..2fa2925
--- /dev/null
+++ b/meta/recipes-core/udev/mount.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+#
+# Called from udev
+#
+# Attempt to mount any added block devices and umount any removed
devices
+
+
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+       # systemd as init uses systemd-mount to mount block devices
+        MOUNT="/usr/bin/systemd-mount"
+        UMOUNT="/usr/bin/systemd-umount"
+
+        if [ -x $MOUNT ] && [ -x $UMOUNT ];
+        then
+                logger "Using systemd-mount to finish mount"
+        else
+                logger "Linux init is using systemd, so please
install systemd-mount to finish mount"
+               exit 1
+        fi
+else
+        MOUNT="/bin/mount"
+        UMOUNT="/bin/umount"
+fi
+
+PMOUNT="/usr/bin/pmount"
+
+for line in `grep -h -v ^# /etc/udev/mount.blacklist
/etc/udev/mount.blacklist.d/*`
+do
+       if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
+       then
+               logger "udev/mount.sh" "[$DEVNAME] is blacklisted,
ignoring"
+               exit 0
+       fi
+done
+
+automount_systemd() {
+        name="`basename "$DEVNAME"`"
+
+        ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+        MOUNT="$MOUNT -o silent"
+
+        # If filesystemtype is vfat, change the ownership group
to 'disk', and
+        # grant it with  w/r/x permissions.
+        case $ID_FS_TYPE in
+        vfat|fat)
+                MOUNT="$MOUNT -o umask=007,gid=`awk -F':'
'/^disk/{print $3}' /etc/group`"
+                ;;
+        # TODO
+        *)
+                ;;
+        esac
+
+        if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+        then
+                #logger "mount.sh/automount
" "$MOUNT -t auto $DEVNAME
\"/run/media/$name\" failed!"
+                rm_dir "/run/media/$name"
+        else
+                logger "mount.sh/automount
" "Auto-mount of [/run/media/$name]
successful"
+                touch "/tmp/.automount-$name"
+        fi
+}
+
+automount() {
+       name="`basename "$DEVNAME"`"
+
+       ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+       # Silent util-linux's version of mounting auto
+       if [ "x`readlink $MOUNT`" = 

Re: [OE-core] [PATCH] udev-extraconf: Add systemd-mount to mount.sh

2018-04-11 Thread Hongzhi, Song

ping

//Hongzhi


On 2018年04月09日 15:28, Hongzhi.Song wrote:

This patch fixs the problem that block devices unable to be formatted when
systemd and udev-extraconf recipes added into rootfs.

If we add systemd and udev-extraconf recipes into rootfs:
 VIRTUAL-RUNTIME_init_manager = "systemd"
 DISTRO_FEATURES_append = " systemd"
 DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
 KERNEL_FEATURES_append = " cfg/systemd.scc"
 IMAGE_INSTALL_append = " udev-extraconf"
 IMAGE_FSTYPES += "tar.bz2 ext4"
 IMAGE_INSTALL_append = " e2fsprogs-mke2fs"
then systemd-udevd.service will invoke udev rules to automount block devices
any probed under itself private namespace, this behavior results in host space
can't format those devices. And host space can't find where the device is used.
Such as:
 root@qemux86:~# mkfs.ext4 /dev/sda1
 mke2fs 1.43.8 (1-Jan-2018)
 /dev/sda1 contains a ext4 file system
last mounted on Tue Apr  3 06:22:41 2018
 Proceed anyway? (y,N) y
 /dev/sda1 is apparently in use by the system; will not make a filesystem 
here!

Command systemd-mount recommended by systemd maintainer instead of command mount
will fix the problem brought with private namespace. Systemd-mount request the
mount operation to be executed by PID 1, and hence host space can access the 
block
devices.

[YOCTO #12644]

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/mount.sh | 141 
  1 file changed, 141 insertions(+)
  create mode 100644 meta/recipes-core/udev/mount.sh

diff --git a/meta/recipes-core/udev/mount.sh b/meta/recipes-core/udev/mount.sh
new file mode 100644
index 000..2fa2925
--- /dev/null
+++ b/meta/recipes-core/udev/mount.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+#
+# Called from udev
+#
+# Attempt to mount any added block devices and umount any removed devices
+
+
+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+   exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
+
+PMOUNT="/usr/bin/pmount"
+
+for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
+do
+   if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
+   then
+   logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring"
+   exit 0
+   fi
+done
+
+automount_systemd() {
+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
+automount() {  
+   name="`basename "$DEVNAME"`"
+
+   ! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+   # Silent util-linux's version of mounting auto
+   if [ "x`readlink $MOUNT`" = "x/bin/mount.util-linux" ] ;
+   then
+   MOUNT="$MOUNT -o silent"
+   fi
+   
+   # If filesystem type is vfat, change the ownership group to 'disk', and
+   # grant it with  w/r/x permissions.
+   case $ID_FS_TYPE in
+   vfat|fat)
+   MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+   ;;
+   # TODO
+   *)
+   ;;
+   esac
+
+   if ! $MOUNT -t auto $DEVNAME "/run/media/$name"
+   then
+   #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+   rm_dir "/run/media/$name"
+   else
+   logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+   touch "/tmp/.automount-$name"
+   fi
+}
+   
+rm_dir() {
+   # We do not want to rm -r populated directories
+   if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1"
+   then
+   ! test -z "$1" && rm -r "$1"
+   

Re: [OE-core] Question about one oe-core commit

2018-03-30 Thread Hongzhi, Song

ping.

// Hongzhi

On 2018年03月28日 17:18, Hongzhi, Song wrote:

Hi, Khem

oe-core upstream commit e6c1765a05c1321f08f3d1fb521dfe6b07bc8e92

You drop mount propagation patch, it only happens with libseccomp, OE 
doesn't enable it.


I don't understand why 'it only happens with libseccomp'. Could you 
make an detailed explanation


for me? I investigated the ubuntu1604, which also has no 
'MountFlags=slave' in systemd-udevd.service.



Thanks.

Hongzhi



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH] systemd-udev: Add systemd-mount to mount.sh

2018-03-11 Thread Hongzhi, Song

ping.

// hongzhi

On 2018年03月06日 18:54, Hongzhi.Song wrote:

Issue: mkfs.ext4  fails, prompting that the device
is in use by the system. But there is no mounted infomation in /proc/mounts.

Reproduce: Be sure that there is storage device connected to you machine.

Boot the machine.
root@intel-x86-64:~# mkfs.ext4 /dev/mmcblk0p1
mke2fs 1.43.5 (04-Aug-2017)
/dev/mmcblk0p1 contains a ext2 file system
last mounted on / on Tue Jan 9 05:24:36 2018
Proceed anyway? (y,N) y
/dev/mmcblk0p1 is apparently in use by the system; will not make a 
filesystem here!

root@intel-x86-64:~# fdisk -l
...
Disk /dev/mmcblk0: 58.2 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe62c8fcc

Device Boot Start End Sectors Size Id Type
/dev/mmcblk0p1 2048 122142719 122140672 58.2G 83 Linux
...

root@intel-x86-64:~#cat /proc/mounts
...
cgroup /sys/fs/cgroup/blkio cgroup 
rw,nosuid,nodev,noexec,relatime,blkio 0 0
mqueue /dev/mqueue mqueue rw,relatime 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime 0 0
tmpfs /var/volatile tmpfs rw,relatime 0 0
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=688048k,mode=700 
0 0

Description:
If linux uses systemd as init, systemd-udevd.service sets 
MountFlags=slave,
which is essentially a sandboxing setting: it detaches mount() 
operations
done within the service from the rest of the system. This means that,
outside of namespace of systemd-udev, we can not access device mounted 
by
udev and some operation will be failed.(e.g. mkfs.ext4 /dev/sda1).

Current automount.rules and mount.sh created for sysvinit is unable to 
solve
above problems.

This patch adds systemd-mount in /etc/udev/script/mount.sh. The tool
recommended by systemd upstream generally is the best way in particular 
in
embedded applications to deal with hotpluggable media. Systemd-mount 
request
the mount operation to be executed by PID 1, and hence outside of the 
mount
context of udev.

Signed-off-by: Hongzhi.Song 
---
  meta/recipes-core/udev/udev-extraconf/mount.sh | 61 +++---
  1 file changed, 56 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-core/udev/udev-extraconf/mount.sh 
b/meta/recipes-core/udev/udev-extraconf/mount.sh
index d760328..2fa2925 100644
--- a/meta/recipes-core/udev/udev-extraconf/mount.sh
+++ b/meta/recipes-core/udev/udev-extraconf/mount.sh
@@ -5,9 +5,28 @@
  # Attempt to mount any added block devices and umount any removed devices
  
  
-MOUNT="/bin/mount"

+BASE_INIT="`readlink "/sbin/init"`"
+INIT_SYSTEMD="/lib/systemd/systemd"
+
+if [ "x$BASE_INIT" = "x$INIT_SYSTEMD" ];then
+   # systemd as init uses systemd-mount to mount block devices
+MOUNT="/usr/bin/systemd-mount"
+UMOUNT="/usr/bin/systemd-umount"
+
+if [ -x $MOUNT ] && [ -x $UMOUNT ];
+then
+logger "Using systemd-mount to finish mount"
+else
+logger "Linux init is using systemd, so please install 
systemd-mount to finish mount"
+   exit 1
+fi
+else
+MOUNT="/bin/mount"
+UMOUNT="/bin/umount"
+fi
+
  PMOUNT="/usr/bin/pmount"
-UMOUNT="/bin/umount"
+
  for line in `grep -h -v ^# /etc/udev/mount.blacklist 
/etc/udev/mount.blacklist.d/*`
  do
if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ];
@@ -17,6 +36,34 @@ do
fi
  done
  
+automount_systemd() {

+name="`basename "$DEVNAME"`"
+
+! test -d "/run/media/$name" && mkdir -p "/run/media/$name"
+
+MOUNT="$MOUNT -o silent"
+
+# If filesystemtype is vfat, change the ownership group to 'disk', and
+# grant it with  w/r/x permissions.
+case $ID_FS_TYPE in
+vfat|fat)
+MOUNT="$MOUNT -o umask=007,gid=`awk -F':' '/^disk/{print $3}' 
/etc/group`"
+;;
+# TODO
+*)
+;;
+esac
+
+if ! $MOUNT --no-block -t auto $DEVNAME "/run/media/$name"
+then
+#logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME 
\"/run/media/$name\" failed!"
+rm_dir "/run/media/$name"
+else
+logger "mount.sh/automount" "Auto-mount of [/run/media/$name] 
successful"
+touch "/tmp/.automount-$name"
+fi
+}
+
  automount() { 
name="`basename "$DEVNAME"`"
  
@@ -72,9 +119,13 @@ if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ] && [ -n "$ID_FS_TYPE" -o "$media_t

# If the device isn't 

Re: [OE-core] Questions about udev rule and systemd-udev,relevant to mounting block device

2018-03-01 Thread Hongzhi, Song

Hi all,

Does anyone have suggestion for me?

Thanks.

Hongzhi.Song


On 2018年03月01日 18:35, Hongzhi, Song wrote:


Defect:

    The exiting method of automount of udev in /oe-core/meta/ /is using

/automount.rules/ which call /mount.sh/ that using //bin/mount/ to 
mount device.


But systemd-udevd detaches /mount()/ operations done within the service

from the rest of the system with MountFlag=slave, this means host can

not access device. (e.g. Executing /mkfs.ext4 /dev/sda1// prompts

//dev/sda1 is apparently in use by the system; will not make a 
filesystem here!/)



Solution:

    Systemd upstream suggest that the best way is to use "systemd-mount"

in udev rules, which will request the mount operation to be executed 
by PID 1.


And I have tested it was effective.


Uncertain:

    The exiting method is designed for /SysV-init /which is not 
compatible to


systemd-udev, at least that's what I think. So I think that we should 
design


a new rule or organizational structure to be suitable for systemd-udev 
and


to mount deferent device. Dose anyone help do this? Or I can make some

improvements on the basis of the existing with "systemd-mount".





-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] Questions about udev rule and systemd-udev,relevant to mounting block device

2018-03-01 Thread Hongzhi, Song

Defect:

    The exiting method of automount of udev in /oe-core/meta/ /is using

/automount.rules/ which call /mount.sh/ that using //bin/mount/ to mount 
device.


But systemd-udevd detaches /mount()/ operations done within the service

from the rest of the system with MountFlag=slave, this means host can

not access device. (e.g. Executing /mkfs.ext4 /dev/sda1// prompts

//dev/sda1 is apparently in use by the system; will not make a 
filesystem here!/)



Solution:

    Systemd upstream suggest that the best way is to use "systemd-mount"

in udev rules, which will request the mount operation to be executed by 
PID 1.


And I have tested it was effective.


Uncertain:

    The exiting method is designed for /SysV-init /which is not 
compatible to


systemd-udev, at least that's what I think. So I think that we should design

a new rule or organizational structure to be suitable for systemd-udev and

to mount deferent device. Dose anyone help do this? Or I can make some

improvements on the basis of the existing with "systemd-mount".

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


Re: [OE-core] [PATCH v3] systemd: re-enable mount propagation for udevd

2018-02-22 Thread Hongzhi, Song
What do you mean "it only happens with libseccomp"? I have tried to 
enable or disable


seccomp via CONFIG_SECCOMP, buf the results were same unless I set 
MountFlags=shared.


Without propagation patch, all block device, such as '/dev/sda*', 
mounted by systemd-udev,


are unaccessible to outside namespace, which means root user cann't use 
'/dev/sda*'. Do you


have any suggestions for me?

Thanks.



On 2018年02月22日 22:25, Burton, Ross wrote:

We used to have this but it was removed in the 232 upgrade:

    * Drop mount propagation patch, it only happens with libseccomp, 
OE doesnt

      enable it

Is this not the case?  Or are you enabling seccomp?  Maybe this should 
be a bbappend in meta-security?


Ross

On 22 February 2018 at 14:15, Hongzhi.Song > wrote:


MountFlags's default value is shared in systemd-udevd.service. But
upstream
sets MountFlags with slave just for keeping mounts done by udev
private to
udevd, which causes block device mounted by udev unvisable but
being busy for
host. So we revert it to shared to be propagated to host.

Signed-off-by: Hongzhi.Song >
---
 ...evd-re-enable-mount-propagation-for-udevd.patch | 33
++
 meta/recipes-core/systemd/systemd_234.bb 
         |  1 +
 2 files changed, 34 insertions(+)
 create mode 100644

meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

diff --git

a/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch

b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
new file mode 100644
index 00..fce7bdd796
--- /dev/null
+++

b/meta/recipes-core/systemd/systemd/systemd-udevd-re-enable-mount-propagation-for-udevd.patch
@@ -0,0 +1,33 @@
+From 11a3312d36109f5e5a7697ddb05c533c51e2cd75 Mon Sep 17 00:00:00
2001
+From: "Hongzhi.Song" >
+Date: Mon, 19 Feb 2018 20:43:02 -0500
+Subject: [PATCH] systemd-udevd: re-enable mount propagation for udevd
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Change the mount propagation flag from MountFlags=slave to
MountFlags=shared
+(default). Use shared to ensure that mounts and unmounts are
propagated from
+systemd's namespace to the service's namespace and vice versa,
while use slave
+to run processes so that none of their mounts and unmounts will
propagate to
+the host.
+
+Signed-off-by: Hongzhi.Song >
+---
+ units/systemd-udevd.service.in 
| 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/units/systemd-udevd.service.in
 b/units/systemd-udevd.service.in

+index fc037b5..841d7a8 100644
+--- a/units/systemd-udevd.service.in

 b/units/systemd-udevd.service.in

+@@ -24,7 +24,6 @@ ExecStart=@rootlibexecdir@/systemd-udevd
+ KillMode=mixed
+ WatchdogSec=3min
+ TasksMax=infinity
+-MountFlags=slave
+ MemoryDenyWriteExecute=yes
+ RestrictRealtime=yes
+ RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
+--
+2.8.1
+
diff --git a/meta/recipes-core/systemd/systemd_234.bb
 b/meta/recipes-core/systemd/systemd_234.bb

index babc351cc8..42f4f1ec76 100644
--- a/meta/recipes-core/systemd/systemd_234.bb 
+++ b/meta/recipes-core/systemd/systemd_234.bb 
@@ -32,6 +32,7 @@ SRC_URI += " \
           
file://0001-main-skip-many-initialization-steps-when-running-in-.patch
\
            file://CVE-2017-18078.patch \
           
file://0001-resolved-fix-loop-on-packets-with-pseudo-dns-types.patch \
+         
file://systemd-udevd-re-enable-mount-propagation-for-udevd.patch \
            "
 SRC_URI_append_qemuall = "
file://0001-core-device.c-Change-the-default-device-timeout-to-2.patch"

--
2.13.3

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org

http://lists.openembedded.org/mailman/listinfo/openembedded-core





-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org

Re: [OE-core] [PATCH v3] systemd: re-enable mount propagation for udevd

2018-02-22 Thread Hongzhi, Song

If MountFlags=slave, systemd-udevd mounts all block device,  such as

'/dev/sda1' '/dev/mmcblk*' , in itself unit namespace. So other namespace,

such as 'root user', has no access to use block device mentioned above.


On 2018年02月23日 08:50, Otavio Salvador wrote:

On Thu, Feb 22, 2018 at 11:15 AM, Hongzhi.Song
 wrote:

MountFlags's default value is shared in systemd-udevd.service. But upstream
sets MountFlags with slave just for keeping mounts done by udev private to
udevd, which causes block device mounted by udev unvisable but being busy for
host. So we revert it to shared to be propagated to host.

Signed-off-by: Hongzhi.Song 

This is what the mountflag does. This does not explain WHY you need this change.



--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core