public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* download_dev-random hook question
@ 2017-11-13 16:35 Christian Storm
  2017-11-13 18:09 ` Henning Schild
  2017-11-16  9:04 ` [ext] Christian Storm
  0 siblings, 2 replies; 10+ messages in thread
From: Christian Storm @ 2017-11-13 16:35 UTC (permalink / raw)
  To: isar-users

Hi,

I just stumbled over the download_dev-random multistrap hook:
Why is it that you only create /dev/{,u}random?
Why not also create other essential files like /dev/{null,zero}
as well, e.g., like this:

```
--- a/meta/recipes-devtools/buildchroot/files/download_dev-random
+++ b/meta/recipes-devtools/buildchroot/files/download_dev-random
@@ -4,10 +4,14 @@ set -e
 
 readonly ROOTFS="$1"
 
-mknod "${ROOTFS}/dev/random" c 1 8
-chmod 640 "${ROOTFS}/dev/random"
+mknod -m 640 "${ROOTFS}/dev/random" c 1 8
 chown 0:0 "${ROOTFS}/dev/random"
 
-mknod "${ROOTFS}/dev/urandom" c 1 9
-chmod 640 "${ROOTFS}/dev/urandom"
+mknod -m 640 "${ROOTFS}/dev/urandom" c 1 9
 chown 0:0 "${ROOTFS}/dev/urandom"
+
+mknod -m 666 "${ROOTFS}/dev/null" c 1 3
+chown 0:0 "${ROOTFS}/dev/null"
+
+mknod -m 666 "${ROOTFS}/dev/zero" c 1 5
+chown 0:0 "${ROOTFS}/dev/zero"
```



Besten Gru�,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

* Re: download_dev-random hook question
  2017-11-13 16:35 download_dev-random hook question Christian Storm
@ 2017-11-13 18:09 ` Henning Schild
  2017-11-14  9:06   ` [ext] Christian Storm
  2017-11-16  9:04 ` [ext] Christian Storm
  1 sibling, 1 reply; 10+ messages in thread
From: Henning Schild @ 2017-11-13 18:09 UTC (permalink / raw)
  To: [ext] Christian Storm; +Cc: isar-users, Frank Lenormand, Frank Lenormand

Good question, looking at the commit it does not become clear. Putting
the author on CC.

Christian, you patched it to shrink it. Did you try removing that step?
I can just guess that nodes will be created by packages/hooks and
something in multistrap needs certain nodes before that happens.


Henning

Am Mon, 13 Nov 2017 17:35:46 +0100
schrieb "[ext] Christian Storm" <christian.storm@siemens.com>:

> Hi,
> 
> I just stumbled over the download_dev-random multistrap hook:
> Why is it that you only create /dev/{,u}random?
> Why not also create other essential files like /dev/{null,zero}
> as well, e.g., like this:
> 
> ```
> --- a/meta/recipes-devtools/buildchroot/files/download_dev-random
> +++ b/meta/recipes-devtools/buildchroot/files/download_dev-random
> @@ -4,10 +4,14 @@ set -e
>  
>  readonly ROOTFS="$1"
>  
> -mknod "${ROOTFS}/dev/random" c 1 8
> -chmod 640 "${ROOTFS}/dev/random"
> +mknod -m 640 "${ROOTFS}/dev/random" c 1 8
>  chown 0:0 "${ROOTFS}/dev/random"
>  
> -mknod "${ROOTFS}/dev/urandom" c 1 9
> -chmod 640 "${ROOTFS}/dev/urandom"
> +mknod -m 640 "${ROOTFS}/dev/urandom" c 1 9
>  chown 0:0 "${ROOTFS}/dev/urandom"
> +
> +mknod -m 666 "${ROOTFS}/dev/null" c 1 3
> +chown 0:0 "${ROOTFS}/dev/null"
> +
> +mknod -m 666 "${ROOTFS}/dev/zero" c 1 5
> +chown 0:0 "${ROOTFS}/dev/zero"
> ```
> 
> 
> 
> Besten Gruß,
>    Christian
> 


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

* Re: download_dev-random hook question
  2017-11-13 18:09 ` Henning Schild
