Merge branch 'next' into arm-port
[people/teissler/ipfire-2.x.git] / make.sh
diff --git a/make.sh b/make.sh
index 4fbbf0cba3848f67dd3de8ed12ecc336a7d738bd..1679d3293a9f07fde8592187e3a2722809e6a084 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -189,7 +189,11 @@ prepareenv() {
     set +h
     LC_ALL=POSIX
     if [ -z $MAKETUNING ]; then
-       MAKETUNING="-j6"
+        if [ "${MACHINE:0:3}" = "arm" ]; then
+            MAKETUNING="-j2"
+        else
+            MAKETUNING="-j6"
+        fi
     fi
     export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
     unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
@@ -243,15 +247,19 @@ buildtoolchain() {
 
     LOGFILE="$BASEDIR/log/_build.toolchain.log"
     export LOGFILE
-    ORG_PATH=$PATH
     NATIVEGCC=`gcc --version | grep GCC | awk {'print $3'}`
     export NATIVEGCC GCCmajor=${NATIVEGCC:0:1} GCCminor=${NATIVEGCC:2:1} GCCrelease=${NATIVEGCC:4:1}
+    ORG_PATH=$PATH
+    export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
     lfsmake1 ccache    PASS=1
     lfsmake1 make      PASS=1
     lfsmake1 binutils  PASS=1
     lfsmake1 gcc               PASS=1
-    export PATH=$BASEDIR/build/usr/local/bin:$BASEDIR/build/tools/bin:$PATH
-    lfsmake1 linux-libc-header
+    if [ "${MACHINE_TYPE}" = "arm" ]; then
+        lfsmake1 linux TOOLS=1 HEADERS=1
+    else
+        lfsmake1 linux-libc-header
+    fi
     lfsmake1 glibc
     lfsmake1 cleanup-toolchain PASS=1
     lfsmake1 tcl
@@ -287,7 +295,11 @@ buildbase() {
     LOGFILE="$BASEDIR/log/_build.base.log"
     export LOGFILE
     lfsmake2 stage2
-    lfsmake2 linux-libc-header
+    if [ "${MACHINE_TYPE}" = "arm" ]; then
+        lfsmake2 linux HEADERS=1
+    else
+        lfsmake2 linux-libc-header
+    fi
     lfsmake2 man-pages
     lfsmake2 glibc
     lfsmake2 cleanup-toolchain PASS=3
@@ -360,42 +372,53 @@ buildipfire() {
   ipfiremake xz
   ipfiremake linux-firmware
   ipfiremake zd1211-firmware
-  ipfiremake linux                     XEN=1
-  ipfiremake kqemu                     XEN=1
-  ipfiremake v4l-dvb                   XEN=1
-  ipfiremake madwifi                   XEN=1
-  ipfiremake mISDN                     XEN=1
-  ipfiremake dahdi                     XEN=1 KMOD=1
-  ipfiremake cryptodev                 XEN=1
-  ipfiremake compat-wireless           XEN=1
-  ipfiremake r8169                     XEN=1
-  ipfiremake r8168                     XEN=1
-  ipfiremake r8101                     XEN=1
-  ipfiremake e1000                     XEN=1
-  ipfiremake e1000e                    XEN=1
-  ipfiremake igb                       XEN=1
-  ipfiremake linux                     PAE=1
-  ipfiremake kqemu                     PAE=1
-  ipfiremake kvm-kmod                  PAE=1
-  ipfiremake v4l-dvb                   PAE=1
-  ipfiremake madwifi                   PAE=1
-  ipfiremake alsa                      PAE=1 KMOD=1
-  ipfiremake mISDN                     PAE=1
-  ipfiremake dahdi                     PAE=1 KMOD=1
-  ipfiremake cryptodev                 PAE=1
-  ipfiremake compat-wireless           PAE=1
-#  ipfiremake r8169                    PAE=1
-#  ipfiremake r8168                    PAE=1
-#  ipfiremake r8101                    PAE=1
-  ipfiremake e1000                     PAE=1
-  ipfiremake e1000e                    PAE=1
-  ipfiremake igb                       PAE=1
+  ipfiremake u-boot
+
+  # The xen and PAE kernels are only available for x86
+  if [ "${MACHINE_TYPE}" != "arm" ]; then
+    ipfiremake linux                   XEN=1
+    ipfiremake kqemu                   XEN=1
+    ipfiremake v4l-dvb                 XEN=1
+    ipfiremake madwifi                 XEN=1
+    ipfiremake mISDN                   XEN=1
+    ipfiremake dahdi                   XEN=1 KMOD=1
+    ipfiremake cryptodev                       XEN=1
+    ipfiremake compat-wireless         XEN=1
+    ipfiremake r8169                   XEN=1
+    ipfiremake r8168                   XEN=1
+    ipfiremake r8101                   XEN=1
+    ipfiremake e1000                   XEN=1
+    ipfiremake e1000e                  XEN=1
+    ipfiremake igb                     XEN=1
+    ipfiremake linux                   PAE=1
+    ipfiremake kqemu                   PAE=1
+    ipfiremake kvm-kmod                        PAE=1
+    ipfiremake v4l-dvb                 PAE=1
+    ipfiremake madwifi                 PAE=1
+    ipfiremake alsa                    PAE=1 KMOD=1
+    ipfiremake mISDN                   PAE=1
+    ipfiremake dahdi                   PAE=1 KMOD=1
+    ipfiremake cryptodev                       PAE=1
+    ipfiremake compat-wireless         PAE=1
+#    ipfiremake r8169                  PAE=1
+#    ipfiremake r8168                  PAE=1
+#    ipfiremake r8101                  PAE=1
+    ipfiremake e1000                   PAE=1
+    ipfiremake e1000e                  PAE=1
+    ipfiremake igb                     PAE=1
+  fi
+
+  # Default kernel build
   ipfiremake linux
+  ipfiremake v4l-dvb
   ipfiremake kqemu
   ipfiremake kvm-kmod
-  ipfiremake v4l-dvb
   ipfiremake madwifi
-  ipfiremake alsa                      KMOD=1
+  if [ "${MACHINE_TYPE}" = "arm" ]; then
+    #todo enable alsa driver in kernel config
+    ipfiremake alsa                    KMOD=1
+  fi
+  #undefined declaration in echo canceler try to fix later
   ipfiremake mISDN
   ipfiremake dahdi                     KMOD=1
   ipfiremake cryptodev
@@ -409,9 +432,6 @@ buildipfire() {
   ipfiremake pkg-config
   ipfiremake linux-atm
   ipfiremake cpio
-
-  installmake strip
-
   ipfiremake dracut
   ipfiremake expat
   ipfiremake gdbm
@@ -453,7 +473,7 @@ buildipfire() {
   ipfiremake arping
   ipfiremake beep
   ipfiremake bind
-  ipfiremake cdrtools
+  ipfiremake dvdrtools
   ipfiremake dnsmasq
   ipfiremake dosfstools
   ipfiremake reiserfsprogs
@@ -757,11 +777,13 @@ buildpackages() {
   $0 git log
 
   # Create images for install
-       ipfiremake cdrom ED=$IPFVER
+  ipfiremake cdrom ED=$IPFVER
 
   # Check if there is a loop device for building in virtual environments
-  if [ $BUILD_IMAGES == 1 ] &&  ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ]); then
-       ipfiremake usb-stick ED=$IPFVER
+  if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ]); then
+       if [ "${MACHINE_TYPE}" != "arm" ]; then
+               ipfiremake usb-stick ED=$IPFVER
+       fi
        ipfiremake flash-images ED=$IPFVER
   fi
 
@@ -915,8 +937,10 @@ downloadsrc)
                cd $BASEDIR/lfs
                for i in *; do
                        if [ -f "$i" -a "$i" != "Config" ]; then
-                               echo -ne "Loading $i"
-                               make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
+                               lfsmakecommoncheck ${i} || continue
+
+                               make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
+                                       MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
                                if [ $? -ne 0 ]; then
                                        beautify message FAIL
                                        FINISHED=0
@@ -932,7 +956,8 @@ downloadsrc)
        ERROR=0
        for i in *; do
                if [ -f "$i" -a "$i" != "Config" ]; then
-                       make -s -f $i LFS_BASEDIR=$BASEDIR MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
+                       make -s -f $i LFS_BASEDIR=$BASEDIR MACHINE=$MACHINE \
+                               MESSAGE="$i\t " md5 >> $LOGFILE 2>&1
                        if [ $? -ne 0 ]; then
                                echo -ne "MD5 difference in lfs/$i"
                                beautify message FAIL
@@ -958,7 +983,7 @@ toolchain)
        test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
        cd $BASEDIR && tar -zc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \
                build/{bin,etc,usr/bin,usr/local} \
-               build/tools/{bin,etc,*-linux-gnu,include,lib,libexec,sbin,share,var} \
+               build/tools/{bin,etc,*-linux-gnu*,include,lib,libexec,sbin,share,var} \
                log >> $LOGFILE
        md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.tar.gz \
                > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-$MACHINE.md5