Compiling and running lmbench for ARM

Oct 17, 2003 2 Replies

Hello,



Can someone please help me with cross-compiling and then installing and running the lmbench Linux benchmark program on an ARM target?



I tried to run a command like: CC=arm-linux-gcc AR=arm-linux-ar RANLIB=arm-linux-ranlib TARGET=linux OS=arm-linux make results in the src directory of lmbench 3.0-a3, and I got errors. I also tried compiling directly on the target, and got other segmentation fault errors.



It works fine directly on my Linux host, but I need it to run on my target as well.



Any help would be appreciated.



Thank you.



This might not help much, but here's how I cross-compiled lmbench-2:

NAME=lmbench-2.0-patch2 DIRNAME=LMbench tar -xzvf @IXIA_TARBALLS@/$NAME.tgz patch -g0 -p0 < cross.patch cd $DIRNAME/src CC=@CROSS_TOOL@gcc AR=@CROSS_TOOL@ar RANLIB=@CROSS_TOOL@ranlib CFLAGS="@TARGET_CFLAGS@" OS=linux-@ARCH@ TARGET=linux ../scripts/build all

(note: I don't think 'make results' is likely to work in an embedded target; better to run the individual program you care about by hand...)

where cross.patch was

Common subdirectories: LMbench/scripts.orig/SCCS and LMbench/scripts/SCCS diff -au LMbench/scripts.orig/os LMbench/scripts/os

--- LMbench/scripts.orig/os Sat Jun 1 12:42:06 2002

+++ LMbench/scripts/os Sat Jun 1 12:46:36 2002 @@ -1,10 +1,13 @@ #!/bin/sh

-OS=bloat-os

-if [ -f ../scripts/gnu-os ]

-then OS=`../scripts/gnu-os | sed s/unknown-//`

-fi

-if [ -f ../../scripts/gnu-os ]

-then OS=`../../scripts/gnu-os | sed s/unknown-//`

+if [ X$OS = X ] +then
  • OS=bloat-os
  • if [ -f ../scripts/gnu-os ]
  • then OS=`../scripts/gnu-os | sed s/unknown-//`
  • fi
  • if [ -f ../../scripts/gnu-os ]
  • then OS=`../../scripts/gnu-os | sed s/unknown-//`
  • fi fi echo $OS diff -au LMbench/scripts.orig/target LMbench/scripts/target

--- LMbench/scripts.orig/target Sat Jun 1 12:42:06 2002

+++ LMbench/scripts/target Sat Jun 1 12:45:41 2002 @@ -5,20 +5,25 @@ # Hacked into existence by Larry McVoy ( snipped-for-privacy@sun.com now snipped-for-privacy@sgi.com). # Copyright (c) 1994 Larry McVoy. GPLed software. # $Id$

-case `uname -s` in

- *HP-UX*) echo hpux;;

- *Linux*) echo linux;;

- *IRIX*) echo irix;;

- *AIX*) echo aix;;

- BSD/OS) echo bsdi;;

- *BSD*) echo bsd;;

- *OSF1*) echo osf1;;

- *ULTRIX*) echo ultrix;;

+ +if [ X$TARGET = X ] +then
  • case `uname -s` in
+ *HP-UX*) TARGET=hpux;; + *Linux*) TARGET=linux;; + *IRIX*) TARGET=irix;; + *AIX*) TARGET=aix;; + BSD/OS) TARGET=bsdi;; + *BSD*) TARGET=bsd;; + *OSF1*) TARGET=osf1;; + *ULTRIX*) TARGET=ultrix;; *SunOS*) case `uname -r` in

- 4*) echo sunos;;

- 5*) echo solaris;;

- *) echo unknown;;

+ 4*) TARGET=sunos;; + 5*) TARGET=solaris;; + *) TARGET=unknown;; esac;;

- *) echo unknown;;

-esac

+ *) TARGET=unknown;;
  • esac
+fi +echo $TARGET exit 0

Thank you for answering.

I have downloaded and compiled LMbench, and got some binary files in /bin/linux-arm. I got the error below when I applied the cross.patch. Do you know what would be the reason? I ignored it, and went ahead with compilation. Now, how do I run the binary files on ARM? Do I just copy them over to my target and do ./? Will that work?

Have you tried the most recent version (lmbench3.0-a3) on an embedded platform? Would that work? If not, is there a reason?

Thanks a lot for your help.

------------------------------------------------------------------------------------------------------ patching file LMbench/scripts/os Hunk #1 succeeded at 1 with fuzz 2. patching file LMbench/scripts/target Hunk #1 FAILED at 5.

1 out of 1 hunk FAILED -- saving rejects to file LMbench/scripts/target.rej

Where target.rej contains:

*************** *** 5,24 **** # Hacked into existence by Larry McVoy ( snipped-for-privacy@sun.com now snipped-for-privacy@sgi.com). # Copyright (c) 1994 Larry McVoy. GPLed software. # $Id$

- case `uname -s` in

- *HP-UX*) echo hpux;;

- *Linux*) echo linux;;

- *IRIX*) echo irix;;

- *AIX*) echo aix;;

- BSD/OS) echo bsdi;;

- *BSD*) echo bsd;;

- *OSF1*) echo osf1;;

- *ULTRIX*) echo ultrix;; *SunOS*) case `uname -r` in

- 4*) echo sunos;;

- 5*) echo solaris;;

- *) echo unknown;; esac;;

- *) echo unknown;;

- esac exit 0

--- 5,29 ---- # Hacked into existence by Larry McVoy ( snipped-for-privacy@sun.com now snipped-for-privacy@sgi.com). # Copyright (c) 1994 Larry McVoy. GPLed software. # $Id$

+
  • if [ X$TARGET = X ]
  • then
  • case `uname -s` in
  • *HP-UX*) TARGET=hpux;;
  • *Linux*) TARGET=linux;;
  • *IRIX*) TARGET=irix;;
  • *AIX*) TARGET=aix;;
  • BSD/OS) TARGET=bsdi;;
  • *BSD*) TARGET=bsd;;
  • *OSF1*) TARGET=osf1;;
  • *ULTRIX*) TARGET=ultrix;; *SunOS*) case `uname -r` in
  • 4*) TARGET=sunos;;
  • 5*) TARGET=solaris;;
  • *) TARGET=unknown;; esac;;
  • *) TARGET=unknown;;
  • esac
  • fi
  • echo $TARGET exit 0

Dan Kegel wrote:

running

directly

CFLAGS="@TARGET_CFLAGS@" OS=linux-@ARCH@ TARGET=linux

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required