当前位置:网站首页>RISCV64

RISCV64

2022-07-07 18:55:00 InfoQ

install  Linux Lab

#  Use ordinary users to download  Cloud Lab, Then choose  linux-lab  Warehouse :
git clone https://gitee.com/tinylab/cloud-lab.git
cd cloud-lab/
#  start-up  Linux Lab  And log in to the experimental environment according to the user name and password printed on the console
tools/docker/run linux-lab

install  qemu-system-riscv64

export QEMU_VERSION=5.0.0
wget https://download.qemu.org/qemu-${QEMU_VERSION}.tar.xz
tar xvJf qemu-${QEMU_VERSION}.tar.xz
cd qemu-${QEMU_VERSION}
./configure --target-list=riscv64-softmmu --prefix=/opt/qemu
make -j $(nproc)
sudo make install
ERROR: glib-2.48 gthread-2.0 is required to compile QEMU
Please call configure before running make!
make: *** [Makefile:84: config-host.mak] Error 1
""
/bin/sh: 1: : Permission denied
make: *** [Makefile:916: install-datadir] Error 127
sudo apt-get install libglib2.0-dev
ERROR: pixman >= 0.21.8 not present.
 Please install the pixman devel package.
sudo apt-get install libpixman-1-dev

Download the latest  Linux  Source code

wget -c https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.18.9.tar.gz
tar xvf linux-5.18.9.tar.gz
cd linux-5.18.9
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- defconfig
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j $(nproc)

Download the latest  BusyBox

wget -c https://www.busybox.net/downloads/busybox-1.35.0.tar.bz2
tar xvf busybox-1.35.0.tar.bz2
cd busybox-1.35.0
cd busybox
CROSS_COMPILE=riscv64-linux-gnu- make defconfig
CROSS_COMPILE=riscv64-linux-gnu- make -j $(nproc)
make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- install

Make  rootfs

cd _install
mkdir proc sys dev etc etc/init.d
ls
# bin dev etc linuxrc proc sbin sys usr
sudo mknod dev/console c 5 1
sudo mknod dev/ram b 1 0
cat etc/init.d/rcS
etc/init.d/rcS
#!bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s
rootfs
chmod +x etc/init.d/rcS
find -print0 | cpio -0oH newc | gzip -9 > ../rootfs.img

function

/opt/qemu/bin/qemu-system-riscv64 \
 -nographic -machine virt \
 -kernel linux-5.18.9/arch/riscv/boot/Image \
 -initrd busybox-1.35.0/rootfs.img \
 -bios fw_jump.elf \
 -append "root=/dev/ram rdinit=/sbin/init"
Kernel panic - not syncing: VFS: Unable to mount
null
After normal startup , see  
uname
null
 

Reference resources

Running 64- and 32-bit RISC-V Linux on QEMU — RISC-V - Getting Started Guide (risc-v-getting-started-guide.readthedocs.io)
原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207071649465507.html