From b9f33f3141f6ef68a90fda2b27758f237161376f Mon Sep 17 00:00:00 2001 From: zhangxiaowei16 Date: Wed, 4 Feb 2026 16:12:50 +0800 Subject: [PATCH] Modify the openvela build script based on Ubuntu --- en/quickstart/openvela_macos_quick_start.md | 14 ++-- en/quickstart/openvela_ubuntu_quick_start.md | 14 ++-- .../quickstart/openvela_macos_quick_start.md | 83 ++++++------------- .../quickstart/openvela_ubuntu_quick_start.md | 14 ++-- 4 files changed, 45 insertions(+), 80 deletions(-) diff --git a/en/quickstart/openvela_macos_quick_start.md b/en/quickstart/openvela_macos_quick_start.md index df9ebc24..f91c1a8a 100644 --- a/en/quickstart/openvela_macos_quick_start.md +++ b/en/quickstart/openvela_macos_quick_start.md @@ -117,13 +117,13 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your GitHub account first. Please refer to the [official GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account). ```bash - repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml + repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml + repo init -u https://github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` #### Option B: Download from Gitee @@ -133,13 +133,13 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your Gitee account first. Please refer to the [official Gitee documentation](https://gitee.com/help/articles/4191). ```bash - repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u https://gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` #### Option C: Download from GitCode @@ -149,16 +149,16 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your GitCode account first. Please refer to the [official GitCode documentation](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh). ```bash - repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u https://gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` -3. Run the sync command. `repo` will download all relevant source code repositories according to the manifest file (`openvela.xml`). +3. Run the sync command. `repo` will download all relevant source code repositories according to the manifest file (`trunk-5.4.xml`). ```Bash repo sync -c -j8 diff --git a/en/quickstart/openvela_ubuntu_quick_start.md b/en/quickstart/openvela_ubuntu_quick_start.md index 28d09e62..e88541b1 100644 --- a/en/quickstart/openvela_ubuntu_quick_start.md +++ b/en/quickstart/openvela_ubuntu_quick_start.md @@ -82,13 +82,13 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your GitHub account first. Please refer to the [official GitHub documentation](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account). ```bash - repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --git-lfs + repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --git-lfs + repo init -u https://github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` #### Option B: Download from Gitee @@ -98,13 +98,13 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your Gitee account first. Please refer to the [official Gitee documentation](https://gitee.com/help/articles/4191). ```bash - repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u https://gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` #### Option C: Download from GitCode @@ -114,16 +114,16 @@ After installation, you can run `repo --version` to verify it. This method requires you to add your SSH public key to your GitCode account first. Please refer to the [official GitCode documentation](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh). ```bash - repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - Method 2: HTTPS ```bash - repo init -u https://gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u https://gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` -3. Execute the sync command. `repo` will download all related source code repositories according to the manifest file (`openvela.xml`). +3. Execute the sync command. `repo` will download all related source code repositories according to the manifest file (`trunk-5.4.xml`). ```bash repo sync -c -j8 diff --git a/zh-cn/quickstart/openvela_macos_quick_start.md b/zh-cn/quickstart/openvela_macos_quick_start.md index f1ce51b4..86f23c90 100644 --- a/zh-cn/quickstart/openvela_macos_quick_start.md +++ b/zh-cn/quickstart/openvela_macos_quick_start.md @@ -117,13 +117,13 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 GitHub 账户,请参考 [GitHub 官方文档](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)。 ```bash - repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml + repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml + repo init -u https://github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` #### 选项 B:从 Gitee 下载 @@ -133,13 +133,13 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 Gitee 账户,请参考 [Gitee 官方文档](https://gitee.com/help/articles/4191)。 ```bash - repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u https://gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` #### 选项 C:从 GitCode 下载 @@ -149,71 +149,38 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 GitCode 账户,请参考 [GitCode 官方文档](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh)。 ```bash - repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ + repo init -u https://gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` -3. 执行同步命令,`repo` 将根据清单文件 (`openvela.xml`) 下载所有相关的源代码仓库。 +3. 执行同步命令,repo 将根据清单文件 (`trunk-5.4.xml`) 下载所有相关的源代码仓库。 - ```Bash + ```bash repo sync -c -j8 ``` -## 步骤三:编译源代码 - -完成源代码下载后,请在 openvela 根目录下执行以下编译步骤。 - -### 1. 设置环境变量 - -执行以下命令,将预编译的工具链路径添加到当前终端会话的环境变量中。 - -```Bash -uname_s=$(uname -s | tr '[A-Z]' '[a-z]') -uname_m=$(uname -m | sed 's/arm64/aarch64/g') -export PATH=$PWD/prebuilts/build-tools/${uname_s}-${uname_m}/bin:$PATH -export PATH=$PWD/prebuilts/cmake/${uname_s}-${uname_m}/bin:$PATH -export PATH=$PWD/prebuilts/python/${uname_s}-${uname_m}/bin:$PATH -export PATH=$PWD/prebuilts/gcc/${uname_s}-${uname_m}/aarch64-none-elf/bin:$PATH -export PATH=$PWD/prebuilts/gcc/${uname_s}-${uname_m}/arm-none-eabi/bin:$PATH -export PYTHONPATH=$PWD/prebuilts/tools/python/dist-packages/cxxfilt -export PYTHONPATH=$PWD/prebuilts/tools/python/dist-packages/kconfiglib:$PYTHONPATH -export PYTHONPATH=$PWD/prebuilts/tools/python/dist-packages/pyelftools:$PYTHONPATH -``` - -> **注意**: 此环境变量配置仅在当前终端窗口有效。若新开终端,需重新执行此脚本。 - -### 2. 配置 CMake 项目 (Out-of-Tree) - -openvela 采用 **Out-of-tree build** 模式,该模式将编译产物与源代码分离,以保持源码目录的整洁。 + ![alt text](./figures/004.png) -运行以下 `cmake` 命令来配置项目。此命令将: + > **操作提示** + > + > - 首次同步耗时较长,具体时间取决于您的网络状况和磁盘性能。 + > - 若因网络问题中断,可重复执行 `repo sync` 进行增量同步。 -- 在 `cmake_out/goldfish-arm64-v8a-ap` 目录下生成构建系统文件。 -- 使用 Ninja 作为构建工具以提升编译速度。 -- 指定目标板的配置文件。 - -```Bash -cmake \ - -B cmake_out/goldfish-arm64-v8a-ap \ - -S $PWD/nuttx \ - -GNinja \ - -DBOARD_CONFIG=../vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap \ - -DEXTRA_FLAGS="-Wno-cpp -Wno-deprecated-declarations" -``` +## 步骤三:编译源代码 -![alt text](./figures/005.png) +完成源代码下载后,请在 openvela 根目录下执行以下编译步骤。 -### 3.(可选)自定义内核配置 +### 1. (可选)自定义内核配置 您可以通过 `menuconfig` 命令打开图形化界面,以调整 NuttX 内核与组件的配置。 ```Bash -cmake --build cmake_out/goldfish-arm64-v8a-ap -t menuconfig +./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ --cmake menuconfig ``` > **操作技巧** @@ -222,33 +189,31 @@ cmake --build cmake_out/goldfish-arm64-v8a-ap -t menuconfig > - 按 `空格键` 可切换选中状态(启用/禁用/模块化)。 > - 配置完成后,选择 **Save** 保存并退出。 -![alt text](./figures/006.png) + -### 4. 执行编译 +### 2. 执行编译 执行以下命令,构建整个项目。 ```Bash -cmake --build cmake_out/goldfish-arm64-v8a-ap +./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ --cmake -j$(nproc) ``` -编译成功后,您将在 `cmake_out/goldfish-arm64-v8a-ap` 目录下找到 `nuttx` 等编译产物。 +编译成功后,您将在 `cmake_out/vela_goldfish-arm64-v8a-ap` 目录下找到 `nuttx` 等编译产物。 -![alt text](./figures/007.png) + ## 步骤四:运行模拟器 在 openvela 根目录下,执行以下脚本启动 `Vela Emulator` 并加载您的编译产物。 ```Bash -./emulator.sh cmake_out/goldfish-arm64-v8a-ap +./emulator.sh cmake_out/vela_goldfish-arm64-v8a-ap/ ``` 模拟器启动后,您将看到 `goldfish-armv8a-ap>` 提示符,表明 openvela 已成功运行。 -![alt text](./figures/008.png) - -![alt text](./figures/009.png) + ## 后续步骤 diff --git a/zh-cn/quickstart/openvela_ubuntu_quick_start.md b/zh-cn/quickstart/openvela_ubuntu_quick_start.md index 4156fa05..cdaca7e1 100644 --- a/zh-cn/quickstart/openvela_ubuntu_quick_start.md +++ b/zh-cn/quickstart/openvela_ubuntu_quick_start.md @@ -82,13 +82,13 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 GitHub 账户,请参考 [GitHub 官方文档](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account)。 ```bash - repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --git-lfs + repo init -u ssh://git@github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://github.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --git-lfs + repo init -u https://github.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --git-lfs ``` #### 选项 B:从 Gitee 下载 @@ -98,13 +98,13 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 Gitee 账户,请参考 [Gitee 官方文档](https://gitee.com/help/articles/4191)。 ```bash - repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init --u ssh://git@gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://gitee.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u https://gitee.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` #### 选项 C:从 GitCode 下载 @@ -114,16 +114,16 @@ sudo mv repo /usr/local/bin 此方式需要您先将 SSH 公钥添加至您的 GitCode 账户,请参考 [GitCode 官方文档](https://docs.gitcode.com/docs/help/home/user_center/security_management/ssh)。 ```bash - repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u ssh://git@gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` - 方式二:HTTPS ```bash - repo init -u https://gitcode.com/open-vela/manifests.git -b trunk-5.4 -m openvela.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs + repo init -u https://gitcode.com/open-vela/manifests.git -b trunk -m tags/trunk-5.4.xml --repo-url=https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ --git-lfs ``` -3. 执行同步命令,repo 将根据清单文件 (`openvela.xml`) 下载所有相关的源代码仓库。 +3. 执行同步命令,repo 将根据清单文件 (`trunk-5.4.xml`) 下载所有相关的源代码仓库。 ```bash repo sync -c -j8