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

Bug#239281: Another implementation for selecting right kernel for x86 cpu



On Sun, Mar 21, 2004 at 08:39:22PM -0800, Matt Kraai wrote:
> On Mon, Mar 22, 2004 at 01:34:34AM +0100, Frans Pop wrote:
>
> I've just fixed this in the repository.

I was working on another implementation. I just finished it.

It uses /proc/cpuinfo, but it uses vendor_id and cpu family instead of
model name. It has the advantages of being more precise and more
generic.

It supports a lot of Intel and Amd model, and it will be easy to add
other models.

I tested it with a lot of cpuinfo available from internet and I used
also the db from Gentoo poll.

I can provide more explanations if you want. I think this patch will
close some bugs on base-installer (every bugs which says that the wrong
kernel was selected for intel and amd cpu).

The only bug from my implementation is that there is no more -586tsc for
2.6.x kernels.

Thanks for reviewing this patch and for applying it if it fits.


-- 
Thomas Poindessous

Index: postinst
===================================================================
--- postinst	(revision 11701)
+++ postinst	(working copy)
@@ -223,28 +223,41 @@
 	i386*)
 		version=2.4
 		MODEL=`grep 'model name' /proc/cpuinfo | cut -d: -f2`
+		VENDOR=`grep '^vendor_id' /proc/cpuinfo | cut -d: -f2`
+		FAMILY=`grep '^cpu family' /proc/cpuinfo | cut -d: -f2`
 		if dmesg | grep -q ^Processors:; then
 			SMP=yes
 		else
 			SMP=no
 		fi
-		case "$MODEL" in 
-		" Intel(R) Pentium(R) [4M]"*|" Pentium II "*|" Pentium III "*)
-			if test $SMP = no; then
-				trykernel=kernel-image-$version-686
-			else
-				trykernel=kernel-image-$version-686-smp
-			fi
-		;;
-	    	" AMD Athlon(tm) "*|" AMD Duron(tm) "*)
-			if test $SMP = no; then
+		case "$VENDOR" in 
+		" AuthenticAMD"*)
+			if test "$FAMILY" = " 6"; then
+			    if test $SMP = no; then
 				trykernel=kernel-image-$version-k7
-			else
+			    else
 				trykernel=kernel-image-$version-k7-smp
+			    fi
+			elif test "$FAMILY" = " 5"; then
+			    trykernel=kernel-image-$version-k6
 			fi
 		;;
-	    	" AMD-K6(tm) "*)
-			trykernel=kernel-image-$version-k6
+		" GenuineIntel"*)
+			if test "$FAMILY" = " 6"; then
+			    if test $SMP = no; then
+				trykernel=kernel-image-$version-686
+			    else
+				trykernel=kernel-image-$version-686-smp
+			    fi
+			elif test "$FAMILY" = " 15"; then
+			    if test $SMP = no; then
+				trykernel=kernel-image-$version-686
+			    else
+				trykernel=kernel-image-$version-686-smp
+			    fi
+			elif test "$FAMILY" = " 5"; then
+			    trykernel=kernel-image-$version-586tsc
+			fi
 		;;
 		*)
 			trykernel=kernel-image-$version-386

Reply to: