无法从 Yocto 为 BeagleBone 编译 Linux 内核 DTSI 文件

标签 linux compilation linux-kernel kernel yocto

我正在使用德州仪器官方 Yocto SDK 为 Beaglebone X-15(TI AM5728 处理器)构建完整的 BSP。

整个 SDK 非常适合 SDK 中的 MACHINE=am57xx-evm 类型。后来的 SDK 包括 MACHINE=beagle-x15,但我需要这个带有 Linux 内核 4.4 的旧版本。

此 SDK 中的 Linux 内核 4.4 确实包含了 beagle-x15 设备树片段,但是 beagle x15 的机器配置不存在,所以我从后来的 SDK 中包含了新机器的 1 conf 文件。

问题是设备树无法编译 - 存在语法问题,如此回溯所示:

| Error: /home/user/tisdk/build/arago-tmp-external-linaro-toolchain/work-shared/beagle-x15/kernel-source/arch/arm/boot/dts/beagle-x15-cmem.dtsi:1.1-2 syntax error
| FATAL ERROR: Unable to parse input tree
| scripts/Makefile.lib:293: recipe for target 'arch/arm/boot/dts/am57xx-beagle-x15-revc.dtb' failed
| make[3]: *** [arch/arm/boot/dts/am57xx-beagle-x15-revc.dtb] Error 1
| arch/arm/Makefile:333: recipe for target 'am57xx-beagle-x15-revc.dtb' failed
| make[2]: *** [am57xx-beagle-x15-revc.dtb] Error 2
| Makefile:150: recipe for target 'sub-make' failed
| make[1]: *** [sub-make] Error 2
| Makefile:24: recipe for target '__sub-make' failed
| make: *** [__sub-make] Error 2
| WARNING: /home/user/tisdk/build/arago-tmp-external-linaro-toolchain/work/beagle_x15-linux-gnueabi/linux-ti-staging/4.4.41+gitAUTOINC+f9f6f0db2d-r7a.arago5.tisdk60/temp/run.do_compile.121513:1 exit 1 from 'exit 1'
| ERROR: oe_runmake failed
| ERROR: Function failed: do_compile (log file is located at /home/user/tisdk/build/arago-tmp-external-linaro-toolchain/work/beagle_x15-linux-gnueabi/linux-ti-staging/4.4.41+gitAUTOINC+f9f6f0db2d-r7a.arago5.tisdk60/temp/log.do_compile.121513)

这是编译失败的整个 DTSI 文件:

    / {
        reserved-memory {
                #address-cells = <2>;
                #size-cells = <2>;
                ranges;

                cmem_block_mem_0: cmem_block_mem@a0000000 {
                        reg = <0x0 0xa0000000 0x0 0x0c000000>;
                        no-map;
                        status = "okay";
                };

        cmem_block_mem_1_ocmc3: cmem_block_mem@40500000 {
            reg = <0x0 0x40500000 0x0 0x100000>;
            no-map;
            status = "okay";
        };
        };

        cmem {
                compatible = "ti,cmem";
                #address-cells = <1>;
                #size-cells = <0>;

        #pool-size-cells = <2>;

                status = "okay";

                cmem_block_0: cmem_block@0 {
                        reg = <0>;
                        memory-region = <&cmem_block_mem_0>;
                        cmem-buf-pools = <1 0x0 0x0c000000>;
                };

        cmem_block_1: cmem_block@1 {
            reg = <1>;
            memory-region = <&cmem_block_mem_1_ocmc3>;
        };
        };
};

这是 beagle-x15.conf 文件:

#@TYPE: Machine
#@NAME: BeagleBoard X15
#@DESCRIPTION: Machine configuration for the BeagleBoard X15

require conf/machine/include/dra7xx.inc

KERNEL_DEVICETREE = "am57xx-beagle-x15.dtb am57xx-beagle-x15-revb1.dtb am57xx-beagle-x15-revc.dtb"

MACHINE_GUI_CLASS = "bigscreen"

SERIAL_CONSOLE = "115200 ttyS2"

UBOOT_MACHINE = "am57xx_evm_config"

WKS_FILE = "sdimage-bootpart.wks"
IMAGE_BOOT_FILES = "MLO u-boot.img"
IMAGE_FSTYPES += "tar.xz wic.xz"

do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot"

# UBI information.  Note that this is board and kernel specific.  Changes
# in your kernel port may require changes in these variables.  For more
# details about this board please see
# http://processors.wiki.ti.com/index.php/UBIFS_Support

# do ubiattach /dev/ubi_ctrl -m 7 -O 2048
# From dmesg:
# UBI: smallest flash I/O unit:    2048
# UBI: logical eraseblock size:    126976 bytes
# from ubiattach stdout:
# UBI device number 0, total 1988 LEBs
MKUBIFS_ARGS = "-F -m 2048 -e 126976 -c 8192"

# do ubiattach /dev/ubi_ctrl -m 7 -O 2048
# from dmesg:
# UBI: smallest flash I/O unit:    2048
# UBI: physical eraseblock size:   131072 bytes (128 KiB)
# UBI: sub-page size:              512
# UBI: VID header offset:          2048 (aligned 2048)
UBINIZE_ARGS = "-m 2048 -p 128KiB -s 512 -O 2048"

如何编译这个 DTSI 文件?谢谢。

更新:事实证明 Ubuntu DTC 编译器也失败了(版本 1.4):

dtc -O dtb -o /home/user/Desktop/test.dtb /home/user/tisdk/build/arago-tmp-external-linaro-toolchain/work-shared/beagle-x15/kernel-source/arch/arm/boot/dts/beagle-x15-cmem.dtsi
Error: /home/user/tisdk/build/arago-tmp-external-linaro-toolchain/work-shared/beagle-x15/kernel-source/arch/arm/boot/dts/beagle-x15-cmem.dtsi:1.1-2 syntax error
FATAL ERROR: Unable to parse input tree

最佳答案

如果未指定版本,dtc 编译器默认将设备树版本视为 0。版本 0 的语法与版本 1 不同。因此您需要添加,

/dts-v1/;

作为设备树文件的第一行。

除此之外,通常您需要编译.dts 文件,而不是直接编译.dtsi(即include)。因此,您需要定义扩展名为 .dts 的设备树文件,包括 .dtsi 文件。

关于无法从 Yocto 为 BeagleBone 编译 Linux 内核 DTSI 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52570141/

相关文章:

ruby - 为什么 `xclip .bashrc` 在 ruby​​ 中比系统 ("xclip .bashrc"花费的时间长得多?

c++ - Linux system() 调用偶尔会阻塞

c++ - 我应该按什么顺序构建我的 C++ 静态库

c - 从 c 程序中确定 TASK_SIZE

c - 在 vfork()/clone() 中调用 execv() 之前设置 setuid()

JavaFX - 由 : java. lang.UnsupportedOperationException : Unable to open DISPLAY? 引起

python - 如何将我的 Python 3 应用程序编译为 .exe?

c++ - 如何总是用 Eclipse 编译一个 cpp 文件?

c - 在 file_operations 中实现 mmap - 将页面数组映射到虚拟空间

linux - PALLOC Linux 内核 4.4