hi guys,
I try to porting openwrt rootfs to my imx6ul board. uboot and kernel build from NXP SDK, rootfs build from lede 17.02. Everything is working ok, but mount_root have some problems.
root@EXC:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00400000 00020000 "u-boot"
mtd1: 00100000 00020000 "dtb"
mtd2: 00800000 00020000 "kernel-0"
mtd3: 00800000 00020000 "kernel-1"
mtd4: 00400000 00020000 "logo"
mtd5: 04900000 00020000 "rootfs"
mtd6: 01e00000 00020000 "rootfs_data"
rootfs is /dev/ubi0_0
in script /lib/preinit/80_mount_root
, i add some shell command before mount_root:
mtd_head=`hexdump -n 2 -e '2/1 "%02x"' /dev/mtdblock6`
[ "$mtd_head" != "5542" ] && mkdir -p /tmp/factory_default
ubiattach /dev/ubi_ctrl -m 6
[ $? -ne 0 ] && {
ubiformat -y /dev/mtd6
ubiattach /dev/ubi_ctrl -m 6
}
[ ! -c /dev/ubi1 ] && {
mknod /dev/ubi1 c 248 0
}
[ ! -d /sys/class/ubi/ubi1/ubi1_0 ] && {
ubimkvol /dev/ubi1 -N rootfs_data -m
}
[ ! -c /dev/ubi1_0 ] && {
mknod /dev/ubi1_0 c 248 1
}
mount_root
in boot log,i found:
mount_root: failed to mount -t ubifs /dev/ubi1_0 /tmp/overlay: Resource busy
mount_root: overlay filesystem has not been fully initialized yet
mount_root: switching to ubifs overlay
mount_root: thomas step 3mount_root: switching to ubifs failed - fallback to ramoverlay
the error is from call tree:
mount_root:
main
--->start()
--->mount_overlay()
--->overlay_mount_fs()
function mount errno of Resource busy
① EBUSY source is already mounted.
② EBUSY source cannot be remounted read-only, because it still holds files open for writing.
③ EBUSY source cannot be mounted on target because target is still busy (it is the working directory of some thread, the mount point of another device, has open files, etc.).
function overlay_mount_fs:
static int overlay_mount_fs(struct volume *v)
{
char *fstype = overlay_fs_name(volume_identify(v));
if (mkdir("/tmp/overlay", 0755)) {
ULOG_ERR("failed to mkdir /tmp/overlay: %s\n", strerror(errno));
return -1;
}
if (mount(v->blk, "/tmp/overlay", fstype, MS_NOATIME, NULL)) {
ULOG_ERR("failed to mount -t %s %s /tmp/overlay: %s\n",
fstype, v->blk, strerror(errno));
return -1;
}
return 0;
}
how to debug this problem ?