Back to home page

LXR

 
 

    


0001 /*
0002  * init/noinitramfs.c
0003  *
0004  * Copyright (C) 2006, NXP Semiconductors, All Rights Reserved
0005  * Author: Jean-Paul Saman <jean-paul.saman@nxp.com>
0006  *
0007  * This program is free software; you can redistribute it and/or modify
0008  * it under the terms of the GNU General Public License as published by
0009  * the Free Software Foundation; version 2 of the License.
0010  *
0011  * This program is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014  * GNU General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU General Public License
0017  * along with this program; if not, write to the Free Software
0018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0019  */
0020 #include <linux/init.h>
0021 #include <linux/stat.h>
0022 #include <linux/kdev_t.h>
0023 #include <linux/syscalls.h>
0024 
0025 /*
0026  * Create a simple rootfs that is similar to the default initramfs
0027  */
0028 static int __init default_rootfs(void)
0029 {
0030     int err;
0031 
0032     err = sys_mkdir((const char __user __force *) "/dev", 0755);
0033     if (err < 0)
0034         goto out;
0035 
0036     err = sys_mknod((const char __user __force *) "/dev/console",
0037             S_IFCHR | S_IRUSR | S_IWUSR,
0038             new_encode_dev(MKDEV(5, 1)));
0039     if (err < 0)
0040         goto out;
0041 
0042     err = sys_mkdir((const char __user __force *) "/root", 0700);
0043     if (err < 0)
0044         goto out;
0045 
0046     return 0;
0047 
0048 out:
0049     printk(KERN_WARNING "Failed to create a rootfs\n");
0050     return err;
0051 }
0052 rootfs_initcall(default_rootfs);