Squashed 'import-layers/meta-openembedded/' content from commit 247b126

Change-Id: I40827e9ce5fba63f1cca2a0be44976ae8383b4c0
git-subtree-dir: import-layers/meta-openembedded
git-subtree-split: 247b1267bbe95719cd4877d2d3cfbaf2a2f4865a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
new file mode 100644
index 0000000..549a114
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/fix-lmbench-memory-check-failure.patch
@@ -0,0 +1,206 @@
+lmbench: Can't proceed on some targets
+
+lmbench can't proceed on some targets.  The memory check fails because the
+memory latency of each page is longer then 10us, which is a time limit set
+in the original memsize.c.
+
+The memory latency is very different on different targets due to the
+hardware and current system load.  The targets with slower memory
+chips or heavy system load need much longer time to read or write
+the memory.
+
+This fix changes the fixed time limit of 10us to a specific value calculated
+from the runtime target.
+
+Also set an upper limit of memory size used for lmbench testing.  The memory
+check sometimes fails if the target has a large amount of memory, for
+example more than 4G.
+
+Signed-off-by: Qingming Su <qingming.su@windriver.com>
+Signed-off-by: Fupan Li <fupan.li@windriver.com>
+
+Add and reword above comments
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+diff --git a/scripts/config-run b/scripts/config-run
+index e1f7b6d..31b9256 100755
+--- a/scripts/config-run
++++ b/scripts/config-run
+@@ -214,6 +214,12 @@ The bigger the range, the more accurate the results, but larger sizes
+ take somewhat longer to run the benchmark.
+
+ EOF
++
++# By default, use 512M memory as the upper limit for lmbench test
++if [ $MB -gt 512 ];then
++MB=512
++fi
++
+ echo $ECHON "MB [default $MB]: $ECHOC"
+ #read TMP
+ TMP=""
+@@ -718,10 +724,10 @@ case $MAIL in
+		;;
+ esac
+
+-INFO=`../scripts/info`
++INFO=`../scripts/hostinfo`
+ if [ $MAIL = yes ]
+ then	if [ ! -f $INFO ]
+-	then	cp ../scripts/info-template $INFO
++	then	cp ../scripts/hostinfo-template $INFO
+ 		chmod +w $INFO
+ 		REUSE=no
+ 	else
+@@ -765,7 +771,7 @@ EOF
+ 		then	EDITOR=$TMP
+ 		fi
+ 		if [ X$EDITOR != "none" ]
+-		then	$EDITOR `../scripts/info`
++		then	$EDITOR `../scripts/hostinfo`
+ 		fi
+ 	fi
+ fi
+diff --git a/src/Makefile b/src/Makefile
+index d1f0dc6..5098998 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -49,7 +49,7 @@ TARGET=`../scripts/target`
+ BINDIR=../bin/$(OS)
+ CONFIG=../bin/$(OS)/`../scripts/config`
+ UTILS=../scripts/target ../scripts/os ../scripts/gnu-os ../scripts/compiler \
+-	../scripts/info ../scripts/info-template ../scripts/version \
++	../scripts/hostinfo ../scripts/hostinfo-template ../scripts/version \
+ 	../scripts/config ../scripts/config-run ../scripts/results \
+ 	../scripts/lmbench ../scripts/make ../scripts/build
+ INSTALL=cp
+@@ -240,7 +240,7 @@ $O/getopt.o : getopt.c $(INCS)
+ 	$(COMPILE) -c getopt.c -o $O/getopt.o
+
+ $(UTILS) :
+-	-cd ../scripts; make get
++	-cd ../scripts; cp info hostinfo; cp info-template hostinfo-template
+
+ # Do not remove the next line, $(MAKE) depend needs it
+ # MAKEDEPEND follows
+diff --git a/src/memsize.c b/src/memsize.c
+index eb25a09..cf9fe0c 100644
+--- a/src/memsize.c
++++ b/src/memsize.c
+@@ -14,9 +14,12 @@ char	*id = "$Id$\n";
+
+ #define	CHK(x)	if ((x) == -1) { perror("x"); exit(1); }
+
+-#ifndef	TOO_LONG
+-#define	TOO_LONG	10	/* usecs */
+-#endif
++//#ifndef	TOO_LONG
++//#define	TOO_LONG	10	/* usecs */
++//#endif
++
++#define	MEMORY_SIZE_1MB (1024 * 1024)
++#define	MEMORY_SIZE_8MB (8 * 1024 * 1024)
+
+ int	alarm_triggered = 0;
+
+@@ -35,10 +38,10 @@ main(int ac, char **av)
+ 	size_t	delta;
+
+ 	if (ac == 2) {
+-		max = size = bytes(av[1]) * 1024 * 1024;
++		max = size = bytes(av[1]) * MEMORY_SIZE_1MB;
+ 	}
+-	if (max < 1024 * 1024) {
+-		max = size = 1024 * 1024 * 1024;
++	if (max < MEMORY_SIZE_1MB) {
++		max = size = 1024 * MEMORY_SIZE_1MB;
+ 	}
+ 	/*
+ 	 * Binary search down and then binary search up
+@@ -48,7 +51,7 @@ main(int ac, char **av)
+ 	}
+ 	/* delta = size / (2 * 1024 * 1024) */
+ 	for (delta = (size >> 21); delta > 0; delta >>= 1) {
+-		uint64 sz = (uint64)size + (uint64)delta * 1024 * 1024;
++		uint64 sz = (uint64)size + (uint64)delta * MEMORY_SIZE_1MB;
+ 		size_t check = sz;
+ 		if (max < sz) continue;
+ 		if (check < sz || !test_malloc(sz)) break;
+@@ -66,41 +69,58 @@ timeit(char *where, size_t size)
+ {
+ 	int	sum = 0;
+ 	size_t	n;
+-	size_t	s_prev;
++	size_t	s_prev = MEMORY_SIZE_8MB;
+ 	size_t	range;
+-	size_t	incr = 1024 * 1024;
++	size_t	incr = MEMORY_SIZE_1MB;
+ 	size_t	pagesize = getpagesize();
+-	unsigned long long	s;
+-
+-	if (size < 1024*1024 - 16*1024) {
+-		fprintf(stderr, "Bad size\n");
+-		return;
+-	}
++	size_t	time_each_page = 0;
++	size_t	too_long = 0;
++	unsigned long long      s;
++
++	if (pagesize < MEMORY_SIZE_1MB)
++		range = MEMORY_SIZE_1MB;
++	else
++		range = MEMORY_SIZE_8MB;
++
++	incr = MEMORY_SIZE_1MB;
++	
++	if (size < range) {
++              fprintf(stderr, "Bad size\n");
++              return;
++	    }
++
++	//Touch range of memory, get the average time (usec) of operating each memory page on this system
++        start(0);
++        touchRange(where, range, pagesize);
++        sum = stop(0, 0);
++
++        if ((time_each_page = sum * pagesize / range) < 1)
++		time_each_page = 1;
++	//Set the uper limit of time spending on one page
++        too_long = 10 * time_each_page;
+
+-	range = 1024 * 1024;
+-	incr = 1024 * 1024;
+-	touchRange(where, range, pagesize);
+ 	for (range += incr; range <= size; range += incr) {
+ 		n = range / pagesize;
+-		set_alarm(n * TOO_LONG);
++		set_alarm(n * too_long);
+ 		touchRange(where + range - incr, incr, pagesize);
+ 		clear_alarm();
+-		set_alarm(n * TOO_LONG);
++		set_alarm(n * too_long);
+ 		start(0);
+ 		touchRange(where, range, pagesize);
+ 		sum = stop(0, 0);
+ 		clear_alarm();
+-		if ((sum / n) > TOO_LONG || alarm_triggered) {
++		if ((sum / n) > too_long || alarm_triggered) {
+ 			size = range - incr;
++			fprintf(stderr, "Error! Memory testing timeout! Touch one page of memory needs more than %d (usecs)\n ", too_long);
+ 			break;
+ 		}
+-		for (s = 8 * 1024 * 1024; s <= range; s_prev = s, s *= 2)
++		for (s = s_prev; s <= range; s_prev = s, s *= 2)
+ 			if (s < s_prev) break;
+ 		incr = s / 8;
+ 		if (range < size && size < range + incr) {
+ 			incr = size - range;
+ 		}
+-		fprintf(stderr, "%dMB OK\r", (int)(range/(1024*1024)));
++		fprintf(stderr, "%dMB OK\r", (int)(range/MEMORY_SIZE_1MB));
+ 	}
+ 	fprintf(stderr, "\n");
+ 	printf("%d\n", (int)(size>>20));
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
new file mode 100644
index 0000000..cda2f0c
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/lmbench_result_html_report.patch
@@ -0,0 +1,61 @@
+lmbench: Fix "make html" graph failure
+
+The html-list perl script cannot parse the first line of the result
+files about the lmbench version.
+
+Additional fixes are to make the result's html pages easier to understand.
+
+Signed-off-by: Lin Yu <lin.yu@windriver.com>
+Signed-off-by: Fupan Li <fupan.li@windriver.com>
+
+Reworded patch description.
+
+Upstream-status: inappropriate [ configuration ]
+
+Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
+
+diff --git a/results/Makefile b/results/Makefile
+index 0935376..1ef9a15 100644
+--- a/results/Makefile
++++ b/results/Makefile
+@@ -186,6 +186,7 @@ paper:
+ # scratch makes you want a Ghz machine.
+ html: dirs
+ 	-make clean
++	make ps
+ 	#$(SCRIPTS)bghtml $(BG)
+ 	$(SCRIPTS)html-list $(LIST)
+ 	$(MK) LIST="$(LIST)" summary > HTML/summary.out 2> HTML/summary.errs
+diff --git a/scripts/html-list b/scripts/html-list
+index 9850461..6383115 100755
+--- a/scripts/html-list
++++ b/scripts/html-list
+@@ -14,7 +14,7 @@ open(H, ">HTML/specific.html");
+ print H <<EOF;
+ <title>LMBENCH System Results</title>
+ <h1>LMBENCH System Results</h1>
+-<h2><a href=summary>Summary of results</a></h2>
++<h2><a href=summary.out>Summary of results</a></h2>
+ <hr>
+ EOF
+
+@@ -47,7 +47,7 @@ foreach $os (@os) {
+ 		open(F, $file);
+ 		$_ = <F>;
+ 		close(F);
+-		next unless /lmbench1.[01]/;
++		next unless /lmbench[0-9]+.[01]/;
+ 		chop;
+ 		$title = $_;
+ 		#s/.lmbench1.? results for //;
+@@ -103,10 +103,7 @@ EOF
+ 				    if $i < $#os;
+ 				print S<<EOF;
+ <h4>$title</h4>
+-<a href=../$doc{$what}>Information on this benchmark</a> (Not up to date)
+ <p><IMG SRC="${what}${scale}$N.gif">\n<p>
+-<a href=../lmbench.html>
+-<img align=middle src="../gifs/arrows/b_arrow.gif">LMBENCH table of contents</a>
+ <a href=specific.html>
+ <img align=middle src=\"../gifs/graph.gif\">System results table of contents</a>
+ <p>
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch
new file mode 100644
index 0000000..41a3b32
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/obey-ranlib.patch
@@ -0,0 +1,30 @@
+In some cases the host may have too old of a ranlib to work.  Since it's
+not exactly a great idea to not be using the cross ranlib anyhow, fix the
+Makefile so we can override ranlib and then override it
+
+Upstream-Status: Inappropriate [build system specific change]
+---
+ src/Makefile |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+Index: lmbench-3.0-a9/src/Makefile
+===================================================================
+--- lmbench-3.0-a9.orig/src/Makefile
++++ lmbench-3.0-a9/src/Makefile
+@@ -38,6 +38,7 @@ CC=`../scripts/compiler`
+ MAKE=`../scripts/make`
+ AR=ar
+ ARCREATE=cr
++RANLIB=ranlib
+ 
+ # base of installation location
+ BASE=/usr/local
+@@ -217,7 +218,7 @@ $O/lmbench : ../scripts/lmbench version.
+ $O/lmbench.a: $(LIBOBJS)
+ 	/bin/rm -f $O/lmbench.a
+ 	$(AR) $(ARCREATE) $O/lmbench.a $(LIBOBJS)
+-	-ranlib $O/lmbench.a
++	-$(RANLIB) $O/lmbench.a
+ 
+ $O/lib_timing.o : lib_timing.c $(INCS)
+ 	$(COMPILE) -c lib_timing.c -o $O/lib_timing.o
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch
new file mode 100644
index 0000000..b46e09a
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-config-script.patch
@@ -0,0 +1,12 @@
+Upstream-Status: Pending
+Index: lmbench-3.0-a9/scripts/config
+===================================================================
+--- lmbench-3.0-a9/scripts/config	2000-01-31 18:29:31.000000000 -0600
++++ lmbench-3.0-a9/scripts/config	2013-03-01 00:19:41.032984315 -0600
+@@ -3,5 +3,5 @@
+ UNAME=`uname -n 2>/dev/null`
+ if [ X$UNAME = X ]
+ then	echo CONFIG
+-else	echo CONFIG.$UNAME
++else	echo ../scripts/CONFIG.$UNAME
+ fi
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch
new file mode 100644
index 0000000..894f146
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/update-results-script.patch
@@ -0,0 +1,160 @@
+Now that we have our binaries in /usr/bin rather than the normal
+lmbench hierarchy we need to update the scripts as well to behave well here.
+
+Upstream-Status: Inappropriate [This is related to the OE-specific behavior
+of installing into /usr/bin, etc, rather than dumping everything into 
+/usr/share/lmbench or similar]
+
+Index: lmbench-3.0-a9/scripts/results
+===================================================================
+--- lmbench-3.0-a9.orig/scripts/results
++++ lmbench-3.0-a9/scripts/results
+@@ -8,11 +8,11 @@ RESULTS=results/$OS
+ BASE=../$RESULTS/`uname -n`
+ EXT=0
+ 
+-if [ ! -f "../bin/$OS/$CONFIG" ]
++if [ ! -f "$CONFIG" ]
+ then	echo "No config file?"
+ 	exit 1
+ fi
+-. ../bin/$OS/$CONFIG
++. $CONFIG
+ 
+ if [ ! -d ../$RESULTS ]
+ then	mkdir -p ../$RESULTS
+@@ -23,11 +23,9 @@ do      EXT=`expr $EXT + 1`
+ 	RESULTS=$BASE.$EXT
+ done
+ 
+-cd ../bin/$OS 
+-PATH=.:${PATH}; export PATH
+ export SYNC_MAX
+ export OUTPUT
+-lmbench $CONFIG 2>../${RESULTS}
++lmbench $CONFIG 2>${RESULTS}
+ 
+ if [ X$MAIL = Xyes ]
+ then	echo Mailing results
+Index: lmbench-3.0-a9/scripts/config-run
+===================================================================
+--- lmbench-3.0-a9.orig/scripts/config-run
++++ lmbench-3.0-a9/scripts/config-run
+@@ -132,20 +132,20 @@ export LMBENCH_SCHED
+ ############################################################################
+ echo $L; echo "";
+ echo "Hang on, we are calculating your timing granularity."
+-../bin/$OS/msleep 250
+-ENOUGH=`../bin/$OS/enough`
++msleep 250
++ENOUGH=`enough`
+ export ENOUGH 
+ echo "OK, it looks like you can time stuff down to $ENOUGH usec resolution."
+ echo ""
+ echo "Hang on, we are calculating your timing overhead."
+-../bin/$OS/msleep 250
+-TIMING_O=`../bin/$OS/timing_o`
++msleep 250
++TIMING_O=`timing_o`
+ export TIMING_O
+ echo "OK, it looks like your gettimeofday() costs $TIMING_O usecs."
+ echo ""
+ echo "Hang on, we are calculating your loop overhead."
+-../bin/$OS/msleep 250
+-LOOP_O=`../bin/$OS/loop_o`
++msleep 250
++LOOP_O=`loop_o`
+ export LOOP_O
+ echo "OK, it looks like your benchmark loop costs $LOOP_O usecs."
+ echo ""
+@@ -177,7 +177,7 @@ then
+ fi
+ if [ X$MB = X ]
+ then	$ECHON "Probing system for available memory: $ECHOC"
+-	MB=`../bin/$OS/memsize 4096`
++	MB=`memsize 4096`
+ fi
+ TOTAL_MEM=$MB
+ MB=`echo \( $MB \* 7 \) / 10 | bc 2>/dev/null`
+@@ -205,9 +205,9 @@ fi
+ # Certain machines tend to barf when you try and bcopy 8MB.
+ # Figure out how much we can use.
+ echo "Checking to see if you have $MB MB; please wait for a moment..."
+-MB=`../bin/$OS/memsize $MB`
+-MB=`../bin/$OS/memsize $MB`
+-MB=`../bin/$OS/memsize $MB`
++MB=`memsize $MB`
++MB=`memsize $MB`
++MB=`memsize $MB`
+ if [ `expr $SYNC_MAX \* $MB` -gt `expr $TOTAL_MEM` ]
+ then
+ 	MB=`expr $TOTAL_MEM / $SYNC_MAX`
+@@ -223,8 +223,8 @@ then	echo Warning: you have only ${MB}MB
+ fi
+ 
+ echo "Hang on, we are calculating your cache line size."
+-../bin/$OS/msleep 250
+-LINE_SIZE=`../bin/$OS/lm_line -M ${MB}M`
++msleep 250
++LINE_SIZE=`lm_line -M ${MB}M`
+ export LINE_SIZE
+ echo "OK, it looks like your cache line is $LINE_SIZE bytes."
+ echo ""
+@@ -479,7 +479,7 @@ EOF
+ 	then	
+ 		for i in $disks
+ 		do	if [ -r $i ]
+-			then	../bin/$OS/flushdisk $i
++			then	flushdisk $i
+ 				if [ $? -eq 1 ]
+ 				then	echo "Must be root to run disk benchmarks."
+ 					echo "Root is needed to flush the buffer cache"
+@@ -584,7 +584,7 @@ fi
+ echo $L
+ echo ""
+ echo "Calculating mhz, please wait for a moment..."
+-MHZ=`../bin/$OS/mhz`
++MHZ=`mhz`
+ cat<<EOF
+ I think your CPU mhz is 
+ 
+@@ -689,9 +689,9 @@ esac
+ 
+ INFO=`../scripts/info`
+ if [ $MAIL = yes ]
+-then	if [ ! -f ../bin/$OS/$INFO ]
+-	then	cp ../scripts/info-template ../bin/$OS/$INFO
+-		chmod +w ../bin/$OS/$INFO
++then	if [ ! -f $INFO ]
++	then	cp ../scripts/info-template $INFO
++		chmod +w $INFO
+ 		REUSE=no
+ 	else	
+ 		REUSE=view
+@@ -705,7 +705,7 @@ then	if [ ! -f ../bin/$OS/$INFO ]
+ 				;;
+ 			[Vv]*)	REUSE=view
+ 				echo $L
+-				more ../bin/$OS/$INFO
++				more $INFO
+ 				echo $L
+ 				;;
+ 	    		*)	REUSE=yes
+@@ -733,7 +733,7 @@ EOF
+ 		then	EDITOR=$TMP
+ 		fi
+ 		if [ X$EDITOR != "none" ]
+-		then	$EDITOR ../bin/$OS/`../scripts/info`
++		then	$EDITOR `../scripts/info`
+ 		fi
+ 	fi
+ fi
+@@ -750,7 +750,7 @@ EOF
+ 
+ VERSION=`../scripts/version`
+ 
+-C=../bin/$OS/`../scripts/config`
++C=`../scripts/config`
+ echo DISKS=\"$DISKS\" > $C
+ echo DISK_DESC=\"$DISK_DESC\" >> $C
+ echo OUTPUT=$OUTPUT >> $C
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch
new file mode 100644
index 0000000..3351ce8
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench-3.0-a9/use-base_libdir-instead-of-hardcoded-lib.patch
@@ -0,0 +1,32 @@
+From 0d09e31970616e09beb7f238c2b59bfc541148fb Mon Sep 17 00:00:00 2001
+From: Ting Liu <b28495@freescale.com>
+Date: Fri, 22 Nov 2013 15:20:08 +0800
+Subject: [PATCH] use base_libdir instead of hardcoded /lib
+
+Upsteam Status: Inappropriate [configuration]
+
+Signed-off-by: Ting Liu <b28495@freescale.com>
+---
+ src/Makefile |    4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index c7a8c79..c7e4e3c 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -143,10 +143,10 @@ install-target:
+ 	if [ ! -d $(BASE) ]; then mkdir $(BASE); fi
+ 	if [ ! -d $(BASE)/bin ]; then mkdir $(BASE)/bin; fi
+ 	if [ ! -d $(BASE)/include ]; then mkdir $(BASE)/include; fi
+-	if [ ! -d $(BASE)/lib ]; then mkdir $(BASE)/lib; fi
++	if [ ! -d $(BASE)$(base_libdir) ]; then mkdir $(BASE)$(base_libdir); fi
+ 	cp $(EXES) $(BASE)/bin
+ 	cp $(INCS) $(BASE)/include
+-	cp $O/lmbench.a $(BASE)/lib/libmbench.a
++	cp $O/lmbench.a $(BASE)$(base_libdir)
+ 	cd ../doc; env MAKEFLAGS="$(MAKEFLAGS)" make CC="${CC}" OS="${OS}" BASE="$(BASE)" install
+ 
+ 
+-- 
+1.7.5.4
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch
new file mode 100644
index 0000000..2d8a246
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/0001-avoid-gcc-optimize-away-the-loops.patch
@@ -0,0 +1,79 @@
+[PATCH] avoid gcc optimize-away the loops
+
+Upstream-Status: pending
+
+Change expression used in do_integer_mul and do_uint64_mul
+benchmarks so GCC doesn't optimize-away the loops, other
+things are same:
+-               TEN(r *= s;); r -= t;
++               i = 0;
++               while ( i++ < 10)
++                       r *= s;
++               r -= t;
+
+and TEN is macro:
+	#define TEN(a) a a a a a a a a a a
+
+Signed-off-by: Roy Li <rongqing.li@windriver.com>
+---
+ src/lat_ops.c | 30 +++++++++++++++++++++++++-----
+ 1 file changed, 25 insertions(+), 5 deletions(-)
+
+diff --git a/src/lat_ops.c b/src/lat_ops.c
+index d343ff3..457072b 100644
+--- a/src/lat_ops.c
++++ b/src/lat_ops.c
+@@ -126,11 +126,23 @@ do_integer_mul(iter_t iterations, void* cookie)
+ 	struct _state *pState = (struct _state*)cookie;
+ 	register int r = pState->N + 37431;
+ 	register int s = pState->N + 4;
+-	register int t = r * s * s * s * s * s * s * s * s * s * s - r;
++	register int t = r;
++	int i = 0;
++
++	while ( i++ < 10)
++		t *= s;
++	t -= r;
+ 
+ 	while (iterations-- > 0) {
+-		TEN(r *= s;); r -= t;
+-		TEN(r *= s;); r -= t;
++		i = 0;
++		while ( i++ < 10)
++			r *= s;
++		r -= t;
++
++		i = 0;
++		while ( i++ < 10)
++			r *= s;
++		r -= t;
+ 	}
+ 	use_int(r);
+ }
+@@ -207,13 +219,21 @@ do_int64_mul(iter_t iterations, void* cookie)
+ 	register int64 r = (int64)pState->N + 37420;
+ 	register int64 s = (int64)pState->N + 4;
+ 	register int64 t;
++	int i = 0;
+ 
+ 	r += (int64)(pState->N + 6)<<32;
+ 	t = r * s * s * s * s * s * s * s * s * s * s - r;
+ 
+ 	while (iterations-- > 0) {
+-		TEN(r *= s;); r -= t;
+-		TEN(r *= s;); r -= t;
++		i = 0;
++		while ( i++ < 10)
++			r *= s;
++		r -= t;
++
++		i = 0;
++		while ( i++ < 10)
++			r *= s;
++		r -= t;
+ 	}
+ 	use_int((int)r);
+ }
+-- 
+2.8.1
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run
new file mode 100644
index 0000000..e904c75
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/lmbench-run
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Wrapper script for lmbench written for the 
+# Debian GNU/Linux distribution by 
+# Javier Fernandez-Sanguino.
+# Distributed under the GPL
+SHAREDIR=/usr/share/lmbench/
+BINDIR=/usr/lib/lmbench/
+SCRIPTSDIR=$SHAREDIR/scripts
+RESULTSDIR=$SHAREDIR/results
+CONFIG=/var/lib/lmbench/config/`$SCRIPTSDIR/config`
+runuid=`id -u`
+
+[ $runuid -gt 0 ] && {
+	echo "You must run this as the root user"
+	exit 0
+}
+cd $SCRIPTSDIR 
+[ ! -f $CONFIG ] && ./config-run
+./results
+
+echo "Benchmark run finished...."
+echo "Remember you can find the results of the benchmark "
+echo "under $RESULTSDIR"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch
new file mode 100644
index 0000000..9a40521
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench/rename-line-binary.patch
@@ -0,0 +1,19 @@
+Both lmbench and util-linux-ng packages provide own /usr/bin/line binaries.
+Even though the binaries name is the same, their functionality is different.
+This patch renames lmbench's line binary as lm_line to avoid conflicts with
+util-linux-ng.  script/config-run is also modified (patch) to call lm_line
+instead of line.
+
+Upstream-Status: Inappropriate [build system specific change]
+
+--- patches/scripts/config-run	2006-11-26 15:11:04.000000000 -0500
++++ patches/scripts/config-run	2011-04-01 09:35:50.000000000 -0400
+@@ -224,7 +224,7 @@ fi
+ 
+ echo "Hang on, we are calculating your cache line size."
+ ../bin/$OS/msleep 250
+-LINE_SIZE=`../bin/$OS/line -M ${MB}M`
++LINE_SIZE=`../bin/$OS/lm_line -M ${MB}M`
+ export LINE_SIZE
+ echo "OK, it looks like your cache line is $LINE_SIZE bytes."
+ echo ""
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
new file mode 100644
index 0000000..a62389d
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-benchmark/lmbench/lmbench_3.0-a9.bb
@@ -0,0 +1,79 @@
+SUMMARY = "Tools for performance analysis"
+HOMEPAGE = "http://lmbench.sourceforge.net/"
+SECTION = "console/utils"
+LICENSE = "GPLv2 & GPL-2.0-with-lmbench-restriction"
+LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
+                    file://COPYING-2;md5=8e9aee2ccc75d61d107e43794a25cdf9"
+
+inherit autotools-brokensep
+
+PR = "r2"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/lmbench/lmbench-${PV}.tgz \
+           file://lmbench-run \
+           file://rename-line-binary.patch \
+           file://update-results-script.patch \
+           file://obey-ranlib.patch \
+           file://update-config-script.patch \
+           file://use-base_libdir-instead-of-hardcoded-lib.patch \
+           file://lmbench_result_html_report.patch \
+           file://fix-lmbench-memory-check-failure.patch \
+           file://0001-avoid-gcc-optimize-away-the-loops.patch \
+"
+SRC_URI[md5sum] = "b3351a3294db66a72e2864a199d37cbf"
+SRC_URI[sha256sum] = "cbd5777d15f44eab7666dcac418054c3c09df99826961a397d9acf43d8a2a551"
+
+EXTRA_OEMAKE = 'CC="${CC}" AR="${AR}" RANLIB="${RANLIB}" CFLAGS="${CFLAGS}" \
+                LDFLAGS="${LDFLAGS}" LD="${LD}" OS="${TARGET_SYS}" \
+                TARGET="${TARGET_OS}" BASE="${prefix}" MANDIR="${mandir}"'
+
+do_configure() {
+    :
+}
+
+do_compile () {
+    . ${CONFIG_SITE}
+    if [ X"$ac_cv_uint" = X"yes" ]; then
+        CFLAGS="${CFLAGS} -DHAVE_uint"
+    fi
+    install -d ${S}/bin/${TARGET_SYS}
+    oe_runmake -C src
+}
+
+do_install () {
+    install -d ${D}${sysconfdir}/default/volatiles \
+           ${D}${bindir} ${D}${mandir} ${D}${libdir}/lmbench \
+           ${D}${datadir}/lmbench/scripts
+
+    echo "d root root 0755 ${localstatedir}/run/${BPN} none" \
+           > ${D}${sysconfdir}/default/volatiles/99_lmbench
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d /run/${BPN} - - - -" \
+              > ${D}${sysconfdir}/tmpfiles.d/lmbench.conf
+    fi
+
+    oe_runmake BASE="${D}${prefix}" MANDIR="${D}${mandir}" \
+            -C src install
+    mv ${D}${bindir}/line ${D}${bindir}/lm_line
+    install -m 0755 ${WORKDIR}/lmbench-run ${D}${bindir}/
+    sed -i -e 's,^SHAREDIR=.*$,SHAREDIR=${datadir}/${BPN},;' \
+           -e 's,^BINDIR=.*$,BINDIR=${libdir}/${BPN},;' \
+           -e 's,^CONFIG=.*$,CONFIG=`$SCRIPTSDIR/config`,;' \
+           ${D}${bindir}/lmbench-run
+    install -m 0755 ${S}/scripts/lmbench ${D}${bindir}
+    install -m 0755 ${S}/scripts/* ${D}${datadir}/lmbench/scripts
+}
+
+pkg_postinst_${PN} () {
+    if [ -z "$D" ]; then
+        if command -v systemd-tmpfiles >/dev/null; then
+            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/lmbench.conf
+        elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
+            ${sysconfdir}/init.d/populate-volatile.sh update
+        fi
+    fi
+}
+
+RDEPENDS_${PN} = "perl"
+FILES_${PN} += "${datadir}/lmbench ${libdir}/lmbench"