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