Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * init/noinitramfs.c
0004  *
0005  * Copyright (C) 2006, NXP Semiconductors, All Rights Reserved
0006  * Author: Jean-Paul Saman <jean-paul.saman@nxp.com>
0007  */
0008 #include <linux/init.h>
0009 #include <linux/stat.h>
0010 #include <linux/kdev_t.h>
0011 #include <linux/syscalls.h>
0012 #include <linux/init_syscalls.h>
0013 #include <linux/umh.h>
0014 
0015 /*
0016  * Create a simple rootfs that is similar to the default initramfs
0017  */
0018 static int __init default_rootfs(void)
0019 {
0020     int err;
0021 
0022     usermodehelper_enable();
0023     err = init_mkdir("/dev", 0755);
0024     if (err < 0)
0025         goto out;
0026 
0027     err = init_mknod("/dev/console", S_IFCHR | S_IRUSR | S_IWUSR,
0028             new_encode_dev(MKDEV(5, 1)));
0029     if (err < 0)
0030         goto out;
0031 
0032     err = init_mkdir("/root", 0700);
0033     if (err < 0)
0034         goto out;
0035 
0036     return 0;
0037 
0038 out:
0039     printk(KERN_WARNING "Failed to create a rootfs\n");
0040     return err;
0041 }
0042 rootfs_initcall(default_rootfs);