/riscv-openwrt

Porting OpenWrt to RISC-V

Primary LanguageCGNU General Public License v2.0GPL-2.0

Port of the OpenWrt project to RISC-VBuild Status

About

Porting OpenWrt to RISC-V ISA.

Release early, release offen. So far it can build the vmlinux & ext4 image and boot up on riscv-qemu successfully. But it still need many works to do and lots of test, check the TODO List and Known Problems.

How to play

Prerequesites

  • Ubuntu (I use 14.04 LTS) with the packages installed sudo apt-get git-core build-essential libssl-dev libncurses5-dev unzip gawk python2.7 subversion
  • qemu-system-riscv installed (riscv-qemu])
  • Bootloader(bbl) from here or build it by yourself.

Build

In terminal.

# clone and checkout
git clone https://github.com/xfguo/riscv-openwrt.git
cd riscv-openwrt
git checkout riscv-port

# todo: update and install packages feed,
#       but there are some issue when compile kmods, we will fix it later
# ./scripts/feeds update -a
# ./scripts/feeds install -a

# temperory step, later will be removed.
cp openwrt.config .config

# config
make menuconfig

# start to build, N=6 is my preferd.
# if something error and stop, use make V=s to check the error.
make -jN [V=s]

Run on Qemu Simulator

If the buld has no error, the results will be placed at bin/riscv64-glibc, try run it with qemu.

qemu-system-riscv -kernel BBL_PATH/bbl -append bin/riscv64-glibc/openwrt-riscv64-vmlinux.elf -drive file=bin/riscv64-glibc/openwrt-riscv64-ext4.img,format=raw -nographic

TODO List/Known Problems

TODOs

  • Many temperory scripts exists and some of them need be checked:
    • toolchain/*
    • include/site/riscv64
  • Support both RISCV32/64, and target/linux/riscv64->target/linux/riscv.
  • OpenWrt trunk use gcc 5.2.0 but RISC-V use 5.3.0, patches need be checked.
  • Now it use CONFIG_KERNEL_GIT_CLONE_URI to clone linux from riscv-openwrt-linux, later it need to become to vanilla kernel + patches.
  • Now it use gcc/binutils/glibc source code packages generated by project riscv-gnu-toolchain to build the toolchain (download from riscv-openwrt-files), later it need to become to official packages + patches.
  • Support initramfs, a disk file must be attached when run riscv-qemu, how to disable it?
  • More RISC-V devices and boards support.
  • Of course, finally, contribute the port to OpenWrt community as a new arch.

Problems

  • Failed when built kernel modules, seems riscv-linux port missing ksymb.c and export them.
  • It works basiclly fine with CPU selection=Rocket but it seems to stuck somewhere when boot that built with CPU selection=Generic RISC-V config.

RISC-V Port Authors