* [PATCH] [RFC] initramfs: Prefix simple paths with $(srctree)
@ 2013-11-14 22:14 Geert Uytterhoeven
2013-11-15 5:55 ` Vineet Gupta
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2013-11-14 22:14 UTC (permalink / raw)
To: Jonas Bonn, linux-kbuild; +Cc: linux, linux-kernel, Geert Uytterhoeven
If CONFIG_INITRAMFS_SOURCE contains relative paths inside the source tree
(e.g. in a defconfig pointing to arch-specific files), the corresponding
file system entries are not found when building outside the source tree.
Prefix all simple paths (paths not starting with "/", "../", or "./") with
$(srctree) to fix this.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
This issue happens when building an OpenRISC defconfig from
git://openrisc.net/jonas/linux. Mainline doesn't have the OpenRISC
initramfs.
Questions:
1. Is this an acceptable solution for mainline?
2. My make-foo is limited. is there a better way to accomplish this, than
by prefixing all paths and removing the prefixes again where they're
not wanted?
usr/Makefile | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/usr/Makefile b/usr/Makefile
index e767f019accf..2170c38936ce 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -41,6 +41,12 @@ hostprogs-y := gen_init_cpio
initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
+ifneq ("$(ramfs-input)", "-d")
+ramfs-input := $(patsubst %, $(srctree)/%, $(ramfs-input))
+ramfs-input := $(patsubst $(srctree)//%, /%, $(ramfs-input))
+ramfs-input := $(patsubst $(srctree)/../%, ../%, $(ramfs-input))
+ramfs-input := $(patsubst $(srctree)/./%, ./%, $(ramfs-input))
+endif
ramfs-args := \
$(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
$(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [RFC] initramfs: Prefix simple paths with $(srctree)
2013-11-14 22:14 [PATCH] [RFC] initramfs: Prefix simple paths with $(srctree) Geert Uytterhoeven
@ 2013-11-15 5:55 ` Vineet Gupta
0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2013-11-15 5:55 UTC (permalink / raw)
To: Geert Uytterhoeven, Jonas Bonn, linux-kbuild; +Cc: linux-kernel, linux
On 11/15/2013 03:44 AM, Geert Uytterhoeven wrote:
> If CONFIG_INITRAMFS_SOURCE contains relative paths inside the source tree
> (e.g. in a defconfig pointing to arch-specific files), the corresponding
> file system entries are not found when building outside the source tree.
>
> Prefix all simple paths (paths not starting with "/", "../", or "./") with
> $(srctree) to fix this.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
> This issue happens when building an OpenRISC defconfig from
> git://openrisc.net/jonas/linux. Mainline doesn't have the OpenRISC
> initramfs.
+1.
This applies to ARC defconfig too.
>
> Questions:
> 1. Is this an acceptable solution for mainline?
> 2. My make-foo is limited. is there a better way to accomplish this, than
> by prefixing all paths and removing the prefixes again where they're
> not wanted?
>
> usr/Makefile | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/usr/Makefile b/usr/Makefile
> index e767f019accf..2170c38936ce 100644
> --- a/usr/Makefile
> +++ b/usr/Makefile
> @@ -41,6 +41,12 @@ hostprogs-y := gen_init_cpio
> initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
> ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
> $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
> +ifneq ("$(ramfs-input)", "-d")
> +ramfs-input := $(patsubst %, $(srctree)/%, $(ramfs-input))
> +ramfs-input := $(patsubst $(srctree)//%, /%, $(ramfs-input))
> +ramfs-input := $(patsubst $(srctree)/../%, ../%, $(ramfs-input))
> +ramfs-input := $(patsubst $(srctree)/./%, ./%, $(ramfs-input))
> +endif
> 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 [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-15 5:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 22:14 [PATCH] [RFC] initramfs: Prefix simple paths with $(srctree) Geert Uytterhoeven
2013-11-15 5:55 ` Vineet Gupta
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).