Skip to content

Commit

Permalink
style: adjust the code block
Browse files Browse the repository at this point in the history
Move the text out of the code block and repair the code block to shrink
  • Loading branch information
CodeChenL committed Nov 1, 2024
1 parent 3a4d86d commit 66b0573
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 85 deletions.
73 changes: 33 additions & 40 deletions docs/common/dev/_kernel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { PreView } from "@site/src/utils/docs";

bsp 是 Radxa 提供的一套快速构建 U-Boot Kernel 的工具,使用 bsp 非常方便就能构建出自己的 U-Boot 和 Kernel.

<PreView params={{ model: props.model }}>
{`
下面将为您展示,以 #model# 为例如何使用 bsp 构建内核。
`}
</PreView>
下面将为您展示,以 {props.model} 为例如何使用 bsp 构建内核。

### bsp 环境配置

Expand Down Expand Up @@ -51,55 +47,52 @@ cd bsp

### 构建内核

**完成 bsp 环境配置后,需要先编译一次内核才会从仓库拉取内核代码。**
直接运行 `./bsp` 会显示所有参数及其解释,根据提示可知命令 `bsp [options] <linux|u-boot> <profile> [product]`
{props.model} 为例,linux profile 为 "**{props.soc}**",以下是其他产品的 profile:

| Model | profile |
| :---------------: | :------: |
| Radxa ROCK 5A | rockchip |
| Radxa ROCK 5B | rockchip |
| Radxa ROCK 5C | rockchip |
| Radxa ROCK 5 ITX | rockchip |
| Radxa ROCK 3A | rk356x |
| Radxa ROCK 3B | rk356x |
| Radxa ROCK 3C | rk356x |
| Radxa CM3 Series | rk356x |
| Radxa CM3I Series | rk356x |
| Radxa ROCK PI S | stable |

然后将产品对应 profile **{props.soc}** 填入 bsp 命令的 `profile` 参数即可构建内核,例如:

<PreView params={{ model: props.model, soc: props.soc }}>
{`
完成 bsp 环境配置后,需要先编译一次内核才会从仓库拉取内核代码。
直接运行 ./bsp 会显示所有参数及其解释,根据提示可知命令 "bsp [options] <linux|u-boot> <profile> [product]"。
以 #model# 为例,linux profile 为 "#soc#"。以下是其他产品的 profile:
| Model | profile |
| :--------------: | :------: |
| Radxa ROCK 5A | rockchip |
| Radxa ROCK 5B | rockchip |
| Radxa ROCK 5C | rockchip |
| Radxa ROCK 5 ITX | rockchip |
| Radxa ROCK 3A | rk356x |
| Radxa ROCK 3B | rk356x |
| Radxa ROCK 3C | rk356x |
| Radxa CM3 Series| rk356x |
| Radxa CM3I Series| rk356x |
| Radxa ROCK PI S | stable |
然后将产品对应 profile **#soc#** 填入 bsp 命令的 **profile** 参数例如:**./bsp linux #soc#**,即可构建内核。
内核源码的路径位于 bsp 目录下的 **.src/linux**,在修改内核源码后,可再次构建内核:
`}
{`./bsp linux #soc#`}
</PreView>

内核源码的路径位于 bsp 目录下的 `.src/linux`,在修改内核源码后,可再次构建内核:

<PreView params={{ soc: props.soc }}>
{`
cd bsp
./bsp --no-prepare-source linux #soc# -r 999
参数说明:
--no-prepare-source # 首次编译不需要加该参数,加该参数是为了使用本地修改进行编译,如果不加这个参数将会从 Radxa kernel 仓库同步最新代码并覆盖本地修改
-r 999 # 指定内核的版本号为 999,以优先使用
`}
{`cd bsp
./bsp --no-prepare-source linux #soc# -r 999
参数说明:
--no-prepare-source # 首次编译不需要加该参数,加该参数是为了使用本地修改进行编译,如果不加这个参数将会从 Radxa kernel 仓库同步最新代码并覆盖本地修改
-r 999 # 指定内核的版本号为 999,以优先使用`}
</PreView>

编译完成后会在当前目录生成许多 `deb` 包, 只需要安装下面两个 `deb` 即可

<PreView params={{ soc: props.soc }}>
{`
linux-headers-5.10.160-999-#soc#_5.10.160-20_arm64.deb
linux-image-5.10.160-999-#soc#_5.10.160-20_arm64.deb
`}
{`linux-headers-5.10.160-999-#soc#_5.10.160-20_arm64.deb
linux-image-5.10.160-999-#soc#_5.10.160-20_arm64.deb`}
</PreView>

将上面两个 `deb` 包复制到板子上使用 `dpkg` 指令安装即可完成内核安装

<PreView params={{ soc: props.soc }}>
{`
sudo dpkg -i linux-image-5.10.160-999-#soc#_5.10.160-20_arm64.deb
sudo dpkg -i linux-headers-5.10.160-999-#soc#_5.10.160-20_arm64.deb
sudo reboot
`}
{`sudo dpkg -i linux-image-5.10.160-999-#soc#_5.10.160-20_arm64.deb
sudo dpkg -i linux-headers-5.10.160-999-#soc#_5.10.160-20_arm64.deb
sudo reboot`}
</PreView>

