Go to file
Timo Ketola ad164f5297 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>
(cherry picked from commit 98a6f1fc02)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2020-05-08 11:52:45 +02:00
arch arch/arc: explicitly set "max-page-size" for GNU LD 2019-12-25 22:09:52 +01:00
board board/udoo/neo: create boot.scr in TARGET_DIR/boot 2020-05-06 07:00:40 +02:00
boot boot/syslinux: fix build of efi part with gnu-efi 3.0.10 2020-04-08 16:23:39 +02:00
configs configs/qemu_riscv*: remove BR2_TARGET_OPENSBI_USE_PLAT 2020-05-07 23:55:13 +02:00
docs docs/manual: minor typo fix 2020-04-08 13:33:36 +02:00
fs fs/cpio: make initramfs init script survive 'console=' kernel argument 2020-05-08 11:52:45 +02:00
linux {linux, linux-headers}: bump 4.{4, 9, 14, 19}.x / 5.{4, 5, 6}.x series 2020-05-08 10:05:03 +02:00
package package/wireguard-linux-compat: tweak kernel-headers < 5.6 logic 2020-05-08 11:50:34 +02:00
support support/testing: test_python_django: use the timeout_multiplier value 2020-04-29 23:42:22 +02:00
system Revert "system: don't attempt swapon/swapoff in inittab if not available" 2020-02-08 20:13:07 +01:00
toolchain toolchain/toolchain-buildroot: PPC64(LE) support in musl requires ALTIVEC 2020-05-07 22:47:30 +02:00
utils utils/genrandconfig: drop outdated python-nfc check 2020-03-04 19:08:12 +01:00
.defconfig arch: remove support for sh64 2016-09-08 22:15:15 +02:00
.flake8 .flake8: fix check for 80/132 columns 2019-04-10 12:31:33 +02:00
.gitignore update gitignore 2013-05-04 12:41:55 +02:00
.gitlab-ci.yml support/testing: add libftdi1 test case 2020-02-23 11:12:09 +01:00
.gitlab-ci.yml.in gitlab-ci: use our updated docker base image 2019-10-27 21:52:28 +01:00
CHANGES Update for 2020.02.1 2020-04-10 22:42:41 +02:00
Config.in Config.in: drop BR2_NEEDS_HOST_{JAVAC,JAR} 2020-03-03 23:55:48 +01:00
Config.in.legacy package/classpath: drop package 2020-03-03 23:49:49 +01:00
COPYING COPYING: add exception about patch licensing 2016-02-26 19:50:13 +01:00
DEVELOPERS DEVELOPERS: remove Rhys Willians from lirc-tools 2020-05-06 07:53:26 +02:00
Makefile Update for 2020.02.1 2020-04-10 22:42:41 +02:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
README README: add reference to submitting-patches 2016-02-01 19:16:08 +01:00

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