[oe-commits] Khem Raj : mkelfimage: Fix cross build
git at git.openembedded.org
git at git.openembedded.org
Tue Jul 17 09:52:03 UTC 2012
Module: openembedded-core.git
Branch: master
Commit: 0d828f19f7ef2d852bbe6da4510efea76a39b982
URL: http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=0d828f19f7ef2d852bbe6da4510efea76a39b982
Author: Khem Raj <raj.khem at gmail.com>
Date: Sat Jul 14 14:14:07 2012 -0700
mkelfimage: Fix cross build
This patch fixes building this tool in cross environment
It uses tools such as CC, HOST_CC, I386_CC etc.
and as long as you are building native it does not
matter since they all are same namely 'gcc' but
in cross compiling that wont work. So we make the
makefiles and configure scripts aware of that fact
Upstream hosts this program in a svn repo. So change
the SRC_URI to official svn repo. With git we were
checking out a lot more that just mkelfimage which
is not required.
There were unpackaged empty directories too so
we make sure they are removed as well.
Fixes Yocto bug# 2765
Signed-off-by: Khem Raj <raj.khem at gmail.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
.../mkelfimage/mkelfimage/cross-compile.patch | 71 ++++++++++++++++++++
meta/recipes-devtools/mkelfimage/mkelfimage_git.bb | 17 -----
meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb | 30 ++++++++
3 files changed, 101 insertions(+), 17 deletions(-)
diff --git a/meta/recipes-devtools/mkelfimage/mkelfimage/cross-compile.patch b/meta/recipes-devtools/mkelfimage/mkelfimage/cross-compile.patch
new file mode 100644
index 0000000..7692709
--- /dev/null
+++ b/meta/recipes-devtools/mkelfimage/mkelfimage/cross-compile.patch
@@ -0,0 +1,71 @@
+make the tool to be cross compilable.
+
+Signed-off-by: Khem Raj <raj.khem at gmail.com>
+Upstream-Status: Pending
+
+Index: mkelfImage/configure.ac
+===================================================================
+--- mkelfImage.orig/configure.ac 2012-07-14 14:04:48.964898667 -0700
++++ mkelfImage/configure.ac 2012-07-14 14:10:47.800916083 -0700
+@@ -70,6 +70,9 @@
+ AC_MSG_ERROR([cc not found])
+ fi
+ eval "${with_default}_CC='$CC'"
++ if test "x$HOST_CC" = 'x'; then
++ AC_CHECK_PROG([HOST_CC], [$CC], [$CC], [gcc], [$PATH])
++ fi
+ AC_PROG_CPP
+ if test "$CPP" = no; then
+ AC_MSG_ERROR([cpp not found])
+@@ -172,7 +175,6 @@
+
+ dnl ---Output variables...
+
+-HOST_CC=$CC
+ HOST_CFLAGS="$HOST_CFLAGS -O2 -Wall \$(HOST_CPPFLAGS)"
+
+ dnl TODO: figure out how to set these appropriately for compilers other than gcc
+Index: mkelfImage/linux-i386/Makefile
+===================================================================
+--- mkelfImage.orig/linux-i386/Makefile 2012-07-14 14:04:48.964898667 -0700
++++ mkelfImage/linux-i386/Makefile 2012-07-14 14:04:49.032898671 -0700
+@@ -4,7 +4,7 @@
+
+ $(LI386_OBJ)/mkelf-linux-i386.o: $(LI386_DIR)/mkelf-linux-i386.c $(LI386_DIR)/convert.bin.c $(LI386_DEP)
+ $(MKDIR) -p $(@D)
+- $(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@
++ $(CC) $(HOST_CFLAGS) -c -g $< -o $@
+
+
+ ifdef I386_CC
+Index: mkelfImage/linux-ia64/Makefile
+===================================================================
+--- mkelfImage.orig/linux-ia64/Makefile 2012-07-14 14:04:48.964898667 -0700
++++ mkelfImage/linux-ia64/Makefile 2012-07-14 14:04:49.032898671 -0700
+@@ -4,7 +4,7 @@
+
+ $(LIA64_OBJ)/mkelf-linux-ia64.o: $(LIA64_DIR)/mkelf-linux-ia64.c $(LIA64_DIR)/convert.bin.c $(LIA64_DEP)
+ $(MKDIR) -p $(@D)
+- $(HOST_CC) $(HOST_CFLAGS) -c -g $< -o $@
++ $(CC) $(HOST_CFLAGS) -c -g $< -o $@
+
+ ifdef IA64_CC
+
+Index: mkelfImage/main/Makefile
+===================================================================
+--- mkelfImage.orig/main/Makefile 2012-07-14 14:04:48.964898667 -0700
++++ mkelfImage/main/Makefile 2012-07-14 14:04:49.032898671 -0700
+@@ -4,11 +4,11 @@
+
+ $(OBJDIR)/sbin/mkelfImage: $(MKELF_OBJS) $(DEPS)
+ $(MKDIR) -p $(@D)
+- $(HOST_CC) $(HOST_CFLAGS) $(MKELF_OBJS) -o $@ $(LIBS)
++ $(CC) $(HOST_CFLAGS) $(MKELF_OBJS) -o $@ $(LIBS)
+
+ $(OBJDIR)/main/mkelfImage.o: main/mkelfImage.c include/mkelfImage.h $(DEPS)
+ $(MKDIR) -p $(@D)
+- $(HOST_CC) $(HOST_CFLAGS) -c $< -o $@
++ $(CC) $(HOST_CFLAGS) -c $< -o $@
+
+ $(OBJDIR)/man/man8/mkelfImage.8: main/mkelfImage.man
+ $(MKDIR) -p $(@D)
diff --git a/meta/recipes-devtools/mkelfimage/mkelfimage_git.bb b/meta/recipes-devtools/mkelfimage/mkelfimage_git.bb
deleted file mode 100644
index 4b45c67..0000000
--- a/meta/recipes-devtools/mkelfimage/mkelfimage_git.bb
+++ /dev/null
@@ -1,17 +0,0 @@
-DESCRIPTION = "A utility to create ELF boot images from Linux kernel images"
-HOMEPAGE = "http://www.coreboot.org/Mkelfimage"
-SECTION = "devel"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a"
-
-SRCREV = "e1e6a91ce0738400fa1615179de88ebc0df29f66"
-PV = "1.0.0+gitr${SRCPV}"
-PR = "r1"
-
-SRC_URI = "git://review.coreboot.org/p/coreboot;protocol=http;branch=master"
-
-S = "${WORKDIR}/git/util/mkelfImage"
-
-inherit autotools
-
-BBCLASSEXTEND = "native"
diff --git a/meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb b/meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb
new file mode 100644
index 0000000..c670f23
--- /dev/null
+++ b/meta/recipes-devtools/mkelfimage/mkelfimage_svn.bb
@@ -0,0 +1,30 @@
+DESCRIPTION = "A utility to create ELF boot images from Linux kernel images"
+HOMEPAGE = "http://www.coreboot.org/Mkelfimage"
+SECTION = "devel"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=ea5bed2f60d357618ca161ad539f7c0a"
+
+SRCREV = "6637"
+PV = "1.0.0+svn${SRCPV}"
+PR = "r1"
+
+DEPENDS += "zlib"
+
+SRC_URI = "svn://coreboot.org/coreboot/trunk/util;module=mkelfImage \
+ file://cross-compile.patch \
+ "
+
+S = "${WORKDIR}/mkelfImage"
+
+CFLAGS += "-fno-stack-protector"
+CACHED_CONFIGUREVARS += "HOST_CC='${BUILD_CC}'"
+EXTRA_OEMAKE += "HOST_CPPFLAGS='${BUILD_CPPFLAGS}'"
+
+inherit autotools
+
+do_install_append() {
+ rmdir ${D}${datadir}/mkelfImage/elf32-i386
+ rmdir ${D}${datadir}/mkelfImage
+}
+
+BBCLASSEXTEND = "native"
More information about the Openembedded-commits
mailing list