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

Re: archdetect guessing on arm* != armel



On Fri, 2014-01-03 at 04:00 +0000, Dimitri John Ledkov wrote:
> Hey Ian,
> 
> I wonder if I see some mid-air collision =)

It looks like we are working along the same lines, so no harm done.

> I am not sure, so not to waste everyone elses time, maybe you can take
> a look at the current ubuntu proposed patches to see how they are
> similar or different to your proposals.

I guess "not to waste everyone elses time" is why the CCs were dropped?
Having written my response I think it would be useful to share with the
list so I've added them back. I hope that is OK.

I also Bcc'd the folks who I originally CC'd so they don't wonder what
happened. Although I expect are on one of the two lists anyway so
wouldn't miss it.

> I've opened your gitorious page which informed me that created
> repositories are empty?! =) Is is all fully / correctly pushed?

libdebian-installer.git should have been OK, but it seems like the lack
of a master branch makes the webui for selecting non-default branches
fail to appear. There was a direct link in the "Activities" list for use
ijc which was to:
https://gitorious.org/ijc-debian/libdebian-installer/commits/4b3ba870c86242a280e2e746544efdb2c8032928
plus I've just pushed a dummy master branch to keep it happy.

When I went to create base-installer.git yesterday there was some sort
of server error, I'm stuck in a loop on "Your new repository is being
created". I've mailed their support alias as they requested.

In the meantime the 3 patches to that repo are appended.

> The patches for armel(symlinked as armhf)/arm64 that have been
> recently proposed look like following:
> https://bugs.launchpad.net/ubuntu/+source/base-installer/+bug/1263756
> https://code.launchpad.net/~dannf/ubuntu/trusty/base-installer/arm64+calxeda-subarches/+merge/199977

I think Dann has already pushed the libdebian-installer bits to Debian.

> Which is:
> - for arm64 just return generic

Eventually this should detect and report "efi" as well. Given the
general intention in the ecosystem to use efi on arm64 this should
perhaps even become the default.

I think there is little value in symlinking subarch-arm64-linux.c to the
32 bit arm ones -- really it just needs to statically return "generic"
and not do all the DT/cpuinfo parsing and matching etc, which is the
bulk of the 32 bit version.

Maybe there will be some code to share if we add efi support to armhf
too -- but more likely the efi detection in subarch-x86-linux.c should
be refactored into a helper which they can all use.

> - for armel/armhf majority of subarches just return generic

Ack. Where on armhf "majority" includes "all new subarches".

> - for armhf, calxeda - subarch midway return generic-lpae
> - for armhf, calxeda - subarch highbank return generic

These two shouldn't be necessary. Both should report "generic" and the
selection of armmp vs. armmp-lpae (s/armmp/generic/g in Ubuntu?) should
be done in base-installer.git/kernel/armhf.sh by
inspecting /proc/cpuinfo for the lpae feature. Otherwise we will need to
enumerate every platform/processor which supports LPAE, which would be
very tedious.

I've got the cpuinfo based stuff in my tree/patches appended below
(heavily based on the equivalent x86 code), it seems to work in the test
suite I added but for some reason the installer is still picking armmp
to actually install. Probably the order of something needs reversing...

So, I think the specific detection of midway and highbank (and the virt
flavour, and arm64 xgene & foundation model) should be removed from the
lists and rely on the fallback return "generic".

(https://code.launchpad.net/~dannf/ubuntu/trusty/base-installer/arm64
+calxeda-subarches/+merge/199977 seems to add highbank and midwap
(/lpae) suport to armel rather than armhf -- that seems odd to me given
that they are hardfloat capable systems, is this just some Ubuntu
oddity)

> I do hope going forward it will be mostly: ! calxeda-midway ! ads,
> return generic. Or some such.
> 
> But doesn't above indicate that some subarch handling is still needed?

I think not given that lpae vs !lpae can be detected via cpuinfo.

> Or can generic-lpae / generic / ads (not sure what's that) kernel
> flavors be merged?

generic^Warmmp-lpae and generic^Warmmp cannot be merged because lpae
address extensions are a static compile time choice -- the page table
entries are different sizes. I principal you could handle this
dynamically (AIUI netware did on x86) but in reality there would be
loads of complexity (boot time patching) and/or overhead (select right
function on every PT update) for not very much gain. We have two
flavours on 32-bit x86 for the same reason.

I don't know what ads is/was but it is armel not armhf and I think for
the most part we should just leave the subarch stuff as is on armel. (At
least for now, probably forever).

Ian.

----- Patches to base-installer.git ------

From ffdd885d2f17ff3f599df3e2b4055a500331f41a Mon Sep 17 00:00:00 2001
From: Ian Campbell <ijc@hellion.org.uk>
Date: Thu, 3 Oct 2013 20:04:51 +0100
Subject: [PATCH 1/3] armhf: Select armp kernel when appropriate.

For $SUBARCH == "generic" simply return "armmp".

For $SUBARCH other than "generic" return both the subarch (which will
correspond to a kernel flavour in Wheezy and earlier) and armmp. This means
that the installer should still be usable for installing Wheezy (and perhaps
earlier).

Better support multiple kernel flavours (code cribbed from i386). Extend test
suite with an example of a "generic" machine.
---
 debian/changelog                          |    7 +++++
 kernel/armhf.sh                           |   33 ++++++++++++++++------
 kernel/tests/armhf/efikamx.test           |    8 ++++--
 kernel/tests/armhf/highbank.cpuinfo       |   24 ++++++++++++++++
 kernel/tests/armhf/highbank.test          |   19 +++++++++++++
 kernel/tests/armhf/midway-no-lpae.cpuinfo |   43 +++++++++++++++++++++++++++++
 kernel/tests/armhf/midway-no-lpae.test    |   19 +++++++++++++
 kernel/tests/armhf/midway.cpuinfo         |   43 +++++++++++++++++++++++++++++
 kernel/tests/armhf/vexpress.test          |    8 ++++--
 kernel/tests/dotest                       |    3 ++
 kernel/tests/runtests                     |    7 +++--
 11 files changed, 197 insertions(+), 17 deletions(-)
 create mode 100644 kernel/tests/armhf/highbank.cpuinfo
 create mode 100644 kernel/tests/armhf/highbank.test
 create mode 100644 kernel/tests/armhf/midway-no-lpae.cpuinfo
 create mode 100644 kernel/tests/armhf/midway-no-lpae.test
 create mode 100644 kernel/tests/armhf/midway.cpuinfo

diff --git a/debian/changelog b/debian/changelog
index 747369c..628d33b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+base-installer (1.141) UNRELEASED; urgency=low
+
+  * Support armmp kernel flavour on armhf. Select it for mx5 and vexpress as
+    well as any generic platform.
+
+ -- Ian Campbell <ijc@hellion.org.uk>  Thu, 02 Jan 2014 15:11:07 +0000
+
 base-installer (1.140) unstable; urgency=medium
 
   [ Aurelien Jarno ]
diff --git a/kernel/armhf.sh b/kernel/armhf.sh
index 99e6dce..469951c 100644
--- a/kernel/armhf.sh
+++ b/kernel/armhf.sh
@@ -1,7 +1,10 @@
 arch_get_kernel_flavour () {
 	case "$SUBARCH" in
 	    mx5|vexpress)
-		echo "$SUBARCH"
+		echo "$SUBARCH armmp"
+		return 0 ;;
+	    generic)
+		echo "armmp"
 		return 0 ;;
 	    *)
 		warning "Unknown $ARCH subarchitecture '$SUBARCH'."
@@ -10,19 +13,31 @@ arch_get_kernel_flavour () {
 }
 
 arch_check_usable_kernel () {
-	# Subarchitecture must match exactly
-	if echo "$1" | grep -Eq -- "-$2(-.*)?$"; then return 0; fi
-	return 1
+        local NAME="$1"
+
+        set -- $2
+        while [ $# -ge 1 ]; do
+                case "$NAME" in
+                    *-"$1" | *-"$1"-*)
+                        # Allow any other hyphenated suffix
+                        return 0
+                        ;;
+                esac
+                shift
+        done
+        return 1
 }
 
 arch_get_kernel () {
 	case "$KERNEL_MAJOR" in
 	    2.6|3.*)
