[Cbe-oss-dev] [PATCH 6/9] Allow targets to specify extra initramfs source files

Jeremy Kerr jk at ozlabs.org
Tue Oct 23 10:54:54 EST 2007


The CONFIG_INITRAMFS_SOURCE Kconfig variable can be a space-separated
list of source files (or directories). This allows a platform to
add extra components to the initramfs image, by defining the
INITRAMFS_EXTRA_FILES make var.

By default, we add a simple initramfs extra file for the generic-2.6
platform, which specifies a few device nodes.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---

 include/kernel-defaults.mk                              |    4 +++-
 target/linux/generic-2.6/image/initramfs-base-files.txt |    9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

Index: kamikaze/include/kernel-defaults.mk
===================================================================
--- kamikaze.orig/include/kernel-defaults.mk
+++ kamikaze/include/kernel-defaults.mk
@@ -40,6 +40,8 @@ KERNEL_MAKEOPTS := -C $(LINUX_DIR) \
 	ARCH="$(LINUX_KARCH)" \
 	CONFIG_SHELL="$(BASH)"
 
+INITRAMFS_EXTRA_FILES ?= $(GENERIC_PLATFORM_DIR)/image/initramfs-base-files.txt
+
 ifneq (,$(KERNEL_CC))
   KERNEL_MAKEOPTS += CC="$(KERNEL_CC)"
 endif
@@ -78,7 +80,7 @@ ifeq ($(KERNEL),2.6)
     define Kernel/SetInitramfs
 		mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
 		grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
-		echo 'CONFIG_INITRAMFS_SOURCE="$(TARGET_DIR)"' >> $(LINUX_DIR)/.config
+		echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $(LINUX_DIR)/.config
 		echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $(LINUX_DIR)/.config
 		echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $(LINUX_DIR)/.config
     endef
Index: kamikaze/target/linux/generic-2.6/image/initramfs-base-files.txt
===================================================================
--- /dev/null
+++ kamikaze/target/linux/generic-2.6/image/initramfs-base-files.txt
@@ -0,0 +1,9 @@
+nod /dev/console 600 0 0 c 5 1
+nod /dev/null 666 0 0 c 1 3
+nod /dev/zero 666 0 0 c 1 5
+nod /dev/tty 666 0 0 c 5 0
+nod /dev/tty0 660 0 0 c 4 0
+nod /dev/tty1 660 0 0 c 4 1
+nod /dev/random 666 0 0 c 1 8
+nod /dev/urandom 666 0 0 c 1 9
+dir /dev/pts 755 0 0



More information about the cbe-oss-dev mailing list