]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
This is the uClibc toolchain...
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Apr 2008 20:13:14 +0000 (22:13 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Apr 2008 20:13:14 +0000 (22:13 +0200)
Some work has to be done yet, but I hope this will compile.

16 files changed:
config/busybox/.config
lfs/adjust-toolchain
lfs/binutils
lfs/busybox
lfs/e2fsprogs
lfs/gcc
lfs/gettext
lfs/linux
lfs/ncurses
lfs/stage5
lfs/stage6 [new file with mode: 0644]
lfs/uClibc [new file with mode: 0644]
lfs/udev
lfs/util-linux-ng
make.sh
tools/make-include

index 74a60569d424c38c161b99ff744334e2d037fb6b..af3e259ad92907d2214fc71a842838ba1f9e273c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Busybox version: 1.10.0
-# Mon Apr  7 12:33:34 2008
+# Sat Apr 26 17:29:28 2008
 #
 CONFIG_HAVE_DOT_CONFIG=y
 
@@ -66,7 +66,7 @@ CONFIG_INSTALL_APPLET_SYMLINKS=y
 # CONFIG_INSTALL_SH_APPLET_SYMLINK is not set
 # CONFIG_INSTALL_SH_APPLET_HARDLINK is not set
 # CONFIG_INSTALL_SH_APPLET_SCRIPT_WRAPPER is not set
-CONFIG_PREFIX="/installer/busybox"
+CONFIG_PREFIX=""
 
 #
 # Busybox Library Tuning
index db81e8b392769f6c78eb133ecfae2b47abccbece..11c6b3e43032268ea87ab9ec0aa3dc72ead08275 100644 (file)
@@ -71,10 +71,21 @@ ifeq "$(STAGE)" "base"
        ln -sfv $(TOOLS_DIR)/bin/ld $(TOOLS_DIR)/$$(gcc -dumpmachine)/bin/ld
        
        gcc -dumpspecs | sed \
-    -e 's@$(TOOLS_DIR)$(LINKER)@$(LINKER)@g' \
-    -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
-    -e '/\*cpp:/{n;s@$$@ -isystem /usr/include@}' > \
-    `dirname $$(gcc --print-libgcc-file-name)`/specs
+               -e 's@$(TOOLS_DIR)$(LINKER)@$(LINKER)@g' \
+               -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
+               -e '/\*cpp:/{n;s@$$@ -isystem /usr/include@}' > \
+               `dirname $$(gcc --print-libgcc-file-name)`/specs
+endif
+
+ifeq "$(STAGE)" "uclibc"
+       $(UCLIBC_TARGET)-gcc -dumpspecs \
+               > $$($(UCLIBC_TARGET)-gcc --print-file specs)
+       sed -e 's/%{shared:-lc}/%{!nointl: -lintl} &/' \
+               -i $$($(UCLIBC_TARGET)-gcc --print-file specs)
+       mv -v $(UCLIBC_DIR)/$(UCLIBC_TARGET)/bin/{ld,ld-old}
+       mv -v $(UCLIBC_DIR)/$(UCLIBC_TARGET)/bin/{ld-new,ld}
+       ln -sfv ../$(UCLIBC_TARGET)/bin/ld \
+               $(UCLIBC_DIR)/bin/$(UCLIBC_TARGET)-ld
 endif
        
        @$(POSTBUILD)
index 00f0bc871d5e3149ed88936edebbe6856bda4213..b4eef3e735ef6fe8bd3f42a473aafa90e2b0bef3 100644 (file)
@@ -45,7 +45,9 @@ endif
 # Top-level Rules
 ###############################################################################
 
-objects = $(DL_FILE) $(THISAPP)-configure-1.patch
+objects = $(DL_FILE) $(THISAPP)-configure-1.patch \
+       $(THISAPP)-uClibc-1.patch \
+       $(THISAPP)-ld_makefile.patch
 
 install : $(TARGET)
 
@@ -64,6 +66,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        -mkdir -v $(DIR_SRC)/binutils-build
        cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-configure-1.patch
 
+ifeq "$(STAGE)" "toolchain"
 ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
        #
        #       Normal build
@@ -72,10 +75,9 @@ ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
 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
@@ -86,14 +88,13 @@ 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
-       
+                                               --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
@@ -102,10 +103,9 @@ endif
 
 ifeq "$(PASS)" "2"
        cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \
-                                                                                                                                               --prefix=$(TOOLS_DIR) \
-                                                                                                                                               --disable-nls \
-                                                                                                                                               --with-lib-path=$(TOOLS_DIR)/lib
-                                                                                                                                               
+                                               --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
        
@@ -129,13 +129,13 @@ else
        #
 
        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
+                                               --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
@@ -143,6 +143,23 @@ else
        -mkdir -p $(TOOLS_DIR)/include
        cp -fv $(DIR_APP)/include/libiberty.h $(TOOLS_DIR)/include
 endif
+endif
+
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-uClibc-1.patch
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-ld_makefile.patch
+       cd $(DIR_SRC)/binutils-build && ../$(THISAPP)/configure \
+                                               --prefix=$(UCLIBC_DIR) \
+                                               --disable-shared \
+                                               --disable-nls \
+                                               --target=$(UCLIBC_TARGET)
+       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=/ulib
+       cd $(DIR_SRC)/binutils-build && cp -fv ld/ld-new \
+               $(UCLIBC_DIR)/$(UCLIBC_TARGET)/bin
+endif
 
        @rm -rf $(DIR_APP) $(DIR_SRC)/binutils-build
        @$(POSTBUILD)
index 8e070c629667e57e8802109e51939e8dfc6e8b66..5a4bc8a104b077c0b62d339c537ab5e35f8579af 100644 (file)
@@ -53,14 +53,28 @@ $(patsubst %,$(DIR_DL)/%,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-       -mkdir -p $(INSTALLER_DIR)/busybox
        cd $(DIR_APP) && cp -f $(DIR_CONFIG)/$(PKG_NAME)/.config .config
-       cd $(DIR_APP) && make oldconfig
-       cd $(DIR_APP) && make -j $(PARALLELISM)
-       cd $(DIR_APP) && make install
-       rm -vf $(INSTALLER_DIR)/linuxrc
-       -mkdir -p $(INSTALLER_DIR)/busybox/usr/share/udhcpc/
+       sed -e "s@^CONFIG_PREFIX=.*@CONFIG_PREFIX=\"$(UCLIBC_DIR)\"@g" \
+               -i $(DIR_APP)/.config
+       cd $(DIR_APP) && make ARCH=i386 \
+               CROSS_COMPILE=$(UCLIBC_TARGET)- \
+               CROSS=$(UCLIBC_TARGET)- \
+               CC="ccache $(UCLIBC_TARGET)-gcc" \
+               oldconfig
+       cd $(DIR_APP) && make ARCH=i386 \
+               CROSS_COMPILE=$(UCLIBC_TARGET)- \
+               CROSS=$(UCLIBC_TARGET)- \
+               CC="ccache $(UCLIBC_TARGET)-gcc" \
+               -j $(PARALLELISM)
+       cd $(DIR_APP) && make ARCH=i386 \
+               CROSS_COMPILE=$(UCLIBC_TARGET)- \
+               CROSS=$(UCLIBC_TARGET)- \
+               CC="ccache $(UCLIBC_TARGET)-gcc" \
+               PREFIX=$(UCLIBC_DIR) \
+               install
+       @rm -f $(UCLIBC_DIR)/linuxrc
+       -mkdir -p $(UCLIBC_DIR)/usr/share/udhcpc/
        install -m 755 -v $(DIR_CONF)/busybox/default.script \
-               $(INSTALLER_DIR)/busybox/usr/share/udhcpc/
+               $(UCLIBC_DIR)/usr/share/udhcpc/
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index abf67db1f8f2309970c30851a1fb09249a89e788..7635c1aeb78389f2639c11a2baa48a2bb9fb8053 100644 (file)
@@ -69,5 +69,13 @@ ifeq "$(STAGE)" "base"
        cd $(DIR_APP)/build && make install-libs
 endif
 
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP)/build && ../configure --prefix=/usr --with-root-prefix="" \
+               --enable-elf-shlibs --build=$(IFS_TARGET) --host=$(UCLIBC_TARGET)
+       cd $(DIR_APP)/build && make -j $(PARALLELISM)
+       cd $(DIR_APP)/build && make install DESTDIR=$(UCLIBC_DIR)
+       cd $(DIR_APP)/build && make install-libs DESTDIR=$(UCLIBC_DIR)
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/lfs/gcc b/lfs/gcc
index d9a5eedeea779f541513aedbbc3fe065120be0df..28fa2941740fd0eef49d210b7924a0f5daf94ad1 100644 (file)
--- a/lfs/gcc
+++ b/lfs/gcc
@@ -39,9 +39,13 @@ ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
 else
        TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-cross$(PASS)
 endif
+else
+ifeq "$(STAGE)" "uclibc"
+       TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
 else
        TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
 endif
+endif
 
 ###############################################################################
 # Top-level Rules
@@ -49,7 +53,8 @@ endif
 
 objects = $(DL_FILE) \
        $(THISAPP)-cross_search_paths-1.patch \
-       $(THISAPP)-specs-1.patch
+       $(THISAPP)-specs-1.patch \
+       $(THISAPP)-uClibc-conf-1.conf
 
 install : $(TARGET)
 
@@ -76,12 +81,11 @@ ifeq "$(firstword $(MAKEFILE_LIST))" "$(PKG_NAME)"
 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_DIR) \
