[嵌入式linux] RK3399/RK3568 PCIE接口的M2固态硬盘调式

一、硬件平台
RK3399+NVME固态硬盘


二、软件调式过程
1、 在dev/block下有识别到nvme

2、格式化 挂载之后 下df-h 看到已经识别到硬盘容量
格式化命令:mkdosfs /dev/block/nvme0n1p1
挂载命令:busybox mount /dev/block/nvme0n1p1 /data/nvme


加log分析

void VolumeManager::handleBlockEvent(NetlinkEvent *evt) {
std::lock_guard lock(mLock);

if (mDebug) {
        LOG(VERBOSE) << "----------------";
        LOG(VERBOSE) << "handleBlockEvent with action " << (int) evt->getAction();
        evt->dump();
    }std::string eventPath(evt->findParam("DEVPATH")?evt->findParam("DEVPATH"):"");
    std::string devType(evt->findParam("DEVTYPE")?evt->findParam("DEVTYPE"):"");

+ LOG << "handleBlockEvent with eventPath " << eventPath;

if (devType != "disk") return;
加入补丁

1. if (isVirtioBlkDevice(majorId)) {
LOG << "Recognized experimental block major ID " << majorId
<< " as virtio-blk (emulator's virtual SD card device)";
mLabel = "Virtual";
break;
}
if(majorId==259) {
LOG << "majorID==259 major11 type " << majorId;
mLabel = "Pcie";
break;
}
LOG << "Unsupported block major11 type " << majorId;
return -ENOTSUP;
2: if (isVirtioBlkDevice(majorId)) {
// drivers/block/virtio_blk.c has "#define PART_BITS 4", so max is
// 2^4 - 1 = 15
return 15;
}
if(majorId==259) {
LOG << "majorID==259 major22 type " << majorId;
return 15;
}


结果可以识别到了 识别成USB移动设备


请使用浏览器的分享功能分享到微信等