From 9283ba7cf9dba64f91b857596dc6530d97395a3d Mon Sep 17 00:00:00 2001 From: Jean-Paul Saman Date: Sat, 10 Feb 2007 01:44:43 -0800 Subject: [PATCH] --- yaml --- r: 47497 b: refs/heads/master c: c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f h: refs/heads/master i: 47495: 3dc8bc6e2e4e1a2ca5edcee208d1a22ae2c3c6ec v: v3 --- [refs] | 2 +- trunk/drivers/block/Kconfig | 4 ++- trunk/init/Kconfig | 4 +++ trunk/init/Makefile | 7 ++++- trunk/init/noinitramfs.c | 52 +++++++++++++++++++++++++++++++++++++ trunk/usr/Makefile | 2 +- 6 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 trunk/init/noinitramfs.c diff --git a/[refs] b/[refs] index 14c0e8a342aa..91bdeda97cfd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dd65aa6690e30fdad84a62191c7ab37da89d9865 +refs/heads/master: c33df4eaaf41fd3e34837a6ae9a5f9970c393d9f diff --git a/trunk/drivers/block/Kconfig b/trunk/drivers/block/Kconfig index 58c1debf86f1..cacb1c816e35 100644 --- a/trunk/drivers/block/Kconfig +++ b/trunk/drivers/block/Kconfig @@ -417,8 +417,10 @@ config BLK_DEV_INITRD etc. See for details. If RAM disk support (BLK_DEV_RAM) is also included, this - also enables initial RAM disk (initrd) support. + also enables initial RAM disk (initrd) support and adds + 15 Kbytes (more on some other architectures) to the kernel size. + If unsure say Y. config CDROM_PKTCDVD tristate "Packet writing on CD/DVD media" diff --git a/trunk/init/Kconfig b/trunk/init/Kconfig index a3f83e2c8250..ab6942231045 100644 --- a/trunk/init/Kconfig +++ b/trunk/init/Kconfig @@ -280,8 +280,12 @@ config RELAY If unsure, say N. +if BLK_DEV_INITRD + source "usr/Kconfig" +endif + config CC_OPTIMIZE_FOR_SIZE bool "Optimize for size (Look out for broken compilers!)" default y diff --git a/trunk/init/Makefile b/trunk/init/Makefile index 633a268d270d..0154aea1e52d 100644 --- a/trunk/init/Makefile +++ b/trunk/init/Makefile @@ -2,7 +2,12 @@ # Makefile for the linux kernel. # -obj-y := main.o version.o mounts.o initramfs.o +obj-y := main.o version.o mounts.o +ifneq ($(CONFIG_BLK_DEV_INITRD),y) +obj-y += noinitramfs.o +else +obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o +endif obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o mounts-y := do_mounts.o diff --git a/trunk/init/noinitramfs.c b/trunk/init/noinitramfs.c new file mode 100644 index 000000000000..f4c1a3a1b8c5 --- /dev/null +++ b/trunk/init/noinitramfs.c @@ -0,0 +1,52 @@ +/* + * init/noinitramfs.c + * + * Copyright (C) 2006, NXP Semiconductors, All Rights Reserved + * Author: Jean-Paul Saman + * + * 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 +#include +#include +#include + +/* + * 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); diff --git a/trunk/usr/Makefile b/trunk/usr/Makefile index 382702ad663b..201f27f8cbaf 100644 --- a/trunk/usr/Makefile +++ b/trunk/usr/Makefile @@ -7,7 +7,7 @@ PHONY += klibcdirs # Generate builtin.o based on initramfs_data.o -obj-y := initramfs_data.o +obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o # initramfs_data.o contains the initramfs_data.cpio.gz image. # The image is included using .incbin, a dependency which is not