Blame view

init/noinitramfs.c 1.46 KB
c33df4eaa   Jean-Paul Saman   [PATCH] disable i...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  /*
   * init/noinitramfs.c
   *
   * Copyright (C) 2006, NXP Semiconductors, All Rights Reserved
   * Author: Jean-Paul Saman <jean-paul.saman@nxp.com>
   *
   * 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
   */
  #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;
562f5e638   Namhyung Kim   init: mark __user...
31
  	err = sys_mkdir((const char __user __force *) "/dev", 0755);
c33df4eaa   Jean-Paul Saman   [PATCH] disable i...
32
33
  	if (err < 0)
  		goto out;
562f5e638   Namhyung Kim   init: mark __user...
34
  	err = sys_mknod((const char __user __force *) "/dev/console",
c33df4eaa   Jean-Paul Saman   [PATCH] disable i...
35
36
37
38
  			S_IFCHR | S_IRUSR | S_IWUSR,
  			new_encode_dev(MKDEV(5, 1)));
  	if (err < 0)
  		goto out;
562f5e638   Namhyung Kim   init: mark __user...
39
  	err = sys_mkdir((const char __user __force *) "/root", 0700);
c33df4eaa   Jean-Paul Saman   [PATCH] disable i...
40
41
42
43
44
45
46
47
48
49
50
  	if (err < 0)
  		goto out;
  
  	return 0;
  
  out:
  	printk(KERN_WARNING "Failed to create a rootfs
  ");
  	return err;
  }
  rootfs_initcall(default_rootfs);