Introduction
Vega's default SDK is built based on buildroot and is used to generate Vega's firmware. The SDK mainly contains the following parts:
- u-boot: 2020.07-rc2
- linux kernel: 5.8.0
- buildroot: 2020.05-rc1
- opensbi: 0.7
Source code: github
Build image
Prepare the Compilation Environment. Using a local Ubuntu system, the officially supported compilation environment is Ubuntu Jammy 22.04.x amd64 only!
If you are using other Linux distributions, we strongly recommend that you use the Docker environment to compile to reduce the probability of compilation errors.
The following describes the compilation methods in the two environments.
1. Compiled using Ubuntu 22.04
Packages to be installed
sudo apt install -y make git gcc g++ bison flex device-tree-compiler mtd-utils lz4
Get SDK Source Code
git clone https://github.com/milkv-vega/vega-buildroot-sdk.git --depth=1
One-click Compilation
Execute one-click compilation script build.sh:
cd vega-buildroot-sdk/
./build.sh
After successful compilation, you can see the three generated images in the out directory:
out/
├── freeloader.bin
├── kernel.bin
└── ubifs.img
2. Compiled using Docker
Docker support is required on hosts running Linux systems. For how to use Docker, please refer to the official documentation or other tutorials.
We put the SDK source code on the Linux host system and call the Docker image environment provided by Milk-V to compile it.
Pull SDK code on Linux host
git clone https://github.com/milkv-vega/vega-buildroot-sdk.git --depth=1
Enter the SDK code directory
cd vega-buildroot-sdk
Pull the Docker image and run
The Docker image used here is the same Docker image used by Milk-V’s other product Duo.
docker run -itd --name vegadocker -v $(pwd):/home/work milkvtech/milkv-duo:latest /bin/bash
Description of some parameters in the command:
vegadockerDocker name, you can use the name you want to use.$(pwd)The current directory, here is the duo-buildroot-sdk directory that was 'cd' to in the previous step.-v $(pwd):/home/workBind the current code directory to the /home/work directory in the Docker image.milkvtech/milkv-duo:latestThe Docker image provided by Milk-V will be automatically downloaded from hub.docker.com for the first time.
After Docker runs successfully, you can use the docker ps -a command to view the running status:
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8edea33c2239 milkvtech/milkv-duo:latest "/bin/bash" 2 hours ago Up 2 hours vegadocker
One-click compilation using Docker
docker exec -it vegadocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh"
Description of some parameters in the command:
vegadockerThe name of the running Docker must be consistent with the name set in the previous step."*"In quotes is the shell command to be run in the Docker image.cd /home/workSwitch to the /home/work directory. Since this directory has been bound to the host's code directory during runtime, the /home/work directory in Docker is the source code directory of the SDK.cat /etc/issueDisplays the version number of the image used by Docker. It is currently Ubuntu 22.04.3 LTS and is used for debugging../build.shExecute one-click compilation script.
After successful compilation, you can see the three generated images in the out directory:
out/
├── freeloader.bin
├── kernel.bin
└── ubifs.img