重启完成后,可以通过 `uname -a` 查看当前启动的内核版本号,来查看是否安装成功
Expand Down
79 changes: 34 additions & 45 deletions docs/common/dev/_u-boot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,69 +47,58 @@ cd bsp

### 构建 U-Boot

<PreView
params={{
model: props.model,
profile: props.profile,
product: props.product,
}}
>
{`
完成 bsp 环境配置后,需要先编译一次 U-Boot 才会从仓库拉取 U-Boot 代码。
直接运行 ./bsp 会显示所有参数及其解释,根据提示可知命令 "bsp [options] <linux|u-boot> <profile> [product]"。
以 #model# 为例,U-Boot profile 为 **#profile#**。以下是其他产品的 profile:
| Model | profile |
| :--------------: | :-----: |
| Radxa ROCK 5A | rknext |
| Radxa ROCK 5B | rknext |
| Radxa ROCK 5C | rknext |
| Radxa ROCK 5 ITX | rknext |
| Radxa ROCK 3A | latest |
| Radxa ROCK 3B | latest |
| Radxa ROCK 3C | latest |
| Radxa CM3 Series| latest |
| Radxa CM3I Series| latest |
| Radxa ROCK PI S | latest |
然后将产品对应 profile **#profile#** 填入 bsp 命令的 profile 参数例如:"./bsp u-boot #profile# #product#",即可构建 U-Boot。
U-Boot 源码的路径位于 bsp 目录下的 ".src/u-boot",在修改 U-Boot 源码后,可再次构建 U-Boot:
`}
</PreView>
**完成 bsp 环境配置后,需要先编译一次 U-Boot 才会从仓库拉取 U-Boot 代码。**
直接运行 `./bsp` 会显示所有参数及其解释,根据提示可知命令 `bsp [options] <linux|u-boot> <profile> [product]`
{props.model} 为例,U-Boot profile 为 "**{props.profile}**"。以下是其他产品的 profile:

| Model | profile |
| :---------------: | :-----: |
| Radxa ROCK 5A | rknext |
| Radxa ROCK 5B | rknext |
| Radxa ROCK 5C | rknext |
| Radxa ROCK 5 ITX | rknext |
| Radxa ROCK 3A | latest |
| Radxa ROCK 3B | latest |
| Radxa ROCK 3C | latest |
| Radxa CM3 Series | latest |
| Radxa CM3I Series | latest |
| Radxa ROCK PI S | latest |

然后将 {props.model} 对应 profile "**{props.profile}**" 填入 bsp 命令的 `profile` 参数即可构建 U-Boot,例如:

<PreView params={{ profile: props.profile, product: props.product }}>
{`./bsp u-boot #profile# #product#`}
</PreView>{" "}

编译一次后 U-Boot 源码的路径位于 bsp 目录下的 `.src/u-boot`,在修改 U-Boot 源码后,可再次构建 U-Boot:

<PreView params={{ profile: props.profile, product: props.product }}>
{`
cd bsp
./bsp --no-prepare-source u-boot #profile# #product#
参数说明:
--no-prepare-source # 首次编译不需要加该参数,加该参数是为了使用本地修改进行编译,如果不加这个参数将会从 Radxa U-Boot 仓库同步最新代码并覆盖本地修改
`}
{`cd bsp
./bsp --no-prepare-source u-boot #profile# #product#
参数说明:
--no-prepare-source # 首次编译不需要加该参数,加该参数是为了使用本地修改进行编译,如果不加这个参数将会从 Radxa U-Boot 仓库同步最新代码并覆盖本地修改`}
</PreView>

更多 bsp 参数使用说明可以执行 `./bsp`查看
更多 bsp 参数使用说明可以执行 `./bsp` 查看

编译完成后会在当前目录生成许多 `deb` 包, 只需要安装下面的 `deb` 即可

<PreView params={{ profile: props.profile }}>
{`
u-boot-#profile#_2023.10-1_arm64.deb
`}
{`u-boot-#profile#_2023.10-1_arm64.deb`}
</PreView>

将上面两个 `deb` 包复制到板子上使用 `dpkg` 指令安装即可完成 U-Boot 安装

<PreView params={{ profile: props.profile }}>
{`
sudo dpkg -i u-boot-#profile#_2023.10-1_arm64.deb
`}
{`sudo dpkg -i u-boot-#profile#_2023.10-1_arm64.deb`}
</PreView>

安装完成后需要将 U-Boot 刷到启动介质中

<PreView params={{ profile: props.profile, product: props.product }}>
{`
cd /usr/lib/u-boot/#product#/
sudo ./setup.sh update_bootloader /dev/mmcblk1 #/dev/mmcblk1 为你当前使用的启动介质,需要根据实际使用的设备来选择
sudo reboot
`}
{`cd /usr/lib/u-boot/#product#/
sudo ./setup.sh update_bootloader /dev/mmcblk1 #/dev/mmcblk1 为你当前使用的启动介质,需要根据实际使用的设备来选择
sudo reboot`}
</PreView>

重启后可以观察 U-Boot 启动 log 查看 U-Boot 是否更新成功。
Expand Down

0 comments on commit 66b0573

Please sign in to comment.