Changes

Jump to: navigation, search

Orange Pi CM4

5,477 bytes added, 19:55, 19 September 2023
Download orangepi-build from github
<big>'''Top view:'''</big><br>
[[File:cm4-img3.png|800px]]
<big>'''Bottom view:'''</big>
[[File:cm4-img4.png|800px]]
<span id="top-and-bottom-views-of-the-orange-pi-cm4-base-board"></span>
<big>'''Top view:'''</big>
[[File:cm4-img5.png|800px]]
<big>'''Bottom view:'''</big>
[[File:cm4-img6.png|800px]]
<span id="the-interface-details-of-orange-pi-cm4"></span>
<div class="figure">
[[File:cm4-img7.png|800px]]
</div>
<span id="interface-details-of-orange-pi-cm4-base-board"></span>
 
=== Interface details of Orange Pi CM4 base board ===
<div class="figure">
[[File:cm4-img8.png|800px]]
</div>
</div></li>
<li><p>'''3.3V''' USB to TTL module and DuPont line, when using serial port debugging function, need USB to TTL module and DuPont line to connect the development board and computer</p>
<p>[[File:cm4-img19.png|350px]] [[File:cm4-img20.png|450px]]</p></li>
<li><p>Personal computer with Ubuntu and Windows operating systems installed</p>
<li><p>Click the &quot;'''Driver Installation'''&quot; button</p>
<p>[[File:cm4-img34.png]]</p></li>
<li><p>Wait for a period of time, the pop-up window will prompt &gt; &quot;'''Driver installation successful'''&quot;, and then click the &gt; &quot;'''OK'''&quot; button</p>
<p>[[File:cm4-img35.png]]</p></li></ol>
</li>
<li><p>Then start burning the Linux image to the SSD</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First, connect the development board to the Windows computer &gt; through the USB2.0 male-to-public data cable. The position of &gt; the USB2.0 burning interface on the development board is shown &gt; in the figure below</p>
<p>[[File:cm4-img38.png]]</p></li>
<li><p>Ensure that no TF card is inserted into the development board &gt; and no power supply is connected</p></li><li><p>Then press and hold the MaskROM button on the development board. &gt; The position of the MaskROM button on the development board is &gt; shown as follows:</p>
<p>[[File:cm4-img39.png]]</p></li>
<li><p>Then connect the Type-C interface to the development board, and &gt; power on, and then you can release the MaskROM button</p>
<p>[[File:cm4-img40.png]]</p></li>
<li><p>If the previous steps are smooth, the development board will &gt; enter '''MASKROM''' mode at this time, and the interface of the &gt; burning tool will prompt &quot;'''Found a MASKROM device'''&quot;.</p>
<p>[[File:cm4-img41.png]]</p></li>
<li><p>Then place the mouse cursor on the field below</p>
</div></li>
<li><p>Then click the right mouse button to pop up the selection &gt; interface as shown in the following figure</p>
<p>[[File:cm4-img43.png]]</p></li>
<li><p>Then select the '''Import configuration''' option</p>
<p>[[File:cm4-img44.png]]</p></li>
<li><p>Then go to the previously downloaded '''MiniLoader''' folder, &gt; select the '''rk356x_linux_pcie.cfg''' configuration file, and &gt; click '''Open'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img77.png]]</p></li>
<li><p>Select '''MiniLoaderAll.bin''' from the '''MiniLoader''' folder &gt; downloaded earlier, and then click '''<span class="mark">Open</span>'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img78.png]]</p></li>
<li><p>Then go to the previously downloaded '''MiniLoader''' folder, &gt; select '''rkspi_loader.img''', and click '''<span class="mark">Open</span>'''</p>
<div class="figure">
<li><p>Then click on the location shown in the image below</p>
<p>[[File:cm4-img80.png]]</p></li>
<li><p>Then select the path of the Linux image you want to burn and &gt; click '''<span class="mark">Open</span>'''</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
<li><p>Then select '''<span class="mark">Force Write to address</span>'''</p>
<p>[[File:cm4-img81.png]]</p></li>
<li><p>Click the Run button again to start burning the Linux image to &gt; the SSD</p>
<p>[[File:cm4-img82.png]]</p></li>
<li><p>The display log of the S.lux image after burning is shown in the &gt; following figure</p>
<p>[[File:cm4-img83.png]]</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|}
</li>
<li><p>After the image is burned, the Linux system in the SPIFlash+PCIe &gt; SSD automatically starts. If it does not start properly, power &gt; it on again.</p></li></ol>
</li></ol>
<div class="figure">
[[File:cm4-img390.png|center|790px]]
</div>
# 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
:│   ├── idbloaderrkspi_loader.img
:│   ├── rkspi_loader└── u-boot.imgitb
│   :└── u-boot.itb
└── u-boot::├── LICENSE
::├── LICENSEorangepi-3b-rk3566_defconfig
├── 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:root@192.168.1.xxx:/root root@192.168.1.xxx:'''|}</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 ==
# 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>Select '''Kernel package''', then enter</li></ol>
<div class="figure">
[[File:cm4-img397.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
<div class="figure">
[[File:cm4-img393.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then it will prompt whether to display the kernel configuration interface. If you do not need to modify the kernel configuration, select the first one. If you need to modify the kernel configuration, select the second one.</li></ol>
[[File:cm4-img398.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you choose to display the kernel configuration menu (the second option) in step 4, the kernel configuration interface opened by '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration, save and exit after modification. Yes, after exiting, the kernel source code will be compiled</li></ol>
[[File:cm4-img399.png]]
<ol style="list-style-type: lower-alpha;">
<li>If you do not need to modify the configuration options of the kernel, when running the build.sh script, pass in '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up kernel configuration interface</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''sudo ./build.sh KERNEL_CONFIGURE=no'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>You can also set '''KERNEL_CONFIGURE=no''' in the '''orangepi-build/userpatches/config-default.conf''' configuration file, which can permanently disable this function</p></li>
<li><p>If the following error is displayed when compiling the kernel, it is because the terminal interface of the Ubuntu PC is too small to display the '''make menuconfig''' interface. Please maximize the terminal of the Ubuntu PC and run the build.sh script again</p></li></ol>
[[File:cm4-img400.png]]
</ol></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Part of the information prompted when compiling the kernel source code is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li>The version of the Linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling current kernel [ '''5.10.160''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The version of the cross-compilation toolchain used</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-none-linux-gnu-gcc 11.2.1''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The configuration file used by the kernel by default and the path where it is stored</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Using kernel config file [ '''config/kernel/linux-rockchip-rk356x-legacy.config''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path of the deb package related to the kernel generated by compiling</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''orangepi-build/output/debs/''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the compiled kernel image deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-image-legacy-rockchip-rk356x_1.0.0_arm64.deb''' ]
|}</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>The time used for compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''5 min''' ]
|}</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Finally, the compilation command to repeatedly compile the kernel selected last time will be displayed. Use the following command to start compiling the kernel source code 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=kernel KERNEL_CONFIGURE=no''' ]
|}</ol></li></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>View the deb package related to the kernel generated by compilation</p>
<li><p>'''linux-dtb-legacy-rockchip-rk356x_1.0.0_arm64.deb''' Contains dtb files used by the kernel</p></li>
<li><p>'''linux-headers-legacy-rockchip-rk356x_1.0.0_arm64.deb''' Include kernel header files</p></li>
<li><p>'''linux-image-legacy-rockchip-rk356x_1.0.0_arm64.deb''' Contains kernel images and kernel modules</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
output/debs/linux-headers-legacy-rockchip-rk356x_1.0.0_arm64.deb
|}</ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>The files contained in the generated Linux-image 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'''
'''boot etc lib''' linux-image-legacy-rockchip-rk356x_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/test$ '''tree -L 2'''
└── usr
:├── lib └── share
:└── share
|}
</ol>
</li></ol>
<ol start="9" style="list-style-type: decimal;">
<li>The orangepi-bulid compilation system will first synchronize the Linux kernel source code with the Linux kernel source code of the github server when compiling the Linux kernel source code, so if you want to modify the Linux kernel source code, you first need to turn off the update function of the source code '''(You need to fully compile the Linux kernel source code before turning off this function. Otherwise, you will be prompted that the source code of the Linux kernel cannot be found. If you download the source code package from Baidu cloud disk, there is no such problem, because the source code of Linux has been cached.)''', otherwise the The changes made will be reverted as follows:</li></ol>
<blockquote>Set the IGNORE_UPDATES variable in '''userpatches/config-default.conf''' to &quot;yes&quot;</blockquote>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
IGNORE_UPDATES=&quot;'''yes'''&quot;
|}</ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>If the kernel has been modified, the following method can be used to update the kernel and kernel modules of the development board Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the deb package of the compiled Linux kernel to the Linux system of the development board</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''cd output/debs'''
'''linux-image-legacy-rockchip-rk356x_1.0.0_arm64.deb root@192.168.1.xxx:/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 the installed Linux kernel</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''apt purge -y linux-image-legacy-rockchip-rk356x'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Install the deb package of the new Linux kernel just uploaded</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''dpkg -i linux-image-legacy-rockchip-rk356x_1.0.0_arm64.deb'''
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then restart the development board, and then check whether the kernel-related modifications have taken effect</li></ol>{| class="wikitable" style="width:800px;" |-|
root@orangepi:~# '''reboot'''
|}</ol></li></ol>
<ol start="11" style="list-style-type: decimal;">
<li><p>Other useful information</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The storage location of the kernel configuration file is as &gt; follows, please do not go to the kernel source code to find &gt; the kernel configuration file used by the development board</p></li><li><p>{| class="wikitable" style="width:800px;" |-| [https://github.com/orangepi-xunlong/orangepi-build/blob/next/external/config/kernel/linux-rockchip-rk356x-legacy.config '''orangepi-build/external/config/kernel/linux-rockchip-rk356x-legacy.config''']|}<li><p>The &gt; location of the dts file used by the development board is</p></li>{| class="wikitable" style="width:800px;" |-| [https://github.com/orangepi-xunlong/linux-orangepi/blob/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3566-orangepi-cm4.dts '''orangepi-build/kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3566-orangepi-cm4.dts''']|}</ol>
</li></ol>
<span id="compile-rootfs"></span>
[https://github.com/orangepi-xunlong/linux-orangepi/blob/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3566-orangepi-cm4.dts '''orangepi-build/kernel/orange-pi-5.10-rk35xx/arch/arm64/boot/dts/rockchip/rk3566-orangepi-cm4.dts''']
 
<span id="compile-rootfs"></span>
== Compile rootfs ==
# 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>Select '''Rootfs and all deb packages''', then enter</li></ol>
<div class="figure">
[[File:cm4-img401.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
<div class="figure">
[[File:cm4-img393.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the type of rootfs</li></ol>
[[File:cm4-img402.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Then select the type of image</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''Image with console interface (server)''' Indicates the image of the server version, which is relatively small</p></li>
<li><p>'''Image with desktop environment''' Indicates a image with a desktop, which is relatively large</p></li></ol></li></ol>
<div class="figure">
[[File:cm4-img403.png]]
</div></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li>If you are compiling the image of the server version, you can also choose to compile the Standard version or the Minimal version. The pre-installed software of the Minimal version will be much less than that of the Standard version '''(please do not choose the Minimal version if there is no special requirement, because many things are not pre-installed by default. Some functions may not be available)'''</li></ol>
<div class="figure">
[[File:cm4-img404.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>If you are compiling the image of the desktop version, you also need to select the type of desktop environment. Currently, Ubuntu Jammy mainly maintains XFCE and Gnome desktops, Ubuntu Focal only maintains XFCE desktops, and Debian Bullseye mainly maintains XFCE and KDE desktops</li></ol>
<div class="figure">
[[File:cm4-img407.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then it will start to compile rootfs, and some of the information prompted during compilation are as follows</p>
<ol style="list-style-type: lower-alpha;">
<li>The type of rootfs</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] local not found [ Creating new rootfs cache for '''jammy''']
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The storage path of the compiled rootfs compressed package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''external/cache/rootfs''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The name of the rootfs compressed package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''jammy-xfce-arm64.f930ff6ebbac1a72108a2e100762b18f.tar.lz4''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The time used for compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''13 min''' ]
|}</ol></li></ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>View the rootfs compressed package generated by compilation</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''jammy-xfce-arm64.f930ff6ebbac1a72108a2e100762b18f.tar.lz4''' is the rootfs compressed package, the meaning of each field of the name is</p>
<ol style="list-style-type: lower-alphanone;"><li><p>a) '''jammy''' indicates the type of Linux distribution of rootfs</p></li><li><p>b) '''xfce''' means rootfs is the type of desktop version, if it is '''cli''', it means the type of server version</p></li><li><p>c) '''arm64''' represents the architecture type of rootfs</p></li><li><p>d) '''f930ff6ebbac1a72108a2e100762b18f''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value to generate Determine whether rootfs needs to be recompiled</p></li></ol>
</li>
<li><p>'''jammy-xfce-arm64.f930ff6ebbac1a72108a2e100762b18f.tar.lz4.list''' lists the package names of all packages installed by rootfs</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls external/cache/rootfs/'''
jammy-xfce-arm64.f930ff6ebbac1a72108a2e100762b18f.tar.lz4.list
|}</ol></li></ol>
<ol start="10" style="list-style-type: decimal;">
<li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to find out whether it has If there is rootfs available in the cache, use it directly, which can save a lot of download and compilation time.</li></ol>
<span id="compile-linux-image"></span>
 
== Compile Linux image ==
# 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>Select '''Full OS image for flashing''', then enter</li></ol>
<div class="figure">
[[File:cm4-img408.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
<div class="figure">
[[File:cm4-img393.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the type of rootfs</li></ol>
[[File:cm4-img402.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Then select the type of image</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''Image with console interface (server)''' Indicates the image of the server version, which is relatively small</p></li>
<li><p>'''Image with desktop environment''' Indicates a image with a desktop, which is relatively large</p></li></ol></li></ol>
<div class="figure">
[[File:cm4-img403.png]]
</div></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li>If you are compiling the image of the server version, you can also choose to compile the Standard version or the Minimal version. The pre-installed software of the Minimal version will be much less than that of the Standard version '''(please do not choose the Minimal version if there is no special requirement, because many things are not pre-installed by default. Some functions may not be available)'''</li></ol>
<div class="figure">
[[File:cm4-img404.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>If you are compiling the image of the desktop version, you also need to select the type of desktop environment. Currently, Ubuntu Jammy mainly maintains XFCE and Gnome desktops, Ubuntu Focal only maintains XFCE desktops, and Debian Bullseye mainly maintains XFCE and KDE desktops</li></ol>
<div class="figure">
[[File:cm4-img407.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then it will start to compile the Linux image. The general process of compilation is as follows</p>
::<p>a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process</p>::<p>b. Download the source code of u-boot and Linux kernel (if cached, only update the code)</p>::<p>c. Compile u-boot source code and generate u-boot deb package</p>::<p>d. Compile the Linux source code and generate Linux-related deb packages</p>::<p>e. Make the deb package of Linux firmware</p>::<p>f. Make the deb package of the orangepi-config tool</p>::<p>g. Create a deb package supported by the board</p>::<p>h. If you are compiling the desktop image, you will also create desktop-related deb packages</p>::<p>i. Check whether the rootfs has been cached, if not, recreate the rootfs, if it has been cached, directly decompress and use</p>::<p>j. Install the previously generated deb package into rootfs</p>::<p>k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configuration, etc.</p>::<p>l. Then make an image file and format the partition, the default type is ext4</p>::<p>m. Then copy the configured rootfs to the mirrored partition</p>::<p>n. Then update initramfs</p>::<p>o. Finally, write the bin file of u-boot into the image through the dd command</p></li>
<li><p>After compiling the image, the following information will be prompted</p>
<ol style="list-style-type: lower-alpha;">
<li>The storage path of the compiled image</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Done building [ '''output/images/Orangepi3b_1.0.0_debian_bullseye_desktop_xfce_linux5.10.160/Orangepi3b_1.0.0_debian_bullseye_desktop_xfce_linux5.10.160.img''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
'''[ o.k. ] Runtime [ 19 min ]'''
|}</ol>
<ol style="list-style-type: lower-alpha;">
<li>Repeat the command to compile the image, and use the following command to start compiling the image 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=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]
|}</ol></li></ol>
<span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
== Orange Pi OS Arch system function adaptation ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Function'''
|-
| '''SPIFlash+M.2 NVMe SSD Boot'''
| '''<span style="color:#FF0000">OK, It needs to be pasted with SPI Flash to work normally</span>'''
|-
| '''WIFI'''
|-
| '''OV5647 camera'''
| '''<span style="color:#FF0000">The kernel driver is OK, 3A is not adjusted</span>'''
|-
| '''Gigabit Ethernet port'''
|-
| '''GPU'''
| '''<span style="color:#FF0000">NO</span>'''
|-
| '''NPU'''
| '''<span style="color:#FF0000">NO</span>'''
|-
| '''VPU'''
| '''<span style="color:#FF0000">NO</span>'''
|}
<span id="orange-pi-os-arch-system-user-guide-instructions"></span>
 
== Orange Pi OS Arch System User Guide Instructions ==
<ol style="list-style-type: decimal;">
<li><p>First open the '''/boot/extlinux/extlinux.conf''' configuration file</p>
{| class="wikitable" style="width:800px;" |-| <p>[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''</p>|}</li><li><p>Then open the corresponding configuration by adding '''FDTOVERLAYS /dtbs/rockchip/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| </olbig> '''Note that xxx.dtbo in FDTOVERLAYS /dtbs/rockchip/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''</big>|}{| class="wikitable" style="width:800px;" |-|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
FDT /dtbs/rockchip/rk3566-orangepi-3b.dtb
'''FDTOVERLAYS /dtbs/rockchip/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' &nbsp;&nbsp;&nbsp;&nbsp; #Configuration that needs to be added|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows, please note that not all dtbos under this path can be used.</p>
{| class="wikitable" style="width:800px;" |-| <p>'''/boot/dtbs/rockchip/overlay/'''</p>|}</li><li><p>The DT overlays configuration that can be used by the development board is as follows</p></li></ol>
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Features on the development board'''
| '''rk356x-spi3-m0-cs0-spidev.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly behind '''FDTOVERLAYS'''. For example, the configurations to open i2c2 and pwm11 at the same time are as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''</p>
<p>LABEL OPIOS ARM</p>
<p>LINUX /Image</p>
<p>FDT /dtbs/rockchip/rk3566-orangepi-3b.dtb</p>
<p>'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/rockchip/overlay/rk356x-i2c2-m1.dtbo /dtbs/rockchip/overlay/rk356x-pwm11-m1.dtbo</span>'''</p>|}</li>
<li><p>After setting, you need to restart the system to make the configuration take effect</p>
{| class="wikitable" style="width:800px;" |-| <p>[orangepi@orangepi-pc ~]$ '''sudo reboot'''</p>|}</li></ol>
<span id="use-of-raspberry-pi-5-inch-screen-1"></span>
 
== Use of Raspberry Pi 5-inch screen ==
=== How to assemble the Raspberry Pi 5-inch screen ===
Please refer to [[\lOrange Pi CM4#How to assemble the Raspberry Pi 5 Inch screen|'''the assembly method of the Raspberry Pi 5-inch screen''']] ('''click the text in the blue part to jump to the corresponding position''').
<span id="how-to-open-raspberry-pi-5-inch-screen-configuration-1"></span>
 
=== How to open Raspberry Pi 5-inch screen configuration ===
<ol style="list-style-type: lower-alpha;">
<li><p>First add the following configuration in &gt; '''/boot/extlinux/extlinux.conf'''</p>{| class="wikitable" style="width:800px;" |-|
<p>[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''</p>
<p>LABEL OPIOS ARM</p>
<p>LINUX /Image</p>
<p>FDT /dtbs/rockchip/rk3566-orangepi-3b.dtb</p>
<p>'''<span style="color:#FF0000">FDTOVERLAYS /dtbs/rockchip/overlay/rk356x-raspi-7inch-touchscreen.dtbo</span>''' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Configuration that needs to be added</p>|}</li>
<li><p>Then restart the system</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>[orangepi@orangepi-pc ~]$ '''sudo reboot'''</p>
|}<p>After restarting, you can see the display on the LCD screen as follows:</p></li></ol> 
[[File:cm4-img419.png]]
</ol>
<span id="how-to-use-the-edp-screen-1"></span>
<span id="how-to-use-the-edp-screen-1"></span>
== How to use the eDP screen ==
=== Assembly method of eDP screen ===
Please refer to [[\lOrange Pi CM4#How to use the eDP screen|'''how to use the eDP screen''']] ('''click the text in the blue part to jump to the corresponding position''').
<span id="how-to-open-edp-screen-configuration"></span>
 
=== How to open eDP screen configuration ===
<ol style="list-style-type: lower-alpha;">
<li><p>First add the following configuration in &gt; '''/boot/extlinux/extlinux.conf'''</p>{| class="wikitable" style="width:800px;" |-|
<p>[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''</p>
<p>LABEL OPIOS ARM</p>
<p>LINUX /Image</p>
<p>FDT /dtbs/rockchip/rk3566-orangepi-3b.dtb</p>
<p>'''<span style="color:#FF0000">FDTOVERLAYS /dtbs/rockchip/overlay/rk356x-edp.dtbo</span>''' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Configuration that needs to be added</p>|}</li>
<li><p>Then restart the system</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>[orangepi@orangepi-pc ~]$ '''sudo reboot'''</p>
|}<p>After restarting, you can see that the display of the eDP screen is as follows:</p></li></ol>
[[File:cm4-img420.png]]
</ol>
<span id="how-to-install-the-software"></span>
<span id="how-to-install-the-software"></span>
== How to install the software ==
Use the pacman package management tool to install software that is not in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.
{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo pacman -Syy vim'''
|}
<span id="android-11-operating-system-instructions"></span>
== Supported Android versions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Android version'''
== Android Function Adaptation ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Functions'''
|-
| '''OV5647 Camera'''
| '''<span style="color:#FF0000">The kernel driver is OK, 3A is not adjusted</span>'''
|-
| '''Gigabit network port'''
# First click enter '''Setting'''
::[[File:cm4-img421.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Network &amp; internet'''</li></ol>
[[File:cm4-img422.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Wi-Fi'''</li></ol>
[[File:cm4-img423.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then turn on the '''Wi-Fi''' switch</li></ol>
[[File:cm4-img424.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>After turning on '''Wi-Fi''', if everything is normal, you can scan for nearby Wi-Fi hotspots</li></ol>
[[File:cm4-img425.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then select the Wi-Fi you want to connect to, and the password input interface shown in the figure below will pop up</li></ol>
[[File:cm4-img426.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then use the keyboard to enter the password corresponding to Wi-Fi, and then use the mouse to click the Enter button in the virtual keyboard to start connecting to Wi-Fi</li></ol>
[[File:cm4-img427.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>After the Wi-Fi connection is successful, the display is as shown in the figure below:</li></ol>
[[File:cm4-img428.png]]
</ol>
<span id="how-to-use-wi-fi-hotspot"></span>
<span id="how-to-use-wi-fi-hotspot"></span>
== How to use Wi-Fi hotspot ==
# Then select '''Settings'''
::[[File:cm4-img421.png]]
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Network &amp; internet'''</li></ol>
[[File:cm4-img422.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select '''Hotspot &amp; tethering'''</li></ol>
[[File:cm4-img429.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select '''Wi-Fi hotspot'''</li></ol>
[[File:cm4-img430.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then turn on the '''Wi-Fi hotspot''', you can also see the name and password of the generated hotspot in the figure below, remember them, and use them when connecting to the hotspot (If you need to modify the name and password of the hotspot, you need to turn off the '''Wi-Fi hotspot''' first, and then you can modify it)</li></ol>
[[File:cm4-img431.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''here AndroidAP_6953''') displayed under the '''Hotspot name''' in the above picture in the WI-FI list searched by the mobile phone. Then you can click '''AndroidAP_6953''' to connect to the hotspot, and the password can be seen under the '''Hotspot password''' in the above picture</li></ol>
[[File:cm4-img432.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>After the connection is successful, it will be displayed as shown in the figure below (the interface of different mobile phones will be different, the specific interface is subject to the display of your mobile phone). At this point, you can open a webpage on your mobile phone to see if you can access the Internet. If you can open the webpage normally, it means that the '''WI-FI Hotspot''' of the development board can be used normally.</li></ol>
[[File:cm4-img433.png]]
</ol>
<span id="bluetooth-test-method"></span>
<span id="bluetooth-test-method"></span>
== Bluetooth test method ==
# First click enter '''Setting'''
::[[File:cm4-img421.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Connected devices'''</li></ol>
[[File:cm4-img434.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click '''Pair new device''' to turn on Bluetooth and start scanning the surrounding Bluetooth devices</li></ol>
[[File:cm4-img435.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The searched Bluetooth devices will be displayed under '''Available devices'''</li></ol>
[[File:cm4-img436.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair''' option</li></ol>
[[File:cm4-img437.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>The test here is the configuration process of the development board and the Bluetooth of the Android mobile phone. At this time, the following confirmation interface will pop up on the mobile phone. After clicking the pairing button on the mobile phone, the pairing process will start</li></ol>
[[File:cm4-img438.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>After the pairing is completed, you can see the paired Bluetooth device as shown in the figure below</li></ol>
[[File:cm4-img439.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''Accept''' to start receiving the picture sent by the mobile phone.</li></ol>
[[File:cm4-img440.png]]
</ol>
<ol start="9" style="list-style-type: decimal;">
<li>You can open the '''Download''' directory in the file manager to view the pictures received by the Android system Bluetooth of the development board</li></ol>
[[File:cm4-img441.png]]
</ol>
<span id="how-to-use-raspberry-pi-5-inch-screen"></span>
<span id="how-to-use-raspberry-pi-5-inch-screen"></span>
== How to use Raspberry Pi 5-inch screen ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please make sure that the image used is the following two versions of the image:'''
'''OrangePi3B_RK3566_Android11_lcd_v1.x.x.img'''
'''OrangePi3B_RK3566_Android11_spi-nvme_lcd_v1.x.x.img'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>The screen needs to be assembled first, please refer to [[\lOrange Pi CM4#Use of Raspberry Pi 5 Inch screen|the assembly method of the Raspberry Pi 5-inch screen]]</p></li>
<li><p>Connect the Type-C power supply to the board and power it on. After the system starts, you can see the screen display as shown in the figure below</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Both the display and touch of the Raspberry Pi 5-inch screen can be used. If you have problems with the screen test, please make sure that the screen you purchased is exactly the same as the screen that the Orange Pi is compatible with.'''</p><p>'''The Orange Pi compatible screen is described in the [[\lOrange Pi CM4#Use of Raspberry Pi 5 Inch screen|assembly method of the Raspberry Pi 5-inch screen]].'''</p></li></olbig>|}<span id="section"></span>== [[File:cm4-img442.png]] ==</li></ol>
<span id="how-to-use-the-edp-screen-2"></span>
== How to use the eDP screen ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Please make sure that the image used is the following two versions of the image:'''
'''OrangePi3B_RK3566_Android11_lcd_v1.x.x.img'''
'''OrangePi3B_RK3566_Android11_spi-nvme_lcd_v1.x.x.img'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The eDP screen has no touch function.'''</big>|}
<ol style="list-style-type: decimal;">
</div></li></ol>
</li>
<li><p>Connect the FPC end of the 30pin single-head codirectional cable to the eDP interface of the development board, and connect the other end to the eDP interface of the screen</p></li></ol>
[[File:cm4-img381.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Then connect the Type-C power supply to the board and power it on. After the system starts, you can see the screen display as shown in the figure below</p>
<span id="pin-interface-gpio-uart-spi-and-pwm-test"></span>
 
== 40pin interface GPIO, UART, SPI and PWM test ==
# First click on the wiringOP icon to open the wiringOP APP
::[[File:cm4-img444.png]]
<ol start="2" style="list-style-type: decimal;">
<li>The main interface of wiringOP APP is displayed as shown in the figure below, and then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol>
[[File:cm4-img445.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is shown in the figure below. The two rows of '''CheckBox''' buttons on the left are in one-to-one correspondence with the 40pin pins. When the '''CheckBox''' button is checked, the corresponding GPIO pin will be set to '''OUT''' mode, and the pin level will be set to high level; when the checkbox is unchecked, the GPIO pin level will be set to low level; When the '''GPIO READALL''' button is pressed, information such as wPi number, GPIO mode, and pin level can be obtained; when the '''BLINK ALL GPIO''' button is clicked, the program will control the 28 GPIO ports to continuously switch between high and low levels</li></ol>
[[File:cm4-img446.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button, the output information is as shown in the figure below:</li></ol>
[[File:cm4-img447.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports in the 40pins of the development board that can be used. The following uses pin 7—the corresponding GPIO is GPIO4_A4—the corresponding wPi serial number is 2—as an example to demonstrate how to set the high and low levels of the GPIO port. First click the '''CheckBox''' button corresponding to pin 7. When the button is selected, pin 7 will be set to high level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is 3.3v, it means setting high level success</li></ol>
[[File:cm4-img448.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button, you can see that the current pin 7 mode is '''OUT''', and the pin level is high</li></ol>
[[File:cm4-img449.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the figure below again to cancel the check status. Pin 7 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means that the low level is set successfully.</li></ol>
[[File:cm4-img450.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then click the '''GPIO READALL''' button, you can see that the current pin 7 mode is OUT, and the pin level is low</p>
<span id="pin-uart-test-2"></span>
 
=== 40pin UART test ===
<li><p>UART7 and UART9 are enabled by default in Android. The position of the 40pin is shown in the figure below, and the corresponding device nodes are '''/dev/ttyS7''' and '''/dev/ttyS9''' respectively</p>
<p>[[File:cm4-img452.png]]</p></li>
<li><p>First click on the wiringOP icon to open the wiringOP APP</p></li></ol>
[[File:cm4-img444.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The main interface of wiringOP APP is displayed as shown in the figure below, and then click the '''UART_TEST''' button to open the UART test interface</li></ol>
[[File:cm4-img453.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The serial port test interface of the APP is shown in the figure below</li></ol>
[[File:cm4-img454.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Take the test of '''UART7''' as an example below, select the '''/dev/ttyS7''' node in the selection box, enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the /dev/ttyS7 node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable</li></ol>
[[File:cm4-img455.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then use Dupont wire to short the RXD and TXD pins of uart7</li></ol>
[[File:cm4-img456.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then you can enter a character in the send edit box below, and click the '''SEND''' button to start sending</li></ol>
[[File:cm4-img457.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>If everything is normal, the received string will be displayed in the receiving box</li></ol>
[[File:cm4-img458.png]]
</ol>
<span id="pin-spi-test-2"></span>
<span id="pin-spi-test-2"></span>
=== 40pin SPI test ===
# According to the schematic diagram of the 40pin interface, the spi available for Orange Pi 3B is spi3
::[[File:cm4-img459.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Here, the SPI interface is tested through the w25q64 module. First, the w25q64 device is connected to the SPI3 interface</li></ol>
[[File:cm4-img460.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click the wiringOP icon to open the wiringOP APP</li></ol>
[[File:cm4-img444.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The main interface of wiringOP APP is displayed as shown in the figure below, click the SPI_TEST button to open the SPI test interface</li></ol>
[[File:cm4-img461.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''OPEN''' button to initialize the SPI</li></ol>
[[File:cm4-img462.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then fill in the bytes that need to be sent, such as reading the ID information of w25q64, fill in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li></ol>
[[File:cm4-img463.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Finally, the APP will display the read ID information</li></ol>
[[File:cm4-img464.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>The MANUFACTURER ID of the w25q64 module is EFh, and the Device ID is 4017h, corresponding to the value read above (h stands for hexadecimal)</li></ol>
[[File:cm4-img465.png]]
</ol>
<span id="pin-pwm-test"></span>
<span id="pin-pwm-test"></span>
=== 40pin PWM test ===
# Android enables '''PWM11''' by default, and the corresponding pin is located at 40pin as shown in the figure below
::[[File:cm4-img466.png]]
<ol start="2" style="list-style-type: decimal;">
<li>First click on the wiringOP icon to open the wiringOP APP</li></ol>
[[File:cm4-img444.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then click the '''PWM_TEST''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>
[[File:cm4-img467.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>The base address corresponding to PWM11 is '''fe6f0030''', here pwmchip0 shows '''fdd70020.pwm''' on the right, then you need to click the drop-down option to select other pwmchips until '''fe6f0030.pwm''' is displayed on the right</li></ol>
[[File:cm4-img468.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>When the drop-down option selects '''pwmchip3''', the corresponding base address of PWM11 is '''fe6f0030''' on the right</li></ol>
[[File:cm4-img469.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then confirm the PWM channel, the default is channel 0, and confirm the PWM cycle, the default configuration is '''50000ns''', converted to PWM frequency is '''20KHz''', you can modify it yourself, click the '''EXPORT''' button to export '''PWM11'''</li></ol>
[[File:cm4-img470.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then drag the drag bar below to change the PWM duty cycle, and then check Enable to output the PWM waveform</li></ol>
[[File:cm4-img471.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then use an oscilloscope to measure the No. 32 pin in the 40pin of the development board, and you can see the following waveform</li></ol>
[[File:cm4-img472.png]]
</ol>
<span id="how-to-use-adb"></span>
<span id="how-to-use-adb"></span>
== How to use ADB ==
=== The method of USB OTG mode switching ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The development board has 4 USB interfaces, among which the USB interface marked in red box in the figure below can support both Host mode and Device mode, and the other 3 USB interfaces only support Host mode.'''</big>
[[File:cm4-img473.png|center]]
<big>'''The USB OTG interface defaults to Host mode, which can be used to connect USB devices such as mouse and keyboard. If you want to use ADB, you need to <span style="color:#FF0000">manually </span>switch to Device mode.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Then select '''Developer options''' in the expanded column</p>
<p>[[File:cm4-img479.png]]</p></li>
<li><p>Finally find the '''USB OTG Mode Switch''' switch, '''<span style="color:#FF0000">turn on the switch to switch to Device mode, turn off the switch to switch to Host mode</span>'''</p></li></ol>
[[File:cm4-img480.png]]
</ol>
<span id="use-the-data-cable-to-connect-to-adb-debugging"></span>
<span id="use-the-data-cable-to-connect-to-adb-debugging"></span>
=== Use the data cable to connect to adb debugging ===
</div></li>
<li><p>Then refer to [[\lOrange Pi CM4#The method of USB OTG mode switching|'''the method of USB OTG mode switching''']] to switch USB OTG to Device mode</p></li>
<li><p>Then connect the development board to the Ubuntu PC through the USB2.0 male-to-male data cable. The position of the USB OTG interface on the development board is shown in the figure below:</p>
<p>[[File:cm4-img481.png]]</p></li>
<li><p>Then install the adb tool on the Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt update'''</p>
<p>test@test:~$ '''sudo apt -y install adb'''</p>|}</li>
<li><p>You can view the identified ADB devices through the following command</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''adb devices'''</p>
<p>List of devices attached</p>
<p>S63QCF54CJ device</p>
<p>test@test:~$ '''lsusb'''</p>
<p>Bus 003 Device 006: ID 2207:0006</p>|}</li><li><p>Then you can log in to the android system through the adb shell on the Ubuntu PC</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
console:/ $
|}</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Execute the following command to remount the Android system</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb root'''
test@test:~$ '''adb remount'''
|}</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then you can transfer files to the Android system</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb push example.txt /system/'''
|}
</ol>
<span id="use-network-connection-adb-debugging"></span>
<span id="use-network-connection-adb-debugging"></span>
=== Use network connection adb debugging ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Using the network adb does not require a data cable to connect the computer and the development board, but to communicate through the network, so first make sure that the wired or wireless network of the development board is connected, and then obtain the IP address of the development board, which will be used later.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>Make sure that the '''service.adb.tcp.port''' of the Android system is set to port number 5555</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>console:/ # '''getprop | grep &quot;adb.tcp&quot;'''</p>
<p>[service.adb.tcp.port]: ['''5555''']</p>|}</li><li><p>If '''service.adb.tcp.port''' is not set, you can use the following command to set the port number of network adb</p></li></ol>{| class="wikitable" style="width:800px;" |-|
console:/ # '''setprop service.adb.tcp.port 5555'''
console:/ # '''start adbd'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li><p>Install adb tool on Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt update'''</p>
<p>test@test:~$ '''sudo apt install -y adb'''</p>|}</li>
<li><p>Then connect to the network adb on the Ubuntu PC</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''adb connect 192.168.1.xxx''' '''(IP地址需要修改为开发板的IP地址)'''</p>
<p>* daemon not running; starting now at tcp:5037</p>
<p>* daemon started successfully</p>
<p>connected to 192.168.1.xxx:5555</p>
 
 
<p>test@test:~$ '''adb devices'''</p>
<p>List of devices attached</p>
<p>192.168.1.xxx:5555 device</p>|}</li><li><p>Then you can log in to the android system through the adb shell on the Ubuntu PC</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
console:/ #
|}</ol>
<span id="how-to-compile-android11-source-code"></span>
</li>
<li><p>After downloading the sub-volume compression package of the Android 11 source code, please check whether the MD5 checksum is correct, if not, please download the source code again</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''md5sum -c RK356X_Android11.tar.gz.md5sum'''</p>
<pstyle="color:#FF0000">'''RK356X_Android11.tar.gz00: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz01: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz02: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz03: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz04: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz05: OK'''</p><pstyle="color:#FF0000">'''RK356X_Android11.tar.gz06: OK'''</p>|}</li><li><p>Then you need to merge multiple compressed files for decompression</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat RK356X_Android11.tar.gz0gz<span style="color:#FF0000">0</span>* | tar -xvzf -'''|}</ol><span id="compile-the-source-code-of-android-11"></span>
<span id="compile-the-source-code-of-android-11"></span>
== Compile the source code of Android 11 ==
<ol style="list-style-type: decimal;">
<li><p>First install the software packages required to compile the Android11 source code</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''sudo apt-get update'''</p>
<p>test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \'''</p>
<p>'''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 \'''</p>
<p>'''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \'''</p>
<p>'''libgl1-mesa-dev libxml2-utils xsltproc unzip liblz4-tool'''</p>|}</li>
<li><p>There is a build.sh compilation script in the source code, and the compilation parameters are as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>-'''U''':Compile uboot</p></li><li><p>-'''K''':Compile kernel</p></li><li><p>-'''A''':compile android</p></li><li><p>-'''u''':Package and generate update.img and update_spi_nvme.img</p></li><li><p>-'''o''':Compile OTA package</p></li><li><p>-'''d''':Specify kernel dts</p></li></ol>
</li>
<li><p>Compile uboot, kernel, android and package them into update.img</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The command to compile and support HDMI 4K display mirroring &gt; (LCD is turned off by default) is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''cd RK356X_Android11'''</p>
<p>test@test:~/ RK356X_Android11$ '''export BOARD=orangepi3b'''</p>
<p>test@test:~/ RK356X_Android11$ '''source build/envsetup.sh'''</p>
<p>test@test:~/ RK356X_Android11$ '''lunch rk3566_r-userdebug'''</p>
<p>test@test:~/ RK356X_Android11$ '''./build.sh -AUKu'''</p>|}</li>
<li><p>The command to compile and support LCD display mirroring (HDMI &gt; is disabled by default) is as follows:</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>test@test:~$ '''cd RK356X_Android11'''</p>
<p>test@test:~/ RK356X_Android11$ '''export BOARD=orangepi3b'''</p>
<p>test@test:~/ RK356X_Android11$ '''source build/envsetup.sh'''</p>
<p>test@test:~/ RK356X_Android11$ '''lunch rk3566_r-userdebug'''</p>
<p>test@test:~/ RK356X_Android11$ '''./build.sh -AUKu'''</p>|}</li></ol>
</li>
<li><p>After the compilation is complete, the following information will be printed</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>********rkImageMaker ver 2.1********</p>
<p>Generating new image, please wait...</p>
<p>Making update_spi_nvme.img OK.</p>
<p>Make update image ok!</p>
<p>/wspace3/RK3566/RK356X_Android11</p>|}</li>
<li><p>The final image file will be placed in the '''rockdev/Image-rk3566_r/''' directory. Among them, '''update.img''' is the boot image that supports TF card and eMMC, and '''update_spi_nvme.img''' is the boot image of NVME SSD</p>
{| class="wikitable" style="width:800px;" |-| <p>[mailto:test@test:~OrangePi_4/rk3399-android-8.1$ test@test:~/RK356X_Android11$] '''cd rockdev/Image-rk3566_r'''</p><p>[mailto:test@test:~OrangePi_4/rk3399-android-8.1$ test@test:~/RK356X_Android11/rockdev/Image-rk3566_r $] '''ls update*'''</p><p>update.img update_spi_nvme.img</p>|}</li></ol>
<span id="appendix"></span>
== User Manual Update History ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Version'''
<span id="image-update-history"></span>
 
== Image Update History ==
{| class="wikitable" style="width:800px;"
|-
| style="text-align:center;" | '''Date'''| style="text-align:center;" | '''Update Notes'''
|-
| style="text-align:center;" | 2023-08-29
|
Orangepicm4_1.0.0_ubuntu_focal_server_linux5.10.160.7z
Orangepicm4_1.0.0_debian_bookworm_desktop_xfce_linux5.10.160.7z
 
OrangePiCM4_RK3566_Android11_v1.0.0.tar.gz
OrangePiCM4_RK3566_Android11_lcd_spi-nvme_v1.0.0.tar.gz
 
* initial version
|-
| style="text-align:center;" | 2023-09-05| Opios-arch-aarch64-xfce-opicm4-23.09-linux5.10.160.img.xz 
* initial version
|}

Navigation menu