mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
![Christoph Hellwig](/assets/img/avatar_default.png)
Add a simple helper to mknod with a kernel space file name and switch the early init code over to it. Remove the now unused ksys_mknod. Signed-off-by: Christoph Hellwig <hch@lst.de>
40 lines
813 B
C
40 lines
813 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* init/noinitramfs.c
|
|
*
|
|
* Copyright (C) 2006, NXP Semiconductors, All Rights Reserved
|
|
* Author: Jean-Paul Saman <jean-paul.saman@nxp.com>
|
|
*/
|
|
#include <linux/init.h>
|
|
#include <linux/stat.h>
|
|
#include <linux/kdev_t.h>
|
|
#include <linux/syscalls.h>
|
|
#include <linux/init_syscalls.h>
|
|
|
|
/*
|
|
* Create a simple rootfs that is similar to the default initramfs
|
|
*/
|
|
static int __init default_rootfs(void)
|
|
{
|
|
int err;
|
|
|
|
err = init_mkdir("/dev", 0755);
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
err = init_mknod("/dev/console", S_IFCHR | S_IRUSR | S_IWUSR,
|
|
new_encode_dev(MKDEV(5, 1)));
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
err = init_mkdir("/root", 0700);
|
|
if (err < 0)
|
|
goto out;
|
|
|
|
return 0;
|
|
|
|
out:
|
|
printk(KERN_WARNING "Failed to create a rootfs\n");
|
|
return err;
|
|
}
|
|
rootfs_initcall(default_rootfs);
|