All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix unprivileged user builds of initramfs
@ 2006-11-19  5:00 Matthew Wilcox
  2006-11-19  7:35 ` Oleg Verych
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew Wilcox @ 2006-11-19  5:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: bos, azarah, Sam Ravnborg


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.  I opted to fix this in the Makefile by doing
a $(shell echo ...).

Second, gen_initramfs_list.sh -l outputs multiple definitions for
deps_initramfs -- one for each argument.  This annoys make the second time
you run it.  I chose to fix this problem by introducing list_header_once()
and making list_header() be a nop.

Someone with more time might find a more elegant fix for either or both
of these problems.  But now my qlogic adapter can find its firmware without
being turned into a module.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>

diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh
index 331c079..dcb5aff 100644
--- a/scripts/gen_initramfs_list.sh
+++ b/scripts/gen_initramfs_list.sh
@@ -157,10 +157,14 @@ unknown_option() {
 	exit 1
 }
 
-list_header() {
+list_header_once() {
 	echo "deps_initramfs := \\"
 }
 
+list_header() {
+	:
+}
+
 header() {
 	printf "\n#####################\n# $1\n" >> ${output}
 }
@@ -227,6 +231,7 @@ arg="$1"
 case "$arg" in
 	"-l")	# files included in initramfs - used by kbuild
 		dep_list="list_"
+		list_header_once
 		shift
 		;;
 	"-o")	# generate gzipped cpio image named $1
diff --git a/usr/Makefile b/usr/Makefile
index e338e7b..3d59fb4 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -20,7 +20,7 @@ $(obj)/initramfs_data.o: $(obj)/initramf
 hostprogs-y := gen_init_cpio
 initramfs   := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
 ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
-                    $(CONFIG_INITRAMFS_SOURCE),-d)
+                    $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
 ramfs-args  := \
         $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
         $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix unprivileged user builds of initramfs
  2006-11-19  5:00 [PATCH] Fix unprivileged user builds of initramfs Matthew Wilcox
@ 2006-11-19  7:35 ` Oleg Verych
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Verych @ 2006-11-19  7:35 UTC (permalink / raw)
  To: linux-kernel

On 2006-11-19, Matthew Wilcox wrote:
[]
> Someone with more time might find a more elegant fix for either or both
> of these problems.  But now my qlogic adapter can find its firmware without
> being turned into a module.

Please check "initramfs-handle-more-than-one-source-dir-or-file-list.patch"
in mm.

____


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-19  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-19  5:00 [PATCH] Fix unprivileged user builds of initramfs Matthew Wilcox
2006-11-19  7:35 ` Oleg Verych

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.