nand_find_volume() {
local ubidevdir ubivoldir
- ubidevdir="/sys/devices/virtual/ubi/$1"
+ ubidevdir="/sys/class/ubi/"
[ ! -d "$ubidevdir" ] && return 1
for ubivoldir in $ubidevdir/${1}_*; do
[ ! -d "$ubivoldir" ] && continue
}
nand_find_ubi() {
- local ubidevdir ubidev mtdnum
+ local ubidevdir ubidev mtdnum cmtdnum
mtdnum="$( find_mtd_index $1 )"
[ ! "$mtdnum" ] && return 1
- for ubidevdir in /sys/devices/virtual/ubi/ubi*; do
- [ ! -d "$ubidevdir" ] && continue
+ for ubidevdir in /sys/class/ubi/ubi*; do
+ [ ! -e "$ubidevdir/mtd_num" ] && continue
cmtdnum="$( cat $ubidevdir/mtd_num )"
- [ ! "$mtdnum" ] && continue
if [ "$mtdnum" = "$cmtdnum" ]; then
ubidev=$( basename $ubidevdir )
ubi_mknod "$ubidevdir"
ubinfo /dev/ubi0 -N metadata1 > /dev/null 2>&1 || return
# Find UBI volume device (e.g. ubi0_123)
- local ubivol="$(grep rootfs_data /sys/devices/virtual/ubi/ubi*/ubi*/name | sed -n 's/.*\(ubi\d*_\d*\).*/\1/p')"
+ local ubivol="$(grep rootfs_data /sys/class/ubi/ubi*/name | sed -n 's/.*\(ubi\d*_\d*\).*/\1/p')"
if [ -n "$ubivol" ]; then
bcm4908_verify_rootfs_data $ubivol
else
cur_boot_part="$(/usr/sbin/fw_printenv -n boot_part)"
if [ -z "${cur_boot_part}" ]; then
- mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num)
+ mtd_ubi0=$(cat /sys/class/ubi/ubi0/mtd_num)
case "$(grep -E "^mtd${mtd_ubi0}:" /proc/mtd | cut -d '"' -f 2)" in
kernel|rootfs)
cur_boot_part=1
cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part)
if [ -z "${cur_boot_part}" ] ; then
- mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num)
+ mtd_ubi0=$(cat /sys/class/ubi/ubi0/mtd_num)
case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in
kernel1|rootfs1)
cur_boot_part=1
cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part)
if [ -z "${cur_boot_part}" ] ; then
- mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num)
+ mtd_ubi0=$(cat /sys/class/ubi/ubi0/mtd_num)
case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in
kernel|rootfs)
cur_boot_part=1
cur_boot_part=$(/usr/sbin/fw_printenv -n boot_part)
if [ -z "${cur_boot_part}" ] ; then
- mtd_ubi0=$(cat /sys/devices/virtual/ubi/ubi0/mtd_num)
+ mtd_ubi0=$(cat /sys/class/ubi/ubi0/mtd_num)
case $(grep -E ^mtd${mtd_ubi0}: /proc/mtd | cut -d '"' -f 2) in
kernel1|rootfs1)
cur_boot_part=1