Go to file
Timo Ketola 98a6f1fc02 fs/cpio: make initramfs init script survive 'console=' kernel argument
When booting with 'console=<empty>' in the kernel command line (as e.g.
U-Boot does with silent flags in effect), opening /dev/console fails.

As per POSIX [0], when iany redirection fails, the shell running exec
shal exit in error. So, when 'console=<empty>' is specified.
/dev/console can't be opened, and the redirection fails, and /init is
killed.

That behaviour was fixed on the kernel side with commit 2bd3a997befc2
(Open /dev/console from rootfs), present since 2.6.34, released in May
2010, so any [dr]ecent kernel will have that fix.

Furthermore, busybox will fix things up anyway (in bb_sanitize_stdio()),
falling back to opening /dev/null if no console is availble. systemd
does a similar thing (in make_console_stdio()), and sysvinit again has
a similar approach (in console_init()).

The archealogy search turned up those relevant commits:

    2011-08-04 10a130f91e initramfs/init: make sure that 0, 1, 2 fds are available
        introduces the three exec redirections in initramfs

    2011-09-06 3fac21ef8d cpio: fix boot with dynamic /dev
        introduces the three exec redirections in cpio

    2011-09-06 13a3afc536 fs/initramfs: refactor with fs/cpio
        dropped the initramfs tweaks to reuse the cpio ones

    2012-11-04 e1ebae700a fs/common: Create initial console device
        introduces the /dev/console char,5,1 pseudo device creation in
        cpio

    2018-03-31 dec061adce fs/cpio: don't extend packages' permissions table
        switched from the permission-table to a manual mknod to create
        /dev/console

The redirections were added before we could guarantee there was a
/dev/console in the rootfs.

We're now guaranteed to have /dev/console in an initramfs, and any recent
kernel will automatically open /dev/console before spawning /init.

The three redirections are useless now, and cause harm under certain
conditions. Drop them.

[0] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_20_01

Signed-off-by: Timo Ketola <timo.ketola@exertus.fi>
Cc: Peter Korsgaard <peter@korsgaard.com>
[yann.morin.1998@free.fr:
  - extend commit log with the analysis done with Peter
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2020-04-25 14:06:34 +02:00
arch arch/arc: explicitly set "max-page-size" for GNU LD 2019-12-25 22:09:52 +01:00
board configs/zynq_qmtech: new defconfig 2020-04-19 21:43:35 +02:00
boot boot/uboot: bump to version 2020.04 2020-04-13 21:55:59 +02:00
configs configs/olpc_xo175: needs host-openssl for kernel build 2020-04-24 13:36:45 +02:00
docs package/pkg-luarocks.mk: add support of host-luarocks-package 2020-04-12 14:48:18 +02:00
fs fs/cpio: make initramfs init script survive 'console=' kernel argument 2020-04-25 14:06:34 +02:00
linux {linux, linux-headers}: bump 4.{4, 9, 14, 19}.x / 5.{4, 5, 6}.x series 2020-04-23 21:42:27 +02:00
package package/wireguard-linux-compat: tweak kernel-headers < 5.6 logic 2020-04-25 11:56:03 +02:00
support support/scripts/boot-qemu-image.py: wait before using expect 2020-04-22 22:04:47 +02:00
system package/systemd: make sure init choice and package have same dependencies 2020-04-05 20:33:36 +02:00
toolchain toolchain/toolchain-buildroot: PPC64(LE) support in musl requires ALTIVEC 2020-04-20 23:36:29 +02:00
utils utils/scancpan: use two spaces indentation in hash file 2020-03-15 23:17:46 +01:00
.defconfig
.flake8 .flake8: fix check for 80/132 columns 2019-04-10 12:31:33 +02:00
.gitignore
.gitlab-ci.yml configs/zynq_qmtech: new defconfig 2020-04-19 21:43:35 +02:00
.gitlab-ci.yml.in gitlab.yml.in*: enable Qemu gitlab testing 2020-04-13 21:51:13 +02:00
CHANGES Update for 2020.02.1 2020-04-11 08:43:29 +02:00
Config.in Config.in: drop BR2_NEEDS_HOST_{JAVAC,JAR} 2020-03-03 23:55:48 +01:00
Config.in.legacy package/python-pyasn: remove duplicate package 2020-04-20 07:44:45 +02:00
COPYING
DEVELOPERS DEVELOPERS: fix typo in nanopi-neo4 board name 2020-04-21 21:31:55 +02:00
Makefile Makefile: assemble package file lists before calling post-build scripts 2020-03-20 22:17:28 +01:00
Makefile.legacy
README

Buildroot is a simple, efficient and easy-to-use tool to generate embedded
Linux systems through cross-compilation.

The documentation can be found in docs/manual. You can generate a text
document with 'make manual-text' and read output/docs/manual/manual.text.
Online documentation can be found at http://buildroot.org/docs.html

To build and use the buildroot stuff, do the following:

1) run 'make menuconfig'
2) select the target architecture and the packages you wish to compile
3) run 'make'
4) wait while it compiles
5) find the kernel, bootloader, root filesystem, etc. in output/images

You do not need to be root to build or run buildroot.  Have fun!

Buildroot comes with a basic configuration for a number of boards. Run
'make list-defconfigs' to view the list of provided configurations.

Please feed suggestions, bug reports, insults, and bribes back to the
buildroot mailing list: buildroot@buildroot.org
You can also find us on #buildroot on Freenode IRC.

If you would like to contribute patches, please read
https://buildroot.org/manual.html#submitting-patches