* [ptxdist] Fix missing elf.h on Darwin
@ 2012-01-22 11:43 Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 1/3] Add host-elf-h-compat package Bernhard Walle
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bernhard Walle @ 2012-01-22 11:43 UTC (permalink / raw)
To: ptxdist
This patch series is an attempt to solve the problem that Darwin has no
/usr/include/elf.h. I'm sure that other non-Linux but POSIX-compatible operating
systems have no /usr/include/elf.h, so it should not only increase portability
for Mac OS but also for *BSD.
I think there are various ways to implement an solution, this one is based on a
newly created elf-h-compat package that uses autoconf to check if there's
already a elf.h present and if yes, it does nothing on "make install".
Otherwise, an own copy of elf.h that is sufficient to compile the kernel and
module-init-tools is installed, which results in sysroot-host/include/elf.h.
The rest of the patches just add the dependencies and set the CFLAGS.
Some words on alternatives: I played a bit with libelf to provide the required
headers, but they don't have elf.h and even a compat-elf.h that includes gelf.h
doesn't bring all required defines. On the other side building libelf just to
get a few definitions is overkill.
Modifying the kernel build system to use its own copy of elf.h (basically
<linux/elf.h>) isn't easy either and will not help module-init-tools (didn't
check kmod).
Using the elf.h from the cross-toolchain would involve bringing the include path
of the cross toolchain in the include path of the host which I'm sure will
generate more problems.
Of course I'm open for alternatives, but discussion without suggesting a
solution doesn't work in most Open Source projects. ;-)
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH 1/3] Add host-elf-h-compat package
2012-01-22 11:43 [ptxdist] Fix missing elf.h on Darwin Bernhard Walle
@ 2012-01-22 11:43 ` Bernhard Walle
2012-01-24 7:53 ` Michael Olbrich
2012-01-22 11:43 ` [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 3/3] module-init-tools: Depend on HOST_ELF_H_COMPAT Bernhard Walle
2 siblings, 1 reply; 6+ messages in thread
From: Bernhard Walle @ 2012-01-22 11:43 UTC (permalink / raw)
To: ptxdist
This package should provide <elf.h> on host operating systems that have
no /usr/include/elf.h. The header is copied from glibc, modified a bit
to remove Gnu dependencies and is sufficient to compile the Linux kernel
and module-init-tools.
The package itself only checks if elf.h is present. If yes, it does
nothing on "make install". If not, it installs its own copy of elf.h in
"make install" to the include directory set in autoconf.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
rules/host-elf-h-compat.in | 4 ++++
rules/host-elf-h-compat.make | 32 ++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
create mode 100644 rules/host-elf-h-compat.in
create mode 100644 rules/host-elf-h-compat.make
diff --git a/rules/host-elf-h-compat.in b/rules/host-elf-h-compat.in
new file mode 100644
index 0000000..8a263ea
--- /dev/null
+++ b/rules/host-elf-h-compat.in
@@ -0,0 +1,4 @@
+## SECTION=hosttools_noprompt
+
+config HOST_ELF_H_COMPAT
+ bool
diff --git a/rules/host-elf-h-compat.make b/rules/host-elf-h-compat.make
new file mode 100644
index 0000000..7001344
--- /dev/null
+++ b/rules/host-elf-h-compat.make
@@ -0,0 +1,32 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2012 by Bernhard Walle <bernhard@bwalle.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+HOST_PACKAGES-$(PTXCONF_HOST_ELF_H_COMPAT) += host-elf-h-compat
+
+#
+# Paths and names
+#
+HOST_ELF_H_COMPAT_VERSION := 0.1
+HOST_ELF_H_COMPAT_MD5 := dc45cdadcac50a42175f66ffed2d4375
+HOST_ELF_H_COMPAT := elf-h-compat-$(HOST_ELF_H_COMPAT_VERSION)
+HOST_ELF_H_COMPAT_SUFFIX := tar.bz2
+HOST_ELF_H_COMPAT_URL := http://bwalle.de/programme//$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
+HOST_ELF_H_COMPAT_SOURCE := $(SRCDIR)/$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
+HOST_ELF_H_COMPAT_DIR := $(HOST_BUILDDIR)/$(HOST_ELF_H_COMPAT)
+
+#
+# autoconf
+#
+HOST_ELF_H_COMPAT_CONF_TOOL := autoconf
+
+# vim: syntax=make
--
1.7.7.4
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat
2012-01-22 11:43 [ptxdist] Fix missing elf.h on Darwin Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 1/3] Add host-elf-h-compat package Bernhard Walle
@ 2012-01-22 11:43 ` Bernhard Walle
2012-01-24 9:43 ` Michael Olbrich
2012-01-22 11:43 ` [ptxdist] [PATCH 3/3] module-init-tools: Depend on HOST_ELF_H_COMPAT Bernhard Walle
2 siblings, 1 reply; 6+ messages in thread
From: Bernhard Walle @ 2012-01-22 11:43 UTC (permalink / raw)
To: ptxdist
Add a dependency to the host tool and set the include flags properly.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
platforms/hosttools.in | 1 +
platforms/kernel.in | 1 +
rules/kernel.make | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/platforms/hosttools.in b/platforms/hosttools.in
index 155b30b..0435545 100644
--- a/platforms/hosttools.in
+++ b/platforms/hosttools.in
@@ -5,6 +5,7 @@ source "rules/host-cmake.in"
source "rules/host-cramfs.in"
source "rules/host-dosfstools.in"
source "rules/host-e2fsprogs.in"
+source "rules/host-elf-h-compat.in"
source "rules/host-genext2fs.in"
source "rules/host-genpart.in"
source "rules/host-gettext.in"
diff --git a/platforms/kernel.in b/platforms/kernel.in
index b601284..4391e79 100644
--- a/platforms/kernel.in
+++ b/platforms/kernel.in
@@ -2,6 +2,7 @@ menuconfig KERNEL
bool
default y
select IMAGE_KERNEL
+ select HOST_ELF_H_COMPAT
select HOST_UMKIMAGE if KERNEL_IMAGE_U
select HOST_XZ if KERNEL_XZ
select HOST_LZOP if KERNEL_LZOP
diff --git a/rules/kernel.make b/rules/kernel.make
index a445182..f125a69 100644
--- a/rules/kernel.make
+++ b/rules/kernel.make
@@ -47,6 +47,7 @@ KERNEL_ENV := KCONFIG_NOTIMESTAMP=1
KERNEL_MAKEVARS := \
$(PARALLELMFLAGS) \
HOSTCC=$(HOSTCC) \
+ HOSTCFLAGS=$(HOST_CPPFLAGS) $(HOST_CFLAGS) \
ARCH=$(PTXCONF_KERNEL_ARCH_STRING) \
CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \
\
--
1.7.7.4
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ptxdist] [PATCH 3/3] module-init-tools: Depend on HOST_ELF_H_COMPAT
2012-01-22 11:43 [ptxdist] Fix missing elf.h on Darwin Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 1/3] Add host-elf-h-compat package Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat Bernhard Walle
@ 2012-01-22 11:43 ` Bernhard Walle
2 siblings, 0 replies; 6+ messages in thread
From: Bernhard Walle @ 2012-01-22 11:43 UTC (permalink / raw)
To: ptxdist
The kernel already depends on it, but module-init-tools may be built
earlier and if we don't add it here to the dependency chain, the build
order could be module-init-tools -> host-elf-h-compat -> kernel which
would not work on systems that have no /usr/include/elf.h.
Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
---
rules/module-init-tools.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rules/module-init-tools.in b/rules/module-init-tools.in
index 765de6b..3d98fd0 100644
--- a/rules/module-init-tools.in
+++ b/rules/module-init-tools.in
@@ -4,6 +4,7 @@
menuconfig MODULE_INIT_TOOLS
tristate
prompt "module-init-tools "
+ select HOST_ELF_H_COMPAT
help
This package contains a set of programs for loading, inserting
and removing kernel modules for Linux (versions 2.5.48 and
--
1.7.7.4
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH 1/3] Add host-elf-h-compat package
2012-01-22 11:43 ` [ptxdist] [PATCH 1/3] Add host-elf-h-compat package Bernhard Walle
@ 2012-01-24 7:53 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2012-01-24 7:53 UTC (permalink / raw)
To: ptxdist
On Sun, Jan 22, 2012 at 12:43:13PM +0100, Bernhard Walle wrote:
> This package should provide <elf.h> on host operating systems that have
> no /usr/include/elf.h. The header is copied from glibc, modified a bit
> to remove Gnu dependencies and is sufficient to compile the Linux kernel
> and module-init-tools.
>
> The package itself only checks if elf.h is present. If yes, it does
> nothing on "make install". If not, it installs its own copy of elf.h in
> "make install" to the include directory set in autoconf.
I like it in general, but I'm a bit concerned about maintaining the correct
dependencies.
How about this:
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
> rules/host-elf-h-compat.in | 4 ++++
> rules/host-elf-h-compat.make | 32 ++++++++++++++++++++++++++++++++
> 2 files changed, 36 insertions(+), 0 deletions(-)
> create mode 100644 rules/host-elf-h-compat.in
> create mode 100644 rules/host-elf-h-compat.make
>
> diff --git a/rules/host-elf-h-compat.in b/rules/host-elf-h-compat.in
> new file mode 100644
> index 0000000..8a263ea
> --- /dev/null
> +++ b/rules/host-elf-h-compat.in
> @@ -0,0 +1,4 @@
> +## SECTION=hosttools_noprompt
> +
> +config HOST_ELF_H_COMPAT
> + bool
default y
> diff --git a/rules/host-elf-h-compat.make b/rules/host-elf-h-compat.make
> new file mode 100644
> index 0000000..7001344
> --- /dev/null
> +++ b/rules/host-elf-h-compat.make
> @@ -0,0 +1,32 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2012 by Bernhard Walle <bernhard@bwalle.de>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
LAZY_PACKAGES-$(PTXCONF_HOST_ELF_H_COMPAT) += host-elf-h-compat
> +
> +#
> +# Paths and names
> +#
> +HOST_ELF_H_COMPAT_VERSION := 0.1
> +HOST_ELF_H_COMPAT_MD5 := dc45cdadcac50a42175f66ffed2d4375
> +HOST_ELF_H_COMPAT := elf-h-compat-$(HOST_ELF_H_COMPAT_VERSION)
> +HOST_ELF_H_COMPAT_SUFFIX := tar.bz2
> +HOST_ELF_H_COMPAT_URL := http://bwalle.de/programme//$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
> +HOST_ELF_H_COMPAT_SOURCE := $(SRCDIR)/$(HOST_ELF_H_COMPAT).$(HOST_ELF_H_COMPAT_SUFFIX)
> +HOST_ELF_H_COMPAT_DIR := $(HOST_BUILDDIR)/$(HOST_ELF_H_COMPAT)
ifneq($(shell uname -s),Linux)
$(STATEDIR)/base.prepare: $(STATEDIR)host-elf-h-compat.install.post
endif
This way, it's built before any real packages on non-Linux hosts.
Michael
> +
> +#
> +# autoconf
> +#
> +HOST_ELF_H_COMPAT_CONF_TOOL := autoconf
> +
> +# vim: syntax=make
> --
> 1.7.7.4
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat
2012-01-22 11:43 ` [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat Bernhard Walle
@ 2012-01-24 9:43 ` Michael Olbrich
0 siblings, 0 replies; 6+ messages in thread
From: Michael Olbrich @ 2012-01-24 9:43 UTC (permalink / raw)
To: ptxdist
On Sun, Jan 22, 2012 at 12:43:14PM +0100, Bernhard Walle wrote:
> Add a dependency to the host tool and set the include flags properly.
>
> Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
> ---
> platforms/hosttools.in | 1 +
> platforms/kernel.in | 1 +
> rules/kernel.make | 1 +
> 3 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/platforms/hosttools.in b/platforms/hosttools.in
> index 155b30b..0435545 100644
> --- a/platforms/hosttools.in
> +++ b/platforms/hosttools.in
> @@ -5,6 +5,7 @@ source "rules/host-cmake.in"
> source "rules/host-cramfs.in"
> source "rules/host-dosfstools.in"
> source "rules/host-e2fsprogs.in"
> +source "rules/host-elf-h-compat.in"
this should be in the first patch, if at all (see my other mail).
> source "rules/host-genext2fs.in"
> source "rules/host-genpart.in"
> source "rules/host-gettext.in"
> diff --git a/platforms/kernel.in b/platforms/kernel.in
> index b601284..4391e79 100644
> --- a/platforms/kernel.in
> +++ b/platforms/kernel.in
> @@ -2,6 +2,7 @@ menuconfig KERNEL
> bool
> default y
> select IMAGE_KERNEL
> + select HOST_ELF_H_COMPAT
> select HOST_UMKIMAGE if KERNEL_IMAGE_U
> select HOST_XZ if KERNEL_XZ
> select HOST_LZOP if KERNEL_LZOP
> diff --git a/rules/kernel.make b/rules/kernel.make
> index a445182..f125a69 100644
> --- a/rules/kernel.make
> +++ b/rules/kernel.make
> @@ -47,6 +47,7 @@ KERNEL_ENV := KCONFIG_NOTIMESTAMP=1
> KERNEL_MAKEVARS := \
> $(PARALLELMFLAGS) \
> HOSTCC=$(HOSTCC) \
> + HOSTCFLAGS=$(HOST_CPPFLAGS) $(HOST_CFLAGS) \
- add quotes
- This overwrites the defaults, so I'm not sure that's the right thing to
do. Maybe use HOST_EXTRACFLAGS?
- HOST_CFLAGS is not used in ptxdist and should be empty.
So
HOSTCFLAGS="$(HOST_CPPFLAGS)" \
or
HOST_EXTRACFLAGS="$(HOST_CPPFLAGS)" \
Maybe there are some kernel developers here, that can comment on that?
Michael
> ARCH=$(PTXCONF_KERNEL_ARCH_STRING) \
> CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) \
> \
> --
> 1.7.7.4
>
>
> --
> ptxdist mailing list
> ptxdist@pengutronix.de
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
ptxdist mailing list
ptxdist@pengutronix.de
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-24 9:43 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-22 11:43 [ptxdist] Fix missing elf.h on Darwin Bernhard Walle
2012-01-22 11:43 ` [ptxdist] [PATCH 1/3] Add host-elf-h-compat package Bernhard Walle
2012-01-24 7:53 ` Michael Olbrich
2012-01-22 11:43 ` [ptxdist] [PATCH 2/3] kernel: Use host-elf-h-compat Bernhard Walle
2012-01-24 9:43 ` Michael Olbrich
2012-01-22 11:43 ` [ptxdist] [PATCH 3/3] module-init-tools: Depend on HOST_ELF_H_COMPAT Bernhard Walle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox