blob: ec043eaf9e39bcf674aa1d78b4d1a75bcf010d01 [file] [log] [blame]
Edward A. James43d44ea2017-08-21 16:08:44 -05001#!/bin/sh
2
3# Get the mtd device number (mtdX)
4findmtd() {
5 m="$(grep -xl "$1" /sys/class/mtd/*/name)"
6 m="${m%/name}"
7 m="${m##*/}"
8 echo "${m}"
9}
10
11pnormtd="$(findmtd pnor)"
12pnor="${pnormtd#mtd}"
13pnordev="/dev/mtd${pnor}"
14
15if [[ ! "$(dd if=${pnordev} bs=1 count=3 2> /dev/null)" = "UBI" ]]; then
16 echo "${pnordev} is not formatted UBI"
17 exit 1
18fi