forked from mirrors/linux
		
	 873e65bc09
			
		
	
	
		873e65bc09
		
	
	
	
	
		
			
			Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation version 2 of the license this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 83 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Richard Fontana <rfontana@redhat.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.021731668@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
		
			
				
	
	
		
			40 lines
		
	
	
	
		
			873 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
	
		
			873 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>
 | |
| 
 | |
| /*
 | |
|  * Create a simple rootfs that is similar to the default initramfs
 | |
|  */
 | |
| static int __init default_rootfs(void)
 | |
| {
 | |
| 	int err;
 | |
| 
 | |
| 	err = ksys_mkdir((const char __user __force *) "/dev", 0755);
 | |
| 	if (err < 0)
 | |
| 		goto out;
 | |
| 
 | |
| 	err = ksys_mknod((const char __user __force *) "/dev/console",
 | |
| 			S_IFCHR | S_IRUSR | S_IWUSR,
 | |
| 			new_encode_dev(MKDEV(5, 1)));
 | |
| 	if (err < 0)
 | |
| 		goto out;
 | |
| 
 | |
| 	err = ksys_mkdir((const char __user __force *) "/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);
 |