xref: /OK3568_Linux_fs/buildroot/fs/cpio/init (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#!/bin/sh
2*4882a593Smuzhiyun# devtmpfs does not get automounted for initramfs
3*4882a593Smuzhiyun/bin/mount -t devtmpfs devtmpfs /dev
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun# use the /dev/console device node from devtmpfs if possible to not
6*4882a593Smuzhiyun# confuse glibc's ttyname_r().
7*4882a593Smuzhiyun# This may fail (E.G. booted with console=), and errors from exec will
8*4882a593Smuzhiyun# terminate the shell, so use a subshell for the test
9*4882a593Smuzhiyunif (exec 0</dev/console) 2>/dev/null; then
10*4882a593Smuzhiyun    exec 0</dev/console
11*4882a593Smuzhiyun    exec 1>/dev/console
12*4882a593Smuzhiyun    exec 2>/dev/console
13*4882a593Smuzhiyunfi
14*4882a593Smuzhiyun
15*4882a593Smuzhiyunexec /sbin/init "$@"
16