无法使用 hikey_defconfig 编译 u-boot

Unable to compile u-boot with hikey_defconfig

我刚刚从 github

克隆了 u-boot
https://github.com/u-boot/u-boot.git

并尝试使用随机选择的 defconfig(特别是 hikey_defconfig)构建它。

export ARCH=arm
export CROSS_COMPILE=/opt/linaro-7.2.1-2017.11/bin/arm-linux-gnueabi-
make hikey_defconfig
make all

一段时间后出现以下错误:

{standard input}: Assembler messages:
{standard input}:36: Error: unexpected character `n' in type specifier
{standard input}:36: Error: bad instruction `b.ne 1b'
scripts/Makefile.build:280: recipe for target 'arch/arm/cpu/armv8/cpu.o' failed
make[1]: *** [arch/arm/cpu/armv8/cpu.o] Error 1
Makefile:1320: recipe for target 'arch/arm/cpu/armv8' failed
make: *** [arch/arm/cpu/armv8] Error 2

看起来像是一个汇编错误。我做错了什么?

Hikey 96Boards 正在使用 Kirin 920/Kirin 960 SoC:两者都在实现 ARMv8-A 64 位架构(Cortex-A73+Cortex-A53)或 Cortex-A53 - 参见 here and here

因此,您应该使用 Linaro aarch64-linux-gnu 或 aarch64-elf 工具链,而不是您使用的 32 位工具链。

工作命令将是:

make CROSS_COMPILE=/opt/linaro/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-elf/bin/aarch64-elf- mrproper hikey_defconfig all

您可以通过查看 configs/hikey_defconfig 中引用的 DTS 文件来检查必须编译的架构,方法如下:

CONFIG_DEFAULT_DEVICE_TREE="hi6220-hikey"

arch/arm/dts/hi6220-hikey.dts 确实包括 arch/arm/dts/hi6220.dtsi,它确实包含说明 Hikey Soc 中包含的内核与哪个架构兼容的语句:
   cpu0: cpu@0 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x0>;
        enable-method = "psci";
    };

    cpu1: cpu@1 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x1>;
        enable-method = "psci";
    };

    cpu2: cpu@2 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x2>;
        enable-method = "psci";
    };

    cpu3: cpu@3 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x3>;
        enable-method = "psci";
    };

    cpu4: cpu@100 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x100>;
        enable-method = "psci";
    };

    cpu5: cpu@101 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x101>;
        enable-method = "psci";
    };

    cpu6: cpu@102 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x102>;
        enable-method = "psci";
    };

    cpu7: cpu@103 {
        compatible = "arm,cortex-a53", "arm,armv8";
        device_type = "cpu";
        reg = <0x0 0x103>;
        enable-method = "psci";
    };

在您选择用于为 Hikey 板编译 u-boot 的 Linaro 工具链期间,这可能会指导您。