Opened 5 years ago

Closed 5 years ago

#1190 closed defect (fixed)

CPU check fails on Raspberry Pi latest revision

Reported by: MarkBrown667 Owned by:
Priority: normal Milestone:
Component: other Version: trunk
Keywords: Cc:

Description

Attempting to use the ARM version of CCL 1.9 on a recent model Raspberry Pi (Linux 3.10.25+), armcl fails to start with the message: "CPU doesn't support required features"

Investigation shows that the check_arm_cpu function in pmcl_kernel.c is not correctly interpreting the output of /proc/cpuinfo. My Raspberry Pi shows the following:

$ cat /proc/cpuinfo
processor	: 0
model name	: ARMv6-compatible processor rev 7 (v6l)
BogoMIPS	: 2.00
Features	: swp half thumb fastmult vfp edsp java tls 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xb76
CPU revision	: 7

Hardware	: BCM2708
Revision	: 000d
Serial		: ******************

check_arm_cpu looks for the string "Processor" (with an upper case P) at the start of each line, using strncmp. However, because the Raspberry Pi is returning "processor" (with a lower case p) the line is not recognised.

The fix is simply to change strncmp to strncasecmp.

There are other issues with the function as well, one being that calls are made to malloc() but the return value is not checked. These can be avoided by allocating procline and cpuline on the stack, with the same size as the input line buffer. This trades off wasting a maximum of 258 bytes of memory on the stack to avoid the overhead of calling malloc() and free() and having to check the return values from malloc().

A modified version of pmcl_kernel.c is included - the changes are to check_arm_cpu only. However, it has not been tested with anything except the Raspberry Pi in my possession.

Attachments (1)

pmcl-kernel.c (62.3 KB) - added by MarkBrown667 5 years ago.
pmcl-kernel.c with check_arm_cpu fixed to recognise later model Raspberry Pi

Download all attachments as: .zip

Change History (2)

Changed 5 years ago by MarkBrown667

pmcl-kernel.c with check_arm_cpu fixed to recognise later model Raspberry Pi

comment:1 Changed 5 years ago by gb

  • Resolution set to fixed
  • Status changed from new to closed

(In [16083]) Propagate r15802 from trunk. Fixes ticket:1190

Note: See TracTickets for help on using tickets.