From: Matthew Wilcox <matthew@wil.cx>
To: linux-kernel@vger.kernel.org
Cc: bos@serpentine.com, azarah@nosferatu.za.org,
Sam Ravnborg <sam@ravnborg.org>
Subject: [PATCH] Fix unprivileged user builds of initramfs
Date: Sat, 18 Nov 2006 22:00:28 -0700 [thread overview]
Message-ID: <20061119050028.GF18567@parisc-linux.org> (raw)
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))
next reply other threads:[~2006-11-19 5:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-19 5:00 Matthew Wilcox [this message]
2006-11-19 7:35 ` [PATCH] Fix unprivileged user builds of initramfs Oleg Verych
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061119050028.GF18567@parisc-linux.org \
--to=matthew@wil.cx \
--cc=azarah@nosferatu.za.org \
--cc=bos@serpentine.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox