This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] TDA4VEN-Q1:动态选择引导文件系统

Guru**** 2466550 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1471718/tda4ven-q1-dynamic-selection-of-the-root-file-system

器件型号:TDA4VEN-Q1

工具与软件:

大家好、专家

我参考该链接 J722S MCU+ SDK: SBL SD HLOS 成功引导、但发现根文件系统选择在设备树(例如 root=/dev/mmcblk1p2)中是固定的、如果我想能够动态地选择不同的根文件系统应该如何实现它。 例如、当 SDcard 存在时、使用 mmcblk1p2;当 sdcard 不存在时、使用 eMMC、例如 mmcblk0p2或 mmcblk0p3。

 

电路板:定制电路板

SDK: 10_00_00_08

此致、

Bing

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Bing:

    您的引导流程中是否有 u-boot? 或者它是优化引导流程。 U-boot 可用于轻松添加此定制。

    此致、

    Tanmay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、 Tanmay、

    U-boot 可用于轻松添加此自定义。

    是的、我也在 uboot 中实现了这一点。 但现在不再有 uboot、内核映像直接由 SBL 加载。

    此致、

    Bing

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Bing:

    这是从器件树文件的"bootargs"中获取的。 那么标准的方法可能就不会有。

    我可以想到的是、在"arch/arm64/kernel/idreg-overrid.c"的"get_bootargs_cmdline ()"中、您将从 bootargs 中解析根装载点。 您可以在此处添加挂钩来修改此处的参数。 但我不确定如何检查 SD 卡是否存在。

    此致、
    Tanmay

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、 Tanmay、

    我想使用 SD 寄存器0x0FA00024的位18来检测它、但内核在读取寄存器时崩溃。

    我向内核源代码中添加了一段代码 ti-processor-sdk-linux-adas-j722s-evm-10_00_00_08/board-support/ti-linux-kernel-6.6.6.32+git-ti/init/main.c、如下所示

    #define MMC1_CTL_REG 0x0FA00024
    #define CARD_DETECT (1 << 18)
    /* return 1 use sd card file system */
    static int use_sdcard_filesystem(void)
    {
    	int ret;
    	void __iomem *mmc1_ctl_reg;
    	unsigned int val;
    
    	mmc1_ctl_reg = ioremap(MMC1_CTL_REG, 4);
    	val = readl(mmc1_ctl_reg);
    	ret = val & CARD_DETECT;
    
    	iounmap(mmc1_ctl_reg);
    
    	return ret;
    }

    日志:

    [    0.000000] ------------[ cut here ]------------
    [    0.000000] WARNING: CPU: 0 PID: 0 at mm/ioremap.c:23 generic_ioremap_prot+0xc8/0x104
    [    0.000000] Modules linked in:
    [    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 6.6.32 #57
    [    0.000000] Hardware name: Texas Instruments J722S EVM (DT)
    [    0.000000] pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    0.000000] pc : generic_ioremap_prot+0xc8/0x104
    [    0.000000] lr : generic_ioremap_prot+0x28/0x104
    [    0.000000] sp : ffff8000812a3dd0
    [    0.000000] x29: ffff8000812a3dd0 x28: 00000000810360ac x27: 0000000000000000
    [    0.000000] x26: 0000000000000000 x25: 0000000000000000 x24: ffff8000813df000
    [    0.000000] x23: 0068000000000f13 x22: 0068000000000713 x21: ffff8000800ae5a0
    [    0.000000] x20: 000000000fa00024 x19: 0000000000000004 x18: 0000000000000006
    [    0.000000] x17: 000000000000002f x16: 00000000fdc612e0 x15: ffff8000812a3870
    [    0.000000] x14: 000000000000000a x13: ffff8000812bea50 x12: 00000000000000d8
    [    0.000000] x11: 0000000000000048 x10: ffff800081316a50 x9 : ffff8000812bea50
    [    0.000000] x8 : 00000000ffffefff x7 : 0000000000000018 x6 : ffff80008140e638
    [    0.000000] x5 : ffff80008140e638 x4 : 0000000000000000 x3 : 0000000000000000
    [    0.000000] x2 : 0068000000000713 x1 : 0000000000000004 x0 : 0000000000000000
    [    0.000000] Call trace:
    [    0.000000]  generic_ioremap_prot+0xc8/0x104
    [    0.000000]  ioremap_prot+0x50/0x78
    [    0.000000]  start_kernel+0xac/0x6f0
    [    0.000000]  __primary_switched+0xbc/0xc4
    [    0.000000] ---[ end trace 0000000000000000 ]---
    [    0.000000] +++++++++++++
    [    0.000000] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
    [    0.000000] Mem abort info:
    [    0.000000]   ESR = 0x0000000096000004
    [    0.000000]   EC = 0x25: DABT (current EL), IL = 32 bits
    [    0.000000]   SET = 0, FnV = 0
    [    0.000000]   EA = 0, S1PTW = 0
    [    0.000000]   FSC = 0x04: level 0 translation fault
    [    0.000000] Data abort info:
    [    0.000000]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [    0.000000]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [    0.000000]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [    0.000000] [0000000000000000] user address but active_mm is swapper
    [    0.000000] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
    [    0.000000] Modules linked in:
    [    0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G        W          6.6.32 #57
    [    0.000000] Hardware name: Texas Instruments J722S EVM (DT)
    [    0.000000] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [    0.000000] pc : readl+0x0/0x18
    [    0.000000] lr : start_kernel+0xc4/0x6f0
    [    0.000000] sp : ffff8000812a3e40
    [    0.000000] x29: ffff8000812a3e40 x28: 00000000810360ac x27: 0000000000000000
    [    0.000000] x26: 0000000000000000 x25: 0000000000000000 x24: ffff8000813df000
    [    0.000000] x23: 0068000000000f13 x22: ffff8000812a9940 x21: 0068000000000713
    [    0.000000] x20: 0000000000000e12 x19: 0000000000000000 x18: 0000000000000006
    [    0.000000] x17: 000000000000002f x16: 00000000fdc612e0 x15: ffff8000812a3870
    [    0.000000] x14: 0000000000000000 x13: ffff8000812bea50 x12: 0000000000000126
    [    0.000000] x11: 0000000000000062 x10: ffff800081316a50 x9 : ffff8000812bea50
    [    0.000000] x8 : 00000000ffffefff x7 : ffff800081316a50 x6 : 80000000fffff000
    [    0.000000] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
    [    0.000000] x2 : 0000000000000000 x1 : ffff8000812b2b40 x0 : 0000000000000000
    [    0.000000] Call trace:
    [    0.000000]  readl+0x0/0x18
    [    0.000000]  __primary_switched+0xbc/0xc4
    [    0.000000] Code: d53cd040 d53cd040 d53cd040 d53cd040 (b9400000) 
    [    0.000000] ---[ end trace 0000000000000000 ]---
    [    0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
    [    0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task! ]---

    奇怪的是,我编译了代码到一个模块使用 insmod 加载模块,没有出现恐慌,这是什么原因?

    此致、

    Bing