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

Re: [PATCH/RFC] Re: Kernel selection on i386 for Xen compatibility



v2 patch is below.

changes since last time:
      * I have tested this now in the installer environment proper as
        well as checking that it passes self tests.
      * Only exports the kernel flavour to kernel.sh, not the complete
        version string.
      * Recognises k7-bigmem and select 686-bigmem as the appropriate
        kernel. (shouldn't/couldn't k7 support be completely deprecated
        these days?) A new test case is included for this case.
      * Got rid of unused $PAE.

Cheers,
Ian.

Index: kernel/README
===================================================================
--- kernel/README	(revision 53021)
+++ kernel/README	(working copy)
@@ -61,6 +61,8 @@
     The major version of the running kernel, e.g. 2.6.
   KERNEL_VERSION
     The full version of the running kernel, e.g. 2.6.8.
+  KERNEL_FLAVOUR
+    The flavour of the running kernel, e.g. 486, 686-bigmem or ixp4xx.
   MACHINE
     The machine hardware name (as returned by uname -m).
   NUMCPUS
Index: kernel/i386.sh
===================================================================
--- kernel/i386.sh	(revision 53021)
+++ kernel/i386.sh	(working copy)
@@ -2,16 +2,24 @@
 	VENDOR=`grep '^vendor_id' "$CPUINFO" | head -n1 | cut -d: -f2`
 	FAMILY=`grep '^cpu family' "$CPUINFO" | head -n1 | cut -d: -f2`
 	MODEL=`grep '^model[[:space:]]*:' "$CPUINFO" | head -n1 | cut -d: -f2`
+
+	if grep '^flags' "$CPUINFO" | grep -q pae ; then
+	    case "$KERNEL_FLAVOUR" in
+		686-bigmem*) BIGMEM="-bigmem" ;;
+		*) ;;
+	    esac
+        fi
+
 	case "$VENDOR" in
 	    " AuthenticAMD"*)
 		case "$FAMILY" in
-		    " 6"|" 15")	echo k7 ;;
+		    " 6"|" 15") echo k7$BIGMEM ;;
 		    *)		echo 486 ;;
 		esac
 		;;
 	    " GenuineIntel")
 		case "$FAMILY" in
-		    " 6"|" 15")	echo 686 ;;
+		    " 6"|" 15")	echo 686$BIGMEM ;;
 		    *)		echo 486 ;;
 		esac
 		;;
@@ -19,7 +27,7 @@
 		case "$FAMILY" in
 		    " 6")
 			case "$MODEL" in
-			    " 9"|" 10")	echo 686 ;;
+			    " 9"|" 10")	echo 686$BIGMEM ;;
 			    *)		echo 486 ;;
 			esac
 			;;
@@ -39,8 +47,8 @@
 	if echo "$1" | grep -Eq -- "-486(-.*)?$"; then return 0; fi
 	if [ "$2" = 486 ]; then return 1; fi
 	if echo "$1" | grep -Eq -- "-686(-.*)?$"; then return 0; fi
-	if [ "$2" = 686 ]; then return 1; fi
-	if [ "$2" = k7 ]; then
+	if [ "$2" = 686 ] || [ "$2" = 686-bigmem ]; then return 1; fi
+	if [ "$2" = k7 ] || [ "$2" = k7-bigmem ] ; then
 		if echo "$1" | grep -Eq -- "-k7(-.*)?$"; then return 0; fi
 		return 1
 	fi
