Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified en/quickstart/figures/007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified en/quickstart/figures/008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 19 additions & 61 deletions en/quickstart/openvela_ubuntu_quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,91 +136,49 @@ After installation, you can run `repo --version` to verify it.
> - The initial sync can be time-consuming, depending on your network connection and disk performance.
> - If the sync is interrupted due to network issues, you can run `repo sync` again to resume.

## Step 3: Build the Source Code
## Step 3: Compile Source Code

After downloading the source code, perform the following compilation steps in the openvela root directory.
After downloading the source code, execute the following compilation steps in the openvela root directory.

### 1. Set Environment Variables
### 1. (Optional) Custom Kernel Configuration

Run the following command to add the paths of the prebuilt toolchains to the environment variables for the current terminal session.
You can use the `menuconfig` command to open a graphical interface to adjust the NuttX kernel and component configurations.

```Bash
uname_s=$(uname -s | tr '[A-Z]' '[a-z]')
uname_m=$(uname -m)
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
./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ --cmake menuconfig
```

> **Note**: These environment variable settings are only valid for the current terminal session. If you open a new terminal, you must run this script again.

### 2. Configure the CMake Project (Out-of-Tree)

openvela uses an **Out-of-tree build** approach, which separates the build artifacts from the source code to keep the source directory clean.

Run the following `cmake` command to configure the project. This command will:

- Generate build system files in the `cmake_out/goldfish-arm64-v8a-ap` directory.
- Use Ninja as the build tool to accelerate compilation.
- Specify the configuration file for the target board.

```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)

### 3. (Optional) Customize Kernel Configuration

You can use the `menuconfig` command to open a graphical interface to adjust the configuration of the NuttX kernel and its components.

```Bash
cmake --build cmake_out/goldfish-arm64-v8a-ap -t menuconfig
```

> **Tips**
> **Operation Tricks**
>
> - Press `/` to search for configuration options.
> - Press the `Spacebar` to toggle the selection state (enable/disable/module).
> - After configuring, select **Save** to save and exit.
> - Press `/` to search for configuration items.
> - Press `Space` to toggle selection status (Enable/Disable/Modularize).
> - After configuration, select **Save** to save and exit.

![alt text](./figures/006.png)
<img src="./figures/006.png" alt="" width="75%">

### 4. Start the Build
### 2. Execute Compilation

Execute the following command to build the entire project.

```Bash
cmake --build cmake_out/goldfish-arm64-v8a-ap
./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ --cmake -j$(nproc)
```

Upon successful compilation, you will find `nuttx` and other build artifacts in the `cmake_out/goldfish-arm64-v8a-ap` directory.
Upon successful compilation, you will find build artifacts such as `nuttx` in the `cmake_out/vela_goldfish-arm64-v8a-ap` directory.

![alt text](./figures/007.png)
<img src="./figures/007.png" alt="" width="75%">

## Step 4: Run the Emulator
## Step 4: Run Emulator

In the openvela root directory, run the following script to start the `Vela Emulator` and load your build artifacts.
In the openvela root directory, execute the following script to start the `Vela Emulator` and load your build artifacts.

```Bash
./emulator.sh cmake_out/goldfish-arm64-v8a-ap
./emulator.sh cmake_out/vela_goldfish-arm64-v8a-ap/
```

After the emulator starts, you will see the `goldfish-armv8a-ap>` prompt, indicating that openvela is running successfully.

![alt text](./figures/008.png)
After the emulator starts, you will see the `goldfish-armv8a-ap>` prompt, indicating that openvela has run successfully.

![alt text](./figures/009.png)
<img src="./figures/008.png" alt="" width="75%">

## Next Steps

Expand Down
Binary file modified zh-cn/quickstart/figures/007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified zh-cn/quickstart/figures/008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed zh-cn/quickstart/figures/009.png
Binary file not shown.
60 changes: 9 additions & 51 deletions zh-cn/quickstart/openvela_ubuntu_quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,52 +140,12 @@ sudo mv repo /usr/local/bin

完成源代码下载后,请在 openvela 根目录下执行以下编译步骤。

### 1. 设置环境变量

执行以下命令,将预编译的工具链路径添加到当前终端会话的环境变量中。

```Bash
uname_s=$(uname -s | tr '[A-Z]' '[a-z]')
uname_m=$(uname -m)
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** 模式,该模式将编译产物与源代码分离,以保持源码目录的整洁。

运行以下 `cmake` 命令来配置项目。此命令将:

- 在 `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)

### 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
```

> **操作技巧**
Expand All @@ -194,33 +154,31 @@ cmake --build cmake_out/goldfish-arm64-v8a-ap -t menuconfig
> - 按 `空格键` 可切换选中状态(启用/禁用/模块化)。
> - 配置完成后,选择 **Save** 保存并退出。

![alt text](./figures/006.png)
<img src="./figures/006.png" alt="" width="75%">

### 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)
<img src="./figures/007.png" alt="" width="75%">

## 步骤四:运行模拟器

在 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)
<img src="./figures/008.png" alt="" width="75%">

## 后续步骤

Expand Down