This is a lightweight toolkit that builds ready-to-flash .img images for Milk-V duo 256M, enabling custom OS development from scratch.
I created this respository for the reason that I think the existing tutorials are not very newbie-friendly to me. This toolkit will tell you how to get all the toolchain you need and build the image in one click.
You should install the cross compile toolchain.
sudo apt update
sudo apt install gcc-riscv64-unknown-elf libconfuse-dev mtools
Notice: For the convenience reason, I use some pre-build binaries. However, if you don't want to use the pre-build binaries for security reason, I have made a full tutorial of how to build these binaries from source.
First, clone the repository.
git clone --recurse-submodules https://github.com/rota1001/milkv-baremetal-toolkit.git
Second, use make
to compile and produce the kernel image.
cd milkv-baremetal-toolkit
make
Then you will get the kernel.img
, you can flash it to the SD card. It will output the helloworld
through the UART serial port.
Notice that the example/
directory consists of a minimal OS example, you can read the Makefile
to understand how it works.
Use Opensbi to boot your own operating system
This project is licensed under GPLv2 and includes the following third-party software:
-
genimage
- License: GPLv2
- Source code: https://github.com/pengutronix/genimage
- Note: We use genimage under its original GPLv2 license.
-
OpenSBI
- License: BSD-2-Clause
- Original source code: https://github.com/riscv-software-src/opensbi
- Modified version used: https://github.com/milkv-duo/duo-buildroot-sdk-v2/tree/develop/opensbi
- Note: Due to the GPLv2 license of this project, we provide the OpenSBI source code used.
-
fiptool
- License: Please refer to the
fiptool/LICENSE
for the details
- License: Please refer to the
All third-party software is used according to their respective licenses.
For full license details, please refer to pre-build-binary/COPYING
(GPLv2), pre-build-binary/COPYING.BSD
(BSD-2-Clause) and those licenses under the genimage
, fiptool
directories.