-		case "$1" in
-		    *)
-			echo "linux-image-$1"
-			;;
-		esac
+		imgbase="linux-image"
+
+		set -- $1
+		while [ $# -ge 1 ]; do
+			echo "$imgbase-$1"
+			shift
+		done
 		;;
 	    *)	warning "Unsupported kernel major '$KERNEL_MAJOR'."
 		;;
diff --git a/kernel/tests/armhf/efikamx.test b/kernel/tests/armhf/efikamx.test
index 43fabb5..f0d3601 100644
--- a/kernel/tests/armhf/efikamx.test
+++ b/kernel/tests/armhf/efikamx.test
@@ -1,11 +1,13 @@
 subarch mx5
 cpuinfo efikamx.cpuinfo
 majors 2.6
-flavour mx5
-kernel-2.6 linux-image-mx5
+flavour mx5 armmp
+kernel-2.6 linux-image-mx5 linux-image-armmp
 usable \
   linux-image-mx5 \
-  linux-image-2.6.38-4-mx5
+  linux-image-2.6.38-4-mx5 \
+  linux-image-armmp \
+  linux-image-2.6.38-4-armmp
 unusable \
   linux-image-iop32x \
   linux-image-netwinder \
diff --git a/kernel/tests/armhf/highbank.cpuinfo b/kernel/tests/armhf/highbank.cpuinfo
new file mode 100644
index 0000000..37a7baa
--- /dev/null
+++ b/kernel/tests/armhf/highbank.cpuinfo
@@ -0,0 +1,24 @@
+~$ cat /proc/cpuinfo
+Processor       : ARMv7 Processor rev 0 (v7l)
+processor       : 0
+BogoMIPS        : 2190.54
+
+processor       : 1
+BogoMIPS        : 2190.54
+
+processor       : 2
+BogoMIPS        : 2190.54
+
+processor       : 3
+BogoMIPS        : 2190.54
+
+Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls 
+CPU implementer : 0x41
+CPU architecture: 7
+CPU variant     : 0x3
+CPU part        : 0xc09
+CPU revision    : 0
+
+Hardware        : Highbank
+Revision        : 0000
+Serial          : 0000000000000000
\ No newline at end of file
diff --git a/kernel/tests/armhf/highbank.test b/kernel/tests/armhf/highbank.test
new file mode 100644
index 0000000..9313647
--- /dev/null
+++ b/kernel/tests/armhf/highbank.test
@@ -0,0 +1,19 @@
+subarch generic
+cpuinfo highbank.cpuinfo
+majors 3.10
+flavour armmp
+kernel-3.10 \
+  linux-image-armmp
+usable \
+  linux-image-armmp \
+  linux-image-3.10-3-armmp
+unusable \
+  linux-image-iop32x \
+  linux-image-netwinder \
+  linux-image-orion5x \
+  linux-image-rpc \
+  linux-image-s3c2410 \
+  linux-image-ixp4xx \
+  linux-image-kirkwood \
+  linux-image-mx5 \
+  linux-image-vexpress
diff --git a/kernel/tests/armhf/midway-no-lpae.cpuinfo b/kernel/tests/armhf/midway-no-lpae.cpuinfo
new file mode 100644
index 0000000..c38eff0
--- /dev/null
+++ b/kernel/tests/armhf/midway-no-lpae.cpuinfo
@@ -0,0 +1,43 @@
+processor	: 0
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 1
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 2
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 3
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+Hardware	: Highbank
+Revision	: 0000
+Serial		: 0000000000000000
diff --git a/kernel/tests/armhf/midway-no-lpae.test b/kernel/tests/armhf/midway-no-lpae.test
new file mode 100644
index 0000000..9641df5
--- /dev/null
+++ b/kernel/tests/armhf/midway-no-lpae.test
@@ -0,0 +1,19 @@
+subarch generic
+cpuinfo midway-no-lpae.cpuinfo
+majors 3.10
+flavour armmp
+kernel-3.10 \
+  linux-image-armmp
+usable \
+  linux-image-armmp \
+  linux-image-3.10-3-armmp
+unusable \
+  linux-image-iop32x \
+  linux-image-netwinder \
+  linux-image-orion5x \
+  linux-image-rpc \
+  linux-image-s3c2410 \
+  linux-image-ixp4xx \
+  linux-image-kirkwood \
+  linux-image-mx5 \
+  linux-image-vexpress
diff --git a/kernel/tests/armhf/midway.cpuinfo b/kernel/tests/armhf/midway.cpuinfo
new file mode 100644
index 0000000..1faf03e
--- /dev/null
+++ b/kernel/tests/armhf/midway.cpuinfo
@@ -0,0 +1,43 @@
+processor	: 0
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 1
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 2
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+processor	: 3
+model name	: ARMv7 Processor rev 2 (v7l)
+BogoMIPS	: 300.00
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+CPU implementer	: 0x41
+CPU architecture: 7
+CPU variant	: 0x3
+CPU part	: 0xc0f
+CPU revision	: 2
+
+Hardware	: Highbank
+Revision	: 0000
+Serial		: 0000000000000000
diff --git a/kernel/tests/armhf/vexpress.test b/kernel/tests/armhf/vexpress.test
index 54c8996..d84bd4b 100644
--- a/kernel/tests/armhf/vexpress.test
+++ b/kernel/tests/armhf/vexpress.test
@@ -1,11 +1,13 @@
 subarch vexpress
 cpuinfo vexpress.cpuinfo
 majors 2.6
