Riscv GCC 4.9.2 无法编译 linux 3.14.29

Riscv GCC 4.9.2 can't compile linux 3.14.29

当我使用riscv gcc(verison 4.9.2)编译linux(version 3.14.29)时,出现一些错误,gcc似乎无法识别某些操作码,我该如何解决那?将 gcc 更改为 4.6 版?谢谢

root@riscv-VirtualBox:/home/riscv/riscv/linux-3.14.29# make ARCH=riscv
scripts/kconfig/conf --silentoldconfig Kconfig
  ......
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h: Assembler messages:
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:22: Error: Instruction csrc requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:22: Error: Instruction csrc requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:10: Error: Instruction csrr requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:22: Error: Instruction csrc requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:22: Error: Instruction csrc requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:10: Error: Instruction csrr requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:16: Error: Instruction csrs requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:16: Error: Instruction csrs requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:10: Error: Instruction csrr requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:16: Error: Instruction csrs requires absolute expression
/home/riscv/riscv/linux-3.14.29/arch/riscv/include/asm/irqflags.h:16: Error: Instruction csrs requires absolute expression
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

root@riscv-VirtualBox:/home/riscv/riscv/linux-3.14.29# riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Chris,我使用以下方式安装 riscv-tools :

git clone https://github.com/riscv/riscv-tools.git
git submodule update --init --recursive
./build.sh

并使用以下方式获取linux来源:

 curl https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.29.tar.xz | tar -xJ 
cd linux-3.14.29 
git init 
git remote add origin https://github.com/riscv/riscv-linux.git 
git fetch 
git checkout -f -t origin/master

您的存储库不匹配(这可能不是您的错)。您可以尝试查看 "new_privileged_isa" 分支,但问题是 RISC-V 特权规范(截至 2015 年 4 月 30 日)仍在不断变化,我们不能保证分支的负责人会一起工作.