手上的板子是imx6d的emmc版本,移植openwrt后,发现openwrt的overlayfs未能挂载,研究openwrt的fstools代码后,发现里面代码主要是针对nand、nor flash等基于mtd驱动的挂载,mount_root一开始会通过volume_find获取rootfs_data的盘符以及类型相关的信息,一般openwrt的flash是uboot、uboot_env,kernel+rootfs(firmware),rootfs_data,art等,所以只有找到rootfs_data才能继续往下走。
思路是这样的,首先通过增加mmc.c,将需要的信息挂载到volume结构里,然后,代码就能够按照流程走下去了。
mmc.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include "libfstools.h"
#include "volume.h"
/* fit for MMC_MAX_VOLUME_NAME and sysfs path lengths */
#define BUFLEN 128
/* could use libubi-tiny instead, but already had the code directly reading
* from sysfs */
const char *const mmc_dir_name = "/";
struct mmc_volume {
struct volume v;
int mmc_num;
int mmc_volid;
};
static struct driver mmc_d