Tuesday, November 11, 2008

HAL and external toolchain

While building an extended filesystem for my project, using an external toolchain/SDK, I found out that recent hal recipe in OpenEmbedded fails to build. It appears that hal uses a linux/input.h header file from glibc installation for its own configuration. Normally, glibc headers are installed in the staging area by corresponding -cross recipes. That's where hal recipe was trying to find it, which is not the case with the external toolchain:
EXTRA_OECONF += "--with-linux-input-header=${STAGING_INCDIR}/linux/input.h"
After some investigation and a short discussion on the oe-dev mailing list (with help from core developers Holger Freyther and Koen Kooi), I was able to create patches to the hal recipe, allowing it to be built by an external toolchain/SDK:
From 507ee230617603258736ecbcf4895de5429f8672 Mon Sep 17 00:00:00 2001
From: Denys Dmytriyenko
Date: Mon, 10 Nov 2008 20:13:22 -0500
Subject: [PATCH] autotools.bbclass: allow autotools_do_configure to accept parameters and pass to oe_runconf


Signed-off-by: Denys Dmytriyenko
---
classes/autotools.bbclass | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/classes/autotools.bbclass b/classes/autotools.bbclass
index 82b5311..adb57f6 100644
--- a/classes/autotools.bbclass
+++ b/classes/autotools.bbclass
@@ -134,7 +134,7 @@ autotools_do_configure() {
;;
esac
if [ -e ${S}/configure ]; then
- oe_runconf
+ oe_runconf $@
else
oenote "nothing to configure"
fi
--
1.5.6.4
From 1a568f9490eb7bfd1060f47e2584d3ce41820b6b Mon Sep 17 00:00:00 2001
From: Denys Dmytriyenko
Date: Mon, 10 Nov 2008 20:17:02 -0500
Subject: [PATCH] hal: Find and use the right linux/input.h to work with external toolchain


Signed-off-by: Denys Dmytriyenko
---
packages/hal/hal_0.5.11.bb | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/packages/hal/hal_0.5.11.bb b/packages/hal/hal_0.5.11.bb
index e93ad64..2b56fdf 100644
--- a/packages/hal/hal_0.5.11.bb
+++ b/packages/hal/hal_0.5.11.bb
@@ -1,8 +1,14 @@
require hal.inc

-PR = "r1"
+PR = "r2"

SRC_URI += " file://hal-right-input-h.patch;patch=1 \
file://fix-configure.diff;patch=1"

-EXTRA_OECONF += "--with-linux-input-header=${STAGING_INCDIR}/linux/input.h"
+# The following code finds the right linux/input.h,
+# which also works with external-toolchain/SDK
+do_configure() {
+ linux_input_h=`echo "#include " | ${CPP} - | \
+ grep "linux\/input.h" | head -n 1 | awk -F '"' '{print $2}'`
+ autotools_do_configure --with-linux-input-header=${linux_input_h}
+}
--
1.5.6.4

No comments: