diff -Naur cross-lfs-3.0.4.orig/patches/flex-2.5.31-yytext_ptr-1.patch cross-lfs-3.0.4/patches/flex-2.5.31-yytext_ptr-1.patch
--- cross-lfs-3.0.4.orig/patches/flex-2.5.31-yytext_ptr-1.patch	1970-01-01 01:00:00.000000000 +0100
+++ cross-lfs-3.0.4/patches/flex-2.5.31-yytext_ptr-1.patch	2003-09-02 09:28:34.000000000 +0200
@@ -0,0 +1,19 @@
+Submitted By: Matthew Burgess (matthew at linuxfromscratch dot org)
+Date: 2003-08-23
+Initial Package Version: 2.5.31
+Origin: James E. Jurach Jr.
+        (Bug 769192 at http://sourceforge.net/projects/lex)
+Description: Enables modutils-2.4.25 to compile without generating
+             the infamous error message as detailed in the FAQ and
+             archives.
+
+--- flex-2.5.31.orig/flex.skl	2003-03-31 19:51:38.000000000 -0600
++++ flex-2.5.31/flex.skl	2003-07-10 11:01:40.000000000 -0500
+@@ -3280,7 +3283,6 @@
+ #undef yy_set_bol
+ #undef yy_new_buffer
+ #undef yy_set_interactive
+-#undef yytext_ptr
+ #undef YY_DO_BEFORE_ACTION
+ 
+ #ifdef YY_DECL_IS_OURS
diff -Naur cross-lfs-3.0.4.orig/patches/gcc-3.4.2-posix-1.patch cross-lfs-3.0.4/patches/gcc-3.4.2-posix-1.patch
--- cross-lfs-3.0.4.orig/patches/gcc-3.4.2-posix-1.patch	1970-01-01 01:00:00.000000000 +0100
+++ cross-lfs-3.0.4/patches/gcc-3.4.2-posix-1.patch	2004-09-11 01:54:08.000000000 +0200
@@ -0,0 +1,233 @@
+Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
+Date: 2004-09-06
+Initial Package Version: 3.4.2
+Origin: Jim Gifford
+Upstream Status: Not Accepted - Alternative to be made
+Description: Fixes all POSIX issues
+ 
+diff -Naur gcc-3.4.2.orig/contrib/test_summary gcc-3.4.2/contrib/test_summary
+--- gcc-3.4.2.orig/contrib/test_summary	2004-08-26 05:49:13.000000000 +0000
++++ gcc-3.4.2/contrib/test_summary	2004-09-07 13:55:31.927020856 +0000
+@@ -106,7 +106,7 @@
+     srcdir = configflags;
+     sub(/\/configure .*/, "", srcdir);
+     printf "LAST_UPDATED: ";
+-    system("tail -1 " srcdir "/LAST_UPDATED");
++    system("tail -n 1 " srcdir "/LAST_UPDATED");
+     print "";
+ 
+     sub(/^[^ ]*\/configure */, " ", configflags);
+diff -Naur gcc-3.4.2.orig/gcc/configure gcc-3.4.2/gcc/configure
+--- gcc-3.4.2.orig/gcc/configure	2004-07-13 06:58:29.000000000 +0000
++++ gcc-3.4.2/gcc/configure	2004-09-07 13:55:32.022006416 +0000
+@@ -10127,7 +10127,7 @@
+   # and we got the correct data, then succeed.
+   if test x$gcc_cv_objdump != x \
+   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
+-     | tail -3 > conftest.got \
++     | tail -n 3 > conftest.got \
+   && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
+     || cmp conftest.big conftest.got > /dev/null 2>&1; }
+   then
+diff -Naur gcc-3.4.2.orig/gcc/configure.ac gcc-3.4.2/gcc/configure.ac
+--- gcc-3.4.2.orig/gcc/configure.ac	2004-07-13 06:58:29.000000000 +0000
++++ gcc-3.4.2/gcc/configure.ac	2004-09-07 13:55:32.050002160 +0000
+@@ -2018,7 +2018,7 @@
+   # and we got the correct data, then succeed.
+   if test x$gcc_cv_objdump != x \
+   && $gcc_cv_objdump -s -j .eh_frame conftest.o 2>/dev/null \
+-     | tail -3 > conftest.got \
++     | tail -n 3 > conftest.got \
+   && { cmp conftest.lit conftest.got > /dev/null 2>&1 \
+     || cmp conftest.big conftest.got > /dev/null 2>&1; }
+   then
+diff -Naur gcc-3.4.2.orig/libjava/acinclude.m4 gcc-3.4.2/libjava/acinclude.m4
+--- gcc-3.4.2.orig/libjava/acinclude.m4	2003-12-31 08:58:29.000000000 +0000
++++ gcc-3.4.2/libjava/acinclude.m4	2004-09-07 13:55:32.056001248 +0000
+@@ -250,8 +250,8 @@
+ AC_MSG_CHECKING(whether 'ld' is at least 2.13)
+ LD_PROG=`$CC --print-prog-name=ld`
+ LD_VERSION=`$LD_PROG --version`
+-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
++LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
++LD_VERSION_MINOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 2`
+ if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+   LD_OK="ok"
+ else
+diff -Naur gcc-3.4.2.orig/libjava/aclocal.m4 gcc-3.4.2/libjava/aclocal.m4
+--- gcc-3.4.2.orig/libjava/aclocal.m4	2004-09-06 23:31:35.000000000 +0000
++++ gcc-3.4.2/libjava/aclocal.m4	2004-09-07 13:55:32.082997144 +0000
+@@ -262,8 +262,8 @@
+ AC_MSG_CHECKING(whether 'ld' is at least 2.13)
+ LD_PROG=`$CC --print-prog-name=ld`
+ LD_VERSION=`$LD_PROG --version`
+-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
++LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
++LD_VERSION_MINOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 2`
+ if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+   LD_OK="ok"
+ else
+diff -Naur gcc-3.4.2.orig/libjava/configure gcc-3.4.2/libjava/configure
+--- gcc-3.4.2.orig/libjava/configure	2004-09-06 23:31:35.000000000 +0000
++++ gcc-3.4.2/libjava/configure	2004-09-07 13:55:32.162984984 +0000
+@@ -3015,8 +3015,8 @@
+ echo "configure:3016: checking whether 'ld' is at least 2.13" >&5
+ LD_PROG=`$CC --print-prog-name=ld`
+ LD_VERSION=`$LD_PROG --version`
+-LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+-LD_VERSION_MINOR=`echo "$LD_VERSION" | head -1 | cut -d '.' -f 2`
++LD_VERSION_MAJOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
++LD_VERSION_MINOR=`echo "$LD_VERSION" | head -n 1 | cut -d '.' -f 2`
+ if expr "$LD_VERSION_MAJOR" \> 2 > /dev/null; then
+   LD_OK="ok"
+ else
+diff -Naur gcc-3.4.2.orig/libstdc++-v3/acinclude.m4 gcc-3.4.2/libstdc++-v3/acinclude.m4
+--- gcc-3.4.2.orig/libstdc++-v3/acinclude.m4	2004-07-15 17:42:45.000000000 +0000
++++ gcc-3.4.2/libstdc++-v3/acinclude.m4	2004-09-07 13:55:33.453788752 +0000
+@@ -273,7 +273,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+   changequote(,)
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+   changequote([,])
+   glibcxx_gnu_ld_version=`echo $ldver | \
+diff -Naur gcc-3.4.2.orig/libstdc++-v3/aclocal.m4 gcc-3.4.2/libstdc++-v3/aclocal.m4
+--- gcc-3.4.2.orig/libstdc++-v3/aclocal.m4	2004-08-13 20:44:03.000000000 +0000
++++ gcc-3.4.2/libstdc++-v3/aclocal.m4	2004-09-07 13:55:33.487783584 +0000
+@@ -286,7 +286,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+   changequote(,)
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+   changequote([,])
+   glibcxx_gnu_ld_version=`echo $ldver | \
+diff -Naur gcc-3.4.2.orig/libstdc++-v3/configure gcc-3.4.2/libstdc++-v3/configure
+--- gcc-3.4.2.orig/libstdc++-v3/configure	2004-08-13 20:44:04.000000000 +0000
++++ gcc-3.4.2/libstdc++-v3/configure	2004-09-07 13:56:22.282365680 +0000
+@@ -7700,7 +7700,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -46876,7 +46876,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -65536,7 +65536,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -67674,7 +67674,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -69688,7 +69688,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -72414,7 +72414,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -74381,7 +74381,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -76247,7 +76247,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+@@ -79926,7 +79926,7 @@
+   # Start by getting the version number.  I think the libtool test already
+   # does some of this, but throws away the result.
+ 
+-  ldver=`$LD --version 2>/dev/null | head -1 | \
++  ldver=`$LD --version 2>/dev/null | head -n 1 | \
+          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
+ 
+   glibcxx_gnu_ld_version=`echo $ldver | \
+diff -Naur gcc-3.4.2.orig/libstdc++-v3/scripts/check_survey.in gcc-3.4.2/libstdc++-v3/scripts/check_survey.in
+--- gcc-3.4.2.orig/libstdc++-v3/scripts/check_survey.in	2003-07-05 06:00:05.000000000 +0000
++++ gcc-3.4.2/libstdc++-v3/scripts/check_survey.in	2004-09-07 13:55:32.171983616 +0000
+@@ -182,9 +182,9 @@
+     function size_command()
+     {
+       case $1 in
+-        TEXT)  TEXT=$(size -B $EXENAME | tail -1 | awk '{print $1}')  ;;
+-        DATA)  DATA=$(size -B $EXENAME | tail -1 | awk '{print $2}')  ;;
+-        SIZE)  SIZE=$(size -B $EXENAME | tail -1 | awk '{print $4}')  ;;
++        TEXT)  TEXT=$(size -B $EXENAME | tail -n 1 | awk '{print $1}')  ;;
++        DATA)  DATA=$(size -B $EXENAME | tail -n 1 | awk '{print $2}')  ;;
++        SIZE)  SIZE=$(size -B $EXENAME | tail -n 1 | awk '{print $4}')  ;;
+       esac
+     }
+   else
+diff -Naur gcc-3.4.2.orig/ltcf-c.sh gcc-3.4.2/ltcf-c.sh
+--- gcc-3.4.2.orig/ltcf-c.sh	2003-11-19 05:29:32.000000000 +0000
++++ gcc-3.4.2/ltcf-c.sh	2004-09-07 13:55:33.503781152 +0000
+@@ -153,7 +153,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
+diff -Naur gcc-3.4.2.orig/ltcf-gcj.sh gcc-3.4.2/ltcf-gcj.sh
+--- gcc-3.4.2.orig/ltcf-gcj.sh	2003-11-19 05:29:32.000000000 +0000
++++ gcc-3.4.2/ltcf-gcj.sh	2004-09-07 13:55:33.496782216 +0000
+@@ -156,7 +156,7 @@
+     # If the export-symbols file already is a .def file (1st line
+     # is EXPORTS), use it as is.
+     # If DATA tags from a recent dlltool are present, honour them!
+-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
++    archive_expsym_cmds='if test "x`head -n 1 $export_symbols`" = xEXPORTS; then
+         cp $export_symbols $output_objdir/$soname-def;
+       else
+         echo EXPORTS > $output_objdir/$soname-def;
diff -Naur cross-lfs-3.0.4.orig/patches/util-linux-2.12p-cramfs-1.patch cross-lfs-3.0.4/patches/util-linux-2.12p-cramfs-1.patch
--- cross-lfs-3.0.4.orig/patches/util-linux-2.12p-cramfs-1.patch	1970-01-01 01:00:00.000000000 +0100
+++ cross-lfs-3.0.4/patches/util-linux-2.12p-cramfs-1.patch	2004-12-26 01:59:00.000000000 +0100
@@ -0,0 +1,93 @@
+Submitted by: Jeremy Utley <jeremy@linuxfromscratch.org>
+Date: 2004-12-25
+Initial Package Version: 2.12p (should apply to versions back to at least k)
+Upstream Status: Not Submitted - Test Version
+Origin: Alexander Patrakov, adapted from debian build of cramfs utilities
+Description: Util-Linux fails in cramfs compilation due to changes in the
+linux-libc-headers package 2.6.9 and after.  This patch is a proper fix to the
+problem, but may in fact not be accepted upstream.
+
+
+diff -Naur util-linux-2.12p/disk-utils/fsck.cramfs.c util-linux-2.12p-new/disk-utils/fsck.cramfs.c
+--- util-linux-2.12p/disk-utils/fsck.cramfs.c	2004-12-11 14:53:16.000000000 +0000
++++ util-linux-2.12p-new/disk-utils/fsck.cramfs.c	2004-12-26 00:53:10.665199086 +0000
+@@ -76,16 +76,7 @@
+ 
+ #define PAD_SIZE 512
+ 
+-#include <asm/page.h>
+-#ifdef PAGE_SIZE
+-#define PAGE_CACHE_SIZE ((int) PAGE_SIZE)
+-#elif defined __ia64__
+-#define PAGE_CACHE_SIZE (16384)
+-#elif defined __alpha__
+-#define PAGE_CACHE_SIZE (8192)
+-#else
+-#define PAGE_CACHE_SIZE (4096)
+-#endif
++#define PAGE_CACHE_SIZE  page_size
+ 
+ /* Guarantee access to at least 8kB at a time */
+ #define ROMBUFFER_BITS	13
+@@ -95,11 +86,13 @@
+ static unsigned long read_buffer_block = ~0UL;
+ 
+ /* Uncompressing data structures... */
+-static char outbuffer[PAGE_CACHE_SIZE*2];
++static char *outbuffer;
+ z_stream stream;
+ 
+ #endif /* INCLUDE_FS_TESTS */
+ 
++static size_t page_size;
++
+ /* Input status of 0 to print help and exit without an error. */
+ static void usage(int status)
+ {
+@@ -464,9 +457,17 @@
+ 	int c;			/* for getopt */
+ 	int start = 0;
+ 
++	page_size = sysconf(_SC_PAGESIZE);
++	
+ 	if (argc)
+ 		progname = argv[0];
+ 
++	outbuffer = malloc(page_size * 2);
++	if (!outbuffer) {
++		fprintf(stderr, _("failed to allocate outbuffer\n"));
++		exit(8);
++	}
++
+ 	/* command line options */
+ 	while ((c = getopt(argc, argv, "hx:v")) != EOF) {
+ 		switch (c) {
+diff -Naur util-linux-2.12p/disk-utils/mkfs.cramfs.c util-linux-2.12p-new/disk-utils/mkfs.cramfs.c
+--- util-linux-2.12p/disk-utils/mkfs.cramfs.c	2004-12-11 14:56:01.000000000 +0000
++++ util-linux-2.12p-new/disk-utils/mkfs.cramfs.c	2004-12-26 00:53:10.666198928 +0000
+@@ -46,16 +46,8 @@
+ static const char *progname = "mkcramfs";
+ static int verbose = 0;
+ 
+-#ifdef __ia64__
+-#define PAGE_CACHE_SIZE (16384)
+-#elif defined __alpha__
+-#define PAGE_CACHE_SIZE (8192)
+-#else
+-#define PAGE_CACHE_SIZE (4096)
+-#endif
+-
+ /* The kernel assumes PAGE_CACHE_SIZE as block size. */
+-static unsigned int blksize = PAGE_CACHE_SIZE; /* settable via -b option */
++static unsigned int blksize;                   /* settable via -b option */
+ static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */
+ static int image_length = 0;
+ 
+@@ -730,6 +722,7 @@
+ 	u32 crc = crc32(0L, Z_NULL, 0);
+ 	int c;
+ 
++	blksize = sysconf(_SC_PAGESIZE);
+ 	total_blocks = 0;
+ 
+ 	if (argc) {
diff -Naur cross-lfs-3.0.4.orig/scripts/build-init.sh cross-lfs-3.0.4/scripts/build-init.sh
--- cross-lfs-3.0.4.orig/scripts/build-init.sh	2004-09-30 09:35:07.000000000 +0200
+++ cross-lfs-3.0.4/scripts/build-init.sh	2005-01-01 13:42:42.576097448 +0100
@@ -142,6 +142,7 @@
 
 
    echo "Unpacking ${archive}"
+   echo "${CAT} ${archive} | tar -xf - ${filelist}"
    ${CAT} ${archive} | tar -xf - ${filelist} 2> /dev/null &&
    echo " o ${1} unpacked successfully" ||
    {
diff -Naur cross-lfs-3.0.4.orig/scripts/cross-scripts/cross-gcc-final.sh cross-lfs-3.0.4/scripts/cross-scripts/cross-gcc-final.sh
--- cross-lfs-3.0.4.orig/scripts/cross-scripts/cross-gcc-final.sh	2004-09-30 11:19:37.000000000 +0200
+++ cross-lfs-3.0.4/scripts/cross-scripts/cross-gcc-final.sh	2004-12-27 17:40:49.000000000 +0100
@@ -124,6 +124,9 @@
 #  ${TOOLS}/lib64/ld-linux.so.2#
 # This sets --dynamic-linker correctly in the generated spec file
 
+cd ${SRC}/${PKGDIR}
+apply_patch gcc-3.4.2-posix-1
+
 cd ${SRC}/${PKGDIR}/gcc/config
 for hfile in ${dl_hfiles} ; do
    if [ -f ${hfile} ]; then
diff -Naur cross-lfs-3.0.4.orig/scripts/host-scripts/host-coreutils-binaries.sh cross-lfs-3.0.4/scripts/host-scripts/host-coreutils-binaries.sh
--- cross-lfs-3.0.4.orig/scripts/host-scripts/host-coreutils-binaries.sh	2004-07-30 06:09:20.000000000 +0200
+++ cross-lfs-3.0.4/scripts/host-scripts/host-coreutils-binaries.sh	2004-12-30 15:34:10.000000000 +0100
@@ -89,6 +89,7 @@
 
 echo " o Build OK" &&
 
+rm -rf ${HST_TOOLS}/bin/{echo,install,expr,cp,ln}
 cp -p src/echo ${HST_TOOLS}/bin/echo &&
 cp -p src/ginstall ${HST_TOOLS}/bin/install &&
 cp -p src/expr ${HST_TOOLS}/bin/expr &&
diff -Naur cross-lfs-3.0.4.orig/scripts/host-scripts/host-flex.sh cross-lfs-3.0.4/scripts/host-scripts/host-flex.sh
--- cross-lfs-3.0.4.orig/scripts/host-scripts/host-flex.sh	2004-07-30 06:09:20.000000000 +0200
+++ cross-lfs-3.0.4/scripts/host-scripts/host-flex.sh	2004-12-26 23:58:36.000000000 +0100
@@ -12,6 +12,10 @@
    2.5.31 )
       # Fix brokenness in flex-2.5.31
       apply_patch flex-2.5.31-debian_fixes-2
+      apply_patch flex-2.5.31-yytext_ptr-1
+      
+      #avoid rebuilding docu (needing help2man)
+      touch doc/flex.1
    ;;
 esac
 
diff -Naur cross-lfs-3.0.4.orig/scripts/native-scripts/native-util-linux.sh cross-lfs-3.0.4/scripts/native-scripts/native-util-linux.sh
--- cross-lfs-3.0.4.orig/scripts/native-scripts/native-util-linux.sh	2004-08-01 11:25:41.000000000 +0200
+++ cross-lfs-3.0.4/scripts/native-scripts/native-util-linux.sh	2004-12-30 14:00:34.000000000 +0100
@@ -25,6 +25,7 @@
    2.[56].* )
       #apply_patch util-linux-2.12-2.6.0hdr-fix
       apply_patch util-linux-2.12a-kernel_headers-1
+      apply_patch util-linux-2.12p-cramfs-1
    ;;
 esac
 
diff -Naur cross-lfs-3.0.4.orig/scripts/plfs-config-x86_64-native-20041226 cross-lfs-3.0.4/scripts/plfs-config-x86_64-native-20041226
--- cross-lfs-3.0.4.orig/scripts/plfs-config-x86_64-native-20041226	1970-01-01 01:00:00.000000000 +0100
+++ cross-lfs-3.0.4/scripts/plfs-config-x86_64-native-20041226	2004-12-30 13:58:17.000000000 +0100
@@ -0,0 +1,229 @@
+#!/bin/sh
+
+# plfs-config 
+
+# Build Options and Package Version Information
+#-----------------------------------------------
+# Version 2.4.4
+#
+# Last Modified
+#	By     :	$LastChangedBy$
+#	Date   :	$LastChangedDate$
+#	Rev No :	$LastChangedRevision$
+#
+
+#-----------------------------
+# Build configuration options
+#-----------------------------
+
+# Set LFS to suit your tree.
+# (ie the mountpoint where your final partition resides)
+export LFS=/mnt/lfs_lit
+
+# Set to where you will install the tools
+# that are to run on the host.
+# This will include the cross compiler
+export HST_TOOLS=/host-tools
+
+# Set this to the location where the target tools
+# are to be installed
+export TGT_TOOLS=/target-tools
+
+# Set SRC for your sourcedir, TARBALLS for where you store
+#  your tarballs
+
+export SRC=/usr/src
+export TARBALLS=/usr/src/cross-lfs/tarballs
+export PATCHES=/usr/src/cross-lfs/patches
+export SCRIPTS=/usr/src/cross-lfs/scripts
+export CONFIGS=/usr/src/cross-lfs/configs
+
+# Logging
+# Set for base of logging tree
+export LOGS=/usr/src/logs
+
+export CONFLOGS=${LOGS}/conflogs
+export BUILDLOGS=${LOGS}/buildlogs
+export INSTLOGS=${LOGS}/instlogs
+export TESTLOGS=${LOGS}/testlogs
+
+# Set your timezone and locale
+export TZ="Europe/Berlin"
+#export LC_ALL="de_DE"
+export LC_ALL="en_US"
+
+# Set your umask
+umask 0022
+
+#---------------
+# Cross Options
+#---------------
+
+# set to the target architecture
+export TGT_ARCH=x86_64
+# Set to the target architectures target-triple
+export TARGET=x86_64-pc-linux-gnu
+# TODO: This should be scripted via a case statement
+# NOTE: This is used during gcc's header mods for target
+#       ix86/x86_64 should be set to i386
+#       sparc64/sparc32 should be set to sparc 
+export ARCH=i386
+
+# set to the target-triple for the host we are building on
+# TODO: This should be set by uname
+export HOST=x86_64-pc-linux-gnu
+# This most of the time will be the same as ${HOST}
+export BUILD=${HOST}
+
+
+#---------------
+# Build Options
+#---------------
+
+# PARALLEL MAKE FLAGS
+#---------------------
+# Set to the desired level of parallelism.
+# eg PMFLAGS="-j 4"
+# If undesired, just set to an empty string.
+#
+export PMFLAGS=""
+
+# POSIX 200112L Compliance
+#--------------------------
+# Set to "Y" to fix all instances of deprecated command options
+# in unpacked packages when using coreutils binaries.
+# (should only be an issue when using cvs glibc > 20030404)
+export POSIX_CONFORM=N
+
+# KERNEL HEADERS
+#----------------
+# Set to "Y" to use sanitised headers for building userspace
+# against. Expects linux-libc-headers
+export USE_SANITISED_HEADERS=Y
+
+# GCC
+#-----
+# Change the following to Y if you would like
+# to build gcc without bootstrap for ch5 and 6
+# shared builds ( save a few cycles :-) )
+export NOBOOTSTRAP=N
+
+# Change the following to Y if you would like
+# to build the final gcc with version specific runtime libs.
+export USE_VER_SPEC_RT_LIBS=Y
+
+# Change the following to Y if you would like
+# to build the final gcc with a program suffix
+export USE_PROGRAM_SUFFIX=Y
+
+# Change the following to Y if you want to use the
+# Native Posix Thread Library instead of linuxthreads.
+export USE_NPTL=Y
+
+# Are we building a bi-arch toolchain
+#export BIARCH=Y
+export BIARCH=N
+
+# MISC
+#------
+# enable to build readline (and build bash against readline) for
+# target-native build
+export USE_READLINE=Y
+
+# BOOTLOADERS
+#-------------
+# set only one of the following to "Y"
+export USE_LILO=Y
+
+# DEVICES
+#---------
+# Choose method for handling devices.
+#
+# Build will default to using MAKEDEV if nothing is selected here.
+#
+# Set either UDEV to Y for utilising udev (2.5/2.6 kernels only)
+# or DEVFS to Y for using devfs (2.4 kernels, deprecated 2.5 and 2.6)
+#
+export UDEV=Y
+export DEVFS=N
+
+# There are 2 binutils listed here.
+# NATIVE_BINUTILS_VER is used only when building a native binutils
+# on a non linux system when BINUTILS_VER is non FSF (ie HJL)
+# This is sorted out at the end of this script.
+
+export AUTOCONF_VER=2.59         # chapter 6
+export AUTOMAKE_VER=1.9.4        # chapter 6
+export BASH_VER=3.0
+export BIN86_VER=0.16.16
+export BINUTILS_VER=2.15.94.0.2         # can be either FSF or HJL Binutils
+export BISON_VER=1.875a
+export BZIP2_VER=1.0.2
+export COREUTILS_VER=5.2.1
+export DEJAGNU_VER=1.4.4
+export DIFFUTILS_VER=2.8.7
+export E2FSPROGS_VER=1.35        # chapter 6
+export ED_VER=0.2                # chapter 6
+export EXPECT_VER=5.42.1
+export FILE_VER=4.12             # chapter 6
+export FINDUTILS_VER=4.2.10
+export FLEX_VER=2.5.31
+export GAWK_VER=3.1.4
+export GCC_VER=3.4-20041224
+export GETTEXT_VER=0.14.1
+export GLIBC_VER=20041018
+export GREP_VER=2.5.1a
+export GROFF_VER=1.19.1          # chapter 6
+export GZIP_VER=1.3.5
+export IANA_ETC_VER=1.03
+export INETUTILS_VER=1.4.2       # chapter 6
+export IPROUTE2_VER=2.6.9-041019
+export KBD_VER=1.12              # chapter 6
+export KERNEL_VER=2.6.10
+export LESS_VER=382              # chapter 6
+export LFS_BS_VER=3.0          # chapter 6
+export LIBTOOL_VER=1.5.10         # chapter 6
+export LILO_VER=22.6.1
+export LINUX_LIBC_HDRS_VER=2.6.9.1
+export M4_VER=1.4.2
+ export MAKEDEV_VER=1.7
+export MAKE_DEVICES_VER=1.2
+export MAKE_VER=3.80
+export MAN_VER=1.5n              # chapter 6
+export MODUTILS_VER=2.4.27       # chapter 6
+export MODINITTOOLS_VER=3.1      # chapter 6
+export NASM_VER=0.98.38
+export NATIVE_BINUTILS_VER=2.15.94.0.2  # FSF binutils versions only
+export NCURSES_VER=5.4
+export NETTOOLS_VER=1.60         # chapter 6
+export PATCH_VER=2.5.4
+export PERL_VER=5.8.6
+export PROCINFO_VER=18           # chapter 6
+export PROCPS_VER=3.2.4          # chapter 6
+export PSMISC_VER=21.5           # chapter 6
+export READLINE_VER=5.0
+export SED_VER=4.1.2
+export SHADOW_VER=4.0.6        # chapter 6
+export STRACE_VER=4.5.8
+export SYSKLOGD_VER=1.4.1        # chapter 6
+export SYSVINIT_VER=2.86         # chapter 6
+export TAR_VER=1.15
+export TCL_VER=8.5a2
+export TEXINFO_VER=4.7
+export UDEV_VER=050
+export UTILLINUX_VER=2.12p
+export VIM_VER=6.3               # chapter 6
+export ZLIB_VER=1.2.2
+
+# Sort out NATIVE_BINUTILS_VER for native builds
+hostos=`uname`
+if [ ! "${hostos}" = "Linux" ]; then
+   # Not linux, cannot use HJL
+   case ${BINUTILS_VER} in
+      *.90.0* )
+      ;;
+      * )
+         export NATIVE_BINUTILS_VER=${BINUTILS_VER}
+      ;;
+   esac
+fi
diff -Naur cross-lfs-3.0.4.orig/scripts/target-scripts/target-module-init-tools.sh cross-lfs-3.0.4/scripts/target-scripts/target-module-init-tools.sh
--- cross-lfs-3.0.4.orig/scripts/target-scripts/target-module-init-tools.sh	2004-10-13 10:27:22.000000000 +0200
+++ cross-lfs-3.0.4/scripts/target-scripts/target-module-init-tools.sh	2005-01-01 13:56:23.327324296 +0100
@@ -31,7 +31,7 @@
       >> ${LOGFILE} || barf
 fi
 
-make LDFLAGS="-s" \
+make DOCBOOKTOMAN="" LDFLAGS="-s" \
    >> ${LOGFILE} 2>&1 &&
 echo " o Build OK" &&
 
diff -Naur cross-lfs-3.0.4.orig/scripts/target-scripts/target-util-linux.sh cross-lfs-3.0.4/scripts/target-scripts/target-util-linux.sh
--- cross-lfs-3.0.4.orig/scripts/target-scripts/target-util-linux.sh	2004-07-30 06:09:22.000000000 +0200
+++ cross-lfs-3.0.4/scripts/target-scripts/target-util-linux.sh	2005-01-01 14:03:49.619477576 +0100
@@ -17,15 +17,9 @@
 
    # Patch to fix fdiskbsdlabel.h for m68k, also adds unistd.h to list
    # of includes for swapon.c
-   apply_patch util-linux-2.12a-cross-lfs-fixes
+   #apply_patch util-linux-2.12a-cross-lfs-fixes
 
-   case ${KERNEL_VER} in
-      2.[56].* )
-         # Fixes for utillinux 2.12 + 2.12a for building against 2.6
-         # kernel headers
-         apply_patch util-linux-2.12a-kernel_headers-1
-      ;;
-   esac
+   apply_patch util-linux-2.12p-cramfs-1
 
    ;;
 esac
@@ -57,11 +51,11 @@
 # Optimization defaults to -O2
 max_log_init Util-linux ${UTILLINUX_VER} "Final (shared)" ${CONFLOGS} ${LOG}
 export CC=${TARGET}-gcc
-#export CPU=${TGT_ARCH}
-export CPU=m68K
+export CPU=${TGT_ARCH}
+#export CPU=m68K
 # TODO: set arch intelligently...
-#export ARCH=intel
-export ARCH=m68k
+export ARCH=intel
+#export ARCH=m68k
 export DESTDIR=${LFS}
 
 ./configure \
