diff mbox

[v2] fs/common: Create initial console device

Message ID 1351765685-8128-1-git-send-email-markos.chandras@gmail.com
State Changes Requested
Headers show

Commit Message

Markos Chandras Nov. 1, 2012, 10:28 a.m. UTC
From: Markos Chandras <markos.chandras@imgtec.com>

A /dev/console node must be present in rootfs when the Linux kernel
boots otherwise the kernel will print the following warning:
"Warning: unable to open an initial console"

This is because when we use an initramfs the /dev directory is not
populated at this point. This can cause problems when a program
(e.g ldso with early debugging enabled) opens a standard file
descriptor for read/write before these descriptors are actually
created by the init process later on.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
 fs/cpio/cpio.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Comments

Arnout Vandecappelle Nov. 1, 2012, 10:21 p.m. UTC | #1
On 11/01/12 11:28, Markos Chandras wrote:
> From: Markos Chandras<markos.chandras@imgtec.com>
>
> A /dev/console node must be present in rootfs when the Linux kernel
> boots otherwise the kernel will print the following warning:
> "Warning: unable to open an initial console"
>
> This is because when we use an initramfs the /dev directory is not
> populated at this point. This can cause problems when a program
> (e.g ldso with early debugging enabled) opens a standard file
> descriptor for read/write before these descriptors are actually
> created by the init process later on.
>
> Signed-off-by: Markos Chandras<markos.chandras@imgtec.com>
> ---
>   fs/cpio/cpio.mk |    2 ++
>   1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> index aa20b41..3293bc9 100644
> --- a/fs/cpio/cpio.mk
> +++ b/fs/cpio/cpio.mk
> @@ -21,6 +21,8 @@ define ROOTFS_CPIO_ADD_INIT
>           fi
>   endef
>
> +PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1

  The last three entries are missing (start, inc, count). Also, there should
be a $(sep) at the end of the line; otherwise, any subsequent entries are
appended at the end of the line.  (This will probably be the last line in
the table anyway, because the fs/ tree is included at the end of Makefile,
but we shouldn't rely on that).


  Regards,
  Arnout

> +
>   endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
>
>   ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
Markos Chandras Nov. 2, 2012, 11:32 a.m. UTC | #2
On Thu, Nov 1, 2012 at 10:21 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 11/01/12 11:28, Markos Chandras wrote:
>>
>> From: Markos Chandras<markos.chandras@imgtec.com>
>>
>> A /dev/console node must be present in rootfs when the Linux kernel
>> boots otherwise the kernel will print the following warning:
>> "Warning: unable to open an initial console"
>>
>> This is because when we use an initramfs the /dev directory is not
>> populated at this point. This can cause problems when a program
>> (e.g ldso with early debugging enabled) opens a standard file
>> descriptor for read/write before these descriptors are actually
>> created by the init process later on.
>>
>> Signed-off-by: Markos Chandras<markos.chandras@imgtec.com>
>> ---
>>   fs/cpio/cpio.mk |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
>> index aa20b41..3293bc9 100644
>> --- a/fs/cpio/cpio.mk
>> +++ b/fs/cpio/cpio.mk
>> @@ -21,6 +21,8 @@ define ROOTFS_CPIO_ADD_INIT
>>           fi
>>   endef
>>
>> +PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1
>
>
>  The last three entries are missing (start, inc, count). Also, there should
> be a $(sep) at the end of the line; otherwise, any subsequent entries are
> appended at the end of the line.  (This will probably be the last line in
> the table anyway, because the fs/ tree is included at the end of Makefile,
> but we shouldn't rely on that).
>
>
>  Regards,
>  Arnout
>
Hi Arnout,

Do I really need these 3 numbers (start, inc, count)? The static file
in  target/generic/device_table_dev.txt
is not using them for the console device.

--
Regards,
Markos
Arnout Vandecappelle Nov. 2, 2012, 11:35 a.m. UTC | #3
On 11/02/12 12:32, Markos Chandras wrote:
>>> >>  +PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1
>> >
>> >
>> >    The last three entries are missing (start, inc, count). Also, there should
>> >  be a $(sep) at the end of the line; otherwise, any subsequent entries are
>> >  appended at the end of the line.  (This will probably be the last line in
>> >  the table anyway, because the fs/ tree is included at the end of Makefile,
>> >  but we shouldn't rely on that).
>> >
> Do I really need these 3 numbers (start, inc, count)? The static file
> in  target/generic/device_table_dev.txt
> is not using them for the console device.

  It is:
/dev/console    c       666     0       0       5       1       -       -       -


  Regards,
  Arnout
Markos Chandras Nov. 2, 2012, 11:45 a.m. UTC | #4
On Fri, Nov 2, 2012 at 11:35 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> On 11/02/12 12:32, Markos Chandras wrote:
>>>>
>>>> >>  +PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1
>>>
>>> >
>>> >
>>> >    The last three entries are missing (start, inc, count). Also, there
>>> > should
>>> >  be a $(sep) at the end of the line; otherwise, any subsequent entries
>>> > are
>>> >  appended at the end of the line.  (This will probably be the last line
>>> > in
>>> >  the table anyway, because the fs/ tree is included at the end of
>>> > Makefile,
>>> >  but we shouldn't rely on that).
>>> >
>>
>> Do I really need these 3 numbers (start, inc, count)? The static file
>>
>> in  target/generic/device_table_dev.txt
>> is not using them for the console device.
>
>
>  It is:
> /dev/console    c       666     0       0       5       1       -       -
> -

HI Arnout,

Hmm I thought that the hyphens there meant "no value is needed". I
will prepare a new patch.
diff mbox

Patch

diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
index aa20b41..3293bc9 100644
--- a/fs/cpio/cpio.mk
+++ b/fs/cpio/cpio.mk
@@ -21,6 +21,8 @@  define ROOTFS_CPIO_ADD_INIT
         fi
 endef
 
+PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1
+
 endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
 
 ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT