Changes

Jump to: navigation, search

Orange Pi Zero 2W

13,210 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk-17</p>
{| class="wikitable" style="width:800px;"
|-
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc --version'''</p>
<p>gcc (Debian 12.2.0-14) 12.2.0</p>
<p>Copyright (C) 2022 Free Software Foundation, Inc.</p>
<p>This is free software; see the source for copying conditions. There is NO</p>
<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li>
<li><p>Write the '''hello_world.c''' program in C language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.c'''</p>
<p>#include &lt;stdio.h&gt;</p>
 
 
<p>int main(void)</p>
<p>{</p>
:<p>printf(&quot;Hello World!\n&quot;);</p>  :<p>return 0;</p><p>}</p>|}</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Debian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3'''</p>
<p>Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p>
<p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>
<p>&gt;&gt;&gt;</p>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li>
<li><p>Write the '''hello_world.py''' program in Python language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>
<p>print('Hello World!')</p>|}</li>
<li><p>The result of running '''hello_world.py''' is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li>
<li><p>After installation, you can check the Java version.</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li>
<li><p>Write the Java version of '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>
<p>public class hello_world</p>
<p>{</p>
:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p>
<p>}</p>
<p>|}</p></li>
<li><p>Then compile and run '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''javac hello_world.java'''</p>
<p>orangepi@orangepi:~$ '''java hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li></ol>
<span id="ubuntu-focal-system"></span>
 
=== Ubuntu Focal system ===
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc --version'''</p>
<p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</p>
<p>Copyright (C) 2019 Free Software Foundation, Inc.</p>
<p>This is free software; see the source for copying conditions. There is NO</p>
<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li>
<li><p>Write the '''hello_world.c''' program in C language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.c'''</p>
<p>#include &lt;stdio.h&gt;</p>
 
 
<p>int main(void)</p>
<p>{</p>
:<p>printf(&quot;Hello World!\n&quot;);</p>  :<p>return 0;</p><p>}</p>|}</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Ubuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python3 is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3'''</p>
<p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p>
<p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>
<p>&gt;&gt;&gt;</p>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li>
<li><p>Write the '''hello_world.py''' program in Python language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>
<p>print('Hello World!')</p>|}</li>
<li><p>The result of running '''hello_world.py''' is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-17</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li>
<li><p>After installation, you can check the Java version.</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>
<p>openjdk 17.0.2 2022-01-18</p>
<p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p>
<p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>|}</li>
<li><p>Write the Java version of '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>
<p>public class hello_world</p>
<p>{</p>
:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p>
<p>}</p>
<p>|}</p></li>
<li><p>Then compile and run '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''javac hello_world.java'''</p>
<p>orangepi@orangepi:~$ '''java hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li></ol>
<span id="ubuntu-jammy-system"></span>
 
=== Ubuntu Jammy system ===
<ol style="list-style-type: lower-alpha;">
<li><p>The version of a.gcc is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc --version'''</p>
<p>gcc (Ubuntu 11.3.0-1ubuntu1~22.04.1) '''11.3.0'''</p>
<p>Copyright (C) 2021 Free Software Foundation, Inc.</p>
<p>This is free software; see the source for copying conditions. There is NO</p>
<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li>
<li><p>Write the '''hello_world.c''' program in C language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.c'''</p>
<p>#include &lt;stdio.h&gt;</p>
 
 
<p>int main(void)</p>
<p>{</p>
:<p>printf(&quot;Hello World!\n&quot;);</p>  :<p>return 0;</p><p>}</p>|}</li>
<li><p>Then compile and run '''hello_world.c'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p>
<p>orangepi@orangepi:~$ '''./hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Ubuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python3 is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3'''</p>
<p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p>
<p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p>
<p>&gt;&gt;&gt;</p>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li>
<li><p>Write the '''hello_world.py''' program in Python language</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.py'''</p>
<p>print('Hello World!')</p>|}</li>
<li><p>The result of running '''hello_world.py''' is as follows</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p>
<p>Hello World!</p>|}</li></ol>
</li>
<li><p>Ubuntu Jammy does not install Java compilation tools and operating environment by default.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk-18</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p>|}</li>
<li><p>After installation, you can check the Java version.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''java --version'''</p>
<p>openjdk 18.0.2-ea 2022-07-19</p>
<p>OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)</p>
<p>OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)</p>|}</li>
<li><p>Write the Java version of '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''vim hello_world.java'''</p>
<p>public class hello_world</p>
<p>{</p>
:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p>
<p>}</p>
<p>|}</p></li>
<li><p>Then compile and run '''hello_world.java'''</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''javac hello_world.java'''</p>
<p>orangepi@orangepi:~$ '''java hello_world'''</p>
<p>Hello World!</p>|}</li></ol>
</li></ol>
<span id="method-of-uploading-files-to-the-development-board-linux-system"></span>
 
== Method of uploading files to the development board Linux system ==
<li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''file_path: '''Needs to be replaced with the path of the file to &gt; be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's &gt; Linux system. It can also be replaced with something else, &gt; such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development &gt; board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux &gt; system can also be modified to other paths.</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li></ol>
</li>
<li><p>If you want to upload a folder, you need to add the -r parameter</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp <span style="color:#FF0000">-r </span> dir_path orangepi@192.168.xx.xx:/home/orangepi/'''</p>|}</li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
<span id="how-to-upload-files-using-filezilla"></span>
==== How to upload files using filezilla ====
<ol style="list-style-type: decimal;">
<li><p>First install filezilla in Ubuntu PC</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''sudo apt install -y filezilla'''</p>|}</li>
<li><p>Then use the following command to open filezilla</p>
{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''filezilla'''</p>|}</li>
<li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</p>
<div class="figure">
</div></li>
<li><p>The method of connecting the development board is as shown in the figure below</p></li></ol>
<div class="figure">
[[File:zero2w-img256.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>Then choose to '''save the password''' and click '''OK'''</p>
<p>[[File:zero2w-img257.png]]</p></li>
<li><p>Then select '''Always trust this host''' and click '''OK'''</p></li></ol>
<div class="figure">
[[File:zero2w-img258.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol>
<div class="figure">
[[File:zero2w-img259.png]]
</div></ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>
<div class="figure">
[[File:zero2w-img260.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li>
<span id="method-to-upload-files-from-windows-pc-to-development-board-linux-system"></span>
 
=== Method to upload files from Windows PC to development board Linux system ===
# First download the installation file of the Windows version of the filezilla software. The download link is as follows
::{| class="wikitable" style="width:800px;"
|-
|
[https://filezilla-project.org/download.php?type=client '''https://filezilla-project.org/download.php?type=client''']
|}
::[[File:zero2w-img261.png]]
<div class="figure">
::[[File:zero2w-img262.png]]
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>The downloaded installation package is as shown below, then double-click to install it directly</p>
{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</p></li></ol>|}
During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;'''
</div>
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li></ol>
<div class="figure">
[[File:zero2w-img264.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li>The method of connecting the development board is as shown in the figure below:</li></ol>
<div class="figure">
[[File:zero2w-img256.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then choose to '''save the password''' and click '''OK'''</li></ol>
<div class="figure">
[[File:zero2w-img265.png]]
</div></ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then select '''Always trust this host''' and click '''OK'''</li></ol>
<div class="figure">
[[File:zero2w-img266.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol>
<div class="figure">
[[File:zero2w-img267.png]]
</div></ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>
<div class="figure">
[[File:zero2w-img268.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li>
<span id="instructions-for-using-the-logo-on-and-off-the-machine"></span>
 
== Instructions for using the logo on and off the machine ==
<li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li>
<li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>'''<span style="color:#FF0000">bootlogo=false</span>'''</p>|}</li>
<li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>'''<span style="color:#FF0000">bootlogo=true</span>'''</p>|}</li>
<li><p>The location of the boot logo picture in the Linux system is</p>
{| class="wikitable" style="width:800px;" |-| <p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li>
<li><p>After replacing the boot logo image, you need to run the following command to take effect</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</p>|}</li></ol>
<span id="how-to-turn-on-the-power-button-in-linux5.4"></span>
 
== How to turn on the power button in Linux5.4 ==
<ol style="list-style-type: decimal;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li>
<li><p>Then select '''System'''</p>
<p>[[File:zero2w-img80.png]]</p></li>
<span id="how-to-shut-down-and-restart-the-development-board"></span>
 
== How to shut down and restart the development board ==
<ol style="list-style-type: decimal;">
<li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>orangepi@orangepi:~$ '''sudo poweroff'''</p>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li>
<li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p>
<p>[[File:zero2w-img269.png]]</p>
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>|}</li><li><p>Use the '''reboot''' command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}</li></ol>
<span id="linux-sdkorangepi-build-usage-instructions"></span>
== Compilation system requirements ==
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<span style="color:#FF0000">Ubuntu 22.04</span>''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''<span style="color:#FF0000">22.04</span>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''lsb_release -a'''
Description: Ubuntu 22.04 LTS
Release: '''<span style="color:#FF0000">22.04</span>'''
Codename: '''jammy'''
|}
If the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-build. The installation image download address of Ubuntu 22.04 amd64 version is:
{| class="wikitable" style="width:800px;"
|-
|
[https://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/22.04/ubuntu-22.04-desktop-amd64.iso''']
|}
After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that you think is fast), otherwise it is easy to make errors due to network reasons when installing the software later. The steps to replace Tsinghua Source are as follows:
<ol style="list-style-type: lower-alpha;">
<li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li></ol>
{| class="wikitable" style="width:800px;"
|-
|
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Note that the Ubuntu version needs to be switched to 22.04.</li></ol>
[[File:zero2w-img271.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/sources.list.bak'''
test@test:~$ '''sudo vim /etc/apt/sources.list'''
'''# ''' The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse
# Pre-release software source, not recommended to be enabled
'''# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy''' Pre-proposed main restricted universe multiverserelease software source, not recommended to be enabled
'''# ''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>After the replacement, you need to update the package information and ensure that no errors are reported.</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo apt-get update'''
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>'''<span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</span>'''</li></ol>
<span id="obtain-the-source-code-of-linux-sdk"></span>
 
== Obtain the source code of linux sdk ==
Linux sdk refers to the orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the following command to download the orangepi-build code:
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''git clone https://github.com/orangepi-xunlong/orangepi-build.git -b next'''
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that when using the H618 Soc development board, you need to download the source code of the <span style="color:#FF0000">next </span> branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''</big>
<div class="figure">
[[File:zero2w-img272.png|center|800px]]
</div>
|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When downloading the orangepi-build code through the git clone command, you do not need to enter the user name and password of the github account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.'''</big>|}
The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''branch'''
|}
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The branch mentioned here is not the same thing as the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.'''
'''We define the linux5.4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.'''</big>|}
After downloading, the following files and folders will be included:
<li><p>'''README.md''': orangepi-build documentation</p></li>
<li><p>'''scripts''': Common script for compiling linux images</p></li></ol>
{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls'''
'''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts'''|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.'''</big>|} 
<span id="download-the-cross-compilation-tool-chain"></span>
 
=== Download the cross-compilation tool chain ===
The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University:
{| class="wikitable" style="width:800px;"
|-
|
[https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/''']
|}
After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''':
{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''ls toolchains/'''
gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu  gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu  gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf  gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi
gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linux
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf  gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf  gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu  gcc-linaro-arm-none-eabi-4.8-2014.04_linux|}
The cross-compilation tool chain used to compile the H618 Linux kernel source code is:
<ol style="list-style-type: lower-alpha;">
<li>linux5.4</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>linux6.1</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
|}</ol>
The cross-compilation tool chain used to compile the H618 u-boot source code is:
<ol style="list-style-type: lower-alpha;">
<li>v2018.05</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>v2021.07</li></ol>{| class="wikitable" style="width:800px;" |-|
'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''
|}
</ol>
<span id="orangepi-build-complete-directory-structure-description"></span>
<span id="orangepi-build-complete-directory-structure-description"></span>
=== orangepi-build complete directory structure description ===
<ol style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p>
<ol style="list-style-type: lower-alphanone;"><li>a) Linux5.4</li></ol></li></ol>{| class="wikitable" style="width:800px;" </li></ol>|-|
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>b) Linux6.1</li></ol>{| class="wikitable" style="width:800px;" |-|
https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9'''
|}</ol></li></ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p>
<ol style="list-style-type: lower-alpha;">
<li>a) v2018.05</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2018.05-h618'''
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>b) v2021.07</li></ol>{| class="wikitable" style="width:800px;" |-|
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi'''
|}</ol></li></ol></li></ol>
<ol start="2" style="list-style-type: decimal;">
<li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p>
<li><p>'''toolchains''': Store cross-compilation tool chain</p></li>
<li><p>'''u-boot''': Store the source code of u-boot</p></li>
<li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls'''
'''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-boot &nbsp;&nbsp;&nbsp;&nbsp; userpatches'''|}</ol></li></ol>
<span id="compile-u-boot"></span>
 
== Compile u-boot ==
# Run the build.sh script, remember to add sudo permissions
{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Select '''U-boot package''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img274.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of u-boot</p>
<p>[[File:zero2w-img276.png]]</p></li></ol>
</li>
<li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p></liol style="list-style-type: lower-alpha;"></olli> <blockquotep>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li> b. <li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.</blockquotep><p>[[File:zero2w-img277.png]]</p></li></ol></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of u-boot source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling u-boot [ '''v2021.07''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Version of the cross-compilation tool chain</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Path to the compiled 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 compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_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 without selecting through the graphical interface. You can start compiling u-boot directly.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]
|}</ol></li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>View the compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''
|}
</ol>
<ol start="8" 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. Therefore, 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. ('''You need to completely compile u-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<ol start="8" 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 Set the IGNORE_UPDATES variable in u-boot source code of the github server. Therefore, 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. ('''You need to completely compile uuserpatches/config-boot before you can turn off this function, otherwise it will prompt that the source code of u-boot cannot be founddefault.conf'''), otherwise the modifications will be restored. The method is as follows:</li></ol>to &quot;yes&quot;
<blockquote>Set the IGNORE_UPDATES variable in u'''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="9" 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>First upload the compiled deb package of u-boot 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'''
'''linux-u-boot-next-orangepizero2w_x.x.x_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>Install the new u-boot deb package just uploaded</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then run the nand-sata-install script</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo nand-sata-install'''
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li></ol>
[[File:zero2w-img278.png]]
</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>After pressing the Enter key, a Warning will pop up first.</li></ol>
[[File:zero2w-img279.png]]
</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Press the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol>
[[File:zero2w-img280.png]]
</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></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 permissions
::{| class="wikitable" style="width:800px;"
|-
|
test@test:~/orangepi-build$ '''sudo ./build.sh'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Select '''Kernel package''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img281.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you will be prompted whether you need 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:zero2w-img282.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select the branch type of the kernel source code</li></ol>
<blockquote>::a. The current branch will compile the linux5.4 kernel source code
::b. The next branch will compile the linux6.1 kernel source code</blockquote>[[File:zero2w-img276.png]]
::[[File:zero2w-img276.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>If you choose to display the kernel configuration menu (the second option) in step 3), the kernel configuration interface opened through '''make menuconfig''' will pop up. At this time, you can directly modify the kernel configuration. After modification, save and exit. Yes, compilation of the kernel source code will begin after exiting.</li></ol>
[[File:zero2w-img283.png]]
<ol style="list-style-type: lower-alpha;">
<li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the 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>b. You can also set '''KERNEL_CONFIGURE=no''' in the orangepi-build/userpatches/config-default.confconfiguration file to permanently disable this function.</p></li>
<li><p>If the following error is prompted when compiling the kernel, it is because the Ubuntu PC terminal interface is too small, causing the make menuconfig interface to be unable to be displayed. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li></ol>
[[File:zero2w-img284.png]]
</ol></ol>
<ol start="7" style="list-style-type: decimal;">
<li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Version of the linux kernel source code</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiling current kernel [ '''6.1.31''' ]
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>The version of the cross-compilation tool chain used</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-next.config''' ]
|}</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>The path to the kernel-related deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Target directory [ '''output/debs/''' ]
|}</ol>
<ol start="5" style="list-style-type: lower-alpha;">
<li>The package name of the kernel image deb package generated by compilation</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] File name [ '''linux-image-next-sun50iw9_x.x.x_arm64.deb''' ]
|}</ol>
<ol start="6" style="list-style-type: lower-alpha;">
<li>Compilation time</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Runtime [ '''10 min''' ]
|}</ol>
<ol start="7" style="list-style-type: lower-alpha;">
<li>Finally, the compilation command to repeatedly compile the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, and you can directly start compiling the kernel source code.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]
|}</ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>View the kernel-related deb package generated by compilation</p>
<li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li>
<li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li>
<li><p>'''linux-image-next-sun50iw9_x.x.x_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-image-next-sun50iw9_x.x.x_arm64.deb
|}
</ol>
</li></ol>
<ol start="9" style="list-style-type: decimal;">
<li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
<ol start="9" style="list-style-type: decimal;"><li>When Set the orangepiIGNORE_UPDATES variable in '''userpatches/config-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github serverdefault. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code (conf'''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. 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="10" style="list-style-type: decimal;">
<li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p>
<ol style="list-style-type: lower-alpha;">
<li>Upload the compiled deb package of the 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-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''
|}</ol>
<ol start="2" 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;" |-|
orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li></ol>{| class="wikitable" style="width:800px;" |-|
orangepi@orangepi:~$ '''sudo''' '''reboot'''
|}
</ol>
</li></ol>
<span id="compile-rootfs"></span>
<span id="compile-rootfs"></span>
== Compile rootfs ==
# Run the build.sh script, remember to add sudo permissions
::{| 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''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img285.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li>
<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>
[[File:zero2w-img276.png]]
</ol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select the type of rootfs</li></ol>
[[File:zero2w-img286.png]]
</ol>
<ol start="6" 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)''' Represents the image of the server version, which is relatively small in size.</p></li>
<li><p>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div class="figure">
[[File:zero2w-img287.png]]
</div></ol></li></ol>
<ol start="7" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>
<div class="figure">
</div>
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img289.png]]
[[File:zero2w-img291.png]]
</ol>
<ol start="9" style="list-style-type: decimal;">
<li><p>Then the compilation of rootfs will start. Some of the information prompted during compilation are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li>Type of rootfs</li></ol></li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]
|}</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 [ '''orangepi-build/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 [ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' ]
|}</ol></li></ol>
<ol start="10" style="list-style-type: decimal;">
<li><p>View the compiled rootfs compressed package</p>
<ol style="list-style-type: lower-alpha;">
<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4''' It is a compressed package of rootfs. The meaning of each field in the name is</li></ol></li></ol>
<blockquote>:a) '''bullseye''' represents the type of Linux distribution of rootfs
:b) '''xfce''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server version.
:c) '''arm64''' represents the architecture type of rootfs
:d) '''25250ec7002de9e81a41de169f1f89721''' 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. Determine whether rootfs needs to be recompiled</blockquoteol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~/orangepi-build$ '''ls external/cache/rootfs/'''
bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list
|}</ol></li></ol>
<ol start="11" style="list-style-type: decimal;">
<li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the 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 check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This 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 permissions
::{| 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''' and press Enter</li></ol>
<div class="figure">
[[File:zero2w-img292.png]]
</div></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then select the model of the development board</li></ol>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li>
<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>
[[File:zero2w-img276.png]]
</ol></li></ol>
<ol start="5" style="list-style-type: decimal;">
<li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p>
<p>[[File:zero2w-img277.png]]</p></li></ol>
</li>
<li><p>Then select the type of rootfs</p></li></ol>
[[File:zero2w-img286.png]]
</ol>
<ol start="7" 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)''' Represents the image of the server version, which is relatively small in size.</p></li>
<li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div class="figure">
[[File:zero2w-img287.png]]
</div></ol></li></ol>
<ol start="8" style="list-style-type: decimal;">
<li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol>
<div class="figure">
[[File:zero2w-img288.png]]
</div></ol>
<ol start="9" style="list-style-type: decimal;">
<li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
[[File:zero2w-img289.png]]
[[File:zero2w-img291.png]]
</ol>
<ol start="10" style="list-style-type: decimal;">
<li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li></ol>
::a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process.
::b. Download the source code of u-boot and linux kernel (if already cached, only update the code)
::c. Compile u-boot source code and generate u-boot deb package
::d. Compile linux source code and generate linux-related deb packages
::e. Make the deb package of linux firmware
::f. Make the deb package of orangepi-config tool
::g. Create a deb package with board-level support
::h. If you compile the desktop version image, you will also create a desktop-related deb package.
::i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use it.
::j. Install the deb package generated previously into rootfs
::k. Make some specific settings for different development boards and different types of images, such as pre-installing additional software packages, modifying system configurations, etc.
::l. Then create the image file and format the partition. The default type is ext4.
::m. Then copy the configured rootfs to the mirror partition.
::n. Then update initramfs o. Finally, write the bin file of u-boot into the image through the dd command.
::o. Finally, write the bin file of u-boot into the image through the dd command.
</ol>
<ol start="11" style="list-style-type: decimal;">
<li><p>After compiling the image, the following message will be displayed</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/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.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 start="3" style="list-style-type: lower-alpha;">
<li>Repeat the command to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol>{| class="wikitable" style="width:800px;" |-|
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next 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 status ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Motherboard functions'''
|-
| '''Mali GPU'''
| '''<span style="color:#FF0000">NO</span>'''
|-
| '''Video codec'''
| '''<span style="color:#FF0000">NO</span>'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin expansion board function'''
|-
| '''TV-OUT'''
| '''<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 ==
# First open the '''/boot/extlinux/extlinux.conf''' configuration file
::{| class="wikitable" style="width:800px;"
|-
|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
|}
<ol start="2" style="list-style-type: decimal;">
<li>Then open the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</li></ol> '''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.'''
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/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/allwinner/sun50i-h616-orangepi-zero2w.dtb
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #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 dtbo under this path can be used.</p>
{| class="wikitable" style="width:800px;" |-| <p>'''/boot/dtbs/allwinner/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;"
|-
| '''Functions on the development board'''
| '''sun50i-h616-disable-uart0.dtbo'''
|}
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYS.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>{| class="wikitable" style="width:800px;" |-|
[orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol>
<ol start="6" style="list-style-type: decimal;">
<li>After setting, you need to restart the system for the configuration to take effect.</li></ol>{| class="wikitable" style="width:800px;" |-|
[orangepi@orangepi-pc ~]$ '''sudo reboot'''
|}
</ol>
<span id="how-to-install-software"></span>
<span id="how-to-install-software"></span>
== How to install software ==
You can use the pacman package management tool to install software that is not available 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-12-tv-system-usage-instructions"></span>
== Supported Android versions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| Android Version
== Android 12 TV function adaptation status ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''Motherboard functions'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin Expansion board function'''
== Onboard LED light display instructions ==
{| class="wikitable" style="width:800px;text-align: center;"
|-
|
=== Use network connection adb debugging ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Using network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board's wired or wireless network is connected, and then obtain the IP address of the development board. Next To be used.'''</big>|}
# Make sure the '''service.adb.tcp.port''' of the Android system is set to 5555 port number
::{| class="wikitable" style="width:800px;"
|-
|
apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;'''
[service.adb.tcp.port]: [5555]
|}
<ol start="2" style="list-style-type: decimal;">
<li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set the port number of the network adb</li><{| class="wikitable" style="width:800px;" |-| apollo-p2:/ol># '''setprop service.adb.tcp.port 5555'''
apollo-p2:/ # '''setprop service.adb.tcp.port 5555'''<br />
apollo-p2:/ # '''stop adbd'''
apollo-p2:/ # '''start adbd'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Install adb tool on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then connect network adb on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the IP address of the development board)'''
<p>* daemon not running; starting now at tcp:5037</p>
<p>* daemon started successfully</p>
connected to 192.168.1.xxx:5555
 
test@test:~$ '''adb devices'''
192.168.1.xxx:5555 device
|}</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
apollo-p2:/ #
|}
</ol>
<span id="use-data-cable-to-connect-adb-debugging"></span>
<span id="use-data-cable-to-connect-adb-debugging"></span>
=== Use data cable to connect adb debugging ===
# Prepare a USB Type C interface data cable, plug one end of the USB interface into the USB interface of the computer, and plug one end of the USB Type C interface into the USB0 interface of the development board (see the description of the picture on the right below for the location of USB0). In this case, the development board is powered by the computer's USB interface, so please ensure that the computer's USB interface can provide the most sufficient power to drive the development board.
::[[File:zero2w-img304.png]] [[File:zero2w-img305.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Install adb tool on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''sudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Check whether the ADB device is recognized</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb devices'''
4c00146473c28651dd0 device
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb shell'''
apollo-p2:/ $
|}
</ol>
<span id="view-how-to-set-hdmi-display-resolution"></span>
<span id="view-how-to-set-hdmi-display-resolution"></span>
== View how to set HDMI display resolution ==
<li><p>First you need to prepare the following accessories</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI to VGA converter</li></ol></li></ol>
[[File:zero2w-img144.png]]
</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></ol>
[[File:zero2w-img145.png]] [[File:zero2w-img146.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>A monitor or TV that supports VGA interface</li></ol>
</li></ol>
<!-- -->
<ol start="2" style="list-style-type: decimal;">
<li>HDMI to VGA display test is as follows</li></ol>
[[File:zero2w-img313.png]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''</big>|}</ol><span id="wi-fi-connection-method"></span>
<span id="wi-fi-connection-method"></span>
== WI-FI connection method ==
# Choose first '''Settings'''
::[[File:zero2w-img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Network &amp; Internet'''</li></ol>
[[File:zero2w-img314.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then turn on WI-FI</li></ol>
[[File:zero2w-img315.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After turning on WI-FI, you can see the searched signals under '''Available networks'''.</li></ol>
[[File:zero2w-img316.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>After selecting the WI-FI you want to connect to, the password input interface shown below will pop up.</li></ol>
<div class="figure">
[[File:zero2w-img317.png]]
</div></ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li></ol>
<div class="figure">
[[File:zero2w-img318.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>The display after successful WI-FI connection is as shown below</li></ol>
[[File:zero2w-img319.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:zero2w-img306.png]]
<ol start="3" style="list-style-type: decimal;">
<li>Then select '''Network &amp; Internet'''</li></ol>
[[File:zero2w-img314.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select '''WIFI hotspot'''</li></ol>
[[File:zero2w-img320.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then open '''Hotspot Enable'''. You can also see the name and password of the generated hotspot in the picture 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 close Hotspot Enable first. Then you can modify it)</li></ol>
[[File:zero2w-img321.png]]
</ol>
<ol start="6" 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_7132''') shown under the '''Hotspot name''' in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''Hotspot password''' in the picture above.</li></ol>
[[File:zero2w-img322.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''WI-FI Hotspot''' of the development board can be used normally.</li></ol>
[[File:zero2w-img323.png]]
</ol>
<span id="how-to-check-the-ip-address-of-the-ethernet-port"></span>
<span id="how-to-check-the-ip-address-of-the-ethernet-port"></span>
== How to check the IP address of the Ethernet port ==
# There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board.
::[[File:zero2w-img107.png]]
<ol start="2" style="list-style-type: decimal;">
<span id="bluetooth-connection-method"></span>
 
== Bluetooth connection method ==
# Choose first '''Settings'''
::[[File:zero2w-img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Bluetooth'''</li></ol>
[[File:zero2w-img327.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open '''Bluetooth Enable'''</li></ol>
[[File:zero2w-img328.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devices</li></ol>
[[File:zero2w-img329.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The searched Bluetooth devices will be displayed under '''Available devices'''</li></ol>
[[File:zero2w-img330.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click on 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:zero2w-img331.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>What is tested here is the Bluetooth configuration process between the development board and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone to start the pairing process.</li></ol>
[[File:zero2w-img332.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>After pairing is completed, open '''Paired devices''' and you will see the paired Bluetooth devices.</li></ol>
[[File:zero2w-img333.png]]
</ol>
<ol start="9" 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 pictures sent by the mobile phone.</li></ol>
[[File:zero2w-img334.png]]
</ol>
<ol start="10" style="list-style-type: decimal;">
<li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''Received files'''.</li></ol>
[[File:zero2w-img335.png]]
</ol>
<span id="how-to-set-usb0-to-host-mode-1"></span>
<span id="how-to-set-usb0-to-host-mode-1"></span>
== How to set USB0 to HOST mode ==
<ol style="list-style-type: lower-alpha;">
<li>Run the following command to set USB0 to HOST mode:</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''
apollo-p2:/ #
|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Run the following command to switch back to Device mode</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''
apollo-p2:/ #
|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The command to view the current mode of USB0 is</li></ol>{| class="wikitable" style="width:800px;" |-|
apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role'''
usb_host
|}
</ol>
<span id="how-to-use-usb-camera"></span>
<span id="how-to-use-usb-camera"></span>
== How to use USB camera ==
# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev
::{| class="wikitable" style="width:800px;"
|-
|
console:/ # '''ls /dev/video0'''
/dev/video0
|}
<ol start="3" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</p></li><li><p>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></li></ol>
<div class="figure">
[[File:zero2w-img337.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then use the adb command to install the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb install usbcamera.apk'''
|}</ol>
<ol start="6" style="list-style-type: decimal;">
<li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li></ol>
[[File:zero2w-img338.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>
<span id="android-system-root-description"></span>
 
== Android system ROOT description ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''</big>|}
# Download from the '''official tool''' on the development board data download page '''rootcheck.apk'''
<div class="figure">
::[[File:zero2w-img336.png]]
</div>
<div class="figure">
::[[File:zero2w-img339.png]]
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li></ol>{| class="wikitable" style="width:800px;" |-|
test@test:~$ '''adb install rootcheck.apk'''
|}</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li></ol>
[[File:zero2w-img340.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li></ol>
[[File:zero2w-img341.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then you can click '''CHECK NOW''' to start checking the ROOT status of the Android system. After the check is completed, the display is as follows. You can see that the Android system has obtained ROOT permissions.</li></ol>
[[File:zero2w-img342.png]]
</ol>
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>
<span id="how-to-use-miracastreceiver-to-cast-the-mobile-phone-screen-to-the-development-board"></span>
== How to use MiracastReceiver to cast the mobile phone screen to the development board ==
<ol style="list-style-type: decimal;">
<li><p>First, please make sure that both the development board and the mobile phone are connected to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to [[Orange Pi Zero 2W#WI-FI connection method|'''the instructions in the WI-FI connection method.''']]</p></li>
<li><p>Then open the '''MiracastReceiver'''application in the Android system of the development board</p>
<p>[[File:zero2w-img343.png]]</p></li>
<span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span>
 
== Method of turning on and off the machine through buttons or infrared remote control ==
== 40pin interface GPIO, UART, SPI test ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on the 40pin interface is not soldered by default, and you need to solder it yourself before it can be used.'''</big>|}
<span id="pin-gpio-port-test-method"></span>
# First open wiringOP APP on the desktop
::[[File:zero2w-img351.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol>
[[File:zero2w-img352.png]]
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>The GPIO test interface is as shown in the figure below. The two rows of '''CheckBox''' buttons on the left have a 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 is set to high level; when unchecked, the GPIO pin level will be set to low level; when the GPIO is clicked When you click the '''GPIO READALL''' button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''BLINK ALL GPIO''' button, all GPIO ports will cycle through outputting high and low levels. This function can be used to test all the 40pin pins. GPIO port.</li></ol>
[[File:zero2w-img353.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button, and the output information is as shown below:</li></ol>
<div class="figure">
[[File:zero2w-img354.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>There are a total of 28 GPIO ports available in the 40-pin development board. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - 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 12. When the button is selected, pin 12 will be set to high level. After setting, you can use a multimeter to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level success.</li></ol>
[[File:zero2w-img355.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li></ol>
[[File:zero2w-img356.png]]
</ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the picture below again to uncheck it, and pin 12 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 the low level setting is successful.</li></ol>
[[File:zero2w-img357.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li></ol>
[[File:zero2w-img358.png]]
</ol>
<span id="pin-uart-test-method"></span>
<span id="pin-uart-test-method"></span>
=== 40pin UART test method ===
# As can be seen from the table below, the default uarts available in the Android12 TV system are uart2 and uart5. Please note that uart0 is set as a debugging serial port by default. Please do not use uart0 as a normal serial port.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO序号GPIO NO.'''
| '''GPIO'''
| '''功能Function'''| '''引脚'''|| '''引脚'''| '''功能'''| '''GPIO'''| '''GPIO序号Pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''<span style="color:#FF0000">11</span>'''|-| '''12<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''<span style="color:#FF0000">13</span>'''|-| '''<span style="color:#FF0000">261</span>'''| '''<span style="color:#FF0000">PI5</span>'''| '''<span style="color:#FF0000">UART2_TX</span>'''| '''<span style="color:#FF0000">15</span>'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''PI1'''| '''257'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="text-align: left;"|| '''PH4'''| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol> apollo-p2:/ # ls /dev/ttyAS* /dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5''' <ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol> [[File:zero2w-img359.png]] <ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img360.png]] <ol start="6wikitable" style="list-style-typewidth: decimal390px;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2wmargin-img361.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[Fileright:zero2w-img362.png]] <ol start="8" style="list-style-type: decimal20px;"><li><p>Then use Dupont wire to short the rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of characters in the send edit box below and click the '''SEND''' button to start sending.</p></li></ol> [[File:zero2w-img363.png]] <ol start="10" style="listtext-style-typealign: decimalcenter;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol> [[File:zero2w-img364.png]] <span id="pin-spi-test-method"></span>=== 40pin SPI test method === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"
|-
| '''GPIO serial number'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pinPin'''
| '''Function'''
| '''GPIO'''
| '''GPIO serial numberNO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''270'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''
|-
| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li>The device node corresponding to SPI1 CS0 uart2 is '''/dev/spidev1.0ttyAS2''', and the device node corresponding to SPI1 CS1 uart5 is '''/dev/spidev1.1ttyAS5'''</li>{| class="wikitable" style="width:800px;" |-| </olp> apollo-p2:/ # '''ls /dev/spidev1.ttyAS*'''</p><p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/spidev1.0 ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1ttyAS5</span>'''</p>|}</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to open wiringOP APP on the SPI1 interface.desktop</li></ol> '''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''UART_TEST'''button to open wiringOP APP on the desktopUART test interface</li></ol> [[File:zero2w-img351.png]]
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''SPI_TEST''' button to open the SPI The serial port test interfaceof wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img365.png]]
[[File:zero2w-img360.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'ttyAS2''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please selector'''/dev/spidev1.0ttyAS5''', if the w25qxx module is connected to node in the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''selection box</p><div class="figure"p> [[File:zero2w-img366img361.png]] </divp></li><li><p>Then Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to initialize open the SPIuart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img367.png]]
[[File:zero2w-img362.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then fill in the bytes that need use Dupont wire to be sent, such as reading short the ID information rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of the onboard SPIFlash, filling characters in the address 0x9f in data[0], send edit box below and then click the '''TRANSFERSEND''' buttonto start sending.</lip></olli>
[[File:zero2w-img368img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li>
[[File:zero2w-img364.png]]</ol start><span id="9" style="listpin-spi-styletest-type: decimal;method"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>
[[File:zero2w-img369.png]]=== 40pin SPI test method ===
<ol start="10" style="list-style-type: decimal;"><li>If # As can be seen from the w25qxx module connected to 40pin SPI1 is readtable below, the ID information of spi available for the onboard SPI Flash 40pin interface is also similar.</li></ol>spi1, and there are two chip select pins cs0 and cs1
<span iddiv style="pin-i2c-test-methoddisplay: flex;"></span>=== 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''36Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''2724'''| '''PI165V'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''PI316'''| '''259PWM4'''|}'''PI14'''| '''270'''|-| '''18'''<ol start| style="2text-align: left;" || '''PH4'''| '''228'''|-| '''20'''| '''GND'''| style="listtext-align: left;"|| style="text-typealign: decimalleft;">||-| '''22'''<li>The device node corresponding to i2c1 is | '''UART2_RX'''| '''PI6'''| '''262'''/dev/i2c|-1| ''', and the device node corresponding to i2c2 is 24'''/dev/i2c| '''SPI1_CS0'''| '''PH5'''| '''229'''|-2| '''26'''| '''SPI1_CS1'''| '''PH9'''</li></ol>| '''233'''apollo|-p2:/ # | '''28'''| '''ls /dev/i2cTWI2-*SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''/dev/i2c| style="text-align: left;"|| style="text-1 /dev/i2calign: left;"||-2| '''32' /dev/i2c''| '''PWM1'''| '''PI11'''| '''267'''|-5| '''34'''| '''GND'''<ol start| style="3text-align: left;" || style="listtext-align: left;"||-| '''36'''| style="text-typealign: decimalleft;">|| '''PC12'''| '''76'''|}<li>First open wiringOP APP on the desktop</li></oldiv>
[[File<ol start="2" style="list-style-type:zero2wdecimal;"><li>The device node corresponding to SPI1 CS0 is '''/dev/spidev1.0''', and the device node corresponding to SPI1 CS1 is '''/dev/spidev1.1'''</li>{| class="wikitable" style="width:800px;" |-img351| apollo-p2:/ # '''ls /dev/spidev1.png]]*'''
'''<span style="color:#FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to the SPI1 interface.</li>
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
|
<big>'''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''</big>
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''I2C_TEST''' button to open wiringOP APP on the i2c test interfacedesktop</li></ol>
[[File:zero2w-img370img351.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then click the '''SPI_TEST''' button to open the SPI test interface</li>
[[File:zero2w-img365.png]]</ol><ol start="56" style="list-style-type: decimal;"><li>The i2c <p>Then select the spi device node in the upper left corner. If you test interface of wiringOP the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'''. If the '''w25qxx''' module is shown in connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the figure below40pin spi1 cs1, then please select '''/dev/spidev1.1'''</lip></oldiv class="figure">
[[File:zero2w-img371img366.png]]
<ol start="6" style="list-style-type: decimal;"/div></li><li><p>Then click the device node selection box in the upper left corner '''OPEN''' button to select initialize the i2c you want to testSPI</lip></olli>
[[File:zero2w-img372img367.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then fill in the bytes that need to be sent, such as reading the ID information of the onboard SPIFlash, filling in the address 0x9f in data[0], and then click the '''TRANSFER''' button</li>
[[File:zero2w-img368.png]]</ol><ol start="79" style="list-style-type: decimal;"><li>Then connect an i2c device to Finally, the APP will display the 40pin i2c pin. Here we take read ID information of the ds1307 rtc module as an exampleonboard SPI Flash.</li></ol>
[[File:zero2w-img178img369.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol>
<ol startspan id="8" style="list-style-type: decimal;"><li><p>The i2c address of the ds1307 rtc module is 0x68. After connecting the lines, we can use the '''i2cdetect -y 1''' or '''i2cdetect -y 2''' command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p><p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -y 2'''</p><p>[[File:zero2wpin-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''OPEN''' button to open i2c, the display is as follows</p><p>[[File:zero2w-img375.png]]</p></li><li><p>Then we test writing a value to the register of the rtc module, for example, writing 0x55 to the 0x1c address</p><ol style="list-style-type: lower-alpha;method"><li><p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''WRITE BYTE''' button to perform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></olspan>
<span id="pin-pwm-test"></span>=== 40pin PWM I2C test method ===
# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 Android12 TV system has i2c1 and pwm4i2c2 turned on by default.
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''<span style="color:#FF0000">264</span>'''| '''<span style="color:#FF0000">PI8</span>'''| '''<span style="color:#FF0000">TWI1-SDA</span>'''| '''<span style="color:#FF0000">3</span>'''|-| '''4'''| '''5V'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"||-| '''>263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''5'''|| '''6'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>5</span>'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265</span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''Pin'''
| '''Function'''
| '''GPIO'''
| '''GPIO NO.'''
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">28</span>'''
| '''<span style="color:#FF0000">TWI2-SCL</span>'''
| '''<span style="color:#FF0000">PI9</span>'''
| '''<span style="color:#FF0000">265</span>'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
</div>
<ol start="2" style="list-style-type: decimal;"><li>First click the wiringOP icon to open wiringOP APP</li></ol> [[File:zero2w-img351.png]] <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:zero2w-img380.png]] <ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li></ol> <div class="figure"> [[File:zero2w-img381.png]] </div><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want device node corresponding to use in the Channel. The default i2c1 is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li></ol> [[File:zero2w-img382.png]] <ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li><dev/ol> [[File:zero2w-img383.png]] <ol start="7" style="listi2c-style-type: decimal;"><li>Then click the 1'''EXPORT'''button to export PWM</li></ol> [[File:zero2w-img384.png]] <ol start="8" style="list-style-type: decimal;"><li>Then drag , and the progress bar below device node corresponding to change the PWM duty cycle, and then check i2c2 is '''Enable''' to output the PWM waveform.</li><dev/ol> [[File:zero2wi2c-img385.png]] <ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol> [[File:zero2w-img386.png]] <span id="how-to-compile-android-12-source-code"></span> = 2'''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></spanli>== Download the source code of Android 12 == <ol style{| class="list-style-type: decimal;wikitable"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-typewidth: lower-alpha800px;"><li>Google Cloud Drive</li></ol></li></ol> [[File:zero2w|-img387.png]]| <ol start="2" style="list-styleapollo-typep2: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li></ol> test@test:~$ # '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''OK''' H618-Android12-Src.tar.gzab: '''OK''' ...... <ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:<ls /li><dev/ol> test@test:~$ '''cat H618-Android12i2c-Src.tar.gza* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz''' <ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li></ol> test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz
'''<span style="color:#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5|}</ol><ol start="53" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to First open wiringOP APP on the Android source codedesktop</li></ol>
test@test[[File:~$ '''cp zero2w-rf opizero2w_android12_patchesimg351.png]]</* H618ol><ol start="4" style="list-Android12style-Src/type: decimal;"><li>Then click the '''I2C_TEST'''button to open the i2c test interface</li>
[[File:zero2w-img370.png]]<span id/ol><ol start="5" style="compile-thelist-sourcestyle-code-of-android-12type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</spanli>== Compile the source code of Android 12 ==
'''Android12 is compiled on an x86_64 computer with Ubuntu 22[[File:zero2w-img371.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then click the device node selection box in the upper left corner to select the Ubuntu 22.04 amd64 version is as follows:'''i2c you want to test</li>
[https[File://repo.huaweicloud.com/ubuntuzero2w-releases/22img372.04png]]</ubuntu-22.04.2ol><ol start="7" style="list-desktopstyle-amd64.iso '''httpstype://repodecimal;"><li>Then connect an i2c device to the 40pin i2c pin.huaweicloud.com/ubuntu-releases/22Here we take the ds1307 rtc module as an example.04</ubuntu-22.04.2-desktop-amd64.iso''']li>
'''[[File:zero2w-img178.png]]</ol><ol start="8" style="list-style-type: decimal;"><li><p>The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory i2c address of 16GB or more, and a hard disk space of 200GB or more the ds1307 rtc module is recommended0x68. The more CPU coresAfter connecting the lines, we can use the better.''' # First install the software packages needed to compile Android12 source code test@test:~$ i2cdetect -y 1''' or '''sudo apti2cdetect -get updatey 2'''command on the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned. If you can see the address 0x68, it means that the ds1307 rtc module is wired correctly.</p>{| class="wikitable" style="width:800px;" |-| test@test<p>apollo-p2:~$ / # '''sudo apt-get install i2cdetect -y git gnupg flex bison gperf build-essential \1'''</p> <p>'''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \Or'''</p> <p>apollo-p2:/ # '''lib32ncurses5i2cdetect -dev x11proto-core-dev libx11-dev lib32z1-dev ccache \y 2'''</p>|}<p>[[File:zero2w-img373.png]]</p></li><li><p>Then set the i2c address to 0x68 in wiringOP, and then click the '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \OPEN'''button to open i2c</p><p>[[File:zero2w-img374.png]]</p></li><li><p>After clicking the '''libssl-dev libncurses5 clang gawkOPEN'''button to open i2c, the display is as follows</p><ol start="2" style="listp>[[File:zero2w-style-type: decimal;"img375.png]]</p></li><li><p>Then compile we test writing a value to the code in register of the longan folderrtc module, for example, which mainly contains u-boot and linux kernelwriting 0x55 to the 0x1c address</p>
<ol style="list-style-type: lower-alpha;">
<li>First run <p>We first set the address of the register to be written to 0x1c</p><p>[[File:zero2w-img376.png]]</p></li><li><p>Then set the value to be written to 0x55</p><p>[[File:zero2w-img377.png]]</p></li><li><p>Then click the '''./build.sh configWRITE BYTE''' button to set compilation optionsperform the writing action</p><p>[[File:zero2w-img378.png]]</p></li></ol></li><li><p>Then click the '''READ BYTE''' button to read the value of the 0x1c register. If it displays 0x55, it means that the i2c read and write test has passed.</p><p>[[File:zero2w-img379.png]]</p></li></ol>
test@test:~$ '''cd H618<span id="pin-Android12pwm-Srctest"></longan'''span>
=== 40pin PWM test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''===
Welcome to mkscript setup progress# As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4.
All available platform<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align:center;"|-0| '''GPIO NO. android'''| '''GPIO'''| '''Function'''| '''Pin'''|-| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''1. linux'''|-| '''264'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|-| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|-| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''Choice [android]| '''<span style="color: #FF0000">PWM3</span>'''| '''0<span style="color:#FF0000">7</span>'''|-All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''UART2_TX'''Choice [h618]: | '''015'''|-All available board| style="text-align:left;"|| style="text-align: left;"|0| '''3. ft3V'''| '''17'''|-| '''231'''1. p1| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''2. p2| '''23'''|-3. p7| style="text-align: left;"|| style="text-align: left;"|4. p7l| '''GND'''| '''25'''5. perf1|-| '''266'''6. perf2| '''PI10'''| '''TWI2-SDA'''7. perf3| '''27'''|-8. qa| '''256'''| '''PI0'''Choice [p2]| style="text-align: left;"|| '''29'''|-| ''2'271'''| '''PI15'''All available flash| style="text-align:left;"|| '''31'''0. default|-| '''<span style="color:#FF0000">268</span>'''1. nor| '''<span style="color:#FF0000">PI12</span>'''| '''<span style="color:#FF0000">PWM2</span>'''Choice [default]| '''<span style="color: #FF0000">33</span>'''|-| '0''258'''| '''PI2'''All available kern_ver| style="text-align:left;"|| '''35'''0. linux|-5.4| '''272'''| '''PI16'''Choice [linux| style="text-5.4]align: left;"|| '''037'''|-All available arch| style="text-align:left;"|| style="text-align: left;"|| '''GND'''| '''39'''0. arm|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"1. arm64|-| '''Pin'''Choice [arm64]: | '''1Function'''| '''GPIO'''| '''.....GPIO NO.'''|-*** Default configuration is based on | '''2''sun50iw9p1smp_h618_android_defconfig'| '''5V'''#| style="text-align: left;"|| style="text-align: left;"|# configuration written to .config|-| '''4'''#| '''5V'''| style="text-align: left;"|make[1]| style="text-align: Leaving directory left;"||-| '''6'''/home/test/H618| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-Android12| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-Src/longan/out/kernel/build| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''|-make| '''12'''| style="text-align: Leaving directory left;"|| '''PI1'''| '''257'''|-| '''14'''| '''GND'''/home/test/H618| style="text-align: left;"|| style="text-Android12align: left;"||-Src| '''<span style="color:#FF0000">16</longanspan>'''| '''<span style="color:#FF0000">PWM4</kernelspan>'''| '''<span style="color:#FF0000">PI14</linuxspan>'''| '''<span style="color:#FF0000">270</span>'''|-5.4| '''18'''| style="text-align: left;"|INFO: clean buildserver| '''PH4'''| '''228'''|-INFO: prepare_buildserver| '''20'''| '''GND'''<ol start| style="2text-align: left;" || style="listtext-align: left;"||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265'''|-| '''30'''| '''GND'''| style="text-typealign: lowerleft;"|| style="text-alphaalign: left;"||-| '''<span style="color:#FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1<li/span>Then run the '''.| '''<span style="color:#FF0000">PI11</build.shspan>'''| ''' script to start compilation.</lispan style="color:#FF0000">267</olspan>'''|-test@test| '''34'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-| '''36'''| style="text-align: left;"|| '''PC12'''| '''76'''|-| '''38'''| style="text-align:~/H618left;"|| '''PI4'''| '''260'''|-Android12| '''40'''| style="text-Src/longan$ align: left;"|| '''PI3'''| '''./build.sh259'''|}</div> <ol start="32" style="list-style-type: lower-alphadecimal;"><li>After compilation is completed, you will see First click the following outputwiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol> sun50iw9p1 compile Kernel successful INFO<ol start="3" style="list-style-type: Prepare toolchain ...decimal;"><li>Then click the '''......PWM_TEST''' INFO: build kernel OK.button on the main interface of wiringOP to enter the PWM test interface</li>
INFO[[File: build rootfs ..zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test interface is as follows</li>
INFO: skip make rootfs for android<div class="figure">
INFO[[File: zero2w----------------------------------------img381.png]]
</div></ol><ol start="5" style="list-style-type: decimal;"><li>Then set which PWM you want to use in the Channel. The default is PWM1. If you want to set it to PWM2, just enter 2 in the Channel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can set the PWM period. The default configuration is '''50000ns'''. The converted PWM frequency is '''20KHz'''</li> [[File:zero2w-img383.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Then click the '''EXPORT'''button to export PWM</li> [[File:zero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li> [[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p>  <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ---------------------------------------- INFO: build lichee OK. INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cd H618-Android12-Src''' test@test:~/H618-Android12-Src$ '''source build/envsetup.sh''' test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug''' test@test:~/H618-Android12-Src$ '''make -j8''' test@test:~/H618-Android12-Src$ '''pack'''|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>The storage path of the Android image generated by compilation is:</p>{| class="wikitable" style="width:800px;" |-| <p>'''longan/out/h618_android12_p2_uart0.img'''</p>|}</li></ol> <span id="appendix"></span> = '''Appendix''' = <span id="user-manual-update-history"></span>== User manual update history == {| class="wikitable" style="width:800px;text-align: center;"|-| '''Version'''| '''Date'''| '''Release Notes'''|-| v1.0| 2023-09-14| initial version|} <span id="image-update-history"></span>== Image update history == {| class="wikitable" style="width:800px;"|-| style="text-align: center;"| '''Date''' | style="text-align: center;"| '''Release Notes'''|-| style="text-align: center;"| 2023-09-14| orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z  orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z  OrangePi_Zero2w_Android12_v1.0.tar.gz
INFO: ----------------------------------------
 
<ol start="3" style="list-style-type: decimal;">
<li>Then use the following command to compile the Android source code and generate the final Android image</li></ol>
 
test@test:~$ '''cd H618-Android12-Src'''
 
test@test:~/H618-Android12-Src$ '''source build/envsetup.sh'''
 
test@test:~/H618-Android12-Src$ '''lunch apollo_p2-userdebug'''
 
test@test:~/H618-Android12-Src$ '''make -j8'''
 
test@test:~/H618-Android12-Src$ '''pack'''
 
<ol start="4" style="list-style-type: decimal;">
<li><p>The storage path of the Android image generated by compilation is:</p>
<p>'''longan/out/h618_android12_p2_uart0.img'''</p></li></ol>
 
<span id="appendix"></span>
 
= '''Appendix''' =
 
<span id="user-manual-update-history"></span>
== User manual update history ==
 
{| class="wikitable"
|-
| '''Version'''
| '''Date'''
| '''Release Notes'''
|-
| v1.0
| 2023-09-14
| initial version
|}
 
<span id="image-update-history"></span>
== Image update history ==
 
{| class="wikitable"
|-
| '''Date'''
 
| '''Release Notes'''
|-
| 202 3-09-14
|
orangepizero2w_1.0.0_debian_bullseye_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_server_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_focal_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux5.4.125.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_server_linux6.1.31.7z
 
orangepizero2w_1.0.0_ubuntu_jammy_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bookworm_desktop_xfce_linux6.1.31.7z
 
orangepizero2w_1.0.0_debian_bullseye_desktop_xfce_linux6.1.31.7z
 
OrangePi_Zero2w_Android12_v1.0.tar.gz
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz

Navigation menu