procd: fix initial nand sysupgrade
authorFelix Fietkau <nbd@openwrt.org>
Sun, 12 Oct 2014 15:50:15 +0000 (15:50 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 12 Oct 2014 15:50:15 +0000 (15:50 +0000)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
SVN-Revision: 42884

package/system/procd/files/nand.sh

index 4894b81f79827cafe0deeb822192c111a3140bae..fd2f943ba39d6168baca40fdb523904ad869e0c7 100644 (file)
@@ -10,6 +10,18 @@ CI_KERNPART="kernel"
 # 'ubi' partition on NAND contains UBI
 CI_UBIPART="ubi"
 
+ubi_mknod() {
+       local dir="$1"
+       local dev="/dev/$(basename $dir)"
+
+       [ -e "$dev" ] && return 0
+
+       local devid="$(cat $dir/dev)"
+       local major="${devid%%:*}"
+       local minor="${devid##*:}"
+       mknod "$dev" c $major $minor
+}
+
 nand_find_volume() {
        local ubidevdir ubivoldir
        ubidevdir="/sys/devices/virtual/ubi/$1"
@@ -18,6 +30,7 @@ nand_find_volume() {
                [ ! -d "$ubivoldir" ] && continue
                if [ "$( cat $ubivoldir/name )" = "$2" ]; then
                        basename $ubivoldir
+                       ubi_mknod "$ubivoldir"
                        return 0
                fi
        done
@@ -33,6 +46,7 @@ nand_find_ubi() {
                [ ! "$mtdnum" ] && continue
                if [ "$mtdnum" = "$cmtdnum" ]; then
                        ubidev=$( basename $ubidevdir )
+                       ubi_mknod "$ubidevdir"
                        echo $ubidev
                        return 0
                fi