@ 2017-11-14  9:06   ` [ext] Christian Storm
  0 siblings, 0 replies; 10+ messages in thread
From: [ext] Christian Storm @ 2017-11-14  9:06 UTC (permalink / raw)
  To: isar-users

> [...]
> Christian, you patched it to shrink it. Did you try removing that step?

Nope, and I'd like to extend that step in terms of /dev/ nodes to be
created instead of removing it :)

> I can just guess that nodes will be created by packages/hooks and
> something in multistrap needs certain nodes before that happens.

Yes, a subset of the standard ones (TM) are required, i.e.,
/dev/{null,{u,}random,...}, you name it.

So, I'd like to have a static /dev/ setup in such a way that the
essential files required to boot are present, even without udev or the
like having created them dynamically.
To be precise, I'd like a to-be-renamed download_dev-random to include
  mknod -m 666 /dev/null c 1 3
  mknod -m 666 /dev/zero c 1 5
  mknod -m 666 /dev/random c 1 8
  mknod -m 666 /dev/urandom c 1 9
  mkdir -m 755 /dev/pts
  mkdir -m 1777 /dev/shm
  mknod -m 666 /dev/tty c 5 0
  mknod -m 600 /dev/console c 5 1
  mknod -m 666 /dev/tty0 c 4 0
  mknod -m 666 /dev/full c 1 7
  mknod -m 600 /dev/initctl p
  mknod -m 666 /dev/ptmx c 5 2


Besten Gru�,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

* Re: download_dev-random hook question
  2017-11-13 16:35 download_dev-random hook question Christian Storm
  2017-11-13 18:09 ` Henning Schild
@ 2017-11-16  9:04 ` [ext] Christian Storm
  2017-11-16  9:19   ` Alexander Smirnov
  2017-11-20  9:41   ` Henning Schild
  1 sibling, 2 replies; 10+ messages in thread
From: [ext] Christian Storm @ 2017-11-16  9:04 UTC (permalink / raw)
  To: isar-users

> I just stumbled over the download_dev-random multistrap hook:
> Why is it that you only create /dev/{,u}random?
> Why not also create other essential files like /dev/{null,zero}
> as well [...]

... and, a further question that just came to my mind: Why is this handled
in a multistrap hook in the first place? Seems rather implicit to me. Why 
not do it explicitly in buildchroot.bb and isar-image-base.bb?


Besten Gru�,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

* Re: download_dev-random hook question
  2017-11-16  9:04 ` [ext] Christian Storm
@ 2017-11-16  9:19   ` Alexander Smirnov
  2017-11-16  9:41     ` Christian Storm
  2017-11-20  9:41   ` Henning Schild
  1 sibling, 1 reply; 10+ messages in thread
From: Alexander Smirnov @ 2017-11-16  9:19 UTC (permalink / raw)
  To: isar-users

Hi,

On 11/16/2017 12:04 PM, [ext] Christian Storm wrote:
>> I just stumbled over the download_dev-random multistrap hook:
>> Why is it that you only create /dev/{,u}random?
>> Why not also create other essential files like /dev/{null,zero}
>> as well [...]
> 
> ... and, a further question that just came to my mind: Why is this handled
> in a multistrap hook in the first place? Seems rather implicit to me. Why
> not do it explicitly in buildchroot.bb and isar-image-base.bb?
>

IIRC correctly multistrap configuration was taken from Debian/Embian 
examples. So I'd personally prefer to drop all the hooks and make 
necessary calls explicitly in recipes.

So I see it like the following:
  - recipe creates rootfs, mounts necessary folders and creates device 
files.
  - recipe calls multistrap which only downloads the packages and unpack 
them to rootfs.
  - recipe calls configscript which performs post-configuration for rootfs.

This would be very helpful in context of switching to debootstrap.

Alex

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

* Re: download_dev-random hook question
  2017-11-16  9:19   ` Alexander Smirnov
