Discussion:
Get machine type in user-space
Per Strandh
2013-06-20 18:15:17 UTC
Permalink
Hi,

I work for a company that develops our own arm-based embedded linux
products. (both hardware and software)

My question is about the "machine type" parameter that is passed from
the bootloader to the kernel.

If the kernel supports more than one "machine type", the the one that
are specified by the bootloader will be choosen.
If the kernel only supports one "machine type" that will *always* be choosen.

Question:
Is it possible from user-space to find out the "machine type" that was
passed from the bootloader?
I know that in /proc/cpuinfo it is possible to see that "name" of the
choosen "machine type", but not if it was the correct one.

Regards
Russell King - ARM Linux
2013-06-20 19:05:08 UTC
Permalink
Post by Per Strandh
If the kernel supports more than one "machine type", the the one that
are specified by the bootloader will be choosen.
If the kernel only supports one "machine type" that will *always* be choosen.
Is it possible from user-space to find out the "machine type" that was
passed from the bootloader?
I know that in /proc/cpuinfo it is possible to see that "name" of the
choosen "machine type", but not if it was the correct one.
That "name" always reflects what was decided upon when the kernel
interprets that machine type ID. It isn't the actual ID but name
of the platform string, which is itself tied to the type ID.
Per Strandh
2013-06-20 19:19:44 UTC
Permalink
Post by Russell King - ARM Linux
Post by Per Strandh
If the kernel supports more than one "machine type", the the one that
are specified by the bootloader will be choosen.
If the kernel only supports one "machine type" that will *always* be choosen.
Is it possible from user-space to find out the "machine type" that was
passed from the bootloader?
I know that in /proc/cpuinfo it is possible to see that "name" of the
choosen "machine type", but not if it was the correct one.
That "name" always reflects what was decided upon when the kernel
interprets that machine type ID. It isn't the actual ID but name
of the platform string, which is itself tied to the type ID.
Yes - When the kernel contained a match of the "machine type" the name
(Hardware:) in /proc/cpuinfo can be used.

But my problem/question is...
If a kernel that did NOT support the "machine type" that the
bootloader reported has been used, the kernel will still load by
choosing one of the ones it does support.
(we have multiple boards with different "machine types" that are very
similar - so a faulty kernel is very likely to work)
In this case the /proc/cpuinfo reflects the selected "machine type"
and not the one reported by the bootloader.

Regards
/Per/
Russell King - ARM Linux
2013-06-20 19:43:11 UTC
Permalink
Post by Per Strandh
Yes - When the kernel contained a match of the "machine type" the name
(Hardware:) in /proc/cpuinfo can be used.
But my problem/question is...
If a kernel that did NOT support the "machine type" that the
bootloader reported has been used, the kernel will still load by
choosing one of the ones it does support.
No it doesn't. If the ID is not recognised, it fails to boot.
David Lanzendörfer
2013-06-20 19:04:00 UTC
Permalink
Hi
Post by Per Strandh
If the kernel supports more than one "machine type", the the one that
are specified by the bootloader will be choosen.
If the kernel only supports one "machine type" that will *always* be choosen.
I wouldn't work with machine type ids anymore, but rather would use
the device tree scripts... It's much easier to update a DTB and you
don't have to build custom kernels anymore for your hardware.
Post by Per Strandh
Is it possible from user-space to find out the "machine type" that was
passed from the bootloader?
I know that in /proc/cpuinfo it is possible to see that "name" of the
choosen "machine type", but not if it was the correct one.
You will have to export a sysfs node in your board file which
exposes the revision information of your board if you have the need
for such data.

-David

Continue reading on narkive:
Loading...