Linux 无法使用hikey_defconfig编译u-boot
我刚从github克隆了u-bootLinux 无法使用hikey_defconfig编译u-boot,linux,gcc,assembly,cross-compiling,u-boot,Linux,Gcc,Assembly,Cross Compiling,U Boot,我刚从github克隆了u-boot https://github.com/u-boot/u-boot.git 并尝试使用随机选择的defconfig(特别是hikey_defconfig)构建它 过了一段时间后,这给了我以下错误: {standard input}: Assembler messages: {standard input}:36: Error: unexpected character `n' in type specifier {standard input}:36: Er
https://github.com/u-boot/u-boot.git
并尝试使用随机选择的defconfig(特别是hikey_defconfig)构建它
过了一段时间后,这给了我以下错误:
{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 96板使用的是麒麟920/麒麟960 SOC:两者都实现了ARMv8-A 64位体系结构(Cortex-A73+Cortex-A53)或Cortex-A53-请参阅和 因此,您应该使用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\u 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";
};
cpu0:cpu@0 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu1:cpu@1 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu2:cpu@2 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu3:cpu@3 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu4:cpu@100 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu5:cpu@101 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu6:cpu@102 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu7:cpu@103 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
这就是在您选择Linaro工具链为Hikey板编译u-boot时可以指导您的方法。Hikey 96板使用Kirin 920/Kirin 960 SOC:两者都实现了ARMv8-a 64位体系结构(Cortex-A73+Cortex-A53)或Cortex-A53-请参阅和 因此,您应该使用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\u 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";
};
cpu0:cpu@0 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu1:cpu@1 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu2:cpu@2 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu3:cpu@3 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu4:cpu@100 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu5:cpu@101 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu6:cpu@102 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
cpu7:cpu@103 {
compatible=“arm,cortex-a53”,“arm,armv8”;
设备类型=“cpu”;
reg=;
启用方法=“psci”;
};
这就是在您选择Linaro工具链为Hikey板编译u-boot时可以指导您的方法。尝试使用ARM(32位)汇编器组装aarch64代码时出现的错误吗?
export ARCH=ARM
看起来不正确。您确定它不是aarch64
?@PeterCordes:aarch64
?好的,这里有两个问题-1。我如何知道我正在尝试汇编的代码是aarch64
?2.除了在下载工具链时阅读发行说明外,我如何知道预装的工具链编译为32位或64位?关于(1),arch/arm/cpu/armv8/cpu.o
通过armv8表示Aarch32或Aarch64。关于(2),执行/opt/linaro-7.2.1-2017.11/bin/arm-linux-gnueabi-gcc-dumpmachine
-dumpmachine
告诉您要构建的主机。arm
是传统的32位<代码>aarch64是ARMv8。你可以从源代码中分辨出区别;如果它使用类似于r0
的寄存器,那么它就是ARM(或Thumb)。如果它使用的是x0
/x0
整数寄存器,那么它就是AArch64。尝试用ARM(32位)汇编程序汇编AArch64代码时会出现错误吗?export ARCH=ARM
。您确定它不是aarch64
?@PeterCordes:aarch64
?好的,这里有两个问题-1。我如何知道我正在尝试汇编的代码是aarch64
?2.除了在下载工具链时阅读发行说明外,我如何知道预装的工具链编译为32位或64位?关于(1),arch/arm/cpu/armv8/cpu.o