Commit a26d79ca81d6e46c445c8db87a89740c9b4d17e9

Authored by Thomas Chou
Committed by Linus Torvalds
1 parent 8e4d9dcb42

[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>

Showing 2 changed files with 3 additions and 2 deletions Side-by-side Diff

scripts/gen_initramfs_list.sh
... ... @@ -158,7 +158,7 @@
158 158 }
159 159  
160 160 list_header() {
161   - echo "deps_initramfs := \\"
  161 + :
162 162 }
163 163  
164 164 header() {
... ... @@ -227,6 +227,7 @@
227 227 case "$arg" in
228 228 "-l") # files included in initramfs - used by kbuild
229 229 dep_list="list_"
  230 + echo "deps_initramfs := \\"
230 231 shift
231 232 ;;
232 233 "-o") # generate gzipped cpio image named $1
... ... @@ -20,7 +20,7 @@
20 20 hostprogs-y := gen_init_cpio
21 21 initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
22 22 ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
23   - $(CONFIG_INITRAMFS_SOURCE),-d)
  23 + $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
24 24 ramfs-args := \
25 25 $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
26 26 $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))