Changes

Jump to: navigation, search

Orange Pi CM4

851 bytes added, 14:49, 19 September 2023
Compile u-boot
# Run the build.sh script, remember to add sudo permission
::{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li><p>Then it will start to compile u-boot, and some information prompted during compilation is explained as follows</p>
<ol style="list-style-type: lower-alpha;">
<li>u-boot source code version</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling u-boot [ '''v2017.09''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The version of the cross-compilation toolchain</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 7.4.1''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Path to the generated u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The package name of the generated u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''1 min''' ]
|}</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Repeat the command to compile u-boot, use the following command to start compiling u-boot directly without selecting through the graphical interface</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepi3b BRANCH=legacy BUILD_OPT=u-boot KERNEL_CONFIGURE=no''' ]
|}</ol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>View the u-boot deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb
|}</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>The files contained in the generated u-boot deb package are as follows</p>
<ol style="list-style-type: lower-alpha;">
<li>Use the following command to decompress the deb package</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb '''usr'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The decompressed file is as follows</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build/output/debs/u-boot$ '''tree usr'''
└── lib
:├── linux-u-boot-legacy-orangepi3b_1.0.0_arm64
:│   ├── idbloader.img
:│   ├── rkspi_loader.img
:│   └── u-boot.itb
:└── u-boot
::├── LICENSE
::├── orangepi-3b-rk3566_defconfig ::└── platform_install.sh
└── platform_install.sh
3 directories, 6 files
|}
</ol>
</li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server, so if you want to modify the u-boot source code, you first need to turn off the download and update function of the source code '''(This function needs to be fully compiled once u-boot, otherwise it will prompt that the source code of u-boot cannot be found. If the source code package downloaded from Baidu cloud disk, there is no such problem, because the source code of u-boot is all cached)''', otherwise the changes made will be reverted, the method is as follows:</li>
<ol start="7" style="list-style-type: decimal;"><li>When Set the orangepiIGNORE_UPDATES variable in userpatches/config-bulid compilation system compiles the u-boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server, so if you want default.conf to modify the u-boot source code, you first need to turn off the download and update function of the source code '''(This function needs to be fully compiled once u-boot, otherwise it will prompt that the source code of u-boot cannot be found. If the source code package downloaded from Baidu cloud disk, there is no such problem, because the source code of u-boot is all cached)''', otherwise the changes made will be reverted, the method is as follows:</li></ol>&quot;yes&quot;
<blockquote>Set the IGNORE_UPDATES variable in userpatches/config{| class="wikitable" style="width:800px;" |-default.conf to &quot;yes&quot;</blockquote>|
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES=&quot;'''<span style="color:#FF0000">yes</span>'''&quot;|}</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>When debugging u-boot code, you can use the following method to update u-boot in the Linux image for testing</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled u-boot deb package to the Linux system of the development board</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
test@test:~/orangepi_build/output/debs/u-boot$ '''scp \'''
'''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb''' [mailto:[email protected]:/root [email protected]:'''|}</root]ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Then log in to the development board and uninstall the deb package of u-boot installed</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''apt purge -y linux-u-boot-orangepi3b-legacy'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Install the new u-boot deb package just uploaded</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''dpkg -i''' '''linux-u-boot-legacy-orangepi3b_1.0.0_arm64.deb'''
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then run the nand-sata-install script</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''nand-sata-install'''
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC''' to update the u-boot in the TF card or '''7 Install/Update the bootloader on SPI Flash''' to update the u-boot in the SPI Flash</li></ol>
[[File:cm4-img394.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>After pressing the Enter key, a Warning will pop up first</li></ol>
[[File:cm4-img395.png]]
</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot, and the following information will be displayed after the update is completed</li></ol>
[[File:cm4-img396.png]]
</ol>
<ol start="8" style="list-style-type: lower-alpha;">
<li>Then you can restart the development board to test whether the modification of u-boot takes effect</li></ol>
</li></ol>
<!-- -->
<ol start="9" style="list-style-type: decimal;">
<li><p>Other useful information</p>
<ol style="list-style-type: lower-alpha;">
<li>In the u-boot 2017.09 source code, the defconfig configuration file used by the development board is</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[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''']
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>In the u-boot 2017.09 source code, the dts file used by the development board is</li></ol>{| 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="compile-the-linux-kernel"></span>
<span id="compile-the-linux-kernel"></span>
== Compile the Linux kernel ==

Navigation menu