Commit 1ef1e15c authored by carbon's avatar carbon

Upgrade README

parent dd82b681
......@@ -13,9 +13,9 @@ Milk-V DuoはCV1800Bをベースにした超小型の組み込みプラットフ
# SDKのディレクトリ構造
```text
```
├── build // コンパイルスクリプトとボード設定
├── build_milkv.sh // 自動コンパイルスクリプト
├── build.sh // 自動コンパイルスクリプト
├── buildroot-2021.05 // Buildrootのソースコード
├── freertos // FreeRTOSのシステム
├── fsbl // 完成済みfsblファームウェア
......@@ -32,6 +32,9 @@ Milk-V DuoはCV1800Bをベースにした超小型の組み込みプラットフ
# クイックスタート
> [!TIP]
> For the compilation and use methods of the SDK, you can also go to our [official documentation](https://milkv.io/docs/duo/getting-started/buildroot-sdk) 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](https://github.com/milk-v/milkv.io/) submit your PR, and we will give out exquisite gifts to contributors from time to time.
コンパイル環境を準備する前に、ローカルのubuntuを使用する際にサポートされているのは`「Ubuntu Jammy 22.04.x amd64」`のみです。
他のLinuxディストロを使用している場合、問題を回避するためにDocker環境を使用することを強くお勧めします。
......@@ -56,14 +59,44 @@ git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
### <1>. 自動コンパイル
- 自動コンパイルスクリプト`build_milkv.sh`を実行
Execute one-click compilation script `build.sh`
```bash
cd duo-buildroot-sdk/
./build.sh
```
You will see tips on how to use the compiled script:
```bash
# ./build.sh
Usage:
./build.sh - Show this menu
./build.sh lunch - Select a board to build
./build.sh [board] - Build [board] directly, supported boards asfollows:
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
Listed at the bottom is the list of currently supported target versions. Those with the `python` suffix include the python, pip, and pinpong libraries.
As shown in the prompt, there are two ways to compile the target version.
The first method is to execute `./build.sh lunch` to bring up the interactive menu, select the version number to be compiled, and press Enter:
```bash
# ./build.sh lunch
Select a target to build:
1. milkv-duo
2. milkv-duo-python
3. milkv-duo256m
4. milkv-duo256m-python
Which would you like:
```
cd duo-buildroot-sdk/
./build_milkv.sh
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 a Duo image with python and pinpong libraries, the command is as follows:
```bash
# ./build.sh milkv-duo-python
```
- 正常にコンパイルされるとSDカード用イメージ`milkv-duo-*-*.img``out`ディレクトリの中に出てきます。
正常にコンパイルされるとSDカード用イメージ`milkv-duo-python-*-*.img``out`ディレクトリの中に出てきます。
*注意:最初のコンパイル時に必要なツールチェーン(およそ840MB)が自動でダウンロードされます。一度ダウンロードされると`host-tools`内に自動で展開されます。以後のコンパイルでは`host-tools`ディレクトリがある場合再びダウンロードはされません。*
......@@ -71,15 +104,31 @@ cd duo-buildroot-sdk/
If you have not executed the one-click compilation script, you need to manually download the toolchain [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz) and extract it to the SDK root directory:
```
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
Then enter the following commands sequentially:
Then enter the following commands in sequence to complete the step-by-step compilation. Replace `[board]` and `[config]` in the command with the version that needs to be compiled. The currently supported `board` and corresponding `config` are as follows:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
For example, if you need to compile a Duo image with python and pinpong libraries, the step-by-step compilation command is as follows:
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -88,7 +137,11 @@ build_all
pack_sd_image
```
生成されたイメージは`install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`に出てきます。
Generated firmware location:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
## 2. Dockerを使用してコンパイル
......@@ -98,19 +151,19 @@ SDKのソースコードをLinuxホストシステムに置いて、Milk-Vから
### SDKのソースコードをホストに持ってくる
```
```bash
git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
```
### SDKのコードディレクトリに入る
```
```bash
cd duo-buildroot-sdk
```
### Dockerイメージを持ってきて実行する
```
```bash
docker run -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest /bin/bash
```
......@@ -121,44 +174,82 @@ docker run -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest
- `milkvtech/milkv-duo:latest` Milk-VによるDockerイメージです。最初にhub.docker.comから自動でダウンロードされます。
Dockerが正常に実行されたら`docker ps -a`コマンドで実行状態を見ることができます。
```
```bash
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8edea33c2239 milkvtech/milkv-duo:latest "/bin/bash" 2 hours ago Up 2 hours duodocker
```
### <1>. Dockerを使用して自動コンパイル
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh [board]"
```
docker exec duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build_milkv.sh"
Note that the `./build.sh [board]` at the end of the command is the same as the previous usage in the one-click compilation instructions in Ubuntu 22.04. Use `./build.sh` can see how to use the command, use `./ build.sh lunch` can bring up the interactive selection menu, use `./build.sh [board]` to directly compile the target version, `[board]` can be replaced with:
```
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
*Versions with `python` suffix include python, pip, pinpong libraries*
コマンド中のパラメータについて:
- `duodocker` 実行中のDockerの名前です。先程設定したものと同じである必要があります。
- `"*"` クオートの中にDockerイメージ中で実行したいコマンドが入ります。
- `cd /home/work` /home/workディレクトリに移動します。このディレクトリは実行時にホストのコードディレクトリに紐付けられているため、Docker中の/home/workディレクトリはSDKのコードディレクトリになります。
- `cat /etc/issue` Dockerで実行されているイメージのバージョンを表示します。これはいまのところ「Ubuntu 22.04.3 LTS」で、デバッグに使われます。
- `./build_milkv.sh` 自動コンパイルスクリプトを実行します。
- `./build.sh [board]` 自動コンパイルスクリプトを実行します。
For example, if you need to compile a Duo image with python and pinpong libraries, the command is as follows:
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh milkv-duo-python"
```
コンパイルが成功すると、`out`ディレクトリの中に`milkv-duo-*-*.img`が出てきます。
### <2>. Dockerを使用して手動コンパイル
If you have not executed the one-click compilation script, you need to manually download the toolchain [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz) and extract it to the SDK root directory:
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
手動コンパイルをする場合はDockerにログインする必要があります。`docker ps -a`コマンドを使用して8edea33c2239みたいな形式のコンテナのIDを表示します。
Dockerに入る:
```
```bash
docker exec -it 8edea33c2239 /bin/bash
```
Dockerに紐付けられたコードディレクトリに入る:
```
```bash
root@8edea33c2239:/# cd /home/work/
```
手動でコンパイルする:
Then enter the following commands in sequence to complete the step-by-step compilation. Replace `[board]` and `[config]` in the command with the version that needs to be compiled. The currently supported `board` and corresponding `config` are as follows:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
For example, if you need to compile a Duo image with python and pinpong libraries, the step-by-step compilation command is as follows:
```bash
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -167,10 +258,16 @@ build_all
pack_sd_image
```
生成されたイメージは`install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`に出てきます。
Generated firmware location:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
Generated firmware location: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`.
コンパイルが完了したら`exit`コマンドでDockerから抜けれます:
```
```bash
root@8edea33c2239:/home/work# exit
```
生成されたイメージはホストのコードディレクトリからも見れます。
......@@ -178,12 +275,12 @@ root@8edea33c2239:/home/work# exit
### Dockerを停止する
コンパイルが完了して、もし上のDocker環境がもう必要ないなら止めて削除できます:
```
```bash
docker stop 8edea33c2239
docker rm 8edea33c2239
```
## その他の環境でのコンパイルに関する注意
## 3. その他の環境でのコンパイルに関する注意
もしこのSDKを上の2つの環境以外で行いたいなら、参考までに以下のことに注意してください。
......@@ -199,7 +296,7 @@ cmake --version
例として、`Ubuntu 20.04`のaptでインストールされる`cmake`のバージョンは
```text
```
cmake version 3.16.3
```
です。条件を満たしていないので手動で最新の`cmake`をインストールしてください
......@@ -237,7 +334,7 @@ appendWindowsPath = false
- Windows上で生成したイメージを書き込む場合`balenaEtcher``Rufus``Win32 Disk Imager`などのツールを使えます。
- Linux上で生成したイメージを書き込む場合ddコマンドを使えます。 **ddコマンドで書き込む場合指定するデバイスが書き込むmicroSDカードであることを十二分に確認してください**
```
```bash
sudo dd if=milkv-duo-*-*.img of=/dev/sdX
```
......@@ -256,7 +353,7 @@ appendWindowsPath = false
Duoのターミナルに入る際に必要なユーザー名とパスワードは以下の通りです。
```text
```
root
milkv
```
......@@ -290,8 +387,7 @@ IO-BoardのEthernetポートに固定MACアドレスを割り当てる必要が
IO-Board上の4発のUSBポートを有効化する:
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-host.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-host.sh /mnt/system/usb.sh
sync
```
- それからボードを再起動してください。
......@@ -320,8 +416,7 @@ USBフラッシュドライブをアンマウントするコマンド。
USBネットワーク(RNDIS)の機能をIO-Board不使用時に使う。
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-rndis.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-rndis.sh /mnt/system/usb.sh
sync
```
- それからボードを再起動してください。
......@@ -330,7 +425,7 @@ USBネットワーク(RNDIS)の機能をIO-Board不使用時に使う。
1. なぜ1つのコアしか表示されないのですか。
CV1800Bチップはデュアルコアですが、現在、Linuxシステムは1つのコアで実行され、もう1つのコアはリアルタイムシステムの実行に使用されています。このコアのSDKはまだリリースされておらず、今後アップデートされる予定です
CV1800Bチップはデュアルコアですが、現在、Linuxシステムは1つのコアで実行され、もう1つのコアはリアルタイムシステムの実行に使用されています。For the use of this core, please see [official documentation](https://milkv.io/docs/duo/getting-started/rtoscore)
2. なぜ28MBしかRAMが使えないのですか。
......
......@@ -13,9 +13,9 @@ Milk-V Duo 是一个基于 CV1800B 芯片的超紧凑嵌入式开发平台。它
# SDK目录结构
```text
```
├── build // 编译目录,存放编译脚本以及各board差异化配置
├── build_milkv.sh // Milk-V Duo 一键编译脚本
├── build.sh // Milk-V Duo 一键编译脚本
├── buildroot-2021.05 // buildroot 开源工具
├── freertos // freertos 系统
├── fsbl // fsbl启动固件,prebuilt 形式存在
......@@ -32,6 +32,9 @@ Milk-V Duo 是一个基于 CV1800B 芯片的超紧凑嵌入式开发平台。它
# 快速开始
> [!TIP]
> 以下 SDK 的编译和使用方法,您也可以转到我们的 [官方文档](https://milkv.io/zh/docs/duo/getting-started/buildroot-sdk) 中查看,会有更好的阅读体验。另外,我们的官方文档网站也是开源的,如果您有兴趣来丰富文档的内容或者翻译成其他语言,可以在 [这个仓库](https://github.com/milk-v/milkv.io/) 中提交您的 PR,我们会不定期为贡献者赠送精美的礼物。
准备编译环境,使用本地的 Ubuntu 系统,官方支持的编译环境为 `Ubuntu Jammy 22.04.x amd64`
如果您使用的是其他的 Linux 发行版,我们强烈建议您使用 Docker 环境来编译,以降低编译出错的概率。
......@@ -48,19 +51,50 @@ sudo apt install -y pkg-config build-essential ninja-build automake autoconf lib
### 获取 SDK
```
```bash
git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
```
### 1、一键编译
- 执行一键编译脚本 `build_milkv.sh`
执行一键编译脚本 `build.sh`
```bash
cd duo-buildroot-sdk/
./build_milkv.sh
./build.sh
```
会看到编译脚本的使用方法提示:
```bash
# ./build.sh
Usage:
./build.sh - Show this menu
./build.sh lunch - Select a board to build
./build.sh [board] - Build [board] directly, supported boards asfollows:
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
最下边列出的是当前支持的目标版本列表,带 `python` 后缀的包含 python,pip, pinpong库。
如提示中所示,有两种方法来编译目录版本。
第一种方法是执行 `./build.sh lunch` 调出交互菜单,选择要编译的版本序号,回车:
```bash
# ./build.sh lunch
Select a target to build:
1. milkv-duo
2. milkv-duo-python
3. milkv-duo256m
4. milkv-duo256m-python
Which would you like:
```
- 编译成功后可以在 `out` 目录下看到生成的SD卡烧录镜像 `milkv-duo-*-*.img`
第二种方法是脚本后面带上目标版本的名字,直接一键编译,比如需要编译 Duo 带 python 和 pinpong 库的的镜像,命令如下:
```bash
# ./build.sh milkv-duo-python
```
编译成功后可以在 `out` 目录下看到生成的SD卡烧录镜像 `milkv-duo-python-*-*.img`
*注: 第一次编译会自动下载所需的工具链,大小为 840M 左右,下载完会自动解压到 SDK 目录下的 `host-tools` 目录,下次编译时检测到已存在 `host-tools` 目录,就不会再次下载了*
......@@ -68,15 +102,31 @@ cd duo-buildroot-sdk/
如果未执行过一键编译脚本,需要先手动下载工具链 [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz),并解压到 SDK 根目录:
```
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
再依次输入如下命令完成分步编译:
再依次输入如下命令完成分步编译,命令中的 `[board]``[config]` 替换为需要编译的版本,当前支持的 `board` 和对应的 `config` 如下:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
比如需要编译 Duo 带 python 和 pinpong 库的的镜像,分步编译命令如下:
```bash
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -85,7 +135,11 @@ build_all
pack_sd_image
```
生成的固件位置: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`
生成的固件位置:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
## 二、使用 Docker 编译
......@@ -95,19 +149,19 @@ pack_sd_image
### 在 Linux 主机上拉 SDK 代码
```
```bash
git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
```
### 进入 SDK 代码目录
```
```bash
cd duo-buildroot-sdk
```
### 拉取 Docker 镜像并运行
```
```bash
docker run -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest /bin/bash
```
......@@ -118,7 +172,7 @@ docker run -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest
- `milkvtech/milkv-duo:latest` Milk-V 提供的 Docker 镜像,第一次会自动从 hub.docker.com 下载
Docker 运行成功后,可以用 `docker ps -a` 命令查看运行状态:
```
```bash
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8edea33c2239 milkvtech/milkv-duo:latest "/bin/bash" 2 hours ago Up 2 hours duodocker
......@@ -126,37 +180,74 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
### 1. 使用 Docker 一键编译
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh [board]"
```
docker exec duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build_milkv.sh"
注意命令最后的 `./build.sh [board]` 和前面在 Ubuntu 22.04 中一键编译说明中的用法是一样的,直接 `./build.sh` 可以查看命令的使用方法,用 `./build.sh lunch` 可以调出交互选择菜单,用 `./build.sh [board]` 可以直接编译目标版本,`[board]` 可以替换为:
```
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
*带 `python` 后缀的版本包含 python,pip, pinpong 库*
命令中部分参数说明:
- `duodocker` 运行的 Docker 名字, 与上一步中设置的名字要保持一致
- `"*"` 双引号中是要在 Docker 镜像中运行的 Shell 命令
- `cd /home/work` 是切换到 /home/work 目录,由于运行时已经将该目录绑定到主机的代码目录,所以在 Docker 中 /home/work 目录就是该 SDK 的源码目录
- `cat /etc/issue` 显示 Docker 使用的镜像的版本号,目前是 Ubuntu 22.04.3 LTS,调试用
- `./build_milkv.sh` 执行一键编译脚本
- `./build.sh [board]` 执行一键编译脚本
编译成功后可以在 `out` 目录下看到生成的SD卡烧录镜像 `milkv-duo-*-*.img`
比如需要编译 Duo 带 python 和 pinpong 库的的镜像,编译命令如下:
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh milkv-duo-python"
```
编译成功后可以在 `out` 目录下看到生成的SD卡烧录镜像 `[board]-*-*.img`
### 2. 使用 Docker 分步编译
如果未执行过一键编译脚本,需要先手动下载工具链 [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz),并解压到 SDK 根目录:
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
分步编译需要登陆到 Docker 中进行操作,用命令 `docker ps -a` 查看并记录容器的 ID 号,比如 8edea33c2239。
登陆到 Docker 中:
```
```bash
docker exec -it 8edea33c2239 /bin/bash
```
进入 Docker 中绑定的代码目录:
```
```bash
root@8edea33c2239:/# cd /home/work/
```
分步编译:
再依次输入如下命令完成分步编译,命令中的 `[board]``[config]` 替换为需要编译的版本,当前支持的 `board` 和对应的 `config` 如下:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
比如需要编译 Duo 带 python, pip 和 pinpong 库的的镜像,分步编译命令如下:
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -165,10 +256,14 @@ build_all
pack_sd_image
```
生成的固件位置: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`
生成的固件位置:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
编译完成后可以用 `exit` 命令退出 Docker 环境:
```
```bash
root@8edea33c2239:/home/work# exit
```
在主机代码目录中同样也可以看到生成的固件。
......@@ -176,12 +271,12 @@ root@8edea33c2239:/home/work# exit
### 停用 Docker
编译完成后,如果不再需要以上的 Docker 运行环境,可先将其停止,再删除:
```
```bash
docker stop 8edea33c2239
docker rm 8edea33c2239
```
## 其他编译注意事项
## 三、其他编译注意事项
如果您想尝试在以上两种环境之外的环境下编译本 SDK,下面是可能需要注意的事项,仅供参考。
......@@ -197,13 +292,13 @@ cmake --version
比如在`Ubuntu 20.04`中用 apt 安装的 cmake 版本号为
```text
```
cmake version 3.16.3
```
不满足此SDK最低要求,需要手动安装目前最新的 `3.27.6` 版本
```
```bash
wget https://github.com/Kitware/CMake/releases/download/v3.27.6/cmake-3.27.6-linux-x86_64.sh
chmod +x cmake-3.27.6-linux-x86_64.sh
sudo sh cmake-3.27.6-linux-x86_64.sh --skip-license --prefix=/usr/local/
......@@ -214,6 +309,21 @@ sudo sh cmake-3.27.6-linux-x86_64.sh --skip-license --prefix=/usr/local/
cmake version 3.27.6
```
### 使用 Windows Linux 子系统 (WSL) 进行编译
如果您希望使用 WSL 执行编译,则构建镜像时会遇到一个小问题,WSL 中的 $PATH 具有 Windows 环境变量,其中路径之间包含一些空格。
要解决此问题,您需要更改 `/etc/wsl.conf` 文件并添加以下行:
```
[interop]
appendWindowsPath = false
```
然后需要使用 `wsl.exe --reboot` 重新启动 WSL。再运行 `./build.sh` 脚本或分步编译命令。
要恢复 `/etc/wsl.conf` 文件中的此更改,请将 `appendWindowsPath` 设置为 `true`。 要重新启动 WSL,您可以使用 Windows PowerShell 命令 `wsl.exe --shutdown`,然后使用`wsl.exe`,之后 Windows 环境变量在 $PATH 中再次可用。
## SD卡烧录
> 注意: 将镜像写入 TF 卡会擦除卡中原有数据,记得在烧录前备份重要的数据!!!
......@@ -264,8 +374,7 @@ mv /mnt/system/blink.sh_backup /mnt/system/blink.sh && sync
使用底板上的 4 个 USB 口,需要修改一下配置,将默认固件中的 `usb-rndis` 功能修改为 `usb-host`
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-host.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-host.sh /mnt/system/usb.sh
sync
```
修改完,重启或重新上电即可生效。
......@@ -294,8 +403,7 @@ umount /mnt/udisk
不使用底板时,恢复 USB 网卡 (RNDIS) 的方法:
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-rndis.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-rndis.sh /mnt/system/usb.sh
sync
```
......@@ -305,7 +413,7 @@ sync
1. 为什么只显示单核?
CV1800B 芯片采用双核设计,当前 Linux 系统运行在其中的一个核上,另外一个核用来运行实时系统,这个核的 SDK 尚未公布,待后续更新
CV1800B 芯片采用双核设计,当前 Linux 系统运行在其中的一个核上,另外一个核用来运行实时系统,该核的使用请查看[官方文档](https://milkv.io/zh/docs/duo/getting-started/rtoscore)
2. 为什么查看 RAM 只显示 28M?
......
......@@ -13,9 +13,9 @@ Milk-V Duo is an ultra-compact embedded development platform based on the CV1800
# SDK Directory Structure
```text
```
├── build // compilation scripts and board configs
├── build_milkv.sh // one-click compilation script
├── build.sh // one-click compilation script
├── buildroot-2021.05 // buildroot source code
├── freertos // freertos system
├── fsbl // fsbl firmware in prebuilt form
......@@ -32,6 +32,9 @@ Milk-V Duo is an ultra-compact embedded development platform based on the CV1800
# Quick Start
> [!TIP]
> For the compilation and use methods of the SDK, you can also go to our [official documentation](https://milkv.io/docs/duo/getting-started/buildroot-sdk) 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](https://github.com/milk-v/milkv.io/) 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 `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.
......@@ -56,14 +59,44 @@ git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
### <1>. One-click Compilation
- Execute the one-click compilation script `build_milkv.sh`:
Execute one-click compilation script `build.sh`
```bash
cd duo-buildroot-sdk/
./build.sh
```
You will see tips on how to use the compiled script:
```bash
# ./build.sh
Usage:
./build.sh - Show this menu
./build.sh lunch - Select a board to build
./build.sh [board] - Build [board] directly, supported boards asfollows:
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
Listed at the bottom is the list of currently supported target versions. Those with the `python` suffix include the python, pip, and pinpong libraries.
As shown in the prompt, there are two ways to compile the target version.
The first method is to execute `./build.sh lunch` to bring up the interactive menu, select the version number to be compiled, and press Enter:
```bash
# ./build.sh lunch
Select a target to build:
1. milkv-duo
2. milkv-duo-python
3. milkv-duo256m
4. milkv-duo256m-python
Which would you like:
```
cd duo-buildroot-sdk/
./build_milkv.sh
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 a Duo image with python and pinpong libraries, the command is as follows:
```bash
# ./build.sh milkv-duo-python
```
- After a successful compilation, you can find the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory.
After a successful compilation, you can find the generated SD card burning image `milkv-duo-python-*-*.img` in the `out` 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 `host-tools` directory in the SDK directory. For subsequent compilations, if the `host-tools` directory is detected, the download will not be performed again*.
......@@ -71,15 +104,31 @@ cd duo-buildroot-sdk/
If you have not executed the one-click compilation script, you need to manually download the toolchain [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz) and extract it to the SDK root directory:
```
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
Then enter the following commands sequentially:
Then enter the following commands in sequence to complete the step-by-step compilation. Replace `[board]` and `[config]` in the command with the version that needs to be compiled. The currently supported `board` and corresponding `config` are as follows:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
For example, if you need to compile a Duo image with python and pinpong libraries, the step-by-step compilation command is as follows:
```bash
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -88,7 +137,11 @@ build_all
pack_sd_image
```
Location of the generated image: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`.
Generated firmware location:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
## 2. Compiled using Docker
......@@ -98,19 +151,19 @@ We put the SDK source code on the Linux host system and call the Docker image en
### Pull SDK code on Linux host
```
```bash
git clone https://github.com/milkv-duo/duo-buildroot-sdk.git --depth=1
```
### Enter the SDK code directory
```
```bash
cd duo-buildroot-sdk
```
### Pull the Docker image and run
```
```bash
docker run -itd --name duodocker -v $(pwd):/home/work milkvtech/milkv-duo:latest /bin/bash
```
......@@ -121,7 +174,7 @@ Description of some parameters in the command:
- `milkvtech/milkv-duo:latest` The 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:
```
```bash
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8edea33c2239 milkvtech/milkv-duo:latest "/bin/bash" 2 hours ago Up 2 hours duodocker
......@@ -129,37 +182,74 @@ CONTAINER ID IMAGE COMMAND CREATED STATUS
### <1>. One-click compilation using Docker
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh [board]"
```
Note that the `./build.sh [board]` at the end of the command is the same as the previous usage in the one-click compilation instructions in Ubuntu 22.04. Use `./build.sh` can see how to use the command, use `./ build.sh lunch` can bring up the interactive selection menu, use `./build.sh [board]` to directly compile the target version, `[board]` can be replaced with:
```
docker exec duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build_milkv.sh"
milkv-duo
milkv-duo-python
milkv-duo256m
milkv-duo256m-python
```
*Versions with `python` suffix include python, pip, pinpong libraries*
Description of some parameters in the command:
- `duodocker` The 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/work` 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.
- `cat /etc/issue` Displays the version number of the image used by Docker. It is currently Ubuntu 22.04.3 LTS and is used for debugging.
- `./build_milkv.sh` Execute one-click compilation script.
- `./build.sh [board]` Execute one-click compilation script.
For example, if you need to compile a Duo image with python and pinpong libraries, the command is as follows:
```bash
docker exec -it duodocker /bin/bash -c "cd /home/work && cat /etc/issue && ./build.sh milkv-duo-python"
```
After successful compilation, you can see the generated SD card burning image `milkv-duo-*-*.img` in the `out` directory.
After successful compilation, you can see the generated SD card burning image `[board]-*-*.img` in the `out` directory.
### <2>. Compile step by step using Docker
If you have not executed the one-click compilation script, you need to manually download the toolchain [host-tools](https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/03/07/16/host-tools.tar.gz) and extract it to the SDK root directory:
```bash
tar -xf host-tools.tar.gz -C /your/sdk/path/
```
Step-by-step compilation requires logging into Docker to operate. Use the command `docker ps -a` to view and record the ID number of the container, such as 8edea33c2239.
Enter Docker:
```
```bash
docker exec -it 8edea33c2239 /bin/bash
```
Enter the code directory bound in Docker:
```
```bash
root@8edea33c2239:/# cd /home/work/
```
Compile step by step:
Then enter the following commands in sequence to complete the step-by-step compilation. Replace `[board]` and `[config]` in the command with the version that needs to be compiled. The currently supported `board` and corresponding `config` are as follows:
```
milkv-duo cv1800b_milkv_duo_sd
milkv-duo-python cv1800b_milkv_duo_sd
milkv-duo256m cv1812cp_milkv_duo256m_sd
milkv-duo256m-python cv1812cp_milkv_duo256m_sd
```
```bash
export MILKV_BOARD=milkv-duo
source milkv/boardconfig-milkv-duo.sh
source device/[board]/boardconfig.sh
source build/milkvsetup.sh
defconfig [config]
clean_all
build_all
pack_sd_image
```
For example, if you need to compile a Duo image with python and pinpong libraries, the step-by-step compilation command is as follows:
```bash
source device/milkv-duo-python/boardconfig.sh
source build/milkvsetup.sh
defconfig cv1800b_milkv_duo_sd
......@@ -168,10 +258,16 @@ build_all
pack_sd_image
```
Generated firmware location:
```
Duo: install/soc_cv1800b_milkv_duo_sd/[board].img
Duo256M: install/soc_cv1812cp_milkv_duo256m_sd/[board].img
```
Generated firmware location: `install/soc_cv1800b_milkv_duo_sd/milkv-duo.img`.
After compilation is completed, you can use the `exit` command to exit the Docker environment:
```
```bash
root@8edea33c2239:/home/work# exit
```
The generated firmware can also be seen in the host code directory.
......@@ -179,12 +275,12 @@ 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:
```
```bash
docker stop 8edea33c2239
docker rm 8edea33c2239
```
## Other compilation considerations
## 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.
......@@ -230,7 +326,7 @@ To solve this problem you need to change the `/etc/wsl.conf` file and add the fo
appendWindowsPath = false
```
After that, you need to reboot the WSL with `wsl.exe --reboot`. Then you able to run the `./build_milkv.sh` script or the `build_all` line in the step-by-step compilation method.
After that, you need to reboot the WSL with `wsl.exe --reboot`. Then you able to run the `./build.sh` script or the `build_all` line in the step-by-step compilation method.
To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true. To reboot the WSL, can you use the Windows PowerShell command `wsl.exe --shutdown` then `wsl.exe`, after that the Windows environment variables become avaliable again in $PATH.
## SD card burning
......@@ -238,7 +334,7 @@ To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true.
> 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`, `Rufus`, or `Win32 Disk Imager`.
- To write the generated image to a microSD card on Linux, use the `dd` command. **Please make sure to carefully confirm that the `of` device `/dev/sdX` corresponds to the microSD card you want to burn**:
```
```bash
sudo dd if=milkv-duo-*-*.img of=/dev/sdX
```
......@@ -257,7 +353,7 @@ To rollback this change in `/etc/wsl.conf` file set `appendWindowsPath` as true.
The username and password for logging into the Duo terminal are as follows:
```text
```
root
milkv
```
......@@ -293,8 +389,7 @@ then reboot the board.
Enable the 4 USB ports on the IO-Board:
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-host.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-host.sh /mnt/system/usb.sh
sync
```
......@@ -324,8 +419,7 @@ umount /mnt/udisk
To restore the functionality of the USB network (RNDIS) when not using the IO-Board, you can follow these steps:
```bash
rm /mnt/system/usb.sh
ln -s /mnt/system/usb-rndis.sh /mnt/system/usb.sh
ln -sf /mnt/system/usb-rndis.sh /mnt/system/usb.sh
sync
```
......@@ -335,7 +429,7 @@ then reboot the board.
1. 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. The SDK for this core has not been released yet and will be updated in the future.
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](https://milkv.io/docs/duo/getting-started/rtoscore).
2. Why does it only show 28M when viewing the RAM?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment