Ver Fonte

support for 32/64 x86_64 multilib with eglibc

Waldemar Brodkorb há 12 anos atrás
pai
commit
440dcafbd0

+ 5 - 0
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)

+ 1 - 1
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/
 

+ 8 - 0
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

+ 78 - 1
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

+ 0 - 1
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 $@
 

+ 3 - 0
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

+ 0 - 28
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