@ 2017-11-16  9:41     ` Christian Storm
  2017-11-16  9:49       ` Alexander Smirnov
  0 siblings, 1 reply; 10+ messages in thread
From: Christian Storm @ 2017-11-16  9:41 UTC (permalink / raw)
  To: isar-users

> >> I just stumbled over the download_dev-random multistrap hook:
> >> Why is it that you only create /dev/{,u}random?
> >> Why not also create other essential files like /dev/{null,zero}
> >> as well [...]
> > 
> > ... and, a further question that just came to my mind: Why is this handled
> > in a multistrap hook in the first place? Seems rather implicit to me. Why
> > not do it explicitly in buildchroot.bb and isar-image-base.bb?
> >
> 
> IIRC correctly multistrap configuration was taken from Debian/Embian 
> examples. So I'd personally prefer to drop all the hooks and make 
> necessary calls explicitly in recipes.

Ah, I see... I totally agree.

> So I see it like the following:
>   - recipe creates rootfs, mounts necessary folders and creates device files.
>   - recipe calls multistrap which only downloads the packages and unpack 
>     them to rootfs.
>   - recipe calls configscript which performs post-configuration for rootfs.

Yes, we're on the same page here, agreed.

> This would be very helpful in context of switching to debootstrap.

Even without the switch, I do find the explicit variant, well, more explicit :)


Besten Gru�,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

* Re: download_dev-random hook question
  2017-11-16  9:41     ` Christian Storm
@ 2017-11-16  9:49       ` Alexander Smirnov
  2017-11-16 10:04         ` Christian Storm
  0 siblings, 1 reply; 10+ messages in thread
From: Alexander Smirnov @ 2017-11-16  9:49 UTC (permalink / raw)
  To: isar-users

Hi,

On 11/16/2017 12:41 PM, Christian Storm wrote:
>>>> I just stumbled over the download_dev-random multistrap hook:
>>>> Why is it that you only create /dev/{,u}random?
>>>> Why not also create other essential files like /dev/{null,zero}
>>>> as well [...]
>>>
>>> ... and, a further question that just came to my mind: Why is this handled
>>> in a multistrap hook in the first place? Seems rather implicit to me. Why
>>> not do it explicitly in buildchroot.bb and isar-image-base.bb?
>>>
>>
>> IIRC correctly multistrap configuration was taken from Debian/Embian
>> examples. So I'd personally prefer to drop all the hooks and make
>> necessary calls explicitly in recipes.
> 
> Ah, I see... I totally agree.
> 
>> So I see it like the following:
>>    - recipe creates rootfs, mounts necessary folders and creates device files.
>>    - recipe calls multistrap which only downloads the packages and unpack
>>      them to rootfs.
>>    - recipe calls configscript which performs post-configuration for rootfs.
> 
> Yes, we're on the same page here, agreed.
> 
>> This would be very helpful in context of switching to debootstrap.
> 
> Even without the switch, I do find the explicit variant, well, more explicit :)
> 

Will you handle this? :-) Or I could add it to TODO?

Alex

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

* Re: download_dev-random hook question
  2017-11-16  9:49       ` Alexander Smirnov
