mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] Add flashbench tool
@ 2012-03-14 16:42 bernhard
  0 siblings, 0 replies; only message in thread
From: bernhard @ 2012-03-14 16:42 UTC (permalink / raw)
  To: ptxdist; +Cc: Bernhard Walle

From: Bernhard Walle <walle@corscience.de>

This patch adds the flashbench tool from Linaro Project
git://git.linaro.org/people/arnd/flashbench.git. See also
http://lwn.net/Articles/428584/. Because there is no tarball, I
exported the current git repo and put it on my server.

The default maximum buffer size of 64 MiB (the buffer is allocated 4
times) was too large for my device, so I patched the tool and added an
option in the ptxdist menu.

Tested with a custom OMAP3 board which is similar to the Devkit8000.

Signed-off-by: Bernhard Walle <walle@corscience.de>
---
 ...o-specify-MAX_BUFSIZE-during-compile-time.patch |   37 +++++++++++
 patches/flashbench-20120222/series                 |    4 ++
 rules/flashbench.in                                |   31 +++++++++
 rules/flashbench.make                              |   68 ++++++++++++++++++++
 4 files changed, 140 insertions(+)
 create mode 100644 patches/flashbench-20120222/0001-Allow-to-specify-MAX_BUFSIZE-during-compile-time.patch
 create mode 100644 patches/flashbench-20120222/series
 create mode 100644 rules/flashbench.in
 create mode 100644 rules/flashbench.make

diff --git a/patches/flashbench-20120222/0001-Allow-to-specify-MAX_BUFSIZE-during-compile-time.patch b/patches/flashbench-20120222/0001-Allow-to-specify-MAX_BUFSIZE-during-compile-time.patch
new file mode 100644
index 0000000..cc9505b
--- /dev/null
+++ b/patches/flashbench-20120222/0001-Allow-to-specify-MAX_BUFSIZE-during-compile-time.patch
@@ -0,0 +1,37 @@
+From: Bernhard Walle <walle@corscience.de>
+Date: Wed, 14 Mar 2012 16:52:47 +0100
+Subject: [PATCH] Allow to specify MAX_BUFSIZE during compile time
+
+The default value of 64 MiB is too large for small embedded systems.
+
+Signed-off-by: Bernhard Walle <walle@corscience.de>
+---
+ Makefile |    2 +-
+ dev.c    |    2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 8fbd119..01771b0 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,5 +1,5 @@
+ CC	:= gcc
+-CFLAGS	:= -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -g2
++CFLAGS	:= -O2 -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -g2 $(EXTRA_CFLAGS)
+ LDFLAGS := -lrt
+ 
+ all: flashbench erase
+diff --git a/dev.c b/dev.c
+index f1718be..73a9b3f 100644
+--- a/dev.c
++++ b/dev.c
+@@ -22,7 +22,9 @@
+ 
+ #include "dev.h"
+ 
++#ifndef MAX_BUFSIZE
+ #define MAX_BUFSIZE (64 * 1024 * 1024)
++#endif
+ 
+ static inline long long time_to_ns(struct timespec *ts)
+ {
diff --git a/patches/flashbench-20120222/series b/patches/flashbench-20120222/series
new file mode 100644
index 0000000..8ac1f19
--- /dev/null
+++ b/patches/flashbench-20120222/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-Allow-to-specify-MAX_BUFSIZE-during-compile-time.patch
+# 2284485069f201f5dd31c217b70f51e0  - git-ptx-patches magic
diff --git a/rules/flashbench.in b/rules/flashbench.in
new file mode 100644
index 0000000..96fa631
--- /dev/null
+++ b/rules/flashbench.in
@@ -0,0 +1,31 @@
+## SECTION=test_suites
+
+config FLASHBENCH
+	tristate
+	prompt "flashbench"
+	help
+	  Identify characteristics of flash media
+
+	  This is the tool used to identify the properties of
+	  SD cards and other media for the Linaro flash memory
+	  survey at [1]. The latest version should be available
+	  at [2]. Please also check out the article on lwn.net [3].
+
+	  [1] https://wiki.linaro.org/WorkingGroups/KernelConsolidation/Projects/FlashCardSurvey
+	  [2] git clone git://git.linaro.org/people/arnd/flashbench.git
+	  [3] http://lwn.net/Articles/428XXX FIXME
+
+if FLASHBENCH
+
+config FLASHBENCH_MAX_BUFSIZE
+	string
+	prompt "Maximum flashbench buffer size in bytes"
+	default 67108864
+	help
+	  This is the maximum buffer size flashbench uses during operationg.
+	  The buffer gets allocated 4 times, so take that into account when
+	  choosing a buffer. The default is 64 MiB.
+
+endif
+
+# vim: set ft=kconfig:
diff --git a/rules/flashbench.make b/rules/flashbench.make
new file mode 100644
index 0000000..f71f0c8
--- /dev/null
+++ b/rules/flashbench.make
@@ -0,0 +1,68 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2012 by Bernhard Walle <walle@corscience.de>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_FLASHBENCH) += flashbench
+
+#
+# Paths and names
+#
+FLASHBENCH_VERSION	:= 20120222
+FLASHBENCH_MD5		:= 3d99608022b50e891e5f66d7c637d8b1
+FLASHBENCH		:= flashbench-$(FLASHBENCH_VERSION)
+FLASHBENCH_SUFFIX	:= tar.gz
+FLASHBENCH_URL		:= http://bwalle.de/programme/$(FLASHBENCH).$(FLASHBENCH_SUFFIX)
+FLASHBENCH_SOURCE	:= $(SRCDIR)/$(FLASHBENCH).$(FLASHBENCH_SUFFIX)
+FLASHBENCH_DIR		:= $(BUILDDIR)/$(FLASHBENCH)
+FLASHBENCH_LICENSE	:= GPL v2
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+FLASHBENCH_CONF_TOOL	:= NO
+FLASHBENCH_MAKE_ENV	:= $(CROSS_ENV)
+FLASHBENCH_MAKE_OPT	:= CC=$(CROSS_CC) \
+	EXTRA_CFLAGS=-DMAX_BUFSIZE=$(PTXCONF_FLASHBENCH_MAX_BUFSIZE)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/flashbench.install:
+	@$(call targetinfo)
+	install -d $(FLASHBENCH_PKGDIR)/usr/sbin/
+	install -m0755 $(FLASHBENCH_DIR)/flashbench $(FLASHBENCH_PKGDIR)/usr/sbin
+	install -m0755 $(FLASHBENCH_DIR)/erase $(FLASHBENCH_PKGDIR)/usr/sbin
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/flashbench.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, flashbench)
+	@$(call install_fixup, flashbench,PRIORITY,optional)
+	@$(call install_fixup, flashbench,SECTION,base)
+	@$(call install_fixup, flashbench,AUTHOR,"Bernhard Walle <walle@corscience.de>")
+	@$(call install_fixup, flashbench,DESCRIPTION,missing)
+
+	@$(call install_copy, flashbench, 0, 0, 0755, -, /usr/sbin/flashbench)
+	@$(call install_copy, flashbench, 0, 0, 0755, -, /usr/sbin/erase)
+
+	@$(call install_finish, flashbench)
+
+	@$(call touch)
+
+# vim: syntax=make
-- 
1.7.9.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-14 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 16:42 [ptxdist] [PATCH] Add flashbench tool bernhard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox