forked from intel/linux-intel-lts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The file init/initramfs.c is always compiled and linked in the kernel vmlinux even when BLK_DEV_RAM and BLK_DEV_INITRD are disabled and the system isn't using any form of an initramfs or initrd. In this situation the code is only used to unpack a (static) default initial rootfilesystem. The current init/initramfs.c code. usr/initramfs_data.o compiles to a size of ~15 kbytes. Disabling BLK_DEV_RAM and BLK_DEV_INTRD shrinks the kernel code size with ~60 Kbytes. This patch avoids compiling in the code and data for initramfs support if CONFIG_BLK_DEV_INITRD is not defined. Instead of the initramfs code and data it uses a small routine in init/noinitramfs.c to setup an initial static default environment for mounting a rootfilesystem later on in the kernel initialisation process. The new code is: 164 bytes of size. The patch is separated in two parts: 1) doesn't compile initramfs code when CONFIG_BLK_DEV_INITRD is not set 2) changing all plaforms vmlinux.lds.S files to not reserve an area of PAGE_SIZE when CONFIG_BLK_DEV_INITRD is not set. [[email protected]: warning fix] Signed-off-by: Jean-Paul Saman <[email protected]> Cc: Al Viro <[email protected]> Cc: <[email protected]> Signed-off-by: Frederik Deweerdt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
- Loading branch information
Jean-Paul Saman
authored and
Linus Torvalds
committed
Feb 11, 2007
1 parent
dd65aa6
commit c33df4e
Showing
5 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* init/noinitramfs.c | ||
* | ||
* Copyright (C) 2006, NXP Semiconductors, All Rights Reserved | ||
* Author: Jean-Paul Saman <[email protected]> | ||
* | ||
* 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; | ||
|
||
err = sys_mkdir("/dev", 0755); | ||
if (err < 0) | ||
goto out; | ||
|
||
err = sys_mknod((const char __user *) "/dev/console", | ||
S_IFCHR | S_IRUSR | S_IWUSR, | ||
new_encode_dev(MKDEV(5, 1))); | ||
if (err < 0) | ||
goto out; | ||
|
||
err = sys_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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters