优势方面,该项目提供了一个系统化的学习和研究平台,能够帮助开发者全面理解嵌入式 Linux 系统的启动和运行机制。详细的操作文档和易于扩展的代码库也使得该项目非常适合开发者进行定制开发。QEMU 设备在性能上模拟了实际硬件的表现,提供了一个接近实际运行环境的安全学习空间,有助于减少昂贵的硬件购买成本和加快开发周期。
This project aims to build an Embedded Linux System, in order to analyze the chip from the power-on execution of the first instruction to the entire system running, based on qemu simulator development board. 本项目旨在真正从0开始构建嵌入式linux系统,为了剖析芯片从上电开始执行第一条指令到整个系统运行,基于qemu定制模拟器开发板。
This project aims to build an Embedded Linux System, in order to analyze the chip from the power-on execution of the first instruction to the entire system running, based on a customized qemu simulator development board.
What is Quard Star?
Quard Star is the name of the hardware board that we simulate using qemu. It is a RISC-V processor with various peripherals and controllers. We will use this board to learn how to build and run an embedded Linux system from scratch.
Hardware Architecture
Software Flow
Memory Distribution
Features
Customized qemu simulator with Quard Star board support
Low-level boot code and mask ROM
OpenSBI and U-Boot bootloader
Linux kernel and device tree
Busybox-based root filesystem
Qt-based graphical user interface
Trusted domain and secure boot
Debugging tools and scripts
Pre-requisites
To build and run this project, you will need the following tools:
gcc/g++
make/cmake
git
qemu
dtc
python3
You can install them using your package manager. For example, on Ubuntu 20.04, you can run:
Then, you can run the build.sh script to compile the qemu simulator and other components:
cd quard_star_tutorial
./build.sh all all
This will generate the output directory with all the binaries and files needed to run the project.
Usage
To run the project, you can use the run.sh script:
./run.sh graphic
This will launch the qemu simulator with the Quard Star board and load the Linux system. You should see a graphical user interface on a new window.
You can also use some command-line options to customize your run. For example:
./run.sh nographic
For more details on how to use these options, please refer to the tutorial files.
Tutorial
This project comes with a series of tutorial files that explain each step of building and running an embedded Linux system based on QEMU. You can find them in the tutorial directory. They are available in Chinese languages.
The tutorial files cover the following topics:
Setting up the QEMU environment
Writing low-level boot code and mask ROM
Using OpenSBI and U-Boot bootloader
Compiling Linux kernel and device tree
Creating root filesystem and boot image
Developing graphical user interface with Qt
Implementing trusted domain and secure boot
Debugging with gdb and kgdb
You can also access the tutorial online on my blog or on read the docs.
Contributing
This project is open source and welcomes contributions from anyone who is interested in learning or teaching embedded Linux system development. If you want to contribute, please follow these steps:
Fork this repository on GitHub.
Create a new branch for your feature or bugfix.
Make your changes and commit them with clear messages.
Push your branch to your forked repository.
Create a pull request from your branch to the main repository.
Wait for review and feedback.
Please make sure your code follows the coding style and conventions of this project. Also, please write comments and documentation for your code.
License
This project uses some open source projects as components or references. I would like to thank and acknowledge their authors and contributors for their great work. so the newly added codes of each part respect the original project license. The rest of the original code open source license is BSD-3-Clause License. See the LICENSE file for more details.
Contact
If you have any questions, suggestions, or feedback about this project, please feel free to contact me at [email protected] or leave a comment on my blog.
Further Reading
If you want to read more about the development process and challenges of this project, you can check out my development note file DEVELOPNOTE.md. It contains some insights and tips on how I built and debugged this project.😎
Note: This project also has an experimental branch called next-kernel that uses the latest Linux kernel from linux-next. It is used to learn and test new features and functions. It might be unstable or incompatible with some components. You can switch to this branch using git checkout next-kernel if you are interested, but please be careful and report any issues or bugs you encounter.😉
Thanks
I would like to acknowledge AI tool (New Bing) for assisting me with writing part of this readme file.
Star History
Donate
If you like this project, you can donate to the author to support the development of the project.
评论