@ 2017-11-16 10:04         ` Christian Storm
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Storm @ 2017-11-16 10:04 UTC (permalink / raw)
  To: isar-users

> >>>> I just stumbled over the download_dev-random multistrap hook:
> >>>> Why is it that you only create /dev/{,u}random?
> >>>> Why not also create other essential files like /dev/{null,zero}
> >>>> as well [...]
> >>>
> >>> ... and, a further question that just came to my mind: Why is this handled
> >>> in a multistrap hook in the first place? Seems rather implicit to me. Why
> >>> not do it explicitly in buildchroot.bb and isar-image-base.bb?
> >>>
> >>
> >> IIRC correctly multistrap configuration was taken from Debian/Embian
> >> examples. So I'd personally prefer to drop all the hooks and make
> >> necessary calls explicitly in recipes.
> > 
> > Ah, I see... I totally agree.
> > 
> >> So I see it like the following:
> >>    - recipe creates rootfs, mounts necessary folders and creates device files.
> >>    - recipe calls multistrap which only downloads the packages and unpack
> >>      them to rootfs.
> >>    - recipe calls configscript which performs post-configuration for rootfs.
> > 
> > Yes, we're on the same page here, agreed.
> > 
> >> This would be very helpful in context of switching to debootstrap.
> > 
> > Even without the switch, I do find the explicit variant, well, more explicit :)
> > 
> 
> Will you handle this? :-) Or I could add it to TODO?

It fell on my feet, so I'll prepare patches, stay tuned...



Besten Gru�,
   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

* Re: download_dev-random hook question
  2017-11-16  9:04 ` [ext] Christian Storm
  2017-11-16  9:19   ` Alexander Smirnov
@ 2017-11-20  9:41   ` Henning Schild
  2017-11-20 10:00     ` Christian Storm
  1 sibling, 1 reply; 10+ messages in thread
From: Henning Schild @ 2017-11-20  9:41 UTC (permalink / raw)
  To: [ext] [ext] Christian Storm; +Cc: isar-users

Am Thu, 16 Nov 2017 10:04:53 +0100
schrieb "[ext] [ext] Christian Storm" <christian.storm@siemens.com>:

> > I just stumbled over the download_dev-random multistrap hook:
> > Why is it that you only create /dev/{,u}random?
> > Why not also create other essential files like /dev/{null,zero}
> > as well [...]  
> 
> ... and, a further question that just came to my mind: Why is this
> handled in a multistrap hook in the first place? Seems rather
> implicit to me. Why not do it explicitly in buildchroot.bb and
> isar-image-base.bb?

Is a hook not explicit? I do not get the point. Using a script outside
of do_build even allows for sharing between the two users. And these two
recipes should probably be deduplicated one day.

Henning

> 
> Besten Gruß,
>    Christian
> 


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

* Re: download_dev-random hook question
  2017-11-20  9:41   ` Henning Schild
@ 2017-11-20 10:00     ` Christian Storm
  0 siblings, 0 replies; 10+ messages in thread
From: Christian Storm @ 2017-11-20 10:00 UTC (permalink / raw)
  To: isar-users

> > > I just stumbled over the download_dev-random multistrap hook:
> > > Why is it that you only create /dev/{,u}random?
> > > Why not also create other essential files like /dev/{null,zero}
> > > as well [...]  
> > 
> > ... and, a further question that just came to my mind: Why is this
> > handled in a multistrap hook in the first place? Seems rather
> > implicit to me. Why not do it explicitly in buildchroot.bb and
> > isar-image-base.bb?
> 
> Is a hook not explicit? I do not get the point. 

It depends :)

In my opinion it's not explicit as /dev node generation is kind of a
side-effect of running multistrap realized via its hooks. If multistrap
would have done it anyway without us placing the hook in there, fine.
But we're placing a hook script in multistrap that does the work -
which could as well be done in do_build(), there named explicitly as
/dev node generation. If I wanted to know how/where /dev node generation
is done, there's as of now one more indirection in terms of the
multistrap hook. That said, I'm not strongly opinionated on this as I
guess it's mostly a matter of taste though...


> Using a script outside of do_build even allows for sharing between the
> two users. 

Yes, but this is also true if this external script is called from within
the two do_builds, explicitly.


> And these two recipes should probably be deduplicated one day.

Yes, I agree but that's another issue...



   Christian

-- 
Dr. Christian Storm
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Otto-Hahn-Ring 6, 81739 M�nchen, Germany

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

end of thread, other threads:[~2017-11-20 10:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-13 16:35 download_dev-random hook question Christian Storm
2017-11-13 18:09 ` Henning Schild
2017-11-14  9:06   ` [ext] Christian Storm
2017-11-16  9:04 ` [ext] Christian Storm
2017-11-16  9:19   ` Alexander Smirnov
2017-11-16  9:41     ` Christian Storm
2017-11-16  9:49       ` Alexander Smirnov
2017-11-16 10:04         ` Christian Storm
2017-11-20  9:41   ` Henning Schild
2017-11-20 10:00     ` Christian Storm

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