@@ -53,11 +61,21 @@
 arch_get_kernel () {
 	imgbase=linux-image
 
+	if [ "$1" = k7-bigmem ]; then
+		echo "$imgbase-$KERNEL_MAJOR-686-bigmem"
+		set k7
+	fi
+
 	if [ "$1" = k7 ]; then
 		echo "$imgbase-$KERNEL_MAJOR-k7"
 		set 486
 	fi
 
+	if [ "$1" = 686-bigmem ]; then
+		echo "$imgbase-$KERNEL_MAJOR-686-bigmem"
+		set 686
+	fi
+
 	if [ "$1" = 686 ]; then
 		echo "$imgbase-$KERNEL_MAJOR-686"
 		set 486
Index: kernel/tests/i386/cittagazze-bigmem.test
===================================================================
--- kernel/tests/i386/cittagazze-bigmem.test	(revision 0)
+++ kernel/tests/i386/cittagazze-bigmem.test	(revision 0)
@@ -0,0 +1,17 @@
+cpuinfo cittagazze.cpuinfo
+majors 2.6
+flavour k7-bigmem
+kernel-2.6 \
+  linux-image-2.6-686-bigmem \
+  linux-image-2.6-k7 \
+  linux-image-2.6-486
+usable \
+  linux-image-2.6-486 \
+  linux-image-2.6-686 \
+  linux-image-2.6-686-bigmem \
+  linux-image-2.6-k7 \
+  linux-image-2.6.18-1-486 \
+  linux-image-2.6.18-1-686 \
+  linux-image-2.6.18-1-686-bigmem \
+  linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 686-bigmem
Index: kernel/tests/i386/cittagazze.test
===================================================================
--- kernel/tests/i386/cittagazze.test	(revision 53021)
+++ kernel/tests/i386/cittagazze.test	(working copy)
@@ -13,3 +13,4 @@
   linux-image-2.6.18-1-686 \
   linux-image-2.6.18-1-686-bigmem \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/via-c7-Samuel.test
===================================================================
--- kernel/tests/i386/via-c7-Samuel.test	(revision 53021)
+++ kernel/tests/i386/via-c7-Samuel.test	(working copy)
@@ -15,3 +15,4 @@
   linux-image-2.6.18-1-686-bigmem \
   linux-image-2.6.18-1-686 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/via-c7-Esther.test
===================================================================
--- kernel/tests/i386/via-c7-Esther.test	(revision 53021)
+++ kernel/tests/i386/via-c7-Esther.test	(working copy)
@@ -16,3 +16,4 @@
 unusable \
   linux-image-2.6-k7 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/oqo1.test
===================================================================
--- kernel/tests/i386/oqo1.test	(revision 53021)
+++ kernel/tests/i386/oqo1.test	(working copy)
@@ -14,3 +14,4 @@
   linux-image-2.6.18-1-686-bigmem \
   linux-image-2.6.18-1-686 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/pentium-3.test
===================================================================
--- kernel/tests/i386/pentium-3.test	(revision 53021)
+++ kernel/tests/i386/pentium-3.test	(working copy)
@@ -15,3 +15,4 @@
 unusable \
   linux-image-2.6-k7 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/pentium-d-2p.test
===================================================================
--- kernel/tests/i386/pentium-d-2p.test	(revision 53021)
+++ kernel/tests/i386/pentium-d-2p.test	(working copy)
@@ -15,3 +15,4 @@
 unusable \
   linux-image-2.6-k7 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/pentium.test
===================================================================
--- kernel/tests/i386/pentium.test	(revision 53021)
+++ kernel/tests/i386/pentium.test	(working copy)
@@ -15,3 +15,4 @@
   linux-image-2.6.18-1-686-bigmem \
   linux-image-2.6.18-1-686 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: kernel/tests/i386/pentium-4M-bigmem.test
===================================================================
--- kernel/tests/i386/pentium-4M-bigmem.test	(revision 0)
+++ kernel/tests/i386/pentium-4M-bigmem.test	(revision 0)
@@ -0,0 +1,20 @@
+cpuinfo pentium-4M.cpuinfo
+machine i686
+majors 2.6
+flavour 686-bigmem
+env SPEAKUP /nonexistent
+kernel-2.6 \
+  linux-image-2.6-686-bigmem \
+  linux-image-2.6-686 \
+  linux-image-2.6-486
+usable \
+  linux-image-2.6-486 \
+  linux-image-2.6-686 \
+  linux-image-2.6-686-bigmem \
+  linux-image-2.6.18-1-486 \
+  linux-image-2.6.18-1-686 \
+  linux-image-2.6.18-1-686-bigmem
+unusable \
+  linux-image-2.6-k7 \
+  linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 686-bigmem
Index: kernel/tests/i386/pentium-4M.test
===================================================================
--- kernel/tests/i386/pentium-4M.test	(revision 53021)
+++ kernel/tests/i386/pentium-4M.test	(working copy)
@@ -16,3 +16,4 @@
 unusable \
   linux-image-2.6-k7 \
   linux-image-2.6.18-1-k7
+env KERNEL_FLAVOUR 486
Index: library.sh
===================================================================
--- library.sh	(revision 53021)
+++ library.sh	(working copy)
@@ -17,6 +17,7 @@
 KERNEL_MAJOR="$(uname -r | cut -d . -f 1,2)"
 KERNEL_VERSION="$(uname -r | cut -d - -f 1)"
 KERNEL_ABI="$(uname -r | cut -d - -f 1,2)"
+KERNEL_FLAVOUR=$(uname -r | cut -d - -f 3-)
 MACHINE="$(uname -m)"
 NUMCPUS=$(cat /var/numcpus 2>/dev/null) || true
 CPUINFO=/proc/cpuinfo

-- 
Ian Campbell

Earth -- mother of the most beautiful women in the universe.
		-- Apollo, "Who Mourns for Adonais?" stardate 3468.1

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


Reply to: