]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/commitdiff
Made a function that checks if the host cpu has all functionalities we need.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Aug 2008 14:00:34 +0000 (16:00 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 13 Aug 2008 14:00:34 +0000 (16:00 +0200)
This is esp. important for the via cpus.

doc/make.sh-usage
tools/make-check
tools/make-include
tools/make-interactive

index 49a912f810e1d0fc08573873acc8fedf864b3aaa..29c71faf878eb2601aed0ac538e80cb5a443bc90 100644 (file)
@@ -27,4 +27,8 @@ Maintainer / advanced commands
       `-- export : Tar.bz2 the source code from revision.
 
      check     : _Run sanity checks_
-      `- --fix : Fix some errors automatically.
+      |          On every option you can use --fix
+      |          to fix some errors automatically.
+      |`-       cpu <flag> : Check cpu for flag.
+      |`- roofiles [--fix] : Check rootfiles for error.
+      `--   sanity [--fix] : Check full code for errors.
index a308c5b30e6acfeed76f68e6059b9313a8922d08..e15e74b3567becf706e910aa4b0e16f07da16bd6 100644 (file)
@@ -193,3 +193,10 @@ check_loop() {
        done
        return 1
 }
+
+CPU_FLAGS=$(grep ^flags /proc/cpuinfo)
+check_cpu() {
+       FLAG=$1;
+       grep -q $FLAG <<< $CPU_FLAGS
+       return $?
+}
index 11ac301dc9032e11c9fe3025bd1686030a5937fa..e67c9cb76ece8841ecf202bf6bfef52c0a1f0308 100644 (file)
@@ -198,7 +198,7 @@ stdumount() {
 exiterror() {
        stdumount
        dialogerror $*
-       build_spy error
+       build_spy error &
        touch $FAILED
        rm -f $RUNNING 2>/dev/null
        exit 1
@@ -466,11 +466,9 @@ prepareenv() {
        
        # Set SCHED_BATCH
        if [ -x /usr/bin/schedtool ]; then
-               echo -ne "Setting kernel schedular to SCHED_BATCH"
                /usr/bin/schedtool -B $$
-               if [ $? -eq 0 ]; then
-                       beautify message DONE
-               else
+               if [ $? -ne 0 ]; then
+                       echo -ne "Setting kernel schedular to SCHED_BATCH"
                        beautify message FAIL
                fi
        fi
@@ -478,30 +476,25 @@ prepareenv() {
        ##############################################################################
        # Checking if running as root user                                           #
        ##############################################################################
-       echo -ne "Checking if we're running as root user"
        if [ `id -u` != 0 ]; then
+               echo -ne "Checking if we're running as root user"
                beautify message FAIL
                exiterror "Not building as root"
-       else
-               beautify message DONE
        fi
 
 
        ##############################################################################
        # Checking for necessary temporary space                                     #
        ##############################################################################
-       echo -ne "Checking for necessary space on disk $BASE_DEV"
        BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
        BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
        if (( 2048000 > $BASE_ASPACE )); then
                BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
                if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
+                       echo -ne "Checking for necessary space on disk $BASE_DEV"
                        beautify message FAIL
                        exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
                fi
-               beautify message DONE
-       else
-               beautify message DONE
        fi
 
        ##############################################################################
@@ -545,6 +538,22 @@ prepareenv() {
 
        export EMB
 
+       ##############################################################################
+       # Checking CPU features                                                      #
+       ##############################################################################
+
+       CHECK_CPU=""
+       if [ 'via-c7' = $TARGET ]; then
+               CHECK_CPU="sse sse2 pne"
+       elif [ 'via-c3' = $TARGET ]; then
+               CHECK_CPU="3dnow"
+       fi
+
+       for flag in $CHECK_CPU; do
+               check_cpu $flag || \
+                       exiterror "Your system doesn't support needed cpu feature \"$flag\" to build target $TARGET."
+       done
+
        ##############################################################################
        # Building Linux From Scratch system configuration                           #
        ##############################################################################
@@ -618,7 +627,7 @@ build() {
        clear
        #a prebuilt toolchain package is only used if found in cache
        if [ ! -d $BASEDIR/cache ]; then
-               exiterror "Use make.sh downloadsrc first!"
+               exiterror "Use make.sh source get first!"
        fi
        cd $BASEDIR/cache/toolchains
        PACKAGE=`ls -v -r $TOOLCHAINNAME.tar.bz2 2> /dev/null | head -n 1`
@@ -630,7 +639,7 @@ build() {
        echo -ne "Building for ${BOLD}${TARGET} (${MACHINE}) on ${MACHINE_REAL}${NORMAL}\n"
 
        build_spy_send_profile &
-       build_spy compiling
+       build_spy compiling &
 
        if [ -f $BASEDIR/log_${MACHINE}/02_base/stage2-LFS ]; then
                prepareenv
index cad194f6fa70dfc14586cd1387a50a28ddbdf145..5ee0f2d904870f8912d74027bf37ce45d7057e98 100644 (file)
@@ -21,6 +21,7 @@
 
 usage() {
        cat doc/make.sh-usage
+       exit 1
 }
 
 case "$1" in
@@ -152,7 +153,27 @@ target)
        ;;
 
 check)
-       check_sanity $2
+       case "$2" in
+               cpu)
+                       [ -z "$3" ] && usage
+                       if check_cpu $3; then
+                               echo -n "CPU has flag $3"
+                               beautify message DONE
+                       else
+                               dialogerror "CPU hasn't got flag $3"
+                               exit 1
+                       fi
+                       ;;
+               rootfiles)
+                       check_rootfiles $3
+                       ;;
+               sanity)
+                       check_sanity $3
+                       ;;
+               *)
+                       usage
+                       ;;
+       esac
        ;;
 
 g[iu]t)