-flavour vexpress
-kernel-2.6 linux-image-vexpress
+flavour vexpress armmp
+kernel-2.6 linux-image-vexpress linux-image-armmp
 usable \
   linux-image-vexpress \
-  linux-image-3.2.0-4-vexpress
+  linux-image-3.2.0-4-vexpress \
+  linux-image-armmp \
+  linux-image-3.2.0-4-armmp
 unusable \
   linux-image-iop32x \
   linux-image-netwinder \
diff --git a/kernel/tests/dotest b/kernel/tests/dotest
index b3a01e5..b0075a7 100755
--- a/kernel/tests/dotest
+++ b/kernel/tests/dotest
@@ -29,6 +29,9 @@ for KERNEL_MAJOR in $MAJORS; do
 		2.6)
 			WANT_KERNELS="$KERNEL_26"
 			;;
+		3.10)
+			WANT_KERNELS="$KERNEL_3_10"
+			;;
 		7)
 			WANT_KERNELS="$KERNEL_7"
 			;;
diff --git a/kernel/tests/runtests b/kernel/tests/runtests
index c9a4c38..7f45184 100755
--- a/kernel/tests/runtests
+++ b/kernel/tests/runtests
@@ -23,7 +23,7 @@ verbose () {
 run_test () {
 	TEST="$1"
 
-	unset SUBARCH CPUINFO OFCPUS MACHINE FLAVOUR KERNEL_26 KERNEL_7 KERNEL_8 USABLE UNUSABLE \
+	unset SUBARCH CPUINFO OFCPUS MACHINE FLAVOUR KERNEL_26 KERNEL_3_10 KERNEL_7 KERNEL_8 USABLE UNUSABLE \
 		|| true
 	NUMCPUS=1
 	MAJORS=2.6
@@ -54,6 +54,9 @@ run_test () {
 			kernel-2.6)
 				KERNEL_26="$value"
 				;;
+			kernel-3.10)
+				KERNEL_3_10="$value"
+				;;
 			kernel-7)
 				KERNEL_7="$value"
 				;;
