[PATCH] initramfs: handle more than one source dir or file list

Fix bug 7401.

Handle more than one source dir or file list to the initramfs gen scripts.

The Kconfig help for INITRAMFS_SOURCE claims that you can specify multiple
space-separated sources in order to allow unprivileged users to build an
image.  There are two bugs in the current implementation that prevent this
from working.

First, we pass "file1 dir2" to the gen_initramfs_list.sh script, which it
obviously can't open.

Second, gen_initramfs_list.sh -l outputs multiple definitions for
deps_initramfs -- one for each argument.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Thomas Chou 2006-11-25 11:09:18 -08:00 committed by Linus Torvalds
parent 8e4d9dcb42
commit a26d79ca81
2 changed files with 3 additions and 2 deletions

View file

@ -158,7 +158,7 @@ unknown_option() {
} }
list_header() { list_header() {
echo "deps_initramfs := \\" :
} }
header() { header() {
@ -227,6 +227,7 @@ arg="$1"
case "$arg" in case "$arg" in
"-l") # files included in initramfs - used by kbuild "-l") # files included in initramfs - used by kbuild
dep_list="list_" dep_list="list_"
echo "deps_initramfs := \\"
shift shift
;; ;;
"-o") # generate gzipped cpio image named $1 "-o") # generate gzipped cpio image named $1

View file

@ -20,7 +20,7 @@ $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
hostprogs-y := gen_init_cpio hostprogs-y := gen_init_cpio
initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
$(CONFIG_INITRAMFS_SOURCE),-d) $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
ramfs-args := \ ramfs-args := \
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))