How to modify /proc/cpuinfo Revision and Serial on BBB / Ubuntu

1,289 views
Skip to first unread message

Dejan Nenov

unread,
Aug 10, 2014, 12:10:51 PM8/10/14
to beagl...@googlegroups.com
Hello all,

Please advise how can I modify the revision and serial that /proc/cpuinfo returns?

I am using a BBB with an Ubuntu distro: 

uname - a returns : Linux arm 3.8.13-bone43 #1 SMP Wed Mar 26 17:36:53 UTC 2014 armv7l armv7l armv7l GNU/Linux

cat /proc/cpuinfo returns:

processor       : 0
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 596.48
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2
Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000


I have found this info online, but it seems impractical to have to recompile the kernel for every board I ship out? A "proper" solution would be to write this values somewhere on EEPROM and have the rad at boot time?

Info found online:

It depends on the version of Linux and processor architecture. Since this is a TI ARM, you can start with:arch/arm/kernel/setup.c.

Look for static int c_show().

The Revision and Serial values are set with ATAG_REVISION and ATAG_SERIAL, so an appropriateboot loader can pass them to Linux. Typically you do not set these in the code but use them as conditionals to handle hardware variations that can not be detected at run time in a machine file or driver.

--------------------------------------------------




Przemek Klosowski

unread,
Aug 11, 2014, 9:57:15 AM8/11/14
to beagl...@googlegroups.com
On Sun, Aug 10, 2014 at 12:10 PM, Dejan Nenov <dejan...@gmail.com> wrote:
Hello all,

Please advise how can I modify the revision and serial that /proc/cpuinfo returns?

I am using a BBB with an Ubuntu distro: 

uname - a returns : Linux arm 3.8.13-bone43 #1 SMP Wed Mar 26 17:36:53 UTC 2014 armv7l armv7l armv7l GNU/Linux

cat /proc/cpuinfo returns:

processor       : 0
model name      : ARMv7 Processor rev 2 (v7l)
BogoMIPS        : 596.48
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc08
CPU revision    : 2
Hardware        : Generic AM33XX (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000


I have found this info online, but it seems impractical to have to recompile the kernel for every board I ship out? A "proper" solution would be to write this values somewhere on EEPROM and have the rad at boot time?

 This info should not be recompiled into the kernel---the idea is to read it from the CPU special registers, initialized by the CPU manufacturers. That of course assumes that your particular CPU has those registers (e.g, that's how you read them on NXP LPC chips: http://lxr.free-electrons.com/source/arch/arm/mach-lpc32xx/common.c#L38).

Unfortunately, it seems that AM33xx does not have it which is why the AM33xx code just initializes them with zeros.

If you really need individual serial numbers, you could add dedicated EEPROM, but I personally would look at a software load solution that uses e.g. the ethernet MAC or a magic file in /etc directory, say.
Reply all
Reply to author
Forward
0 new messages