如何停止emmc恢复?

huangapple go评论70阅读模式
英文:

How can I stop emmc recovery?

问题

我有一个预构建的Linux内核4.19。我无法构建一个新的内核。我可以挂载一个emmc分区为只读,没有问题。但是我在挂载分区为读写时遇到了问题。它报告“运行CQE恢复”。

我考虑在我执行mount partition -o rw后,当恢复功能启动时杀死它。我怀疑该功能在core.c中。我的想法是将MMC_CQE_RECOVERY_TIMEOUT设置为内核命令行参数。但我不知道如果存在的话,哪个参数可以实现这个。或者我可以运行一个停止恢复的函数。我可以创建一个调用来自cqhci-core.c的函数mmc_cqe_request_done(mmc, mrq)的二进制文件,但我没有访问mmc, mrq参数,因为我不是在创建内核驱动程序,或者我可以在引导内核并运行mknod()之后从块设备本身创建这些参数。这些中哪些是可能的?

我并不打算打补丁内核源代码,我只是想知道是否有可能通过创建一个可以运行的二进制文件或使用可以停止qce恢复的内核参数来实现。

英文:

I have a prebuilt Linux kernel 4.19. I can't build a fresh one. I can mount an emmc partition read-only with no issue. I have trouble mounting partitions read and write. It reports "running CQE recovery"

I am thinking of killing the recovery function when it starts after I mount partition -o rw. I am suspecting the function is in core.c
My idea would be to set the MMC_CQE_RECOVERY_TIMEOUT as a kernel command line parameter. But I don't know which parameter does that if it exists. Or I could run a function that stops the recovery. I could maybe create a binary that calls the function mmc_cqe_request_done(mmc, mrq) from cqhci-core.c but I don't have access to mmc, mrq parameters since im not making a kernel driver or maybe I can create the parameters somehow from a block device itself after booting the kernel and running mknod(). Which of these is possible?

I am not trying to patch any kernel source I want to know if it's possible to stop running QCE recovery by creating a binary I can run or use a kernel parameter that can stop qce recovery.

答案1

得分: 0

当我提出这个问题时,我完全不知道设备树 blob 可以被修改。我最初的解决方案是我可以在用户空间运行代码来停止恢复。但后来我找到了一个更简单的解决方案,与编写代码无关。

问题是我需要停止命令队列,但我不知道如何做,也不知道它是如何在首次启用的。

事实证明,设备树具有mediatek,cqhci属性,这在内核中没有得到很好的支持。看来我的内核源代码可能通过对其内核源代码进行修补来启用它,因为它在主线 MEDIATEK mmc 中不可用。

/dts-v1/;

/ {
    mmc@11230000 {
        compatible = "mediatek,mt6768-mmc";
        mediatek,cqhci;
    };
};

所以我不得不使用fdtput来修改设备树文件。

fdtput -d /path/to/fdt /mmc@11230000 "mediatek,cqhci"

步骤

  1. 我从boot.img中提取了设备树 blob。
  2. 我通过Binwalk遍历了这个 blob,以获取纯粹的扁平设备树。
  3. 使用fdtput从 blob 中删除了命令队列启用器属性。
英文:

When I asked the question I had no idea device tree blobs could be modified. My goto solution was the impression I could run code in userspace to stop the recovery. I found a simpler solution. Which has nothing to do with writing code.

The problem was I needed to stop the command queue and I had no idea how to do it and didn't know where it was being enabled in the first place.

It turns out the device tree has mediatek,cqhci property which isn't supported well by the kernel. It seems my kernel sources probably had it enabled by patching their kernel sources since it wasn't available for mainline MEDIATEK mmc

/dts-v1/;

/ {
    mmc@11230000 {
        compatible = "mediatek,mt6768-mmc";
        mediatek,cqhci;
    };
};

So I had to modify the device tree file with fdtput.

fdtput -d /path/to/fdt /mmc@11230000 "mediatek,cqhci"

Steps

  1. I dumped the device tree blob from the boot.img
  2. I Binwalked through the blob to get the pure flattened device tree
  3. Deleted the command queue enabler property from the blob with fdtput

huangapple
  • 本文由 发表于 2023年7月27日 21:46:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76780399.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定