duo-buildroot-sdk
Описание
Milk-V Duo Official buildroot SDK
Языки
- C94,1%
- Python3,4%
- Assembly1%
- Makefile0,7%
- Shell0,4%
- Perl0,1%
- Остальные0,3%
Project Introduction
Milk-V Duo is an ultra-compact embedded development platform based on the CV1800B chip. It can run Linux and RTOS, providing a reliable, low-cost, and high-performance platform for professionals, industrial ODMs, AIoT enthusiasts, DIY hobbyists, and creators.
Hardware
- CPU: CVITEK CV1800B (C906@1Ghz + C906@700MHz)
- Dual RV64 Core up to 1GHz
- 64MB RAM
- Provides 10/100Mbps Ethernet via optional add-on board
SDK Directory Structure
├── build // compilation scripts and board configs
├── build.sh // one-click compilation script
├── buildroot-2021.05 // buildroot source code
├── freertos // freertos system
├── fsbl // fsbl firmware in prebuilt form
├── install // temporary images stored here
├── isp_tuning // camera effect parameters
├── linux_5.10 // linux kernel
├── middleware // self-developed multimedia framework
├── device // configuration files for milkv
├── opensbi // opensbi library
├── out // final image for SD card
├── ramdisk // prebuilt ramdisk
└── u-boot-2021.10 // u-boot source code
Quick Start
Tip
For the compilation and use methods of the SDK, you can also go to our official documentation for better information and eading experience. In addition, our official documentation website is also open source. If you are interested in enriching the content of the documentation or translating it into other languages, you can go to this repository submit your PR, and we will give out exquisite gifts to contributors from time to time.
Prepare the Compilation Environment. Using a local Ubuntu system, the officially supported compilation environment is 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
Install the packages that compile dependencies:
Get SDK Source Code
<1>. One-click Compilation
Execute one-click compilation script :
You will see tips on how to use the compiled script:
Listed at the bottom is the list of currently supported target versions.
As shown in the prompt, there are two ways to compile the target version.
The first method is to execute to bring up the interactive menu, select the version number to be compiled, and press Enter:
The second method is to put the name of the target version after the script and compile it directly. For example, if you need to compile the image of , the command is as follows:
After a successful compilation, you can find the generated SD card burning image in the directory.
Note: The first compilation will automatically download the required toolchain, which is approximately 840MB in size. Once downloaded, it will be automatically extracted to the directory in the SDK directory. For subsequent compilations, if the directory is detected, the download will not be performed again.
<2>. Step-by-step Compilation
If you have not executed the one-click compilation script, you need to manually download the tool chain host-tools and then copy or move it to the SDK root directory:
Source environment:
If it is the first time to compile, you will be prompted to select the target to compile:
After selecting the corresponding number, press Enter. After the environment variable is successfully loaded, some information about the current target will be displayed, such as:
After the environment is loaded, a link named will be created in the directory, linking to the compilation target directory. The next time you source the environment, when the link is detected, you will no longer be prompted to select a target. If you need to change the compilation target, you can add the parameter to re-call the interactive menu for selection:
After the environment is loaded successfully, enter the following commands in sequence to complete the step-by-step compilation:
If you are compiling an SD card image, you also need to execute the following command to generate the image:
For example, if you need to compile the image of , the step-by-step compilation commands are as follows:
Generated firmware location:
Note that the SD card image is and the eMMC image is .
Tip
In addition to using
for a complete compilation, you can also compile a module separately. Generally speaking, you should first executebuild_allto clean the intermediate files, and then executeclean_xxxto recompile. For supported modules, you can enterbuild_xxxorclean_and then double-click thebuild_key to view them. The following lists some common module compilation methods:tab
- fsbl:
,clean_fsblbuild_fsbl- uboot:
,clean_ubootbuild_uboot- kernel:
,clean_kernelbuild_kernel- osdrv:
,clean_osdrvbuild_osdrv- middleware:
,clean_middlewarebuild_middleware
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
Enter the SDK code directory
Pull the Docker image and run
Description of some parameters in the command:
Docker name, you can use the name you want to use.duodockerThe current directory, here is the duo-buildroot-sdk directory that was 'cd' to in the previous step.$(pwd)Bind the current code directory to the /home/work directory in the Docker image.-v $(pwd):/home/workThe Docker image provided by Milk-V will be automatically downloaded from hub.docker.com for the first time.milkvtech/milkv-duo:latest
After Docker runs successfully, you can use the command to view the running status:
<1>. One-click compilation using Docker
Note that the at the end of the command is the same as the previous usage in the one-click compilation instructions in Ubuntu 22.04. Use can see how to use the command, use can bring up the interactive selection menu, use to directly compile the target version, can be replaced with:
milkv-duo-sd
milkv-duo-spinand
milkv-duo-spinor
milkv-duo256m-sd
milkv-duo256m-spinand
milkv-duo256m-spinor
milkv-duos-emmc
milkv-duos-sd
Description of some parameters in the command:
The name of the running Docker must be consistent with the name set in the previous step.duodockerIn quotes is the shell command to be run in the Docker image."*"Switch 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.cd /home/workDisplays the version number of the image used by Docker. It is currently Ubuntu 22.04.3 LTS and is used for debugging.cat /etc/issueExecute one-click compilation script../build.sh [board]
For example, if you need to compile the image of , the command is as follows:
After successful compilation, you can see the generated SD card burning image in the directory.
<2>. Compile step by step using Docker
If you have not executed the one-click compilation script, you need to manually download the tool chain host-tools and then copy or move it to the SDK root directory:
Step-by-step compilation requires logging into Docker to operate. Use the command to view and record the ID number of the container, such as .
If is not in the list, the container may have been stopped. You need to rerun it and then check the ID number in the window:
Enter Docker:
Enter the code directory bound in Docker:
Source environment:
If it is the first time to compile, you will be prompted to select the target to compile:
After selecting the corresponding number, press Enter. After the environment variable is successfully loaded, some information about the current target will be displayed, such as:
After the environment is loaded, a link named will be created in the directory, linking to the compilation target directory. The next time you source the environment, when the link is detected, you will no longer be prompted to select a target. If you need to change the compilation target, you can add the parameter to re-call the interactive menu for selection:
After the environment is loaded successfully, enter the following commands in sequence to complete the step-by-step compilation:
If you are compiling an SD card image, you also need to execute the following command to generate the image:
For example, if you need to compile the image of , the step-by-step compilation commands are as follows:
Generated firmware location:
Note that the SD card image is and the eMMC image is .
Tip
In addition to using
for a complete compilation, you can also compile a module separately. Generally speaking, you should first executebuild_allto clean the intermediate files, and then executeclean_xxxto recompile. For supported modules, you can enterbuild_xxxorclean_and then double-click thebuild_key to view them. The following lists some common module compilation methods:tab
- fsbl:
,clean_fsblbuild_fsbl- uboot:
,clean_ubootbuild_uboot- kernel:
,clean_kernelbuild_kernel- osdrv:
,clean_osdrvbuild_osdrv- middleware:
,clean_middlewarebuild_middleware
After compilation is completed, you can use the command to exit the Docker environment:
The generated firmware can also be seen in the host code directory.
Stop Docker
After compilation is completed, if the above Docker running environment is no longer needed, you can stop it first and then delete it:
3. Other compilation considerations
If you want to try to compile this SDK in an environment other than the above two environments, the following are things you may need to pay attention to, for reference only.
cmake version
Note: minimum version requirement is .
Check the version of in the system:
For example, the version of installed using apt in the is:
cmake version 3.16.3
The minimum requirement of this SDK is not met. Manual installation of the latest version is needed:
When manually installed, is located in . To check its version, use the command , which should display:
cmake version 3.27.6
Compiling with Windows Linux Subsystem (WSL)
If you wish to perform the compilation with WSL, there's an small issue building the image. The $PATH, due Windows interoperability, has Windows environment variables which include some spaces between the paths.
To solve this problem you need to change the file and add the following lines:
[interop]
appendWindowsPath = false
After that, you need to reboot the WSL with . Then you able to run the script or the line in the step-by-step compilation method.
To rollback this change in file set as true. To reboot the WSL, can you use the Windows PowerShell command then , after that the Windows environment variables become avaliable again in $PATH.
SD card burning
Note: Writing the image to the microSD card will erase the existing data on the card. Remember to back up important data before burning!!!
- To write the generated image to a microSD card on Windows, you can use tools like
,balenaEtcher, orRufus.Win32 Disk Imager - To write the generated image to a microSD card on Linux, use the
command. Please make sure to carefully confirm that thedddeviceofcorresponds to the microSD card you want to burn:/dev/sdX
Power ON
- Insert the microSD card into the microSD card slot of the Milk-V Duo.
- Connect the serial cable (optional).
- Power on, the Duo will boot up and enter the system normally.
- If a serial cable is connected, you can view the boot logs in the serial console (
,mobarXtermor others). After entering the system, you can use the serial console to log in to the terminal and execute relevant Linux commands.Xshell
The method to log in to the Duo terminal
- Using a serial cable.
- Using a USB network (CDC-NCM).
- Using the Ethernet interface (requires the IO-Board).
The username and password for logging into the Duo terminal are as follows:
root
milkv
To disable LED blinking
If you want to disable the LED blinking feature on the Duo, you can execute the following command in the Duo terminal:
This means renaming the LED blinking script, and after restarting the Duo, the LED will no longer blink.
If you want to restore LED blinking, rename it back to its original name and restart the device:
Using the IO-Board baseboard
Note that when using the IO-Board, the USB network (CDC-NCM) is not available, Please use the Ethernet interface on the IO-Board.
If you need to assign a fixed MAC address to the Ethernet port of the IO-Board, please execute the following command(Replace the MAC address in the command with the MAC address you want to set, and please note that MAC addresses of different devices within the same network segment must not be duplicated):
then reboot the board.
Enable the 4 USB ports on the IO-Board:
then reboot the board.
For example, if a USB flash drive is connected to the USB port on the IO-Board, you can use the command to check if the device is detected.
To mount the USB drive and view its contents in the system (taking /dev/sda1 as an example):
Verify if the contents in the directory match the expectations:
The command to unmount a USB flash drive:
To restore the functionality of the USB network (CDC-NCM) when not using the IO-Board, you can follow these steps:
then reboot the board.
FAQs
-
Why is only a single core being displayed?
The CV1800B chip adopts a dual-core design. Currently, the Linux system runs on one of the cores, while the other core is used for running a real-time system. For the use of this core, please see official documentation.
-
Why does it only show 28M when viewing the RAM?
Because a portion of the RAM is allocated to ION, which is the memory used when running algorithms with the camera. If you're not using the camera, you can modify the value of this ION_SIZE to 0 and then recompile to generate the image(Duo 256M: ION_SIZE).
Links to some documentation from the chip manufacturer
- CV181x/CV180x MMF SDK Development Documents (English and Chinese): MultiMedia Framework Software Development Document.
- CV Series Chip TPU SDK Development Documentation Compilation (Chinese): CV series chip TPU SDK development data summary.