写点什么

Build QEMU RISC-V Linux

作者:贾献华
  • 2022 年 8 月 03 日
  • 本文字数:1135 字

    阅读完需:约 4 分钟

Linux Kernel

wget -c https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.tar.xztar xvf linux-5.4.tar.xzcd linux-5.4make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfigmake ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- -j $(nproc)
复制代码

报错:

fs/pipe.c:607:13: internal compiler error: in get_len_gather_scatter_mode, at optabs-query.cc:673


#count 的大小就是增加的 swap 空间的大小,64M 是块大小,所以空间大小是 bs*count=4906MBsudo dd if=/dev/zero of=/swapfile bs=64M count=64# 把刚才空间格式化成swap格式sudo mkswap /swapfile# 使用刚才创建的swap空间sudo swapon /swapfile
复制代码

free -h

              total        used        free      shared  buff/cache   availableMem:          3.3Gi       259Mi       398Mi       2.0Mi       2.7Gi       2.8GiSwap:         4.0Gi          0B       4.0Gi
复制代码

Qemu

wget https://download.qemu.org/qemu-7.0.0.tar.xztar xvJf qemu-7.0.0.tar.xzcd qemu-7.0.0./configure --target-list=riscv64-softmmu --prefix=/opt/qemu-7.0.0 --enable-virtfs
复制代码

报错:

Using './build' as the directory for build output


ERROR: Cannot find Ninja

需要安装 ninja

sudo apt install ninja-build./configure --target-list=riscv64-softmmu --prefix=/opt/qemu-7.0.0 --enable-virtfs
复制代码

报错:

Using './build' as the directory for build output


ERROR: glib-2.56 gthread-2.0 is required to compile QEMU

需要安装 glib-2.56

 sudo apt install -y libglib2.0-dev
复制代码

报错:

../meson.build:463:2: ERROR: Dependency "pixman-1" not found, tried pkgconfig


A full log can be found at /home/ubuntu/riscv64-linux/qemu-7.0.0/build/meson-logs/meson-log.txt


ERROR: meson setup failed

需要安装 pixman-1

sudo apt install -y libpixman-1-dev
复制代码

报错:

../meson.build:1467:0: ERROR: Feature virtfs cannot be enabled: virtio-9p (virtfs) on Linux requires libcap-ng-devel and libattr-devel


A full log can be found at /home/ubuntu/riscv64-linux/qemu-7.0.0/build/meson-logs/meson-log.txt


ERROR: meson setup failed

需要安装 libcap-ng-devel 和 libattr-devel。

sudo apt install -y libcap-ng-dev libattr1-dev
复制代码

编译

./configure --target-list=riscv64-softmmu --prefix=/opt/qemu-7.0.0 --enable-virtfsmake -j $(nproc)sudo make install
复制代码

BusyBox

 tar xvf busybox-1.35.0.tar.bz2 cd busybox-1.35.0 cd busybox-1.35.0/ CROSS_COMPILE=riscv64-unknown-linux-gnu- make defconfig CROSS_COMPILE=riscv64-unknown-linux-gnu- make -j $(nproc)
复制代码

运行

 
复制代码


用户头像

贾献华

关注

及时当勉励 岁月不待人 2018.06.04 加入

https://2022.iosdevlog.com

评论

发布
暂无评论
Build QEMU RISC-V Linux_8月月更_贾献华_InfoQ写作社区