summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <mail@waldemar-brodkorb.de>2012-10-07 19:42:00 +0200
committerWaldemar Brodkorb <mail@waldemar-brodkorb.de>2012-10-07 19:42:00 +0200
commit440dcafbd07915cadeb26806fe6d8835d62f293b (patch)
tree4f4bd3575253b05f0598720c13c9c4c8df2a73e9
parent0c4255f9860dec3c7f0ecf32454bd93268879278 (diff)
support for 32/64 x86_64 multilib with eglibc
-rw-r--r--mk/image.mk5
-rw-r--r--package/busybox/Makefile2
-rw-r--r--package/eglibc/Makefile8
-rw-r--r--toolchain/eglibc/Makefile79
-rw-r--r--toolchain/gcc/Makefile1
-rw-r--r--toolchain/kernel-headers/Makefile3
-rw-r--r--toolchain/uClibc/Makefile28
7 files changed, 95 insertions, 31 deletions
diff --git a/mk/image.mk b/mk/image.mk
index 4e1ab94dc..8ce4dbf0b 100644
--- a/mk/image.mk
+++ b/mk/image.mk
@@ -50,6 +50,11 @@ image-prepare-post:
sed -i '/^root:/s!:/bin/sh$$!:${ROOTSH}!' ${TARGET_DIR}/etc/passwd
-rm -f ${TARGET_DIR}/bin/sh
ln -sf ${BINSH} ${TARGET_DIR}/bin/sh
+ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
+ mv ${TARGET_DIR}/lib/* ${TARGET_DIR}/${ADK_TARGET_LIBC_PATH}
+ rm -rf ${TARGET_DIR}/lib/
+ ln -sf /${ADK_TARGET_LIBC_PATH} ${TARGET_DIR}/lib
+endif
KERNEL_PKGDIR:=$(LINUX_BUILD_DIR)/kernel-pkg
KERNEL_PKG:=$(PACKAGE_DIR)/kernel_$(KERNEL_VERSION)_$(CPU_ARCH).$(PKG_SUFFIX)
diff --git a/package/busybox/Makefile b/package/busybox/Makefile
index 34b274d96..9fe1ef52a 100644
--- a/package/busybox/Makefile
+++ b/package/busybox/Makefile
@@ -9,7 +9,7 @@ PKG_RELEASE:= 1
PKG_MD5SUM:= e025414bc6cd79579cc7a32a45d3ae1c
PKG_DESCR:= Core utilities for embedded systems
PKG_SECTION:= base
-#PKG_BUILDDEP:= libtirpc
+PKG_BUILDDEP:= libtirpc
PKG_URL:= http://www.busybox.net/
PKG_SITES:= http://www.busybox.net/downloads/
diff --git a/package/eglibc/Makefile b/package/eglibc/Makefile
index 0ea35d935..40d1a4848 100644
--- a/package/eglibc/Makefile
+++ b/package/eglibc/Makefile
@@ -67,6 +67,14 @@ endif
${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nscd.conf ${IDIR_EGLIBC}/etc
${INSTALL_DATA} ${STAGING_TARGET_DIR}/etc/nsswitch.conf ${IDIR_EGLIBC}/etc
$(CP) $(STAGING_TARGET_DIR)/usr/bin/getconf $(IDIR_EGLIBC)/usr/bin
+ifeq ($(ADK_TARGET_MULTILIB_X86_32),y)
+ ${INSTALL_DIR} $(IDIR_EGLIBC)/lib32 $(IDIR_EGLIBC)/usr/lib32
+ $(CP) $(STAGING_TARGET_DIR_32)/lib/ld* $(IDIR_EGLIBC)/lib32
+ -for file in libc libcrypt libdl libm libresolv libutil libnsl libnss_dns libnss_files; do \
+ $(CP) $(STAGING_TARGET_DIR_32)/lib/$$file.so* $(IDIR_EGLIBC)/lib32; \
+ $(CP) $(STAGING_TARGET_DIR_32)/lib/$$file-$(PKG_VERSION).so $(IDIR_EGLIBC)/lib32; \
+ done
+endif
eglibc-static-install:
${INSTALL_DIR} $(IDIR_EGLIBC_STATIC)/usr/lib
diff --git a/toolchain/eglibc/Makefile b/toolchain/eglibc/Makefile
index 677711f10..7f369d3ed 100644
--- a/toolchain/eglibc/Makefile
+++ b/toolchain/eglibc/Makefile
@@ -13,7 +13,6 @@ endif
TARGET_CFLAGS:= $(filter-out -fstack-protector,$(TARGET_CFLAGS))
EGLIBC_CONFOPTS:= --build=$(GNU_HOST_NAME) \
- --host=$(REAL_GNU_TARGET_NAME) \
--without-cvs \
--disable-profile \
--disable-debug \
@@ -43,9 +42,15 @@ EGLIBC_CONFOPTS+= --without-fp
endif
EGLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
+EGLIBC_BUILD_DIR_INITIAL32:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers32
EGLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
+EGLIBC_BUILD_DIR_FINAL32:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final32
+ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
+$(WRKBUILD)/.headers_configure: $(WRKBUILD)/.headers_configure32
+else
$(WRKBUILD)/.headers_configure:
+endif
mkdir -p $(EGLIBC_BUILD_DIR_INITIAL)
(cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc);
@@ -56,6 +61,7 @@ $(WRKBUILD)/.headers_configure:
$(WRKBUILD)/libc/configure \
--prefix=$(STAGING_TARGET_DIR)/usr \
--with-headers=$(STAGING_TARGET_DIR)/usr/include \
+ --host=$(REAL_GNU_TARGET_NAME) \
${EGLIBC_CONFOPTS} \
);
touch $@
@@ -70,13 +76,42 @@ $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-64.h
touch $@
+$(WRKBUILD)/.headers_configure32:
+ mkdir -p $(EGLIBC_BUILD_DIR_INITIAL32)
+ (cd ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION); \
+ ln -sf ../ports ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)/libc);
+ $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
+ $(EGLIBC_BUILD_DIR_INITIAL32)/option-groups.config
+ (cd $(EGLIBC_BUILD_DIR_INITIAL32); \
+ ${EGLIBC_ENV} \
+ CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
+ $(WRKBUILD)/libc/configure \
+ --prefix=$(STAGING_TARGET_DIR_32)/usr \
+ --with-headers=$(STAGING_TARGET_DIR_32)/usr/include \
+ --host=i486-openadk-linux-gnu \
+ ${EGLIBC_CONFOPTS} \
+ );
+ (cd $(EGLIBC_BUILD_DIR_INITIAL32); \
+ PATH='${TARGET_PATH}' \
+ ${EGLIBC_ENV} \
+ CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
+ $(MAKE) install-headers install-bootstrap-headers=yes cross-compiling=yes \
+ );
+ touch $(STAGING_TARGET_DIR_32)/usr/include/gnu/stubs.h
+ touch $(STAGING_TARGET_DIR_32)/usr/include/gnu/stubs-64.h
+ touch $@
+
ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
EGLIBC_ENV+= libc_cv_ssp=yes
else
EGLIBC_ENV+= libc_cv_ssp=no
endif
+ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
+$(WRKBUILD)/.configured: $(WRKBUILD)/.configured32
+else
$(WRKBUILD)/.configured:
+endif
mkdir -p $(EGLIBC_BUILD_DIR_FINAL)
$(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
$(EGLIBC_BUILD_DIR_FINAL)/option-groups.config
@@ -86,6 +121,7 @@ $(WRKBUILD)/.configured:
--prefix=/usr \
--enable-shared \
--enable-stackguard-randomization \
+ --host=$(REAL_GNU_TARGET_NAME) \
${EGLIBC_CONFOPTS} \
);
touch $@
@@ -102,4 +138,45 @@ $(WRKBUILD)/.installed: $(EGLIBC_BUILD_DIR_FINAL)/libc.so
${INSTALL_DATA} ${WRKBUILD}/libc/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc/
touch $@
+$(WRKBUILD)/.configured32:
+ mkdir -p $(EGLIBC_BUILD_DIR_FINAL32)
+ $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
+ $(EGLIBC_BUILD_DIR_FINAL32)/option-groups.config
+ (cd $(EGLIBC_BUILD_DIR_FINAL32); \
+ ${EGLIBC_ENV} \
+ CC='${REAL_GNU_TARGET_NAME}-gcc -m32' \
+ $(WRKBUILD)/libc/configure \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-stackguard-randomization \
+ --host=i486-openadk-linux-gnu \
+ ${EGLIBC_CONFOPTS} \
+ );
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL32) cross-compiling=yes all
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINAL32) install_root=$(STAGING_TARGET_DIR_32) install
+ mkdir -p $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32
+ $(CP) $(STAGING_TARGET_DIR_32)/lib/* $(STAGING_TARGET_DIR_32)/usr/lib/* \
+ $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32
+ -rm $(STAGING_TARGET_DIR)/lib/$(REAL_GNU_TARGET_NAME)/4.7.2/32/libc.so
+ touch $@
+
+$(WRKBUILD)/.configuredx32:
+ mkdir -p $(EGLIBC_BUILD_DIR_FINALX32)
+ $(CP) ${TOPDIR}/toolchain/eglibc/eglibc.config \
+ $(EGLIBC_BUILD_DIR_FINALX32)/option-groups.config
+ (cd $(EGLIBC_BUILD_DIR_FINALX32); \
+ ${EGLIBC_ENV} \
+ CC=${REAL_GNU_TARGET_NAME}-gcc -mx32 \
+ $(WRKBUILD)/libc/configure \
+ --prefix=/usr \
+ --enable-shared \
+ --enable-stackguard-randomization \
+ --host=x86_64-x32-openadk-linux-gnu \
+ ${EGLIBC_CONFOPTS} \
+ );
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINALX32) cross-compiling=yes all
+ ${EGLIBC_ENV} $(MAKE) -C $(EGLIBC_BUILD_DIR_FINALX32) install_root=$(STAGING_TARGET_DIR_X32) install
+ touch $@
+
+
include ${TOPDIR}/mk/toolchain.mk
diff --git a/toolchain/gcc/Makefile b/toolchain/gcc/Makefile
index a61d5eaa7..e14a4be7e 100644
--- a/toolchain/gcc/Makefile
+++ b/toolchain/gcc/Makefile
@@ -150,7 +150,6 @@ $(GCC_BUILD_DIR_FINAL)/.configured:
${GCC_CONFOPTS} \
--enable-languages=$(LANGUAGES) \
--with-sysroot='$${prefix}/${STAGING_HOST2TARGET}' \
- --with-slibdir=$(STAGING_TARGET_DIR)/lib \
--enable-shared
touch $@
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index 4346cb1a6..405119000 100644
--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -10,6 +10,9 @@ $(WRKBUILD)/.headers:
$(MAKE) -C $(WRKBUILD) HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
INSTALL_HDR_PATH=$(STAGING_DIR)/usr \
headers_install
+ $(MAKE) -C $(WRKBUILD) HOSTCC=$(CC_FOR_BUILD) ARCH=x86 V=1 \
+ INSTALL_HDR_PATH=$(STAGING_TARGET_DIR_32)/usr \
+ headers_install
$(MAKE) -C $(WRKBUILD) HOSTCC=$(CC_FOR_BUILD) ARCH=$(ARCH) V=1 \
INSTALL_HDR_PATH=$(LINUX_HEADER_DIR) \
headers_install
diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile
index 48279469e..a59805454 100644
--- a/toolchain/uClibc/Makefile
+++ b/toolchain/uClibc/Makefile
@@ -83,33 +83,6 @@ endif
touch $(WRKBUILD)/.configured
touch $@
-ifeq ($(ADK_TARGET_WITH_MULTILIB),y)
-$(WRKBUILD)/.compiled:
- $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
- PREFIX= \
- DEVEL_PREFIX=/ \
- RUNTIME_PREFIX=/ \
- HOSTCC="$(CC_FOR_BUILD)" \
- CPU_CFLAGS="$(TARGET_CFLAGS)" \
- MULTILIB_DIR=/$(ADK_TARGET_LIBC_PATH) \
- all
- touch $@
-
-$(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
- $(MAKE) -C $(WRKBUILD) \
- PREFIX=$(STAGING_TARGET_DIR) \
- DEVEL_PREFIX=/usr/ \
- DEVEL_PREFIX_LIB=/ \
- RUNTIME_PREFIX=/ \
- CPU_CFLAGS="$(TARGET_CFLAGS)" \
- MULTILIB_DIR=/$(ADK_TARGET_LIBC_PATH) \
- install_dev install_runtime
- rm -rf $(STAGING_TARGET_DIR)/$(ADK_TARGET_LIBC_PATH)/libc.so
- ln -s libc.so.0 $(STAGING_TARGET_DIR)/$(ADK_TARGET_LIBC_PATH)/libc.so
- touch $@
-
-else
-
$(WRKBUILD)/.compiled:
$(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
PREFIX= \
@@ -141,6 +114,5 @@ $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
rm -rf $(STAGING_TARGET_DIR)/lib/libc.so
ln -s libc.so.0 $(STAGING_TARGET_DIR)/lib/libc.so
touch $@
-endif
include ${TOPDIR}/mk/toolchain.mk