-                                                                                                                               --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
@@ -103,22 +107,21 @@ else
                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
-       
+                                               --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)
+                                               LD_FOR_TARGET=$(LD)
        cd $(DIR_SRC)/gcc-build && make install
 endif
 endif
@@ -133,23 +136,22 @@ ifeq "$(PASS)" "2"
        cd $(DIR_APP) && \
                for file in $$(find gcc/config -name linux64.h -o -name linux.h); do \
                        cp -uv $$file{,.orig}; \
-               sed -e 's@/lib\(64\)\?\(32\)\?/ld@$(TOOLS_DIR)&@g' \
-                                       -e 's@/usr@$(TOOLS_DIR)@g' $$file.orig > $$file; \
+                       sed -e 's@/lib\(64\)\?\(32\)\?/ld@$(TOOLS_DIR)&@g' \
+                               -e 's@/usr@$(TOOLS_DIR)@g' $$file.orig > $$file; \
                        echo -e "\n#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR 0" >> $$file; \
                        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
-               
+                                               --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
@@ -168,20 +170,19 @@ else
        
        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
+               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
-                                                                                                                                       
+                                               --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
@@ -192,21 +193,21 @@ ifeq "$(PASS)" "2"
                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
-       
+                                               --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"
+                                               LD_FOR_TARGET="${IFS_TARGET}-ld"
        cd $(DIR_SRC)/gcc-build && make install
 endif
 endif
