XV6-RISCV On K210
(`-') (`-') <-.(`-') (OO )_.-> _(OO ) __( OO) (_| \_)--.,--.(_/,-.\ ,--. (`-') '-'. ,--. .----. .--. .----. \ `.' / \ \ / (_/ / .' ( OO).-> | .' / \_,-. | /_ | / .. \ \ .') \ / / . / -. (,------. | /) .' .' | | | / \ . .' \ _ \ /_)' .-. \ `------' | . ' .' /_ | | ' \ / ' / .'. \ \-'\ / \ `-' / | |\ \ | | | | \ `' / `--' '--' `-' `----' `--' '--' `------' `--' `---''
- RISC-V Toolchain: riscv-gnu-toolchain
git clone https://github.com/HUST-OS/xv6-k210
First you need to connect your k210 board to your PC.
And check the
USB serial port:
ls /dev/ | grep USB
In my situation it will be
cd xv6-k210 make build
Run on k210 board
Instead of the original file system, xv6-k210 runs with FAT32. You might need an SD card with FAT32 format.
shell, you need to rename the "_init" and "_sh" in the "/xv6-user" to "init" and "sh" after building, then copy them to the root of your SD card. Or you can directly run the command as below with your SD card connected.
Warning: this will format your SD card and clean your original data!
make sdcard sd="your SD card device's path"
To run on k210:
Sometimes you should change the
USB serial port:
make run k210-serialport=`Your-USB-port`(default by ttyUSB0)
Ps: Most of the k210-port in Linux is ttyUSB0, if you use Windows or Mac OS, this doc may help you: maixpy-doc
Run on qemu-system-riscv64
First, make sure
qemu-system-riscv64 is installed on your system.
Second, make a disk image file with FAT32 file system.
It will generate a disk image file
fs.img, and compile some user programs like
shell then copy them into the
As long as the
fs.img exists, you don't need to do this every time before running, unless you want to update it.
Finally, start running.
make run platform=qemu
Ps: Press Ctrl + A then X to quit qemu.
The shell commands are user programs, too. Those program should be put in a "/bin" directory in your SD card or the
Now we support a few useful commands, such as
cat and so on.
shell supports some shortcut keys as below:
- Ctrl-H -- backspace
- Ctrl-U -- kill a line
- Ctrl-D -- end of file (EOF)
- Ctrl-P -- print process list
- Multicore boot
- Bare-metal printf
- Memory alloc
- Page Table
- Timer interrupt
- S mode extern interrupt
- Receive uarths message
- SD card driver
- Process management
- File system
- User program
- Steady keyboard input(k210)
Keyboard input on k210 platform.