更改

跳转至: 导航搜索

Orange Pi 3B

添加809字节, 2023年8月3日 (四) 17:19
编译u-boot
<ol style="list-style-type: decimal;">
<li><p>运行build.sh脚本,记得加sudo权限</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~/orangepi-build$ '''sudo ./build.sh'''</p>|}</li>
<li><p>选择'''U-boot package''',然后回车</p>
<div class="figure">
<ol style="list-style-type: lower-alpha;">
<li><p>u-boot源码的版本</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] Compiling u-boot [ '''v2017.09''' ]</p>|}</li>
<li><p>交叉编译工具链的版本</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 7.4.1''' ]</p>|}</li>
<li><p>编译生成的u-boot deb包的路径</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]</p>|}</li>
<li><p>编译生成的u-boot deb包的包名</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] File name [ '''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb''' ]</p>|}</li>
<li><p>编译使用的时间</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] Runtime [ '''1 min''' ]</p>|}</li>
<li><p>重复编译u-boot的命令,使用下面的命令无需通过图形界面选择,可以直接开始编译u-boot</p>
{| class="wikitable" style="width:800px;" |-| <p>[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepi3b BRANCH=legacy BUILD_OPT=u-boot KERNEL_CONFIGURE=no''' ]</p>|}</li></ol>
</li>
<li><p>查看编译生成的u-boot deb包</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''</p>
<p>linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb</p>|}</li>
<li><p>生成的u-boot的deb包包含的文件如下所示</p>
<ol style="list-style-type: lower-alpha;">
<li><p>使用下面的命令可以解压deb包</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~/orangepi-build$ '''cd output/debs/u-boot'''</p>
<p>test@test:~/orangepi_build/output/debs/u-boot$ $ '''dpkg -x''' \</p>
<p>'''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb . (注意命令最后有个”.”)'''</p>
<p>test@test:~/orangepi_build/output/debs/u-boot$ '''ls'''</p>
<p>linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb '''usr'''</p>|}</li>
<li><p>解压后的文件如下所示</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~/orangepi-build/output/debs/u-boot$ '''tree usr'''</p>
<p>usr</p>
<p>└── lib</p>
:<p>├── linux-u-boot-legacy-orangepi3b_1.0.0_arm64</p>:<p>│   ├── idbloader.img</p>:<p>│   ├── rkspi_loader.img</p>:<p>│   └── u-boot.itb</p>:<p>└── u-boot</p>::<p>├── LICENSE</p>::<p>├── orangepi-3b-rk3566_defconfig</p>::<p>└── platform_install.sh</p>  <p>3 directories, 6 files</p>|}</li></ol>
</li>
<li><p>orangepi-bulid编译系统编译u-boot源码时首先会将u-boot的源码和github服务器的u-boot源码进行同步,所以如果想修改u-boot的源码,首先需要关闭源码的下载更新功能('''需要完整编译过一次u-boot后才能关闭这个功能,否则会提示找不到u-boot的源码,如果是从百度云盘下载的源码压缩包,则没有这个问题,因为u-boot的源码都已缓存好了'''),否则所作的修改都会被还原,方法如下:</p>
<p>设置userpatches/config-default.conf中的IGNORE_UPDATES变量为”yes”</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''</p>
<p>IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;</p>|}</li>
<li><p>调试u-boot代码时,可以使用下面的方法来更新linux镜像中的u-boot进行测试</p>
<ol style="list-style-type: lower-alpha;">
<li><p>将编译好的u-boot的deb包上传到开发板的linux系统中</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~/orangepi-build$ '''cd output/debs/u-boot'''</p>
<p>test@test:~/orangepi_build/output/debs/u-boot$ '''scp \'''</p>
<p>'''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''</p>|}</li>
<li><p>然后登录到开发板,卸载已安装的u-boot的deb包</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''apt purge -y linux-u-boot-orangepi3b-legacy'''</p>|}</li>
<li><p>再安装刚才上传的新的u-boot的deb包</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''dpkg -i''' '''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb'''</p>|}</li>
<li><p>然后运行 nand-sata-install脚本</p>
{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''nand-sata-install'''</p>|}</li>
<li><p>然后选择'''5 Install/Update the bootloader on SD/eMM'''来更新TF卡中的u-boot或者'''7 Install/Update the bootloader on SPI Flash'''来更新SPI Flash中的u-boot</p>
<p>[[File:media/image383.png|312x152px]]</p></li>
<ol style="list-style-type: lower-alpha;">
<li><p>u-boot 2017.09源码中,开发板使用的defconfig配置文件为</p>
{| class="wikitable" style="width:800px;" |-| <p>[https://github.com/orangepi-xunlong/u-boot-orangepi/blob/v2017.09-rk3588/configs/orangepi_5_defconfig '''orangepi-build/u-boot/v2017.09-rk3588/configs/orangepi-3b-rk3566_defconfig''']</p>|}</li><li><p>u-boot 2017.09源码中,开发板使用dts文件为</p></li>{| class="wikitable" style="width:800px;" |-| [https://github.com/orangepi-xunlong/u-boot-orangepi/blob/v2017.09-rk3588/arch/arm/dts/rk3588s-orangepi-5.dts '''orangepi-build/u-boot/v2017.09-rk3588/arch/arm/dts/rk3566-orangepi-3b.dts''']|}</ol>
</li></ol>
 
<span id="orangepi-buildu-bootv2017.09-rk3588archarmdtsrk3566-orangepi-3b.dts编译linux内核"></span>
[https://github.com/orangepi-xunlong/u-boot-orangepi/blob/v2017.09-rk3588/arch/arm/dts/rk3588s-orangepi-5.dts '''orangepi-build/u-boot/v2017.09-rk3588/arch/arm/dts/rk3566-orangepi-3b.dts''']
== 编译linux内核 ==
8,460
个编辑

导航菜单