Giter Site home page Giter Site logo

z4yx / ucore_os_lab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chyyuu/os_kernel_lab

3.0 3.0 0.0 51.4 MB

uCore OS kernel porting for RISC-V (K210 chip)

License: GNU General Public License v2.0

Shell 5.07% Python 0.08% Makefile 3.37% C++ 1.48% Assembly 2.26% C 87.53% M4 0.21%

ucore_os_lab's Introduction

uCore for riscv64 : uCore OS Labs on RISCV-64 (privileged spec 1.9)

uCore for riscv64 is a porting of ucore_os_lab to RISC-V architecture (privileged spec 1.9). It's built on top of the opensbi, a supervisor execution environment for RISC-V systems.

This uCore port runs on Kendryte K210 chip and QEMU.

Quickstart

Installing riscv-tools

You may build the toolchain for RV64, or download pre-built toolchain from https://kendryte.com/downloads/

Here are the steps to build the toolchain. (tested in ubuntu 16.04 x86-64)

0. setenv

$ export RISCV=/path/to/install/riscv/toolchain
$ export PATH=$RISCV/bin:$PATH

1. build gcc/gdb tools (64bit)

$ sudo apt-get install autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev
$ git clone https://github.com/riscv/riscv-tools.git
$ cd riscv-tools
$ git submodule update --init --recursive
$ ./build.sh
$ cd ..

2. build qemu (64bit)

$ sudo apt install libgtk-3-dev
$ sudo apt install libsdl2-dev
$ cd riscv-tools/riscv-gnu-toolchain/riscv-qemu
$ ./configure --target-list=riscv64-softmmu
$ make
$ cp riscv64-softmmu/qemu-system-riscv64 $RISCV/bin

See Installation Manual for details.

Build uCore and OpenSBI

1. build ucore (64bit)

To build all projects at once, run the following commands

$ git clone -b riscv64-priv-1.9 --single-branch https://github.com/z4yx/ucore_os_lab.git
$ cd ucore_os_lab/labcodes_answer/lab8
$ make DEFS=-DRV_PRIV_SPEC_1_9 -j8 bin/kernel
$ riscv64-unknown-elf-objcopy --output-format=binary bin/kernel{,.bin}

labcodes_answer/lab8/bin/kernel.bin is the uCore binary.

2. build OpenSBI

$ git clone -b ucore-k210-lab --single-branch https://github.com/z4yx/opensbi.git
$ make -j8 PLATFORM=kendryte/k210 CROSS_COMPILE=riscv64-unknown-elf- FW_PAYLOAD_OFFSET=0x200000 FW_PAYLOAD_PATH=<Path to ucore_os_lab>/labcodes_answer/lab8/bin/kernel.bin

build/platform/kendryte/k210/firmware/fw_payload.bin is the final firmware binary which contains opensbi and uCore.

Run on K210 chip

Install the kflash program provided by Kendryte.

$ sudo pip3 install kflash

Upload binary to K210 board with the following command

$ kflash -t build/platform/kendryte/k210/firmware/fw_payload.bin

For more information about kflash, run kflash -h.

Labs info

lab0: preparing
lab1: boot/protect mode/stack/interrupt
lab2: physical memory management
lab3: virtual memory management
lab4: kernel thread management
lab5: user process management
lab6: scheduling
lab7: mutex/sync
lab8: filesystem

Read the Docs

Detailed documentation can be found in the docs directory.

Maintainers

  • Yu Chen: yuchen AT tsinghua.edu.cn
  • Yong, Xiang: [email protected]
  • Mao, Junjie: [email protected]
  • Wei Zhang: zhangwei15 AT mails.tsinghua.edu.cn
  • Yuxiang Zhang: zyx17 AT mails.tsinghua.edu.cn

ucore_os_lab's People

Contributors

chyyuu-tsinghua-cs avatar uuyych avatar archstacker avatar shzhxh avatar chyyuu avatar z4yx avatar eternalnight avatar xxzc avatar yuantailing avatar

Stargazers

Larry Xu avatar Neucrack avatar Dmitrii Kuznetsov avatar

Watchers

Myown2 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.