Skip to content

Commit

Permalink
A workaround to make sure /dev/mtd0 can be created
Browse files Browse the repository at this point in the history
A workaround to make sure /dev/mtd0 can be created when memdisk is used.
This is due to sometimes "modprobe phram" can not successfully create /dev/mtd0.
Have to try several times.
Ref: https://gitlab.gnome.org/GNOME/gparted/issues/50#note_523831
     http://gparted-forum.surf4.info/viewtopic.php?pid=32784#p32784
  • Loading branch information
stevenshiau authored and bluca committed Jun 17, 2019
1 parent 033a004 commit abfb059
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions components/9990-main.sh
Expand Up @@ -57,8 +57,19 @@ Live ()
if [ $? -eq 0 ]
then
# We found a memdisk, set up phram
modprobe phram phram=memdisk,${MEMDISK}
modprobe phram phram=memdisk,${MEMDISK}
# Sometimes "modprobe phram" can not successfully create /dev/mtd0.
# Have to try several times.
max_try=20
while [ ! -c /dev/mtd0 -a "$max_try" -gt 0 ]; do
modprobe phram phram=memdisk,${MEMDISK}
sleep 0.2
if [ -c /dev/mtd0 ]; then
break
else
rmmod phram
fi
max_try=$((max_try - 1))
done

# Load mtdblock, the memdisk will be /dev/mtdblock0
modprobe mtdblock
Expand Down

0 comments on commit abfb059

Please sign in to comment.