@@ -218,15 +219,14 @@ ifeq "$(STAGE)" "base"
        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
-  
+                                               --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
        
@@ -234,5 +234,54 @@ ifeq "$(STAGE)" "base"
        ln -sfv gcc /usr/bin/cc 
 endif
 
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP) && patch -p1 -i $(DIR_PATCHES)/$(THISAPP)-uClibc-conf-1.conf
+       sed -e "s@/lib/ld-uClibc.so.0@$(UCLIBC_LINKER)@g" -i $(DIR_APP)/gcc/config/linux.h
+       echo -e "\n#undef STARTFILE_PREFIX_SPEC\n#define STARTFILE_PREFIX_SPEC \"$(UCLIBC_DIR)/lib/\"" \
+               >> $(DIR_APP)/gcc/config/linux.h
+ifeq "$(PASS)" "1"
+       cd $(DIR_APP) && sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 $(UCLIBC_DIR)/include@g" \
+               -i gcc/Makefile.in
+       touch ${UCLIBC_LINKER}
+       cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \
+                                               --prefix=$(UCLIBC_DIR) \
+                                               --target=$(UCLIBC_TARGET) \
+                                               --disable-nls \
+                                               --disable-shared \
+                                               --enable-languages=c \
+                                               --disable-__cxa_atexit \
+                                               --enable-target-optspace \
+                                               --with-gnu-ld \
+                                               --disable-multilib \
+                                               --disable-libmudflap \
+                                               --disable-libgomp
+       cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM)
+       cd $(DIR_SRC)/gcc-build && make install
+endif
+
+ifeq "$(PASS)" "2"
+       cd $(DIR_APP) && sed -e 's/%{shared:-lc}/%{!nointl: -lintl} &/' \
+               -i gcc/config/linux.h
+       cd $(DIR_APP) && cp -v gcc/Makefile.in{,.tmp}
+       #cd $(DIR_APP) && sed 's/^XCFLAGS =$$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
+       #       > gcc/Makefile.in
+       cd $(DIR_SRC)/gcc-build && ../$(THISAPP)/configure \
+                                               --prefix=$(UCLIBC_DIR) \
+                                               --target=$(UCLIBC_TARGET) \
+                                               --libexecdir=/ulib \
+                                               --enable-shared \
+                                               --disable-__cxa_atexit \
+                                               --enable-target-optspace \
+                                               --enable-languages=c,c++ \
+                                               --disable-multilib \
+                                               --disable-libmudflap \
+                                               --with-gnu-ld \
+                                               --disable-nls
+       cd $(DIR_SRC)/gcc-build && make -j $(PARALLELISM)
+       cd $(DIR_SRC)/gcc-build && make install
+       ln -svf gcc $(UCLIBC_DIR)/$(UCLIBC_TARGET)/bin/cc
+endif
+endif
+
        @rm -rf $(DIR_APP) $(DIR_SRC)/gcc-build
        @$(POSTBUILD)
index a9f14259ce978841c324ce74ffae9cd390ced64e..3cf1e5e7ced59469fc02de94cb8f51d4f6392464 100644 (file)
@@ -31,7 +31,11 @@ THISAPP    = $(PKG_NAME)-$(VER)
 DL_FILE    = $(THISAPP).tar.gz
 DIR_APP    = $(DIR_SRC)/$(THISAPP)
 
-TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
+ifeq "$(STAGE)" "uclibc"
+       TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
+else
+       TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
+endif
 
 ###############################################################################
 # Top-level Rules
