64位编译64位

跑通了64位的poky,Poky的开发者说并不支持32位,bitbake and spike/runqemu无法配置

Sorry for the delay responding. We do not currently support RV32 builds, but poky should run on a 32bit build host without problems.
Adding RV32 support should be a moderate amount of work. It will require adding a new riscv32 machine type and then updating all the places that currently refer to riscv64, to make them refer to riscv32 as well.

于是转而继续之前的任务,将32位的vmlinux和bbl编译出来。尝试过不用qemu用spike,但由于没有能用的bbl,所以没办法。

32位编译32位

riscv-qemu的维护者将分配内存的问题解决了,但表示riscv32暂时不会增加支持。

riscv32 support is a separate problem, but this should be enough to get you running.

On Qemu

Invalid Htif Register

64位编译32位

On Qemu

https://github.com/riscv/riscv-pk/issues/43

Nice. I think the HTIF issue is EWONTFIX. @a0u is working on the general-purpose UART, which we should standardize on in favor of the tethering stuff.

but the HTIF console is not implemented on 32-bit, it just traps if the device is set. Trying sifive_board now.

On Sifive_board

git clone https://github.com/riscv/riscv-gnu-toolchain/
git reset --hard 2ffda4e
(this is a 1.9 version, as QEMU does not support 1.9.1)
./configure --with-xlen=32 --prefix=$RISCV
make -j4 linux
git clone https://github.com/sifive/riscv-pk/
git reset --hard fd688fc
vim Makefile.in // CFLAGS 去掉 -msoft-float
mkdir build
cd build
../configure --host=riscv32-unknown-linux-gnu
make -k #pk fails with an gcc ICE on this toolchain version, but we only need bbl
#build qemu
git clone https://github.com/riscv/riscv-qemu
cd riscv-qemu
git fetch origin pull/46/head:shr
git checkout shr
git submodule update --init pixman
./configure --target-list=riscv64-softmmu,riscv32-softmmu
make
#boot kernel
riscv32-softmmu/qemu-system-riscv32 -machine sifive -nographic -kernel $HOME/riscv-pk-sifive/build/bbl

but….

不带vmlinux可以跑,带vmlinux会
kernel panic

SIFIVE, INC.
...LOGO...
[ 0.000000] Linux version 4.6.2-00032-g1ef29a9-dirty (dxu@ubuntu) (gcc version
...
[ 3.140000] Call Trace:
[ 3.140000] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

32位编译64位

 

With #46 riscv64-softmmu works on a 32-bit Debian chroot using a riscv64 Linux kernel + initramfs built from freedom-u-sdk (be sure to use the version of freedom-u-sdk mentioned in README.md after checking out the PR).

The tests were done on 64-bit Intel hardware + a 32-bit OS, so it’s still theoretically possible you could have compatibility problems with 32-bit hardware. Let me know how it goes.

riscv32 support is a separate problem, but this should be enough to get you running.

$ git clone https://github.com/riscv/riscv-qemu
$ git reset --hard fe43ef4
$ cd riscv-qemu
$ git fetch origin pull/46/head:shr
$ git checkout shr
$ git submodule update --init pixman
$ vim hw/riscv/riscv_board.c
$ ./configure --target-list=riscv32-softmmu,riscv64-softmmu --disable-werror
$ make

try

sudo apt-get install unzip
#先编gnu-toolchain

git clone https://github.com/sifive/freedom-u-sdk
cd freedom-u-sdk
git reset --hard 5d38ed5d
git submodule update --init --recursive
vim riscv-pk/Makefile.in #delete 84:-msoft-float
make -j4

加入了busybox, initramfs
虽然这套流程是按照sifive_board的流程来的,但是无法使用sifive_board.

The current sifive_board doesn’t work with the current freedom-u-sdk even on a 64-bit host with 8GB because the register assignment of the UART has changed (on my TODO)

#run qemu
./riscv64-softmmu/qemu-system-riscv64 -kernel freedom-u-sdk/work/riscv-pk/bbl -nographic

actually, we boot the kernel successfully and the initial username and password is

root
sifive

2 thoughts on “riscv-poky 32bit Practice

  1. Shi同学你好,我最近因为课布置的任务也在折腾riscv,我想编译出一个能跑的riscv32 linux,你之前成功过吗?我谷歌到了你之前问的riscv问题,然后你用了一个非官方修改过的支持32bit的riscv-linux似乎你已经成功了?

    请问是怎么做到的?我用那个人给的repo里面的Makefile好像没法编译啊

    可以联系一下我吗 谢谢 我的email是szhou42@illinois.edu

    1. Hi, Shicheng. 我应该是失败了。。我们试过用64位和32位的ubuntu OS交叉编译riscv32 linux,最终应该是都出了问题。32位编译出来的会出现invalid htif register错误,64位编译出来的会Kernel panic。我们应该有保留当时的操作记录,整理之后可以发给你。
      你指的是哪个人的repo?我当时提了太多问题记不得了。
      祝顺利!

Leave a Reply

Your email address will not be published. Required fields are marked *