mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
Check /dev/console using init_stat()
vfs_lstat() which was used previously would fail with certain configurations. This was likely due to the involved functions being marked __init at some point in the past. Signed-off-by: Sven Schwermer <sven.schwermer@disruptive-technologies.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
parent
82689c6270
commit
ccb5f0a475
|
@ -1578,20 +1578,21 @@ static int __ref kernel_init(void *unused)
|
|||
/* Open /dev/console, for stdin/stdout/stderr, this should never fail */
|
||||
void __init console_on_rootfs(void)
|
||||
{
|
||||
struct file *file;
|
||||
|
||||
#ifndef CONFIG_BLK_DEV_INITRD
|
||||
/*
|
||||
* Use /dev/console to infer if the rootfs is setup properly.
|
||||
* In case of initrd or initramfs /dev/console might be instantiated
|
||||
* later by /init so don't do this check for CONFIG_BLK_DEV_INITRD
|
||||
*/
|
||||
struct kstat console_stat;
|
||||
if (vfs_lstat((char __user *) "/dev/console", (struct kstat __user *) &console_stat)
|
||||
|| !S_ISCHR(console_stat.mode)) {
|
||||
struct kstat stat;
|
||||
if (init_stat("/dev/console", &stat, 0) || !S_ISCHR(stat.mode)) {
|
||||
panic("/dev/console is missing or not a character device!\nPlease ensure your rootfs is properly configured\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
struct file *file = filp_open("/dev/console", O_RDWR, 0);
|
||||
file = filp_open("/dev/console", O_RDWR, 0);
|
||||
|
||||
if (IS_ERR(file)) {
|
||||
pr_err("Warning: unable to open an initial console.\n");
|
||||
|
|
Loading…
Reference in New Issue
Block a user