@@ -67,5 +71,16 @@ ifeq "$(STAGE)" "base"
        cd $(DIR_APP) && make install
 endif
 
+ifeq "$(STAGE)" "uclibc" # Do this in pass 1 and 2
+       cd $(DIR_APP)/gettext-runtime && CC=$(UCLIBC_TARGET)-gcc ./configure \
+                                               --prefix=$(UCLIBC_DIR) \
+                                               --host=$(UCLIBC_TARGET) \
+                                               --with-included-gettext \
+                                               --without-csharp \
+                                               --disable-libasprintf
+       cd $(DIR_APP)/gettext-runtime && make -C intl/ -j $(PARALLELISM)
+       cd $(DIR_APP)/gettext-runtime && make -C intl/ install
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index dc20122c9655beccc86b2df34a9aa5c8423af066..4a94e6a0333b690c3e9f2db9beeaa4bddcd4c076 100644 (file)
--- a/lfs/linux
+++ b/lfs/linux
@@ -143,5 +143,12 @@ ifeq "$(STAGE)" "ipfire"
        ln -svf System.map-$(FULLVER) /boot/System.map
 endif
 
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP) && make mrproper
+       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/* $(UCLIBC_DIR)/include
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index 082da689792f9f81c36a57aaf1e8073dd349dd05..cfea50a8e4c0003160c52012b31f14e9ab7ffaf8 100644 (file)
@@ -73,9 +73,9 @@ ifeq "$(STAGE)" "base"
        mv -v /usr/lib/libncursesw.so.5* /lib
        ln -sfv ../../lib/libncursesw.so.5 /usr/lib/libncursesw.so
        for lib in curses ncurses form panel menu; do \
-    rm -vf /usr/lib/lib$${lib}.so ; \
-    echo "INPUT(-l$${lib}w)" >/usr/lib/lib$${lib}.so ; \
-    ln -sfv lib$${lib}w.a /usr/lib/lib$${lib}.a ; \
+               rm -vf /usr/lib/lib$${lib}.so ; \
+               echo "INPUT(-l$${lib}w)" >/usr/lib/lib$${lib}.so ; \
+               ln -sfv lib$${lib}w.a /usr/lib/lib$${lib}.a ; \
        done
        ln -sfv libncurses++w.a /usr/lib/libncurses++.a
        
@@ -86,5 +86,17 @@ ifeq "$(STAGE)" "base"
        ln -sfv libncurses.a /usr/lib/libcurses.a
 endif
 
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-coverity_fixes-1.patch
+       cd $(DIR_APP) && ./configure --prefix=/usr \
+                                               --build=$(IFS_TARGET) \
+                                               --host=$(UCLIBC_TARGET) \
+                                               --with-shared \
+                                               --without-debug \
+                                               #--enable-widec
+       cd $(DIR_APP) && make -j $(PARALLELISM)
+       cd $(DIR_APP) && make install DESTDIR=$(INSTALLER_DIR)
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index 4dc1975226c85fec316cb8bf240efd8e6cebe627..390c2d7f03e6632d20f79b89e9dc1369783ee901 100644 (file)
@@ -45,5 +45,11 @@ download :
 
 $(TARGET) :
        @$(PREBUILD)
-       
+       for i in lib include $(UCLIBC_TARGET); do \
+               mkdir -pv $(UCLIBC_DIR)/$${i}; \
+       done
+       ln -svf ../include $(UCLIBC_DIR)/$(UCLIBC_TARGET)/sys-include
+       ln -svf ../lib /usr/$(UCLIBC_TARGET)/$(UCLIBC_TARGET)/lib
+       ln -svf usr/$(UCLIBC_TARGET)/lib /ulib
+       ln -svf lib /usr/$(UCLIBC_TARGET)/ulib
        @$(POSTBUILD)
diff --git a/lfs/stage6 b/lfs/stage6
new file mode 100644 (file)
index 0000000..807011d
--- /dev/null
@@ -0,0 +1,49 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  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        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+PKG_NAME   = stage6
+VER        = LFS
+
+THISAPP    = $(PKG_NAME)-$(VER)
+
+TARGET     = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+install : $(TARGET)
+
+download :
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) :
+       @$(PREBUILD)
+       
+       @$(POSTBUILD)
diff --git a/lfs/uClibc b/lfs/uClibc
new file mode 100644 (file)
index 0000000..2ec0e11
--- /dev/null
@@ -0,0 +1,93 @@
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  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        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include Config
+
+PKG_NAME   = uClibc
+VER        = 0.9.29
+
+THISAPP    = $(PKG_NAME)-$(VER)
+DL_FILE    = $(THISAPP).tar.bz2
+DIR_APP    = $(DIR_SRC)/$(THISAPP)
+
+LOCALE_FILE = $(PKG_NAME)-locale-030818.tgz
+
+TARGET = $(DIR_INFO)/$(STAGE_ORDER)_$(STAGE)/$(THISAPP)-pass$(PASS)
+
+###############################################################################
+# Top-level Rules
+###############################################################################
+
+objects = $(DL_FILE) $(LOCALE_FILE) $(THISAPP)-config-1.patch
+
+install : $(TARGET)
+
+download :$(patsubst %,$(DIR_DL)/%,$(objects))
+
+$(patsubst %,$(DIR_DL)/%,$(objects)) :
+       @$(LOAD)
+
+###############################################################################
+# Installation Details
+###############################################################################
+
+$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
+       @$(PREBUILD)
+       @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
+       
+       ## Copy configuration
+       cp -fv $(DIR_CONF)/$(PKG_NAME)/.config $(DIR_APP)/.config
+       cp -fv $(DIR_DL)/$(LOCALE_FILE) $(DIR_APP)/extra/locale
+
+ifeq "$(PASS)" "0"
+       rm -vf $(DIR_APP)/.config
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-config-1.patch
+       cd $(DIR_APP) && make KERNEL_SOURCE=$(UCLIBC_DIR) headers all
+       rm -fvr $(DIR_APP)/include/{asm,asm-generic,linux}
+       cd $(DIR_APP) && make DEVEL_PREFIX=$(UCLIBC_DIR)/ install_dev
+endif
+
+ifneq "$(PASS)" "0" # Do this on pass 1 and 2
+       cd $(DIR_APP) && sed \
+               -e "s@.*SHARED_LIB_LOADER_P.*@SHARED_LIB_LOADER_PREFIX=\"$(UCLIBC_DIR)/lib\"@g" \
+               -e "s@.*RUNTIME_PREFIX.*@RUNTIME_PREFIX=\"$(UCLIBC_DIR)\"@g" \
+               -e "s@.*DEVEL_PREFIX.*@DEVEL_PREFIX=\"$(UCLIBC_DIR)/\"@g" \
+               -e "s@.*KERNEL_SOURCE.*@KERNEL_SOURCE=\"$(UCLIBC_DIR)\"@g" \
+               -i .config
+       cd $(DIR_APP) && make CROSS=$(UCLIBC_TARGET)- all -j $(PARALLELISM)
+       rm -fvr $(DIR_APP)/include/{asm,asm-generic,linux}
+       cd $(DIR_APP) && make install
+endif
+
+ifeq "$(PASS)" "2"
+       cd $(DIR_APP) && make headers
+       cd $(DIR_APP) && make CC="gcc -Wl,--dynamic-linker,$(UCLIBC_LINKER) /ulib/libc.so.0" \
+               -C utils
+       make -C utils install
+       mv -vf $(UCLIBC_DIR)/sbin/ldconfig $(UCLIBC_DIR)/bin
+       rm -rvf $(UCLIBC_DIR)/sbin/
+endif
+
+       @rm -rf $(DIR_APP)
+       @$(POSTBUILD)
index f33aabf1996545b5cd81be6659186271003e0122..9af1f2786ea8f43846d14b2bd11c12e7d28dafa6 100644 (file)
--- a/lfs/udev
+++ b/lfs/udev
@@ -55,8 +55,11 @@ $(patsubst %,$(DIR_DL)/%,$(objects)) :
 $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        @$(PREBUILD)
        @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
-       cd $(DIR_APP) && tar -xvf $(DIR_DL)/$(PKG_NAME)-config-$(CONFVER).tar.bz2
+       cd $(DIR_APP) && tar -jxf $(DIR_DL)/$(PKG_NAME)-config-$(CONFVER).tar.bz2
        
+       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-usb_id-1.patch
+
+ifeq "$(STAGE)" "base"
        install -dv /lib/{firmware,udev/devices/{pts,shm}}
        -mknod -m0666 /lib/udev/devices/null c 1 3
        ln -sfv /proc/self/fd /lib/udev/devices/fd
@@ -64,15 +67,27 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        ln -sfv /proc/self/fd/1 /lib/udev/devices/stdout
        ln -sfv /proc/self/fd/2 /lib/udev/devices/stderr
        ln -sfv /proc/kcore /lib/udev/devices/core
-       
-       cd $(DIR_APP) && patch -Np1 -i $(DIR_PATCHES)/$(THISAPP)-usb_id-1.patch
-       
+
        cd $(DIR_APP) && make EXTRAS="`echo extras/*/`" -j $(PARALLELISM)
        cd $(DIR_APP) && make DESTDIR=/ EXTRAS="`echo extras/*/`" install
-       
+
        cd $(DIR_APP) && cp -v etc/udev/rules.d/[0-9]* /etc/udev/rules.d/
-       
+
        cd $(DIR_APP)/$(PKG_NAME)-config-$(CONFVER) && make install
+endif
+
+ifeq "$(STAGE)" "uclibc"
+       ### XXX The predefined devnodes go here
+
+       cd $(DIR_APP) && make EXTRAS="`echo extras/*/`" \
+               CROSS_COMPILE=$(UCLIBC_TARGET)- -j $(PARALLELISM)
+       cd $(DIR_APP) && make DESTDIR=$(INSTALLER_DIR) EXTRAS="`echo extras/*/`" \
+               CROSS_COMPILE=$(UCLIBC_TARGET)- install
+       
+       cd $(DIR_APP) && cp -v etc/udev/rules.d/[0-9]* $(INSTALLER_DIR)/etc/udev/rules.d/
+       
+       cd $(DIR_APP)/$(PKG_NAME)-config-$(CONFVER) && make install DESTDIR=$(INSTALLER_DIR)
+endif
        
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
index 95a9c788fa7a22030b42b1d46cb7d01849d0ca74..0052ddaec7888c344b77f674994a657e89d32e6a 100644 (file)
@@ -70,5 +70,12 @@ ifeq "$(STAGE)" "base"
        cd $(DIR_APP) && make install
 endif
 
+ifeq "$(STAGE)" "uclibc"
+       cd $(DIR_APP) && ./configure            --build=$(IFS_TARGET) \
+                                               --host=$(UCLIBC_TARGET)
+       cd $(DIR_APP) && make -j $(PARALLELISM)
+       cd $(DIR_APP) && cp -vf disk-utils/mkswap $(UCLIBC_DIR)/sbin/mkswap
+endif
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/make.sh b/make.sh
index 1cbc7b8ea00204a466aefd1dac72291862be7435..395eb723c11c17ed63f3b5657b5293d20cf27eb2 100755 (executable)
--- a/make.sh
+++ b/make.sh
 ############################################################################
 #
 
-NAME="IPFire"                                                                          # Software name
-SNAME="ipfire"                                                                 # Short name
-VERSION="3.0-prealpha"                                 # Version number
+NAME="IPFire"                  # Software name
+SNAME="ipfire"                 # Short name
+VERSION="3.0-prealpha"         # Version number
 TOOLCHAINVERSION="${VERSION}-1"        # Toolchain
-SLOGAN="www.ipfire.org"                                        # Software slogan
+SLOGAN="www.ipfire.org"                # Software slogan
 
 # Include funtions
 . tools/make-include
@@ -52,13 +52,13 @@ toolchain_build() {
        
        if [ "${MACHINE}" != "${MACHINE_REAL}" ]; then
                toolchain_make binutils-x-compile
-               toolchain_make gcc-x-compile                                                    PASS=1
+               toolchain_make gcc-x-compile            PASS=1
                toolchain_make glibc-x-compile
-               toolchain_make gcc-x-compile                                                    PASS=2
+               toolchain_make gcc-x-compile            PASS=2
        
        fi
        
-       toolchain_make binutils                                                                                 PASS=1
+       toolchain_make binutils                         PASS=1
        toolchain_make gcc                                                                                                      PASS=1
        toolchain_make glibc
        toolchain_make adjust-toolchain
@@ -68,7 +68,7 @@ toolchain_build() {
                toolchain_make expect
                toolchain_make dejagnu
                toolchain_make gcc                                                                                              PASS=2
-               toolchain_make binutils                                                                         PASS=2
+               toolchain_make binutils                 PASS=2
        fi
        
        toolchain_make ncurses
@@ -396,20 +396,49 @@ misc_build() {
        #ipfire_make mbr
 }
 
+################################################################################
+# This builds the entire stage "uclibc"                                        #
+################################################################################
+uclibc_build() {
+
+       PATH=${UCLIBC_DIR}/bin:${TOOLS_DIR}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
+       STAGE_ORDER=05
+       STAGE=uclibc
+
+       LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-uclibc.log"
+       export LOGFILE
+
+       ipfire_make stage5
+       ipfire_make linux
+       ipfire_make uClibc              PASS=0
+       ipfire_make binutils
+       ipfire_make gcc                 PASS=1
+       ipfire_make uClibc              PASS=1
+       ipfire_make gettext             PASS=1
+       ipfire_make adjust-toolchain
+       ipfire_make gcc                 PASS=2
+       ipfire_make uClibc              PASS=2
+       ipfire_make gettext             PASS=2
+       ipfire_make busybox
+       ipfire_make udev
+       ipfire_make ncurses
+       #ipfire_make e2fsprogs
+       #ipfire_make util-linux-ng
+}
+
 ################################################################################
 # This builds the entire stage "installer"                                     #
 ################################################################################
 installer_build() {
 
        PATH=${TOOLS_DIR}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
-       STAGE_ORDER=05
+       STAGE_ORDER=06
        STAGE=installer
 
        LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-installer.log"
        export LOGFILE
        
-       ipfire_make stage5
-       ipfire_make busybox
+       ipfire_make stage6
        ipfire_make installer
        ipfire_make initramfs
 }
@@ -420,24 +449,24 @@ installer_build() {
 packages_build() {
 
        PATH=${TOOLS_DIR}/usr/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/${MACHINE_REAL}-linux/bin
-       STAGE_ORDER=06
+       STAGE_ORDER=07
        STAGE=packages
 
        LOGFILE="$BASEDIR/log_${MACHINE}/_build.${STAGE_ORDER}-packages.log"
        export LOGFILE
 
-  toolchain_make strip
-  
-  # Generating list of packages used
+       toolchain_make strip
+
+       # Generating list of packages used
        ### MISSING ATM
 
        ipfire_make cdrom
        
-  # Check if there is a loop device for building in virtual environments
-  #if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then
-  #    ipfire_make usb-stick
-  #fi
-  mv $LFS/$IMAGES_DIR/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1
+       # Check if there is a loop device for building in virtual environments
+       #if [ -e /dev/loop/0 ] || [ -e /dev/loop0 ]; then
+       #       ipfire_make usb-stick
+       #fi
+       mv $LFS/$IMAGES_DIR/{*.iso,*.tgz,*.img.gz} $BASEDIR >> $LOGFILE 2>&1
 
        #ipfire_make core-updates
        ### DISABLED ATM
@@ -452,11 +481,11 @@ packages_build() {
                fi
        done
 
-  # Cleanup
-  stdumount
-  rm -rf $LFS/tmp/*
-
-  cd $PWD
+       # Cleanup
+       stdumount
+       rm -rf $LFS/tmp/*
+       
+       cd $PWD
 }
 
 # See what we're supposed to do
index 5421ddf72fc7d09156d6dd7d8b16f82c6dd59547..3d67c46f4276b5374b7d992c9001a786f8ae4832 100644 (file)
@@ -24,9 +24,9 @@
 #
 ###############################################################################
 
-CONFIG_ROOT=/etc/$SNAME                                        # Configuration rootdir
-NICE=10                                                                                                        # Nice level
-TARGET=i686                                                                                    # Default target
+CONFIG_ROOT=/etc/$SNAME                # Configuration rootdir
+NICE=10                                # Nice level
+TARGET=i686                    # Default target
 KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }' | tr -d '\n'; grep --max-count=1 FULLVER lfs/linux | awk '{ print $3 }' | cut -c 7-| tail -1`
 MACHINE_REAL=`uname -m`
 GIT_TAG=$(git tag | tail -1)
@@ -89,6 +89,9 @@ if [ 'i686' = $TARGET -o 'i586' = $TARGET \
        IFS_TARGET="${MACHINE}-pc-linux-gnu"
        CFLAGS="-march=${MACHINE} -O2 -pipe -fomit-frame-pointer"
        CXXFLAGS="${CFLAGS}"
+       UCLIBC_TARGET=i386-pc-linux-uclibc
+       UCLIBC_LINKER=/ulib/ld-uClibc.so.0
+       UCLIBC_CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
 elif [ 'via-c7' = $TARGET ]; then
        MACHINE=i686
        MACHINE_REAL=${MACHINE_REAL}
@@ -96,6 +99,9 @@ elif [ 'via-c7' = $TARGET ]; then
        IFS_TARGET="${MACHINE}-pc-linux-gnu"
        CFLAGS="-march=${MACHINE} -mmmx -msse -msse2 -msse3 -O2 -pipe -fomit-frame-pointer"
        CXXFLAGS="${CFLAGS}"
+       UCLIBC_TARGET=i386-pc-linux-uclibc
+       UCLIBC_LINKER=/ulib/ld-uClibc.so.0
+       UCLIBC_CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
 elif [ 'via-c3' = $TARGET ]; then
        MACHINE=i586
        MACHINE_REAL=${MACHINE_REAL}
@@ -103,6 +109,9 @@ elif [ 'via-c3' = $TARGET ]; then
        IFS_TARGET="${MACHINE}-pc-linux-gnu"
        CFLAGS="-march=c3 -m3dnow -O2 -pipe -fomit-frame-pointer"
        CXXFLAGS="${CFLAGS}"
+       UCLIBC_TARGET=i386-pc-linux-uclibc
+       UCLIBC_LINKER=/ulib/ld-uClibc.so.0
+       UCLIBC_CFLAGS="-march=i386 -Os -pipe -fomit-frame-pointer"
 else
        beautify message FAIL
        echo "Not a valid target arch (i686|i586|i486|i386|via-c7|via-c3) - $TARGET"
@@ -127,6 +136,8 @@ IMAGES_DIR=/images
 # include machine in TOOLCHAINNAME
 TOOLCHAINNAME=$SNAME-$TOOLCHAINVERSION-toolchain-t${TARGET}-m${MACHINE}
 
+# The place where all uclibc files are stored in
+UCLIBC_DIR=/usr/${UCLIBC_TARGET}
 
 ###############################################################################
 #
@@ -365,6 +376,9 @@ entershell() {
                LINKER=$LINKER \
                TOOLS_DIR=$TOOLS_DIR \
                INSTALLER_DIR=$INSTALLER_DIR \
+               UCLIBC_DIR=$UCLIBC_DIR \
+               UCLIBC_TARGET=$UCLIBC_TARGET \
+               UCLIBC_LINKER=$UCLIBC_LINKER \
                MACHINE="$MACHINE" \
                MACHINE_REAL="$MACHINE_REAL" \
                CFLAGS="$CFLAGS" \
@@ -465,7 +479,7 @@ toolchain_make() {
 } # End of toolchain_make()
 
 ################################################################################
-# This is the function that builds every package in stage "base"                    #
+# This is the function that builds every package in stage "base" and "ipfire"  #
 ################################################################################
 ipfire_make() {
        lfsmakecommoncheck $*
@@ -481,6 +495,15 @@ ipfire_make() {
        if grep -qEi 'KERNEL_MOD = yes' $1 ; then
                unset EXTRA_MAKE
        fi
+       
+       local MYCFLAGS MYCXXFLAGS
+       if [ "${STAGE}" = "uclibc" ]; then
+               MYCFLAGS=${UCLIBC_CFLAGS}
+               MYCXXFLAGS=${UCLIBC_CFLAGS}
+       else
+               MYCFLAGS=${CFLAGS}
+               MYCXXFLAGS=${CXXFLAGS}
+       fi
 
        local PKG_TIME_START=`date +%s`
        chroot $LFS $TOOLS_DIR/bin/env -i \
@@ -503,10 +526,13 @@ ipfire_make() {
                INSTALLER_DIR=$INSTALLER_DIR \
                CDROM_DIR=$CDROM_DIR \
                IMAGES_DIR=$IMAGES_DIR \
+               UCLIBC_DIR=$UCLIBC_DIR \
+               UCLIBC_TARGET=$UCLIBC_TARGET \
+               UCLIBC_LINKER=$UCLIBC_LINKER \
                MACHINE="$MACHINE" \
                MACHINE_REAL="$MACHINE_REAL" \
-               CFLAGS="$CFLAGS" \
-               CXXFLAGS="$CXXFLAGS" \
+               CFLAGS="$MYCFLAGS" \
+               CXXFLAGS="$MYCXXFLAGS" \
                IFS_HOST="$IFS_HOST" \
                IFS_TARGET="$IFS_TARGET" \
                KVER=$KVER \
@@ -540,8 +566,9 @@ prepareenv() {
        mkdir -p $BASEDIR/log_${MACHINE}/02_base 2>/dev/null
        mkdir -p $BASEDIR/log_${MACHINE}/03_${SNAME} 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}/05_uclibc 2>/dev/null
+       mkdir -p $BASEDIR/log_${MACHINE}/06_installer 2>/dev/null
+       mkdir -p $BASEDIR/log_${MACHINE}/07_packages 2>/dev/null
   
        #############################################################################
        # Are we running the right shell?                                           #
@@ -666,21 +693,21 @@ prepareenv() {
        mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
 
        # Make all sources and proc available under lfs build
-       mount --bind /dev                                                                                                                                                                       $LFS/dev
-  mount --bind /proc                                                                                                                                                           $LFS/proc
-       mount --bind $BASEDIR/cache                                                                                                                             $LFS/usr/src/cache
-       mount --bind $BASEDIR/ccache                                                                                                                    $LFS/usr/src/ccache
-       mount --bind $BASEDIR/distcc                                                                                                                    $LFS/usr/src/distcc
-       mount --bind $BASEDIR/config                                                                                                                    $LFS/usr/src/config
-       mount --bind $BASEDIR/doc                                                                                                                                       $LFS/usr/src/doc
-       mount --bind $BASEDIR/lfs                                                                                                                                       $LFS/usr/src/lfs
-       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
+       mount --bind /dev                                       $LFS/dev
+       mount --bind /proc                                      $LFS/proc
+       mount --bind $BASEDIR/cache                             $LFS/usr/src/cache
+       mount --bind $BASEDIR/ccache                            $LFS/usr/src/ccache
+       mount --bind $BASEDIR/distcc                            $LFS/usr/src/distcc
+       mount --bind $BASEDIR/config                            $LFS/usr/src/config
+       mount --bind $BASEDIR/doc                               $LFS/usr/src/doc
+       mount --bind $BASEDIR/lfs                               $LFS/usr/src/lfs
+       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
 
        # Run LFS static binary creation scripts one by one
        export CCACHE_DIR=$BASEDIR/ccache
@@ -742,6 +769,9 @@ build() {
        beautify build_stage "Building miscellaneous"
        misc_build
 
+       beautify build_stage "Building uclibc"
+       uclibc_build
+
        beautify build_stage "Building installer"
        installer_build