当我使用riscv gcc(verison 4.9.2)编译linux(版本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.
答案 0 :(得分:0)
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