From: ms Date: Mon, 10 Mar 2008 16:47:16 +0000 (+0000) Subject: This is for cross compiling the ipfire. X-Git-Tag: v3.0-alpha1~1089 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=acef736270dbb1e06f0248f7ff73a4127aabcc3c;p=ipfire-3.x.git This is for cross compiling the ipfire. All of this is still under construction and testing so don't expect that it works. git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@1262 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- diff --git a/config/kernel/kernel.config.i586 b/config/kernel/kernel.config similarity index 99% rename from config/kernel/kernel.config.i586 rename to config/kernel/kernel.config index 048a26c8d..063d5876f 100644 --- a/config/kernel/kernel.config.i586 +++ b/config/kernel/kernel.config @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit -# Linux kernel version: 2.6.24-ipfire1 -# Thu Jan 31 18:38:32 2008 +# Linux kernel version: 2.6.24 +# Sat Feb 16 21:37:18 2008 # # CONFIG_64BIT is not set CONFIG_X86_32=y @@ -151,9 +151,9 @@ CONFIG_X86_CYCLONE_TIMER=y # CONFIG_M586 is not set # CONFIG_M586TSC is not set # CONFIG_M586MMX is not set -# CONFIG_M686 is not set +CONFIG_M686=y # CONFIG_MPENTIUMII is not set -CONFIG_MPENTIUMIII=y +# CONFIG_MPENTIUMIII is not set # CONFIG_MPENTIUMM is not set # CONFIG_MPENTIUM4 is not set # CONFIG_MK6 is not set @@ -176,6 +176,7 @@ CONFIG_X86_GENERIC=y CONFIG_X86_CMPXCHG=y CONFIG_X86_L1_CACHE_SHIFT=7 CONFIG_X86_XADD=y +CONFIG_X86_PPRO_FENCE=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y @@ -484,8 +485,6 @@ CONFIG_NETFILTER_XT_MATCH_QUOTA=m CONFIG_NETFILTER_XT_MATCH_REALM=m # CONFIG_NETFILTER_XT_MATCH_SCTP is not set CONFIG_NETFILTER_XT_MATCH_STATE=m -CONFIG_NETFILTER_XT_MATCH_LAYER7=m -# CONFIG_NETFILTER_XT_MATCH_LAYER7_DEBUG is not set CONFIG_NETFILTER_XT_MATCH_STATISTIC=m CONFIG_NETFILTER_XT_MATCH_STRING=m CONFIG_NETFILTER_XT_MATCH_TCPMSS=m diff --git a/lfs/Config b/lfs/Config index 421c8ca90..985114af9 100644 --- a/lfs/Config +++ b/lfs/Config @@ -67,6 +67,20 @@ DIR_SOURCE = $(DIR_SRC)/src KGCC = gcc +ifeq "$(STAGE)" "toolchain" +ifneq "$(MACHINE_REAL)" "$(MACHINE)" +ifeq "$(CROSS)" "" + CC="${IFS_TARGET}-gcc" + CXX="${IFS_TARGET}-g++" + AR="${IFS_TARGET}-ar" + AS="${IFS_TARGET}-as" + RANLIB="${IFS_TARGET}-ranlib" + LD="${IFS_TARGET}-ld" + STRIP="${IFS_TARGET}-strip" +endif +endif +endif + ############################################################################### # Common Macro Definitions ############################################################################### diff --git a/lfs/binutils b/lfs/binutils index ac6b5152e..00f0bc871 100644 --- a/lfs/binutils +++ b/lfs/binutils @@ -32,7 +32,11 @@ DL_FILE = $(THISAPP).tar.bz2 DIR_APP = $(DIR_SRC)/$(THISAPP) ifeq "$(STAGE)" "toolchain" +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS) +else + TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-cross +endif else TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) endif @@ -60,21 +64,51 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -v $(DIR_SRC)/binutils-build cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-configure-1.patch +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" + # + # Normal build + # + ifeq "$(PASS)" "1" +ifeq "$(MACHINE)" "$(MACHINE_REAL)" cd $(DIR_SRC)/binutils-build && CC="gcc -B/usr/bin/" ../$(THISAPP)/configure \ - --prefix=$(TOOLS_DIR) --disable-nls --disable-werror + --prefix=$(TOOLS_DIR) \ + --disable-nls \ + --disable-werror + cd $(DIR_SRC)/binutils-build && make -j $(PARALLELISM) cd $(DIR_SRC)/binutils-build && make install cd $(DIR_SRC)/binutils-build && make -C ld clean cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=$(TOOLS_DIR)/lib cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin +else + # + # Cross build + # + cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \ + --prefix=$(TOOLS_DIR) \ + --build=${IFS_HOST} \ + --host=${IFS_TARGET} \ + --target=${IFS_TARGET} \ + --disable-nls \ + --enable-shared \ + --disable-multilib + + cd $(DIR_SRC)/binutils-build && make configure-host + cd $(DIR_SRC)/binutils-build && make -j $(PARALLELISM) + cd $(DIR_SRC)/binutils-build && make install +endif endif ifeq "$(PASS)" "2" - cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure --prefix=$(TOOLS_DIR) \ - --disable-nls --with-lib-path=$(TOOLS_DIR)/lib + cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \ + --prefix=$(TOOLS_DIR) \ + --disable-nls \ + --with-lib-path=$(TOOLS_DIR)/lib + cd $(DIR_SRC)/binutils-build && make -j $(PARALLELISM) cd $(DIR_SRC)/binutils-build && make install + cd $(DIR_SRC)/binutils-build && make -C ld clean cd $(DIR_SRC)/binutils-build && make -C ld LIB_PATH=/usr/lib:/lib cd $(DIR_SRC)/binutils-build && cp -v ld/ld-new $(TOOLS_DIR)/bin @@ -88,6 +122,27 @@ ifeq "$(STAGE)" "base" cp -fv ../$(THISAPP)/include/libiberty.h /usr/include endif + +else + # + # Cross build + # + + cd $(DIR_SRC)/binutils-build && AR=ar AS=as ../$(THISAPP)/configure \ + --prefix=$(CTOOLS_DIR) \ + --host=${IFS_HOST} \ + --target=${IFS_TARGET} \ + --with-lib-path=$(TOOLS_DIR)/lib \ + --disable-nls \ + --enable-shared \ + --disable-multilib + cd $(DIR_SRC)/binutils-build && make configure-host + cd $(DIR_SRC)/binutils-build && make -j $(PARALLELISM) + cd $(DIR_SRC)/binutils-build && make install + -mkdir -p $(TOOLS_DIR)/include + cp -fv $(DIR_APP)/include/libiberty.h $(TOOLS_DIR)/include +endif + @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build @$(POSTBUILD) diff --git a/lfs/binutils-x-compile b/lfs/binutils-x-compile new file mode 120000 index 000000000..695eb82ea --- /dev/null +++ b/lfs/binutils-x-compile @@ -0,0 +1 @@ +binutils \ No newline at end of file diff --git a/lfs/gcc b/lfs/gcc index 56840af34..d9a5eedee 100644 --- a/lfs/gcc +++ b/lfs/gcc @@ -34,7 +34,11 @@ CFLAGS = CXXFLAGS = ifeq "$(STAGE)" "toolchain" +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS) +else + TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-cross$(PASS) +endif else TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) endif @@ -43,7 +47,9 @@ endif # Top-level Rules ############################################################################### -objects = $(DL_FILE) +objects = $(DL_FILE) \ + $(THISAPP)-cross_search_paths-1.patch \ + $(THISAPP)-specs-1.patch install : $(TARGET) @@ -60,15 +66,61 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) -mkdir -v $(DIR_SRC)/gcc-build - + +ifeq "$(STAGE)" "toolchain" +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" + # + # Normal build + # + ifeq "$(PASS)" "1" +ifeq "$(MACHINE)" "$(MACHINE_REAL)" cd $(DIR_SRC)/gcc-build && CC="gcc -B/usr/bin/" ../$(THISAPP)/configure \ - --prefix=$(TOOLS_DIR) --with-local-prefix=/tools --disable-nls \ - --enable-shared --enable-languages=c + --prefix=$(TOOLS_DIR) \ + --with-local-prefix=$(TOOLS_DIR) \ + --disable-nls \ + --enable-shared \ + --enable-languages=c cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM) cd $(DIR_SRC)/gcc-build && make install ln -vs gcc $(TOOLS_DIR)/bin/cc +else + # + # Cross build + # + cd $(DIR_APP) && sed -e "s,/tools,$(TOOLS_DIR),g" \ + < $(DIR_PATCHES)/$(THISAPP)-specs-1.patch | patch -Np1 + + cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-cross_search_paths-1.patch + + cd $(DIR_APP) && cp -v gcc/cppdefault.c{,.orig} + cd $(DIR_APP) && sed -e '/#define STANDARD_INCLUDE_DIR/s@"/usr/include"@0@g' \ + gcc/cppdefault.c.orig > gcc/cppdefault.c + + cd $(DIR_APP) && cp -v gcc/Makefile.in{,.orig} + cd $(DIR_APP) && sed -e 's@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 $(TOOLS_DIR)/include@g' \ + gcc/Makefile.in.orig > gcc/Makefile.in + + cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \ + --prefix=$(TOOLS_DIR) \ + --build=${IFS_HOST} \ + --host=${IFS_TARGET} \ + --target=${IFS_TARGET} \ + --with-local-prefix=$(TOOLS_DIR) \ + --enable-long-long \ + --enable-c99 \ + --enable-shared \ + --enable-threads=posix \ + --enable-__cxa_atexit \ + --disable-nls \ + --enable-languages=c,c++ \ + --disable-libstdcxx-pch + + cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM) AS_FOR_TARGET=$(AS) \ + LD_FOR_TARGET=$(LD) + cd $(DIR_SRC)/gcc-build && make install +endif endif ifeq "$(PASS)" "2" @@ -87,24 +139,93 @@ ifeq "$(PASS)" "2" touch $$file.orig; \ done - cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure --prefix=$(TOOLS_DIR) \ - --with-local-prefix=$(TOOLS_DIR) --enable-clocale=gnu \ - --enable-shared --enable-threads=posix --enable-__cxa_atexit \ - --enable-languages=c,c++ --disable-libstdcxx-pch --disable-bootstrap + cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \ + --prefix=$(TOOLS_DIR) \ + --with-local-prefix=$(TOOLS_DIR) \ + --enable-clocale=gnu \ + --enable-shared \ + --enable-threads=posix \ + --enable-__cxa_atexit \ + --enable-languages=c,c++ \ + --disable-libstdcxx-pch \ + --disable-bootstrap cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM) cd $(DIR_SRC)/gcc-build && make install endif +else + # + # Cross build + # + + cd $(DIR_APP) && sed -e "s,/tools,$(TOOLS_DIR),g" \ + < $(DIR_PATCHES)/$(THISAPP)-specs-1.patch | patch -Np1 + + cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-cross_search_paths-1.patch + + echo -e "\n#undef STARTFILE_PREFIX_SPEC\n#define STARTFILE_PREFIX_SPEC \"$(TOOLS_DIR)/lib/\"" \ + >> $(DIR_APP)/gcc/config/linux.h + + cd $(DIR_APP) && cp -v gcc/Makefile.in{,.orig} + cd $(DIR_APP) && sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 $(TOOLS_DIR)/include@g" \ + gcc/Makefile.in.orig > gcc/Makefile.in + +ifeq "$(PASS)" "1" + cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \ + --prefix=$(CTOOLS_DIR) \ + --host=${IFS_HOST} \ + --target=${IFS_TARGET} \ + --disable-multilib \ + --with-local-prefix=$(TOOLS_DIR) \ + --disable-nls \ + --disable-shared \ + --disable-threads \ + --enable-languages=c + + cd $(DIR_SRC)/gcc-build && make all-gcc -j $(PARALLELISM) + cd $(DIR_SRC)/gcc-build && make install-gcc +endif + +ifeq "$(PASS)" "2" + cd $(DIR_APP) && cp -v configure{,.orig} + cd $(DIR_APP) && sed -e '/FLAGS_FOR_TARGET.*\/lib\//s@-B[^ ]*/lib/@@g' configure.orig > \ + configure + + cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \ + --prefix=$(CTOOLS_DIR) \ + --target=${IFS_TARGET} \ + --host=${IFS_HOST} \ + --disable-multilib \ + --with-local-prefix=$(TOOLS_DIR) \ + --disable-nls \ + --enable-shared \ + --enable-languages=c,c++ \ + --enable-__cxa_atexit \ + --enable-c99 \ + --enable-long-long \ + --enable-threads=posix + + cd $(DIR_SRC)/gcc-build && make AS_FOR_TARGET="${IFS_TARGET}-as" \ + LD_FOR_TARGET="${IFS_TARGET}-ld" + cd $(DIR_SRC)/gcc-build && make install +endif +endif +endif ifeq "$(STAGE)" "base" cd $(DIR_APP) && sed -i 's/install_to_$$(INSTALL_DEST) //' libiberty/Makefile.in cd $(DIR_APP) && sed -i 's/^XCFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in cd $(DIR_APP) && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in - cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure --prefix=/usr \ - --libexecdir=/usr/lib --enable-shared --enable-threads=posix \ - --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ \ - --disable-bootstrap + cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \ + --prefix=/usr \ + --libexecdir=/usr/lib \ + --enable-shared \ + --enable-threads=posix \ + --enable-__cxa_atexit \ + --enable-clocale=gnu \ + --enable-languages=c,c++ \ + --disable-bootstrap cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM) cd $(DIR_SRC)/gcc-build && make install diff --git a/lfs/gcc-x-compile b/lfs/gcc-x-compile new file mode 120000 index 000000000..b08d5af57 --- /dev/null +++ b/lfs/gcc-x-compile @@ -0,0 +1 @@ +gcc \ No newline at end of file diff --git a/lfs/glibc b/lfs/glibc index 0b5283c14..255acedef 100644 --- a/lfs/glibc +++ b/lfs/glibc @@ -31,10 +31,14 @@ THISAPP = $(PKG_NAME)-$(VER) DL_FILE = $(THISAPP).tar.bz2 DIR_APP = $(DIR_SRC)/$(THISAPP) -CFLAGS = -O2 -mno-tls-direct-seg-refs # This will make it xen-friendly +CFLAGS = CXXFLAGS = -TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" + TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP) +else + TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-cross +endif ############################################################################### # Top-level Rules @@ -58,6 +62,11 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) @mkdir $(DIR_SRC)/glibc-build +ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)" + # + # Normal build + # + ifeq "$(STAGE)" "toolchain" cd $(DIR_SRC)/glibc-build && echo "CFLAGS += -march=$(MACHINE)" > configparms cd $(DIR_SRC)/glibc-build && CFLAGS="$(CFLAGS)" ../$(THISAPP)/configure \ @@ -97,6 +106,40 @@ ifeq "$(STAGE)" "base" # Timezone cp -v --remove-destination /usr/share/zoneinfo/GMT /etc/localtime +endif +else + # + # Cross build + # + + cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-libgcc_eh-1.patch + cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-localedef_segfault-1.patch + cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-i586_chk-1.patch + + echo "libc_cv_forced_unwind=yes" > $(DIR_SRC)/glibc-build/config.cache + echo "libc_cv_c_cleanup=yes" >> $(DIR_SRC)/glibc-build/config.cache + + cd $(DIR_SRC)/glibc-build && BUILD_CC="gcc" \ + CC="$(IFS_TARGET)-gcc" \ + AR="$(IFS_TARGET)-ar" \ + RANLIB="$(IFS_TARGET)-ranlib" \ + CFLAGS="-march=$$(cut -d- -f1 <<< $(IFS_TARGET)) -mtune=generic -g -O2" \ + ../$(THISAPP)/configure \ + --prefix=$(TOOLS_DIR) \ + --host=${IFS_TARGET} \ + --build=$(IFS_HOST) \ + --disable-profile \ + --enable-add-ons \ + --with-tls \ + --enable-kernel=2.6.0 \ + --with-__thread \ + --with-binutils=$(CTOOLS_DIR)/bin \ + --with-headers=$(TOOLS_DIR)/include \ + --cache-file=config.cache + + cd $(DIR_SRC)/glibc-build && make PARALLELMFLAGS=-j$(PARALLELISM) + cd $(DIR_SRC)/glibc-build && make install + endif @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build diff --git a/lfs/glibc-x-compile b/lfs/glibc-x-compile new file mode 120000 index 000000000..0c4c137d7 --- /dev/null +++ b/lfs/glibc-x-compile @@ -0,0 +1 @@ +glibc \ No newline at end of file diff --git a/lfs/linux b/lfs/linux index c895d7fad..c44d7631d 100644 --- a/lfs/linux +++ b/lfs/linux @@ -60,16 +60,17 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) ifeq "$(STAGE)" "toolchain" + install -dv $(TOOLS_DIR)/include cd $(DIR_APP) && make mrproper - cd $(DIR_APP) && make headers_check - cd $(DIR_APP) && make INSTALL_HDR_PATH=dest headers_install + cd $(DIR_APP) && make ARCH=i386 headers_check + cd $(DIR_APP) && make ARCH=i386 INSTALL_HDR_PATH=dest headers_install cd $(DIR_APP) && cp -rv dest/include/* $(TOOLS_DIR)/include endif ifeq "$(STAGE)" "base" cd $(DIR_APP) && make mrproper - cd $(DIR_APP) && make headers_check - cd $(DIR_APP) && make INSTALL_HDR_PATH=dest headers_install + cd $(DIR_APP) && make ARCH=i386 headers_check + cd $(DIR_APP) && make ARCH=i386 INSTALL_HDR_PATH=dest headers_install cd $(DIR_APP) && cp -rv dest/include/* /usr/include endif @@ -79,14 +80,45 @@ ifeq "$(STAGE)" "ipfire" # cd $(DIR_APP) && patch -Np1 < $(DIR_PATCHES)/reiser4-for-$(VER).patch - # ip_conntrack permissions from 440 to 444 - #cd $(DIR_APP) && patch -Np0 < $(DIR_PATCHES)/ip_conntrack_standalone-patch-for-ipfire.patch - cd $(DIR_APP) && make mrproper + + -[ "$(TARGET_ARCH)" == "i586" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_MPENTIUMIII is not set/CONFIG_MPENTIUMII=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + -[ "$(TARGET_ARCH)" == "i486" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_M486 is not set/CONFIG_M486=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + -[ "$(TARGET_ARCH)" == "i386" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_M386 is not set/CONFIG_M386=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + -[ "$(TARGET_ARCH)" == "i486" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_M486 is not set/CONFIG_M486=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + -[ "$(TARGET_ARCH)" == "via-c7" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_MVIAC7 is not set/CONFIG_MVIAC7=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + -[ "$(TARGET_ARCH)" == "via-c3" ] && \ + sed -e "s/^CONFIG_M686=y/# CONFIG_686 is not set/" \ + -e "s/^# CONFIG_MVIAC3_2 is not set/CONFIG_MVIAC3_2=y/" \ + < $(DIR_CONF)/kernel/kernel.config > $(DIR_APP)/.config + + # if no $(TARGET) matched use the default + [ ! -e "$(DIR_APP)/.config" ] && cp -f $(DIR_CONF)/kernel/kernel.config \ + $(DIR_APP)/.config - cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE) $(DIR_APP)/.config - cd $(DIR_APP) && sed -i -e "s/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(EXTRAVERSION)/" \ - Makefile + cd $(DIR_APP) && \ + sed -i -e "s/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ $(EXTRAVERSION)/" \ + Makefile cd $(DIR_APP) && make oldconfig diff --git a/make.sh b/make.sh index a18ba72a4..68d2a3d78 100755 --- a/make.sh +++ b/make.sh @@ -17,7 +17,7 @@ # along with IPFire; if not, write to the Free Software # # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # -# Copyright (C) 2007 IPFire-Team . # +# Copyright (C) 2008 IPFire-Team . # # # ############################################################################ # @@ -38,30 +38,39 @@ SLOGAN="www.ipfire.org" # Software slogan toolchain_build() { ORG_PATH=$PATH - export PATH=$BASEDIR/build_${MACHINE}/usr/local/ccache/bin:$BASEDIR/build_${MACHINE}/usr/local/distcc/bin:$BASEDIR/build_${MACHINE}/$TOOLS_DIR/bin:$PATH + export PATH=$BASEDIR/build_${TARGET}/usr/local/ccache/bin:$BASEDIR/build_${TARGET}/usr/local/distcc/bin:$BASEDIR/build_${TARGET}/$CTOOLS_DIR/bin:$BASEDIR/build_${TARGET}/$TOOLS_DIR/bin:$PATH STAGE_ORDER=01 STAGE=toolchain LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-toolchain.log" export LOGFILE - NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}` - export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1} - # make distcc first so that CCACHE_PREFIX works immediately [ -z "$DISTCC_HOSTS" ] || toolchain_make distcc toolchain_make ccache + toolchain_make linux + + if [ "${MACHINE}" != "${MACHINE_REAL}" ]; then + toolchain_make binutils-x-compile + toolchain_make gcc-x-compile PASS=1 + toolchain_make glibc-x-compile + toolchain_make gcc-x-compile PASS=2 + + fi toolchain_make binutils PASS=1 toolchain_make gcc PASS=1 - toolchain_make linux + exiterror "Stop here" + toolchain_make glibc toolchain_make adjust-toolchain - toolchain_make tcl - toolchain_make expect - toolchain_make dejagnu - toolchain_make gcc PASS=2 - toolchain_make binutils PASS=2 + if [ "${MACHINE}" == "${MACHINE_REAL}" ]; then + toolchain_make tcl + toolchain_make expect + toolchain_make dejagnu + toolchain_make gcc PASS=2 + toolchain_make binutils PASS=2 + fi toolchain_make ncurses toolchain_make bash toolchain_make bzip2 diff --git a/tools/make-include b/tools/make-include index 8bc5172b7..0dfe68f95 100644 --- a/tools/make-include +++ b/tools/make-include @@ -2,7 +2,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2007 Michael Tremer & Christian Schmidt # +# Copyright (C) 2008 Michael Tremer & Christian Schmidt # # # # This program is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # @@ -72,9 +72,8 @@ fi if [ 'i686' = $MACHINE_REAL \ -o 'i586' = $MACHINE_REAL \ -o 'i486' = $MACHINE_REAL \ - -o 'i386' = $MACHINE_REAL \ -o 'x86_64' = $MACHINE_REAL ]; then - : + IFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")" else beautify message FAIL echo "Can't determine your architecture - $MACHINE_REAL" @@ -82,27 +81,27 @@ else fi if [ 'i686' = $TARGET -o 'i586' = $TARGET \ - -o 'i486' = $TARGET -o 'i386' = $TARGET ]; then + -o 'i486' = $TARGET ]; then MACHINE=${TARGET} MACHINE_REAL=${MACHINE_REAL} LINKER=/lib/ld-linux.so.2 - C2HOST="${MACHINE}-pc-linux-gnu" - C2FLAGS="-march=${MACHINE} -O2 -pipe -fomit-frame-pointer" - CXX2FLAGS="${C2FLAGS}" + IFS_TARGET="${MACHINE}-pc-linux-gnu" + CFLAGS="-march=${MACHINE} -O2 -pipe -fomit-frame-pointer" + CXXFLAGS="${CFLAGS}" elif [ 'via-c7' = $TARGET ]; then MACHINE=i686 MACHINE_REAL=${MACHINE_REAL} LINKER=/lib/ld-linux.so.2 - C2HOST="i686-pc-linux-gnu" - C2FLAGS="-march=${MACHINE} -mmmx -msse -msse2 -msse3 -O2 -pipe -fomit-frame-pointer" - CXX2FLAGS="${C2FLAGS}" + IFS_TARGET="${MACHINE}-pc-linux-gnu" + CFLAGS="-march=${MACHINE} -mmmx -msse -msse2 -msse3 -O2 -pipe -fomit-frame-pointer" + CXXFLAGS="${CFLAGS}" elif [ 'via-c3' = $TARGET ]; then MACHINE=i586 MACHINE_REAL=${MACHINE_REAL} LINKER=/lib/ld-linux.so.2 - C2HOST="i586-pc-linux-gnu" - C2FLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer" - CXX2FLAGS="${C2FLAGS}" + IFS_TARGET="${MACHINE}-pc-linux-gnu" + CFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer" + CXXFLAGS="${CFLAGS}" else beautify message FAIL echo "Not a valid target arch (i686|i586|i486|i386|via-c7|via-c3) - $TARGET" @@ -113,6 +112,7 @@ mkdir $BASEDIR/log_${MACHINE}/ 2>/dev/null # Set up what used to be /tools TOOLS_DIR=/tools_${MACHINE} +CTOOLS_DIR=/cross-tools_${MACHINE} # Set up /installer INSTALLER_DIR=/installer @@ -124,7 +124,7 @@ CDROM_DIR=/cdrom IMAGES_DIR=/images # include machine in TOOLCHAINNAME -TOOLCHAINNAME=$SNAME-$TOOLCHAINVERSION-toolchain-${MACHINE} +TOOLCHAINNAME=$SNAME-$TOOLCHAINVERSION-toolchain-t${TARGET}-m${MACHINE} ############################################################################### @@ -148,12 +148,12 @@ fi ## Measurements for positioning result messages RESULT_WIDTH=4 TIME_WIDTH=8 -OPT_WIDTH=6 +OPT_WIDTH=7 VER_WIDTH=10 RESULT_COL=$((${COLUMNS} - $RESULT_WIDTH - 4)) TIME_COL=$((${RESULT_COL} - $TIME_WIDTH - 5)) VER_COL=$((${TIME_COL} - $VER_WIDTH - 5)) -OPT_COL=$((${VER_COL} - $OPT_WIDTH - 6)) +OPT_COL=$((${VER_COL} - $OPT_WIDTH - 5)) ## Set Cursur Position Commands, used via echo -e SET_RESULT_COL="\\033[${RESULT_COL}G" @@ -244,7 +244,7 @@ beautify() ;; build_stage) MESSAGE=$2 - echo -ne "${BOLD}*** ${MESSAGE}${SET_OPT_COL} options${SET_VER_COL} version " + echo -ne "${BOLD}*** ${MESSAGE}${SET_OPT_COL} options${SET_VER_COL} version " echo -ne "${SET_TIME_COL} time (sec)${SET_RESULT_COL} status${NORMAL}\n" ;; make_pkg) @@ -350,7 +350,7 @@ entershell() { chroot $LFS $TOOLS_DIR/bin/env -i \ HOME=/root \ TERM=$TERM \ - PS1="${BOLD}[chroot-${MACHINE}-${TARGET}]${NORMAL} \u:\w\$ " \ + PS1="${BOLD}[chroot-${TARGET}(${MACHINE})]${NORMAL} \u:\w\$ " \ PATH=$PATH \ CONFIG_ROOT=${CONFIG_ROOT} \ VERSION=${VERSION} \ @@ -367,9 +367,10 @@ entershell() { INSTALLER_DIR=$INSTALLER_DIR \ MACHINE="$MACHINE" \ MACHINE_REAL="$MACHINE_REAL" \ - CHOST="$C2HOST" \ - CFLAGS="$C2FLAGS" \ - CXXFLAGS="$CXX2FLAGS" \ + CFLAGS="$CFLAGS" \ + CXXFLAGS="$CXXFLAGS" \ + IFS_HOST="$IFS_HOST" \ + IFS_TARGET="$IFS_TARGET" \ KVER=$KVER \ STAGE=$STAGE \ STAGE_ORDER=$STAGE_ORDER \ @@ -437,7 +438,11 @@ toolchain_make() { CONFIG_ROOT=$CONFIG_ROOT \ LINKER=$LINKER \ TOOLS_DIR=$TOOLS_DIR \ + CTOOLS_DIR=$CTOOLS_DIR \ MACHINE="$MACHINE" \ + MACHINE_REAL="$MACHINE_REAL" \ + IFS_HOST="$IFS_HOST" \ + IFS_TARGET="$IFS_TARGET" \ LFS_BASEDIR=$BASEDIR \ LFS=$LFS \ PARALLELISM=$PARALLELISM \ @@ -500,9 +505,10 @@ ipfire_make() { IMAGES_DIR=$IMAGES_DIR \ MACHINE="$MACHINE" \ MACHINE_REAL="$MACHINE_REAL" \ - CHOST="$C2HOST" \ - CFLAGS="$C2FLAGS" \ - CXXFLAGS="$CXX2FLAGS" \ + CFLAGS="$CFLAGS" \ + CXXFLAGS="$CXXFLAGS" \ + IFS_HOST="$IFS_HOST" \ + IFS_TARGET="$IFS_TARGET" \ KVER=$KVER \ STAGE=$STAGE \ STAGE_ORDER=$STAGE_ORDER \ @@ -528,14 +534,14 @@ ipfire_make() { ################################################################################ prepareenv() { - LOGFILE=$BASEDIR/log_${MACHINE}/_build.preparation.log + LOGFILE=$BASEDIR/log_${MACHINE}/_build.00-preparation.log export LOGFILE mkdir -p $BASEDIR/log_${MACHINE}/01_toolchain 2>/dev/null - mkdir -p $BASEDIR/log_${MACHINE}/02_base 2>/dev/null - mkdir -p $BASEDIR/log_${MACHINE}/03_ipfire 2>/dev/null - mkdir -p $BASEDIR/log_${MACHINE}/04_misc 2>/dev/null - mkdir -p $BASEDIR/log_${MACHINE}/05_installer 2>/dev/null - mkdir -p $BASEDIR/log_${MACHINE}/06_packages 2>/dev/null + mkdir -p $BASEDIR/log_${MACHINE}/02_base 2>/dev/null + mkdir -p $BASEDIR/log_${MACHINE}/03_ipfire 2>/dev/null + mkdir -p $BASEDIR/log_${MACHINE}/04_misc 2>/dev/null + mkdir -p $BASEDIR/log_${MACHINE}/05_installer 2>/dev/null + mkdir -p $BASEDIR/log_${MACHINE}/06_packages 2>/dev/null ############################################################################# # Are we running the right shell? # @@ -627,6 +633,17 @@ prepareenv() { if [ ! -h $TOOLS_DIR ]; then exiterror "Could not create $TOOLS_DIR symbolic link." fi + + # Check /ctools symlink + if [ -h $CTOOLS_DIR ]; then + rm -f $CTOOLS_DIR + fi + if [ ! -a $CTOOLS_DIR ]; then + ln -s $BASEDIR/build_${MACHINE}/$CTOOLS_DIR / + fi + if [ ! -h $CTOOLS_DIR ]; then + exiterror "Could not create $CTOOLS_DIR symbolic link." + fi # Setup environment set +h @@ -635,9 +652,9 @@ prepareenv() { unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD # Make some extra directories - mkdir -p $BASEDIR/build_${MACHINE}/{$TOOLS_DIR,$INSTALLER_DIR,cdrom,images,usr/local/{ccache,distcc}} 2>/dev/null + mkdir -p $BASEDIR/build_${MACHINE}/{$TOOLS_DIR,$CTOOLS_DIR,$INSTALLER_DIR,cdrom,images,usr/local/{ccache,distcc}} 2>/dev/null mkdir -p $BASEDIR/{cache,ccache,distcc} 2>/dev/null - mkdir -p $LFS/{$TOOLS_DIR,usr/src} 2>/dev/null + mkdir -p $LFS/{$TOOLS_DIR,$CTOOLS_DIR,usr/src} 2>/dev/null mkdir -p $LFS/dev/pts mkdir -p $LFS/proc mkdir -p $LFS/usr/src/{cache,config,doc,lfs,log_${MACHINE},src,ccache,distcc} @@ -659,6 +676,7 @@ prepareenv() { mount --bind $BASEDIR/log_${MACHINE} $LFS/usr/src/log_${MACHINE} mount --bind $BASEDIR/src $LFS/usr/src/src mount --bind $BASEDIR/build_${MACHINE}/$TOOLS_DIR $LFS/$TOOLS_DIR + mount --bind $BASEDIR/build_${MACHINE}/$CTOOLS_DIR $LFS/$CTOOLS_DIR mount --bind $BASEDIR/build_${MACHINE}/$INSTALLER_DIR $LFS/$INSTALLER_DIR mount --bind $BASEDIR/build_${MACHINE}/$CDROM_DIR $LFS/$CDROM_DIR mount --bind $BASEDIR/build_${MACHINE}/$IMAGES_DIR $LFS/$IMAGES_DIR @@ -689,7 +707,7 @@ build() { PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.bz2 2> /dev/null | head -n 1` #only restore on a clean disk - echo -ne "Building for ${BOLD}${MACHINE}-${TARGET} on ${MACHINE_REAL}${NORMAL}\n" + echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n" if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then prepareenv @@ -697,7 +715,7 @@ build() { beautify message DONE "Stage toolchain already built or extracted" else if [ -z "$PACKAGE" ]; then - echo "Full toolchain compilation" | tee -a $LOGFILE + echo "Full toolchain compilation" prepareenv . $BASEDIR/tools/make-check @@ -706,7 +724,7 @@ build() { beautify build_stage "Building toolchain" toolchain_build else - echo "Restore from $PACKAGE" | tee -a $LOGFILE + echo "Restore from $PACKAGE" if [ `md5sum $BASEDIR/cache/toolchains/$PACKAGE | awk '{print $1}'` == `cat $BASEDIR/cache/toolchains/$TOOLCHAINNAME.md5 | awk '{print $1}'` ]; then cd $BASEDIR && tar jxf $BASEDIR/cache/toolchains/$PACKAGE prepareenv