[PATCH 17/17] defaultenv-2: mtdparts-add: Use new partition parameter

Sascha Hauer s.hauer at pengutronix.de
Thu Feb 12 00:54:34 PST 2015


mtd devices now have a partition parameter to create mtd partitions.
Use it to simplify the mtdparts-add script.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 defaultenv/defaultenv-2-base/bin/mtdparts-add | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/defaultenv/defaultenv-2-base/bin/mtdparts-add b/defaultenv/defaultenv-2-base/bin/mtdparts-add
index a0e419e..805e3e2 100644
--- a/defaultenv/defaultenv-2-base/bin/mtdparts-add
+++ b/defaultenv/defaultenv-2-base/bin/mtdparts-add
@@ -26,13 +26,12 @@ if [ -z "${parts}" ]; then
 	exit
 fi
 
-if [ -e /tmp/mtdparts/${device} ]; then
-	delpart /dev/${device}.*
+${device}.partitions="$parts"
+if [ $? != 0 ]; then
+	echo "Failed to add partitions $parts to $device"
+	exit 1
 fi
 
-addpart -n /dev/${device} "$parts" || exit
-mkdir -p /tmp/mtdparts/${device}
-
 if [ -n ${kernelname} ]; then
 	global linux.mtdparts.${device}
 	global.linux.mtdparts.${device}="${kernelname}:${parts}"
-- 
2.1.4




More information about the barebox mailing list