aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2023-02-15 03:06:05 +0000
committerDaniel Golle <daniel@makrotopia.org>2023-02-15 03:27:59 +0000
commite8625c89efbbbe12a5934c10fc3478fd2f70fb21 (patch)
treedf96a66ab704dd1333293429da5a3e2a84a38cc3 /package/base-files
parent62e583ddb9c1f8a5d760ff0612433c5e262fe481 (diff)
downloadupstream-e8625c89efbbbe12a5934c10fc3478fd2f70fb21.tar.gz
upstream-e8625c89efbbbe12a5934c10fc3478fd2f70fb21.tar.bz2
upstream-e8625c89efbbbe12a5934c10fc3478fd2f70fb21.zip
treewide: replace /sys/devices/virtual/ubi by /sys/class/ubi
Starting from Linux Kernel version 6.3 UBI devices will no longer be considered virtual, but rather have an MTD device parent. Hence they will no longer be listed under /sys/devices/virtual/ubi which is used in multiple places in OpenWrt. Prepare for future kernels by using /sys/class/ubi instead of /sys/devuces/virtual/ubi. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/base-files')
-rw-r--r--package/base-files/files/lib/upgrade/nand.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/package/base-files/files/lib/upgrade/nand.sh b/package/base-files/files/lib/upgrade/nand.sh
index e7ac34f5d0..907945b349 100644
--- a/package/base-files/files/lib/upgrade/nand.sh
+++ b/package/base-files/files/lib/upgrade/nand.sh
@@ -28,7 +28,7 @@ ubi_mknod() {
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
@@ -41,13 +41,12 @@ nand_find_volume() {
}
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"