@@ -75,7 +78,7 @@ run_test () {
 	done < "$TEST"
 
 	export ARCH SUBARCH CPUINFO OFCPUS NUMCPUS MACHINE
-	export MAJORS FLAVOUR KERNEL_26 KERNEL_7 KERNEL_8
+	export MAJORS FLAVOUR KERNEL_26 KERNEL_3_10 KERNEL_7 KERNEL_8
 	export USABLE UNUSABLE
 
 	TMP="$(mktemp -t base-installer-tests.XXXXXX)"
-- 
1.7.10.4


From bc329648782cf7433212948518ff15b01528b613 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ijc@hellion.org.uk>
Date: Thu, 2 Jan 2014 15:08:55 +0000
Subject: [PATCH 2/3] armhf: Select armmp-lpae kernel when hardware supports
 it

---
 kernel/armhf.sh                   |   17 +++++++++++++++--
 kernel/tests/armhf/midway.cpuinfo |    8 ++++----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/kernel/armhf.sh b/kernel/armhf.sh
index 469951c..a2a3523 100644
--- a/kernel/armhf.sh
+++ b/kernel/armhf.sh
@@ -4,7 +4,19 @@ arch_get_kernel_flavour () {
 		echo "$SUBARCH armmp"
 		return 0 ;;
 	    generic)
-		echo "armmp"
+		if grep -q '^Features.*\blpae\b' "$CPUINFO"; then
+			HAVE_LPAE=y
+		else
+			HAVE_LPAE=n
+		fi
+		case "$HAVE_LPAE" in
+		    y)
+			echo "armmp armmp-lpae"
+			;;
+		    n)
+			echo "armmp"
+			;;
+		esac
 		return 0 ;;
 	    *)
 		warning "Unknown $ARCH subarchitecture '$SUBARCH'."
@@ -17,8 +29,9 @@ arch_check_usable_kernel () {
 
         set -- $2
         while [ $# -ge 1 ]; do
+                TRY="$1"
                 case "$NAME" in
-                    *-"$1" | *-"$1"-*)
+                    *-"$TRY" | *-"$TRY"-*)
                         # Allow any other hyphenated suffix
                         return 0
                         ;;
diff --git a/kernel/tests/armhf/midway.cpuinfo b/kernel/tests/armhf/midway.cpuinfo
index 1faf03e..40176b9 100644
--- a/kernel/tests/armhf/midway.cpuinfo
+++ b/kernel/tests/armhf/midway.cpuinfo
@@ -1,7 +1,7 @@
 processor	: 0
 model name	: ARMv7 Processor rev 2 (v7l)
 BogoMIPS	: 300.00
-Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
 CPU implementer	: 0x41
 CPU architecture: 7
 CPU variant	: 0x3
@@ -11,7 +11,7 @@ CPU revision	: 2
 processor	: 1
 model name	: ARMv7 Processor rev 2 (v7l)
 BogoMIPS	: 300.00
-Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
 CPU implementer	: 0x41
 CPU architecture: 7
 CPU variant	: 0x3
@@ -21,7 +21,7 @@ CPU revision	: 2
 processor	: 2
 model name	: ARMv7 Processor rev 2 (v7l)
 BogoMIPS	: 300.00
-Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
 CPU implementer	: 0x41
 CPU architecture: 7
 CPU variant	: 0x3
@@ -31,7 +31,7 @@ CPU revision	: 2
 processor	: 3
 model name	: ARMv7 Processor rev 2 (v7l)
 BogoMIPS	: 300.00
-Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt 
+Features	: swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae 
 CPU implementer	: 0x41
 CPU architecture: 7
 CPU variant	: 0x3
-- 
1.7.10.4


From 918d89301529a677a2170ac16bbb53e8d3a7de15 Mon Sep 17 00:00:00 2001
From: Ian Campbell <ijc@hellion.org.uk>
Date: Thu, 2 Jan 2014 19:16:19 +0000
Subject: [PATCH 3/3] Add support for armhf/omap

This was a kernel flavour in Wheezy so include it for consistency alongside mx5
and vexpress.
---
 kernel/armhf.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/armhf.sh b/kernel/armhf.sh
index a2a3523..8e522d2 100644
--- a/kernel/armhf.sh
+++ b/kernel/armhf.sh
@@ -1,6 +1,6 @@
 arch_get_kernel_flavour () {
 	case "$SUBARCH" in
-	    mx5|vexpress)
+	    omap|mx5|vexpress)
 		echo "$SUBARCH armmp"
 		return 0 ;;
 	    generic)
-- 
1.7.10.4


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


Reply to: