Skip to contentSkip to conversation

fs/common: Create initial console device

PATCH Superseded Markos Chandras 2 participants 5 messages Nov 1, 2012 – Nov 2, 2012

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs/common: Create initial console device

From: Markos Chandras <[email protected]>

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.

---
 fs/cpio/cpio.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/cpio/cpio.mk +2 -0
index aa20b41..3293bc9 100644
@@ -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
Signature · 1 line
1.7.1
#1 lore raw

PATCH v2 1/1 fs/common: Create initial console device

Quoted 22 lines · Markos Chandras

From: Markos Chandras<[email protected]>

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.

---
  fs/cpio/cpio.mk |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
fs/cpio/cpio.mk +0 -0
index aa20b41..3293bc9 100644

fs/cpio/cpio.mk define ROOTFS_CPIO_ADD_INIT · line 24

Quoted 4 lines
fs/cpio/cpio.mk +1 -0
@@ -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

Quoted 4 lines
fs/cpio/cpio.mk +1 -0
+
  endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
 
  ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw

PATCH v2 1/1 fs/common: Create initial console device

Quoted 37 lines · Arnout Vandecappelle
Quoted 23 lines · Markos Chandras

From: Markos Chandras<[email protected]>

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.

---
  fs/cpio/cpio.mk |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
fs/cpio/cpio.mk +0 -0
index aa20b41..3293bc9 100644

fs/cpio/cpio.mk define ROOTFS_CPIO_ADD_INIT · line 24

Quoted 4 lines
fs/cpio/cpio.mk +1 -0
@@ -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).

Quoted 3 lines

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

#3 lore raw

PATCH v2 1/1 fs/common: Create initial console device

Quoted 9 lines · Markos Chandras
Quoted 9 lines
Quoted 9 lines
Quoted 1 line
Quoted 1 line

+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).

Quoted 3 lines

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

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#4 lore raw

PATCH v2 1/1 fs/common: Create initial console device

Quoted 19 lines · Arnout Vandecappelle
Quoted 18 lines · Markos Chandras
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

+PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1

Quoted 10 lines
Quoted 10 lines

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

Quoted 7 lines
Quoted 2 lines

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.

Signature · 2 lines
Regards,
Markos