[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 3/4] Fix i386 feature tests for '686' kernel flavour



Remove tests for specific vendor names and family numbers.  The '686'
flavour requires an FPU, TSC, CMPXCHG8 and CMOV instructions, so test
for the corresponding CPU flags.  It no longer requires the NOPL
instruction, which has now been entirely disabled (see #463606
and #464962).
---
These flag tests are based on the conditions in arch/x86/Kconfig.cpu and
the lack of MATH_EMULATION in the 686 config.  Unit tests pass.

Ben.

 debian/changelog |    1 +
 kernel/i386.sh   |   40 ++++++----------------------------------
 2 files changed, 7 insertions(+), 34 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 903389e..62b1325 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ base-installer (1.119) UNRELEASED; urgency=low
   [ Ben Hutchings ]
   * Fix i386 kernel package compatibility check: a suffix of '-pae' means
     the package is incompatible, just as '-bigmem' does
+  * Fix i386 feature tests for '686' kernel flavour
 
  -- Ben Hutchings <ben@decadent.org.uk>  Sun, 24 Apr 2011 22:21:08 +0100
 
diff --git a/kernel/i386.sh b/kernel/i386.sh
index e4303c6..99b3f98 100644
--- a/kernel/i386.sh
+++ b/kernel/i386.sh
@@ -66,40 +66,12 @@ arch_get_kernel_flavour () {
 		;;
 	esac
 
-	local VENDOR FAMILY MODEL
-	VENDOR=$(sed -n 's/^vendor_id\s*: //; T; p; q' "$CPUINFO")
-	FAMILY=$(sed -n 's/^cpu family\s*: //; T; p; q' "$CPUINFO")
-	MODEL=$(sed -n 's/^model\s*: //; T; p; q' "$CPUINFO")
-
-	case "$VENDOR" in
-	    AuthenticAMD*)
-		case "$FAMILY" in
-		    6|15|16|17|18|20)	echo 686 486 ;;
-		    *)			echo 486 ;;
-		esac
-		;;
-	    GenuineIntel)
-		case "$FAMILY" in
-		    6|15)	echo 686 486 ;;
-		    *)		echo 486 ;;
-		esac
-		;;
-	    CentaurHauls)
-		case "$FAMILY" in
-		    6)
-			case "$MODEL" in
-			    9|10|13)	echo 686 486 ;;
-			    *)		echo 486 ;;
-			esac
-			;;
-		    *)
-			echo 486 ;;
-		esac
-		;;
-	    *)
-		echo 486 ;;
-	esac
-	return 0
+	# Should we offer a 686 kernel?
+	if grep -q '^flags.*\bfpu\b.*\btsc\b.*\bcx8\b.*\bcmov\b' "$CPUINFO"; then
+		echo 686 486
+	else
+		echo 486
+	fi
 }
 
 arch_check_usable_kernel () {
-- 
1.7.4.4



Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: