修改defconfig之后,initrd启动失败

我修改了kernel的defconfig文件,然后重新编译内核和模块,烧录之后initrd启动失败,日志如下:

[    3.340024] Freeing unused kernel memory: 7616K
[    3.340095] Run /init as init process
[    3.355024] Checking overlayfs setting...
[    3.363580] Overlayfs is disabled...
[    3.369287] Root device found: PARTUUID=3c94872b-6070-4e9f-9480-070e3296a897
[    3.619520] usb 1-2: new high-speed USB device number 2 using tegra-xusb
[    3.776342] hub 1-2:1.0: USB hub found
[    3.777174] hub 1-2:1.0: 4 ports detected
[    3.907359] usb 1-3: new high-speed USB device number 3 using tegra-xusb
[    4.064988] hub 1-3:1.0: USB hub found
[    4.065796] hub 1-3:1.0: 4 ports detected
[    4.359519] usb 1-3.1: new high-speed USB device number 4 using tegra-xusb
[    4.579518] usb 1-3.2: new full-speed USB device number 5 using tegra-xusb
[    6.656873] pcie_tegra194: module verification failed: signature and/or required key missing - tainting kernel
[    6.657002] pcie_tegra194: disagrees about version of symbol _dev_info
[    6.657004] pcie_tegra194: Unknown symbol _dev_info (err -22)
[    6.657015] pcie_tegra194: disagrees about version of symbol _dev_err
[    6.657016] pcie_tegra194: Unknown symbol _dev_err (err -22)
[    6.657030] pcie_tegra194: disagrees about version of symbol _dev_warn
[    6.657031] pcie_tegra194: Unknown symbol _dev_warn (err -22)
[    6.657066] pcie_tegra194: disagrees about version of symbol dev_err_probe
[    6.657067] pcie_tegra194: Unknown symbol dev_err_probe (err -22)
[    6.657073] pcie_tegra194: disagrees about version of symbol _dev_printk
[    6.657073] pcie_tegra194: Unknown symbol _dev_printk (err -22)
[    6.677282] phy_tegra194_p2u: disagrees about version of symbol _dev_err
[    6.677287] phy_tegra194_p2u: Unknown symbol _dev_err (err -22)
[    6.677293] phy_tegra194_p2u: disagrees about version of symbol _dev_warn
[    6.677294] phy_tegra194_p2u: Unknown symbol _dev_warn (err -22)
[    6.702021] nvme_core: disagrees about version of symbol device_remove_file_self
[    6.702025] nvme_core: Unknown symbol device_remove_file_self (err -22)
[    6.702036] nvme_core: disagrees about version of symbol dev_set_name
[    6.702038] nvme_core: Unknown symbol dev_set_name (err -22)
[    6.702065] nvme_core: disagrees about version of symbol device_initialize
[    6.702066] nvme_core: Unknown symbol device_initialize (err -22)
[    6.702091] nvme_core: disagrees about version of symbol bpf_trace_run2
[    6.702092] nvme_core: Unknown symbol bpf_trace_run2 (err -22)

可能是新生成的内核模块没有打包到initrd中,请问如果重新打包initrd

麻煩把你做過的所有步驟貼上來

我修改了Linux_for_Tegra# ls source/kernel/kernel-jammy-src/arch/arm64/configs/defconfig
然后执行下面的脚本:

build_kernel() {
    cd $TOP_DIR/Linux_for_Tegra/source
    make -C kernel

    export INSTALL_MOD_PATH=$TOP_DIR/Linux_for_Tegra/rootfs/
    make install -C kernel
    cp kernel/kernel-jammy-src/arch/arm64/boot/Image ../kernel/Image

    export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src
    make modules
    make modules_install

    make dtbs
    cp nvidia-oot/device-tree/platform/generic-dts/dtbs/* $TOP_DIR/Linux_for_Tegra/kernel/dtb/
}

然后执行:BOARDID=3767 BOARDSKU=0000 ./tools/kernel_flash/l4t_initrd_flash.sh -c tools/kernel_flash/flash_l4t_external.xml --external-device nvme0n1p1 --direct sdc jetson-orin-nano-devkit external

你確定你的modules_install有執行成功?
一是你run這個script的時候有沒有用root權限 不然根本寫不進Linux_for_Tegra/rootfs/
二是文件上的步驟有說要加上-E 不然Makefile不會吃到你設定的INSTALL_MOD_PATH modules八成被裝到你的host上不知道哪個目錄

還有update initrd的話麻煩把kernel image也copy到Linux_for_Tegra/rootfs/boot/底下
然後再執行

sudo ./tools/l4t_update_initrd.sh

這裡其實文件上沒有寫得很清楚
需要copy到Linux_for_Tegra/kernel/Image是因為flash的時候這個檔案會被copy進rootfs
但是Linux_for_Tegra/tools/l4t_update_initrd.sh這個tool是依據rootfs裡的kernel版本號來決定要怎麼更新initrd
(因為原本是OTA的時候需要在device上run /usr/sbin/nv-update-initrdl4t_update_initrd.sh只是為了可以在host PC上執行的一個wrapper而已)
所以kernel image也要被copy進Linux_for_Tegra/rootfs/boot/Image 這樣Linux_for_Tegra/tools/l4t_update_initrd.sh的執行結果才會正確
當然如果你沒有改kernel版本號的話就不會有影響

最後還有改kernel config請不要直接修改defconfig
任何操作都請用menuconfig改完之後再savedefconfig
你直接改defconfig很可能條件沒有滿足 你改的東西根本沒有生效

好的,多谢

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.