6,556
edits
Changes
→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;"
# As can be seen from the table below, the available uarts are uart2, uart3, uart4 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 NO.'''
| '''Function'''
| '''Pin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''Multiplexing function in 40pinPin'''| '''Corresponding dtbo configurationFunction'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin 2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text- uart2align: left;"|| style="text-align: left;"||-| '''8'''| '''piUART0_TX'''| '''PH0'''| '''224'''|-uart2| '''10'''| '''UART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- uart3align: left;"|| '''PI1'''| '''pi-uart3257'''
|-
| '''40pin - uart414'''| '''pi-uart4GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart516'''| '''ph-uart5PWM4/UART4_RX'''|}'''PI14'''| '''270'''[[File:zero2w|-img175.png]]| '''18'''<ol start="5" | style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select | '''<Save>PH4''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select | '''<Back>228'''</p><p>[[File:zero2w|-img84.png]]</p></li><li><p>Then select | '''<Reboot>20''' to restart the system to make the > configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>| '''GND''' <!-- --><ol start| style="3text-align: left;" || style="list-styletext-typealign: decimalleft;">|<li><p>After entering the Linux system, first confirm whether there is a uart5 device node under |-| '''<span class="mark">/dev</span>22'''</p><p>| '''注意, linux5.4系统为TWI0_SDA/dev/ttyASx.UART2_RX'''</p><p>orangepi@orangepi:~$ | '''ls /dev/ttyS*PI6'''</p><p>/dev/ttySx</p></li>| '''262'''<li><p>Then start testing the uart interface. First use Dupont wire to short|-circuit the rx and tx pins of the uart interface to be tested.</p></li><li><p>Use the | '''gpio24''' command in wiringOP to test the loopback function of the serial port as shown below. If you can see the following print, it means the serial port communication is normal.</p><p>| '''Note that the last x in the gpio serial /dev/ttySx command needs to be replaced with the serial number of the corresponding uart device node.SPI1_CS0'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttySx # linux-6.1 test commandPH5'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command229'''</p><p>Out: 0: |-> 0</p><p>Out: 1: -> 1</p>| '''26'''<p>Out: 2: -> 2</p>| '''SPI1_CS1'''<p>Out: 3: -> 3^C</p></li><li><p>Finally, you can run the | '''serialTest.pyPH9''' program in examples to test the loopback function of the serial port. If you can see the following print, it means that the serial port loopback test is normal.</p><p>| '''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to be replaced with the serial number of the corresponding uart device node.233'''</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples28'''</p><p>root@orangepi:~/wiringOP| '''TWI2-PythonSCL/examples# UART3_TX'''| 'python3 serialTest.py --device "/dev/ttySx" # linux6.1 use''PI9'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device "/dev/ttyASx" # linux5.4 use265'''</p><p>Out: 0: |-> 0</p><p>Out: 1: -> 1</p>| '''30'''| '''GND'''<p>Out: 2: | style="text-> 2</p><p>Outalign: 3: ->left; 3</p>"|<p>Out: 4:^C</p><p>exit</p></li></ol> <span id| style="hardwaretext-watchdogalign: left;"||-test"></span>| '''32'''| '''PWM1'''== Hardware watchdog test ==| '''PI11'''| '''267'''The watchdog_test program is pre|-installed in the Linux system released by Orange Pi and can be tested directly.| '''34'''The method to run the watchdog_test program is as follows:| '''GND''' <ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">||-<li><p>The second parameter 10 represents the counting time of the watchdog. If the dog is not fed within this time, the system will restart.</p></li>| '''36'''<li><p>We can feed the dog by pressing any key on the keyboard (except ESC). After feeding the dog, the program will print a line "| style="text-align: left;keep alive" to indicate that the dog feeding is successful.</p>"|<p>orangepi@orangepi:~$ | '''sudo watchdog_test 10PC12'''</p><p>open success</p>| '''76'''<p>options is 33152,identity is sunxi|-wdt</p><p>put_usr return,if 0,success| '''38'''| style="text-align:0</p>left;"|| '''PI4'''<p>The old reset time is: 16</p>| '''260'''<p>return ENOTTY,if |-1,success:0</p><p>return ENOTTY,if | '''40'''| style="text-1,successalign:0</p>left;"|<p>put_user return,if 0,success:0</p>| '''PI3'''<p>put_usr return,if 0,success:0</p>| '''259'''<p>keep alive</p>|}<p>keep alive</p><p>keep alive</p></li></oldiv>
<span idol start="check2" style="list-thestyle-chipidtype: decimal;"><li><p>In Linux systems, uart is turned off by default and needs to be turned on manually before it can be used. The opening steps are as follows:: </p><ol style="list-ofstyle-h618type: lower-chipalpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</spanp>{| class="wikitable" style= Check "width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><li><p>Then select '''Hardware'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' to select the chipid of H618 chip ==serial port you want to open.</p></li>
<p>Out: 0: -> 0</p><p>Out: 1: -> 1</p><p>Out: 2: -> 2</p><p>Out: 3: -> 3^C</p>|}</li><li><p>Finally, you can run the '''serialTest.py'''If the Python version program in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want examples to use test the latest version loopback function of Python, the serial port. If you can use see the following method to download print, it means that the serial port loopback test is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the Python source code package command needs to compile and install be replaced with the latest version serial number of the corresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttySx" # linux6.1 use'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device "/dev/ttyASx" # linux5.4 use'''</p>
<span id="howhardware-towatchdog-replace-pip-source-in-pythontest"></span>=== How to replace pip source in Python ===
<ol style="list-style-type: lower-alpha;"><li><p>The Linux image provided by Orange Pi has Docker pre-installed, but second parameter 10 represents the counting time of the watchdog. If the Docker service dog is not turned fed within this time, the system will restart.</p></li><li><p>We can feed the dog by pressing any key on by default. Use the '''enable_dockerkeyboard (except ESC).sh''' script to enable After feeding the docker servicedog, and then you can start using the docker command, and the docker service program will be automatically started print a line "keep alive" to indicate that the next time you start the systemdog feeding is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''enable_docker.shsudo watchdog_test 10'''</p><p>open success</p>You can use the following command to test docker. If '''hello<p>options is 33152,identity is sunxi-world''' can be runwdt</p><p>put_usr return,if 0, docker can be used normally.success:0</p><p>The old reset time is: 16</p>orangepi@orangepi<p>return ENOTTY,if -1,success:~$ '''docker run hello0</p><p>return ENOTTY,if -world'''1,success:0</p><p>put_user return,if 0,success:0</p>Unable to find image 'hello-world<p>put_usr return,if 0,success:latest' locally0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p>|}</li></ol>
'''Note: You need The following demonstration is to log out compile and log in again to install the system to take effectlatest version of Python 3. You can also restart the system9.''' <span id="how-If you want to-compile and install-home-assistant"></span>== How to install Home Assistant == '''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage other versions of Home AssistantPython, please refer the method is the same (you need to download the official documentation or source code corresponding booksto the Python you want to install).''' <span id="installation-via-docker"></spanbig>=== Installation via docker ===|}
<ol style="list-style-type: decimal;">
<li><p>First, please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[\l|'''How dependency packages needed to Install Docker''']] section.compile Python</p></li><li><p>Then you can search for the docker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker search homeassistantsudo apt-get update'''</p></li><li><p>Then use the following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the download time will be relatively long. Please be patient and wait for the download to complete.</p><p>orangepi@orangepi:~$ '''docker pull homeassistant/homesudo apt-get install -y build-essential zlib1g-assistantdev \'''</p><p>Using default tag: latest'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>latest: Pulling from homeassistant/home'''libreadline-dev libffi-dev curl libbz2-assistantdev'''</p>|}<p/li>be307f383ecc: Downloading</pli><p>5fbc4c07ac88: Download completeThen download the latest version of Python3.9 source code and unzip it</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''...... (Omit some output)wget \'''</p><p>3cc6a1510c9f'''https: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb<www.python.org/ftp/python/p><p>Status: Downloaded newer image for homeassistant3.9.10/homePython-assistant:latest3.9.10.tgz'''</p><p>dockerorangepi@orangepi:~$ '''tar xvf Python-3.9.10.io/homeassistant/home-assistant:latesttgz'''</p>|}</li><li><p>Then you can use run the following configuration command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/homecd Python-assistant3.9.10'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago orangepi@orangepi:~$ '''1.17GB/configure --enable-optimizations'''</p>|}</li><li><p>At this point you can run the Home Assistant docker containerThen compile and install Python3.9. The compilation time takes about half an hour.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker run make -d \j4'''</p><p>orangepi@orangepi:~$ '''--name homeassistant \sudo make altinstall'''</p>|}<p/li>'''--privileged \'''</pli><p>'''--restart=unless-stopped \'''After installation, you can use the following command to check the version number of the Python you just installed.</p><p>'''{| class="wikitable" style="width:800px;" |-e TZ=Asia/Shanghai \'''</p>| <p>'''-v /home/orangepi/home-assistant@orangepi:/config \'''</p><p>~$ '''python3.9 --network=host \version'''</p><p>'''homeassistant/home-assistant:latestPython 3.9.10'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interfaceupdate pip</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the following interface is not displayed normally after waiting for more than a minute, it means there is a problem with the Home Assistant installation. At this time, you need to check whether there is a problem with the previous installation and setting process/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li><div class="figure"/ol>
<ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</divp><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p>|}</li><li><p>Then follow How to permanently change the pip source under Linux</p><ol style="list-style-type: lower-alpha;"><li><p>First create a new '''~/.pip''' directory, then add the interface prompts to '''pip.conf''' configuration file, and set according the pip source in it to your own preferences, and then click NextTsinghua source.</p><div {| class="figurewikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''mkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''cat <<EOF > ~/.pip/pip.conf'''</p><p>'''[[Fileglobal]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https:zero2w//pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trusted-img182host = pypi.png]]tuna.tsinghua.edu.cn'''</p><p>'''EOF'''</divp>|}</li><li><p>Then click Nextuse pip3 to install the Python library very quickly</p></li></ol></li><div li><p>How to temporarily change the pip source under Linux, where '''<packagename>''' needs to be replaced with a specific package name</p>{| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''pip3 install <packagename> -i \'''</p><p>'''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn'''</p>|}</li></ol> <span id="how-to-install-docker"></span> == How to install Docker == The Linux image provided by Orange Pi has Docker pre-installed, but the Docker service is not turned on by default. Use the '''enable_docker.sh''' script to enable the docker service, and then you can start using the docker command, and the docker service will be automatically started the next time you start the system.
'''</div></lispan style="color:#FF0000">This message shows that your installation appears to be working correctly.</olspan>'''
<ol style="list-style-type: decimal;">
<li><p>First open , please install docker and ensure that docker can run normally. For the installation steps of docker, please refer to the instructions in the [[Orange Pi Zero 2W#How to install Docker|'''Language SupportHow to Install Docker'''</p><p>[[File:zero2w-img201.png]]section.</p></li><li><p>Then find you can search for the '''Chinese (China)''' optiondocker image of Home Assistant</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img202.png]]~$ '''docker search homeassistant'''</p>|}</li><li><p>Then please use the left button following command to download the Docker image of Home Assistant to your local computer. The image size is about 1GB, and the mouse download time will be relatively long. Please be patient and wait for the download to select complete.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''Chinese (China)docker pull homeassistant/home-assistant''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below</p><p>Using default tag:latest</p><p>[[Filelatest:zero2wPulling from homeassistant/home-img203.png]]assistant</p><p>be307f383ecc: Downloading</lip><p>5fbc4c07ac88: Download complete</olp> <p>'''Note that this step is not easy to drag, please be patient and try it a few times...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><ol start="4" style="list-style-typep>7a4e4d5b979f: decimal;"Pull complete</p><lip>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Then select '''Apply SystemStatus: Downloaded newer image for homeassistant/home-Wide''' to apply the Chinese settings to the entire systemassistant:latest</p><p>[[Filedocker.io/homeassistant/home-assistant:zero2w-img204.png]]latest</p>|}</li><li><p>Then set you can use the '''Keyboard input method system''' system following command to view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''fcitxdocker images homeassistant/home-assistant'''</p><p>[[File:zero2w-img205.png]]REPOSITORY TAG IMAGE ID CREATED SIZE</p></li><li><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''Then restart the Linux system to make the configuration take effect<span style="color:#FF0000">1.17GB</span>'''</p>|}</li><li><p>After reAt this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px;" |-entering the system, please select | <p>orangepi@orangepi:~$ '''Do not ask me againdocker run -d \''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p>:<p>[[File:zero2w'''--img206.png]]name homeassistant \'''</p>:<p>'''--privileged \'''</lip><li>:<p>Then you can see that the desktop is displayed in Chinese'''--restart=unless-stopped \'''</p>:<p>[[File:zero2w'''-img207.png]]e TZ=Asia/Shanghai \'''</p>:<p>'''-v /lihome/orangepi/home-assistant:/config \'''</p><li>:<p>Then we can open '''Geany--network=host \''' to test the Chinese input method. The opening method is as shown in the figure below</p>:<p>[[File'''homeassistant/home-assistant:zero2w-img208.png]]latest'''</p>|}</li><li><p>After opening '''GeanyThen enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''It takes a while for the Home Assistant container to start. If the interface below does not display normally, please wait a few seconds before refreshing it. If the English input method following interface is still not displayed normally after waiting for more than a minute, it means there is a problem with the defaultHome Assistant installation. We can switch At this time, you need to check whether there is a problem with the Chinese input method through the '''Ctrl+Spaceprevious installation and setting process.''' shortcut key, and then we can input Chinese.</p></big>|}<pdiv class="figure"> [[File:zero2w-img209img180.png]]</p></li></ol>
<span id="installation-method-of-ubuntu-22.04-system"/div></li><li><p>Then enter your '''name, username''' and '''password''' and click '''Create Account'''</spanp><div class=== Installation method of Ubuntu 22.04 system ==="figure">
<div class="figure">
[[File:zero2w-img214img183.png]]
</div></li>
<li><p>The interface after selection is as shown below, then Then click OK</p><p>[[File:zero2w-img215.png]]Finish</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the div class="figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol">
<span id="remote-login-using-nomachine"/div></spanli>=== Remote login using NoMachine === '''Please ensure that the Ubuntu or Debian system installed on the development board is a desktop version of the system. In addition, NoMachine also provides detailed usage documentation. It is strongly recommended to read this document thoroughly to become familiar with the use of NoMachine. <li><p>The document link main interface finally displayed by Home Assistant is as follows:'''shown below</p> '''https<p>[[File://knowledgebasezero2w-img185.nomachine.compng]]</DT10R00166''' '''NoMachine supports Windows, Mac, Linux, iOS and Android platforms, so we can remotely log in and control the Orange Pi development board through NoMachine on a variety of devices. The following demonstrates how to remotely log in to the Linux system desktop of the Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.''' '''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.''' p><ol style="list-style-type: decimal;"/li><li><p>First download the installation package of the NoMachine software Linux '''arm64''' deb version, and then install it into the Linux system of the development boardMethod to stop Home Assistant container</p>
<ol style="list-style-type: lower-alpha;">
<li>Since H618 is an ARMv8 architecture SOC and <p>The command to view the system we use docker container is >as follows</p>{| class="wikitable" style="width:800px; Ubuntu or Debian, we need " |-| <p>orangepi@orangepi:~$ '''docker ps -a'''</p>|}</li><li><p>The command to download stop the Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''NoMachine for ARM > ARMv8 DEBdocker stop homeassistant''' installation package. </p>|}</li><li><p>The download link command to delete the Home Assistant container is as >follows</p>{| class="wikitable" style="width:800px; follows" |-| <p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}</li></ol>
</li></ol>
<ol start="2" style="list-style-type: lower-alphadecimal;"><li><p>In additionFirst install dependency packages</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''If it is debian12, you can also download please use the following command:'''</p></big><p>orangepi@orangepi:~$ '''NoMachinesudo apt-get update''' installation > package from the official tool.</p><p>[[Fileorangepi@orangepi:zero2w~$ '''sudo apt-get install -y python3 python3-dev python3-img218.png]]venv \'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>First enter the '''remote login softwarelibopenjp2-NoMachine7 libturbojpeg0-dev tzdata''' folder</p>|}</li><li><p>Then you need to compile and install Python3.9. For the method, please refer to the [[FileOrange Pi Zero 2W#Python related instructions|'''Python source code compilation and installation method''']] section.</p>{| class="wikitable" style="background-color:zero2w#ffffdc;width:800px;" |-img219| <big><p>'''The default Python version of Debian Bullseye is Python3.png]]9, so there is no need to compile and install it.'''</p><p>Then download the arm64 '''The default Python version of the deb installation packageUbuntu Jammy is Python3.10, so there is no need to compile and install it.'''</p><p>[[File:zero2w-img220'''The default Python version of Debian Bookworm is Python3.11, so there is no need to compile and install it.png]]'''</p></big>|}</li><li><p>Then upload create a Python virtual environment</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Debian Bookworm is python3.11, please remember to replace the downloaded corresponding command.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''cd /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''nomachine_xpython3.x9 -m venv .x_x_arm64.deb''' to </p><p>orangepi@orangepi:~$ '''source bin/activate'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then install the >required Python packages</p>{| class="wikitable" style="width:800px; Linux system of the development board" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</p>|}</li><li><p>Then use the following command to you can install Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''NoMachinepip3 install homeassistant''' in </p>|}</li><li><p>Then enter the Linux > system of the development boardfollowing command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:~/srv/homeassistant$ '''sudo dpkg hass'''</p>|}</li><li><p>Then enter【'''development board IP address: 8123'''】 in the browser to see the Home Assistant interface</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-i nomachine_x| <big><p>'''When you run the hass command for the first time, some libraries and dependency packages necessary for operation will be downloaded, installed and cached. This process may take several minutes.xNote that you cannot see the Home Assistant interface in the browser at this time.x_x_arm64_arm64Please wait for a while and then refresh it.deb'''</p></libig>|}</oldiv class="figure">
<ol startspan id="3" style="list-styleuse-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</p></li><li><p>Then open '''NoMachine''' in Window</p><p>[[File:zero2wapt-img222.png]]</p></li><li><p>After NoMachine is started, it will automatically scan other devices with NoMachine installed on the LAN. After entering the main interface of NoMachine, you can see that the development board is already in the list of connectable devices, and then click on the location shown in the red box in the picture below You can now log in to the Linux system desktop of the development board.</p><p>[[File:zero2w-img223.png]]</p></li><li><p>Then click '''OK'''</p><p>[[File:zero2w-img224.png]]</p></li><li><p>Then enter the username and password of the development board Linux system in the corresponding positions in the figure below, and then click OK to start logging in.</p><p>[[File:zero2winstall-img225.png]]</p></li><li><p>Then click OK in the next interface.</p></li><li><p>Finally you can see the desktop of the development board Linux system</p><p>[[File:zero2w-img226.png]]</p></li></ol> <span id="remote-login-using-vncopencv"></span>=== Remote login using VNC Use apt to install OpenCV === '''Before operating, please make sure that the Windwos computer and the development board are in the same LAN, and that you can log in to the Ubuntu or Debian system of the development board through ssh normally.''' '''There are many problems with VNC testing in Ubuntu20.04, please do not use this method.'''
<ol style="list-style-type: decimal;">
<li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''sThe installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.shapt-get update'''</p><p>You will require a password to access your desktops.</p><p>Passwordorangepi@orangepi: ~$ '''#Set the vnc password here, 8 characters'''</p><p>Verify: '''#Set the vnc password here, 8 characters'''</p><p>Would you like to enter a viewsudo apt-get install -only password (y/n)? '''nlibopencv-dev python3-opencv'''</p><p>xauth: file /root/.Xauthority does not exist</p>|}<p>New 'X' desktop is orangepi:1</p><p>Creating default startup script /root/.vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p><p>Killing Xtightvnc process ID 3047</p><p>New 'X' desktop is orangepi:1</p><p>Starting applications specified in /root/.vnc/xstartup</p><p>Log file is /root/.vnc/orangepi:1.log</p></li><li><p>The steps to Then use MobaXterm software to connect the following command to print the version number of OpenCV. The output is normal, indicating that the development board Linux system desktop are as follows:OpenCV installation is successful.</p>
<ol style="list-style-type: lower-alpha;">
<li>First click Session, then select VNC, then fill <p>The version of OpenCV in the IP Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c >quot;import cv2; address and port of the development board, and finally click print(cv2.__version__)>quot; OK to confirm'''</p><p>'''4.5.4'''</lip>|}</olli></li><p>The version of OpenCV in Ubuntu20.04 is as follows:</olp> <div {| class="figurewikitable">style="width:800px;" |-| [[File<p>orangepi@orangepi:zero2w~$ '''python3 -img227c "import cv2; print(cv2.__version__)"'''</p><p>'''4.png]]2.0'''</p>|}</divli><ol startli><p>The version of OpenCV in Debian11 is as follows:</p>{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>Then enter the VNC password set earlierorangepi@orangepi:~$ '''python3 -c "import cv2; print(cv2.__version__)"'''</p><p>[[File:zero2w-img228'''4.5.png]]1'''</p>|}</li><li><p>After successful login, the interface The version of OpenCV in Debian12 is displayed as shown below, follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c >quot;import cv2; and then you can remotely operate the desktop of the development print(cv2.__version__)>quot; board Linux system'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol> <span id="set-up-the-chinese-environment-and-install-the-chinese-input-method"></span> == Set up the Chinese environment and install the Chinese input method ==
<span id="qtdebian-system-installation-method"></span>== QT = Debian system installation method ===
<ol style="list-style-type: decimal;">
<li><p>Use First set the following script to install QT5 and QT Creator</p><p>orangepi@orangepi:~$ default '''install_qt.shlocale'''</p></li><li><p>After installation, the QT version number will be automatically printed.to Chinese</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The qt version that comes with Ubuntu20.04 is Enter the following command to start configuring '''5.12.8locale'''</p><p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.12.8''' in /usr/lib/aarch64-linux-gnu</p></li><li><p>The QT version that comes with Ubuntu22.04 is '''5.15.3'''</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p>800px;" <p>Using Qt version '''5.15.3''' in /usr/lib/aarch64-linux|-gnu</p></li><li><p>The QT version that comes with Debian11 is '''5.15.2'''</p>| <p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.2''' in /usr/lib/aarch64-linuxsudo dpkg-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5.15.8'''</p><p>orangepi@orangepi:~$ '''install_qt.shreconfigure locales'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.8''' in /usr/lib/aarch64-linux-gnu</p></li></ol>|}
</li>
<li><p>Then you can see the QT Creator startup icon in select '''Applicationszh_CN.UTF-8 UTF-8'''</p><p>[[File:zero2win the pop-img230.png]]</p><p>You can also up interface (use the up and down keys on the keyboard to move up and down, use the space bar to select, and finally use the following command Tab key to move the cursor to open QT Creator</p><p>orangepi@orangepi:~$ '''qtcreator<OK>'''</p></li><li><p>The interface after QT Creator is opened is as follows, and then return Car can be used)</p><p>[[File:zero2w-img231img186.png]]</p></li><li><p>The version of QT Creator is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>The Then set the default version of QT Creator in '''Ubuntu20locale''' to '''zh_CN.04UTF-8''' is as > follows</p><p>[[File:zero2w-img232img187.png]]</p></li><li><p>The default version of QT Creator in After exiting the interface, the '''Ubuntu22.04locale''' setting will begin. The output displayed on the command line is as > follows:</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img233.png]]</p></li><li>| <p>The default version of QT Creator in orangepi@orangepi:~$ '''Debian11sudo dpkg-reconfigure locales''' is as follows</p><p>[[File:zero2w-img234Generating locales (this might take a while)...png]]</p>:<p>en_US.UTF-8... done</lip><li>:<p>The default version of QT Creator in '''Debian12''' is as followszh_CN.UTF-8... done</p><p>[[File:zero2w-img235Generation complete.png]]</p>|}</li></ol>
</li>
<li><p>Then set up QT</p><ol style="list-style-type: lower-alpha;"><li><p>First open '''Help'''->'''About Plugins...Input Method'''.</p><p>[[File:zero2w-img236img188.png]]</p></li><li><p>Then remove the check mark of select '''ClangCodeModelOK'''</p><p>[[File:zero2w-img237img189.png]]</p></li><li><p>'''After setting up, you need to restart QT Creator'''</p></li><li><p>Then make sure the GCC compiler used by QT Creator. If the > default is Clang, please change it to GCC.</p><p>select '''Debian12 please skip this step.Yes'''</p><p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239img190.png]]</p></li></ol></li><li><p>Then you can open a sample codeselect '''fcitx'''</p><p>[[File:zero2w-img240img191.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.Then select '''OK'''</p><p>[[File:zero2w-img241img192.png]]</p></li><li><p>Then click '''Configure Project'''</pspan style="color:#FF0000">Then restart the Linux system to make the configuration take effect.<p/span>[[File:zero2w-img242.png]]'''</p></li><li><p>Then click the green triangle in the lower left corner to compile and run the sample codeopen '''Fcitx configuration'''</p><p>[[File:zero2w-img243img193.png]]</p></li><li><p>After waiting for a period of time, Then click the interface + sign as shown in the figure picture below will pop up, which means that QT can compile and run normally.</p><p>[[File:zero2w-img244img194.png]]</p></li><li><p>References</p><p>[https://wiki.qt.io/Install_Qt_5_on_Ubuntu Then search '''https://wiki.qt.io/Install_Qt_5_on_UbuntuGoogle Pinyin''']</p><p>[https://download.qt.io/archive/qtcreator and click '''https://download.qt.io/archive/qtcreatorOK''']</p><p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p></li></oldiv class="figure">
<span id="how/div></li><li><p>Then put '''Google Pinyin''' on top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany''' editor totest the Chinese input method</p><p>[[File:zero2w-installimg198.png]]</p></li><li><p>The Chinese input method test is as follows</p><p>[[File:zero2w-rosimg199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space''' shortcut key</p></li><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/default/locale''' to '''zh_CN.UTF-18'''</p>{| class="wikitable" style="width:800px;" |-noetic| <p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p><p># File generated by update-on-ubuntu20.04locale</p><p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p><p>LANG='''<span style== How to install ROS 1 Noetic on Ubuntu20"color:#FF0000">zh_CN.04 UTF-8</span>'''</p><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.UTF-8</span>'''</p>|}</li><li><p>Then '''<span style="color:#FF0000">restart the system</span>''' and you will see that the system is displayed in Chinese.</p><p>[[File:zero2w-img200.png]]</p></li></ol>
<ol style="list-style-type: decimal;"><li><p>First open '''Language Support'''</p><p>[[File:zero2w-img201.png]]</p></li><li><p>Then find the '''Chinese (China)''' option</p><p>[[File:zero2w-img202.png]]</p></li><li><p>Then please use the left button of the mouse to select '''Chinese (China)''' and hold it down, then drag it up to the starting position. After dragging, the display will be as shown below:</p><p>[[File:zero2w-img203.png]]</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this step is not easy to drag, please be patient and try it a few times.'''</big>|}</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img204.png]]</p></li><li><p>Then set the '''Keyboard input method system''' system to '''fcitx'''</p><p>[[File:zero2w-img205.png]]</p></li><li><p>'''<span style="color:#FF0000">Then restart the Linux system to make the configuration take effect</span>'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in the following interface, and then please decide according to your own preferences whether the standard folder should also be updated to Chinese</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then we can open '''Geany''' to test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space''' shortcut key, and then we can input Chinese.</p><p>[[File:zero2w-img246img209.png]]</p></li></ol>
<ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 First open '''Noetic NinjemysLanguage Support''' is as follows:</p><p>[http[File://wikizero2w-img201.ros.orgpng]]</noeticp></Installation/Ubuntu li><li><p>Then find the '''http://wiki.ros.org/noetic/Installation/UbuntuChinese (China)'''option</p><p>[[File:zero2w-img210.png]]</p></li><li><p>In Then please use the official installation documentation left button of ROS the mouse to select '''Noetic NinjemysChinese (China)'''and hold it down, Ubuntu recommends using Ubuntu20then drag it up to the starting position.04After dragging, so please ensure that the system used by the development board is '''Ubuntu20.04 desktop system'''.display will be as shown below:</p><p>[http[File://wikizero2w-img211.ros.orgpng]]</noeticp></Installation li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''http://wikiNote that this step is not easy to drag, please be patient and try it a few times.ros.org'''</noeticbig>|}</Installationol><ol start="4" style="list-style-type: decimal;"><li><p>Then select ''']Apply System-Wide''' to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img247img212.png]]</p></li><li><p>'''<span style="color:#FF0000">Then use restart the script below Linux system to install ros1make the configuration take effect</span>'''</p></li><li><p>orangepi@orangepi:~$ After re-entering the system, please select '''install_ros.sh ros1Do not ask me again'''in the following interface, and then please decide whether the standard folder should also be updated to Chinese according to your own preferences.</p><p>[[File:zero2w-img206.png]]</p></li><li><p>Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and some core components see that the desktop is displayed in ROSChinese</p><p>[[File:zero2w-img207.png]]</p></li></olli><p> '''Note that when running Then open the following command, you need to ensure that the development board can access github normally, otherwise an error will be reported due to network problems.''' '''The install_ros.sh script will try to modify Fcitx5 configuration program</etc/hosts and automatically run the following commands. However, this method cannot guarantee that github can be accessed normally every time. If install_ros.sh prompts the following error after installing ros1, please find other ways to allow the linux system of the development board to access github normally, and then manually run the following Order.'''p> '''https<p>[[File://rawzero2w-img213.githubusercontent.compng]]</rosp></rosdistroli><li><p>Then choose to use Pinyin input method</master/rosdep/osx-homebrew.yaml'''p><div class="figure">
</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-img215.png]]</p></li><li><p>Then we can open '''Geany'''ERROR: error loading sources listto test the Chinese input method. The opening method is as shown in the figure below</p><p>[[File:zero2w-img208.png]]</p></li><li><p>After opening '''Geany''', the English input method is still the default. We can switch to the Chinese input method through the '''Ctrl+Space'''shortcut key, and then we can enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol>
[[File:zero2w-img217.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation package from the official tool.</p><p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p><p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version of the deb installation package</p><p>[[File:zero2w-img220.png]]</p></li><li><p>Then upload the downloaded '''nomachine_x.x.x_x_arm64.deb''' to the Linux system of the development board</p></li><li><p>Then use the following command to install '''NoMachine''' in the Linux system of the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''rosdep updatesudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}reading in sources list data from </etcli></rosol></rosdepli></sourcesol><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine software.listThe download address is as follows</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change.d'''</big>|}{| class="wikitable" style="width:800px;" Hit |-| '''https://rawdownloads.githubusercontentnomachine.com/rosdownload/rosdistro/master/rosdep/osx-homebrew.yaml?id=9'''|}
<ol style="list-style-type: decimal;">
<li><p>The currently active version of ROS 2 is as follows, Use the recommended version is '''Galactic Geochelone'''following script to install QT5 and QT Creator</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img251.png]]</p>| <p>[[Fileorangepi@orangepi:zero2w-img252~$ '''install_qt.png]]sh'''</p>|}</li><li><p>[http://docs.ros.org/ '''http://docsAfter installation, the QT version number will be automatically printed.ros.org''']</p><p>'''httpol style="list-style-type://docs.ros.org/en/galactic/Releases.html'''</plower-alpha;"></li> <li><p>The link to the official installation documentation of ROS 2 qt version that comes with Ubuntu20.04 is '''Galactic Geochelone5.12.8''' is as follows:</p><p{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docsinstall_qt.ros.org/en/galactic/Installation.htmlsh'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''...</p></li><lip>QMake version 3.1</p>In the official installation documentation of ROS 2 <p>Using Qt version '''Galactic Geochelone<span style="color:#FF0000">5.12.8</span>''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''Ubuntu20.04 desktop systemin /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The QT version that comes with Ubuntu22.04 is '''5. There are several ways to install ROS 215. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '3'''Debian packages'''.</p></li><li><p>Use the '''install_ros.sh''' script to install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_rosinstall_qt.sh ros2'''</p><p>......</lip><lip>QMake version 3.1</p><p>The Using Qt version '''install_ros.sh<span style="color:#FF0000">5.15.3</span>''' script will automatically run the '''ros2 in /usr/lib/aarch64-h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.linux-gnu</p>|}<p/li>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. .<li><p>The QT version that comes with Debian11 is '''5.15.2'''</p><p>ros2 is an extensible command{| class="wikitable" style="width:800px;" |-line tool for ROS 2.</p>| <p>optional argumentsorangepi@orangepi:~$ '''install_qt.sh'''</p><p>-h, --help show this help message and exit......</p><p>Commands:QMake version 3.1</p><p>action Various action related sub-commandsUsing Qt version '''</pspan style="color:#FF0000">5.15.2<p/span>bag Various rosbag related sub-commands<''' in /p><p>component Various component related subusr/lib/aarch64-linux-commandsgnu</p><p>daemon Various daemon related sub-commands</p>|}<p>doctor Check ROS setup and other potential issues</pli><pli>interface Show information about ROS interfaces</p><p>launch Run a launch fileThe QT version that comes with Debian12 is '''5.15.8'''</p><p>lifecycle Various lifecycle related sub-commands</p>{| class="wikitable" style="width:800px;" <p>multicast Various multicast related sub|-commands</p><p>node Various node related sub-commands</p>| <p>param Various param related sub-commandsorangepi@orangepi:~$ '''install_qt.sh'''</p><p>pkg Various package related sub-commands......</p><p>run Run a package specific executableQMake version 3.1</p><p>security Various security related sub-commandsUsing Qt version '''</pspan style="color:#FF0000">5.15.8<p/span>service Various service related sub''' in /usr/lib/aarch64-commandslinux-gnu</p>|}<p/li>topic Various topic related sub-commands</pol><p>wtf Use `wtf` as alias to `doctor`</pli><pli>Call `ros2 <command> -h` for more detailed usage.</p></li><li><p>Then you Then you can use see the QT Creator startup icon in '''test_ros.shApplications''' script to test whether ROS 2 is installed successfully. If you can see the following print, it means ROS 2 can run normally</p><p>[[File:zero2w-img230.png]]</p><p>orangepi@orangepi:~$ '''test_ros.sh'''You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>[INFO] [1671174101.200091527] [talker]: Publishingorangepi@orangepi: ~$ '''qtcreator''Hello World: 1'</p>|}</li><li><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]The interface after QT Creator is opened is as follows</p><p>[INFO] [1671174102File:zero2w-img231.199572327png] [talker]: Publishing: 'Hello World: 2'</pp></li><pli>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img253.png]]</p></li><li><p>For how to use ROS, please refer to the documentation of ROS 2.</p><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p></li></ol> <span id="how-to-install-ros-2-humble-on-ubuntu22.04"></span>=== How to install ROS 2 Humble on Ubuntu22.04 === <ol style="list-style-type: decimal;"><li><p>Use the install_ros.sh script to '''install_ros.sh'''</p><p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p></li><li><p>The '''install_ros.sh''' script will automatically run the '''ros2 -h''' command after installing ros2. If you can see the following print, it means that the ros2 installation is complete.</p><p>usage: ros2 [-h] Call `ros2 <command> -h` for more detailed usage. ...</p><p>ros2 is an extensible command-line tool for ROS 2.</p><p>optional arguments:</p><p>-h, --help show this help message and exit</p><p>Commands:</p><p>action Various action related sub-commands</p><p>bag Various rosbag related sub-commands</p><p>component Various component related sub-commands</p><p>daemon Various daemon related sub-commands</p><p>doctor Check ROS setup and other potential issues</p><p>interface Show information about ROS interfaces</p><p>launch Run a launch file</p><p>lifecycle Various lifecycle related sub-commands</p><p>multicast Various multicast related sub-commands</p><p>node Various node related sub-commands</p><p>param Various param related sub-commands</p><p>pkg Various package related sub-commands</p><p>run Run a package specific executable</p><p>security Various security related sub-commands</p><p>service Various service related sub-commands</p><p>topic Various topic related sub-commands</p><p>wtf Use `wtf` as alias to `doctor`</p><p>Call `ros2 <command> -h` for more detailed usage.</p></li><li><p>Then you can use the '''test_ros.sh''' script to test whether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p><p>orangepi@orangepi:~$ '''test_ros.sh'''</p><p>[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [1671174101.235661048] [listener]: I heard: [Hello World: 1]</p><p>[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [1671174102.204196299] [listener]: I heard: [Hello World: 2]</p><p>[INFO] [1671174103.199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p></li><li><p>Run the following command to open rviz2</p><p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p></li><li><p>Reference documentation</p><p>'''http://docs.ros.org/en/humble/index.html'''</p><p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html''']</p></li></ol> <span id="how-to-install-kernel-header-files"></span>== How to install kernel header files == '''Debian11 system with Linux6.1 kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04.''' <ol style="list-style-type: decimal;"><li><p>The Linux image released by OPi comes with the deb package of the kernel header file by default, and the storage location is '''/opt/'''</p><p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p></li><li><p>Use the following command to install the deb package of the kernel header file</p><p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*.deb'''</p></li><li><p>After installation, you can see the folder where the kernel header file is located under '''/usr/src'''.</p><p>orangepi@orangepi:~$ '''ls /usr/src'''</p><p>linux-headers-x.x.x</p></li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image. The source code of the hello module is in '''/usr/src/hello'''. After entering this directory, then use the make command to compile.</p><p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5.4.125'</p><p>CC [M] /usr/src/hello/hello.o</p><p>Building modules, stage 2.</p><p>MODPOST 1 modules</p><p>CC [M] /usr/src/hello/hello.mod.o</p><p>LD [M] /usr/src/hello/hello.ko</p><p>make[1]: Leaving directory '/usr/src/linux-headers-5.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></li><li><p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo insmod hello.ko'''</p></li><li><p>Then use the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If you can see the following output, it means that the '''hello.ko''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hello.ko''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol> <span id="testing-of-some-programming-languages-supported-by-linux-system"></span>== Testing of some programming languages supported by Linux system == <span id="debian-bullseye-system"></span>=== Debian Bullseye system === <ol style="list-style-type: decimal;"><li><p>Debian Bullseye The version of QT Creator is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The default version of a.gcc is as follows</p><p>orangepi@orangepi:~$ QT Creator in '''gcc --versionUbuntu20.04'''is as follows</p><p>gcc (Debian 10.2.1[[File:zero2w-6) 10.2.1 20210110</p><p>Copyright (C) 2020 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 PURPOSEimg232.png]]</p></li><li><p>Write the The default version of QT Creator in '''hello_worldUbuntu22.c04''' program in C languageis as follows</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img233.c'''</p><p>#include <stdio.h></p><p>int main(void)</p><p>{</p><p>printf("Hello World!\n");</p><p>return 0;</p><p>}png]]</p></li><li><p>Then compile and run The default version of QT Creator in '''hello_world.cDebian11'''is as follows</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg234.c'''png]]</p></li><li><p>orangepi@orangepi:~$ The default version of QT Creator in '''./hello_worldDebian12'''is as follows</p><p>Hello World![[File:zero2w-img235.png]]</p></li></ol>
</li>
<li><p>Debian Bullseye has Python3 installed by defaultThen set up QT</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific version of Python is as follows</p><p>orangepi@orangepi:~$ First open '''python3Help'''</p><p>->'''Python 3About Plugins..9.2''' (default, Feb 28 2021, 17:03:44).</p><p>[GCC 10[File:zero2w-img236.2.1 20210110png]] on linux</p><p/li>Type "help", "copyright", "credits" or "license" for more information.</pli><p>>>>Then remove the check mark of '''ClangCodeModel'''</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode[[File:zero2w-img237.'''png]]</p></li><li><p>Write the '''hello_world.py''' program in Python language</pspan style="color:#FF0000">After setting up, you need to restart QT Creator<p/span>orangepi@orangepi:~$ '''vim hello_world.py'''</p></li><pli>print('Hello World!')</p>Then make sure the GCC compiler used by QT Creator. If the default is Clang, please change it to GCC.</lip>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <libig><p>The result of running '''hello_worldDebian12 please skip this step.py''' is as follows</p></big>|}<p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img238.py'''png]]</p><p>Hello World![[File:zero2w-img239.png]]</p></li></ol>
</li>
<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 Then you can use the following command to install openjdk. The latest > version in Debian Bullseye is openjdk-17open a sample code</p><p>orangepi@orangepi[[File:~$ '''sudo apt install zero2w-y openjdk-17-jdk'''img240.png]]</p></li><li><p>After installationclicking on the sample code, you the corresponding instruction document will automatically open. You can check read the Java versioninstructions carefully.</p><p>orangepi@orangepi[[File:~$ '''java zero2w--version'''img241.png]]</p></li><li><p>Write the Java version of Then click '''hello_world.javaConfigure Project'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img242.java'''png]]</p><p/li>public class hello_world</pli><p>{Then click the green triangle in the lower left corner to compile and run the sample code</p><p>public static void main(String[[File:zero2w-img243.png]] args)</p></li><li><p>{After waiting for a period of time, the interface shown in the figure below will pop up, which means that QT can compile and run normally.</p><p>System[[File:zero2w-img244.out.println("Hello World!");png]]</p><p>}</pli><pli>}</p>References</lip><li>{| class="wikitable" style="width:800px;" |-| <p>Then compile and run [https://wiki.qt.io/Install_Qt_5_on_Ubuntu '''hello_worldhttps://wiki.qt.javaio/Install_Qt_5_on_Ubuntu''']</p><p>orangepi@orangepi[https:~$ //download.qt.io/archive/qtcreator '''javac hello_worldhttps://download.qt.javaio/archive/qtcreator''']</p><p>orangepi@orangepi[https:~$ //download.qt.io/archive/qt '''java hello_worldhttps://download.qt.io/archive/qt''']</p><p>Hello World!</p></li></ol>|}
</li></ol>
<span id="debianros-bookworminstallation-systemmethod"></span> == ROS installation method == <span id="how-to-install-ros-1-noetic-on-ubuntu20.04"></span>=== Debian Bookworm system How to install ROS 1 Noetic on Ubuntu20.04 === # The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys''' ::[[File:zero2w-img245.png]]
'''https://wiki.ros.org/Distributions'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Ubuntu Focal is installed with The link to the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system official installation documentation of the development board.ROS 1 '''Noetic Ninjemys''' is as follows:</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>The version of a[http://wiki.ros.gcc is as follows<org/noetic/Installation/p><p>orangepi@orangepi:~$ Ubuntu '''gcc --version'''<http://p><p>gcc (Ubuntu 9wiki.4ros.0-1ubuntu1~20.04.1) 9.4.0<org/noetic/Installation/p><p>Copyright (C) 2019 Free Software Foundation, Inc.Ubuntu''']</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 In the official installation documentation of ROS '''hello_worldNoetic Ninjemys''', Ubuntu recommends using Ubuntu20.c04, so please ensure that the system used by the development board is ''' program in C language</pspan style="color:#FF0000">Ubuntu20.04 desktop system<p/span>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include <{| class="wikitable" style="width:800px;stdio.h></p>" <p>int main(void)</p>|-<p>{</p>| <p>printf("Hello World!\n");<[http:/p><p>return 0;</p><p>}<wiki.ros.org/p><noetic/li><li><p>Then compile and run Installation '''hello_worldhttp://wiki.cros.org/noetic/Installation''']</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg247.c'''png]]</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Focal has Python3 installed by defaultThen use the script below to install ros1</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The specific version of Python3 is as follows</p>|-<p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write the '''hello_world.py''' program in Python language</p><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>| <p>orangepi@orangepi:~$ '''python3 hello_worldinstall_ros.pysh ros1'''</p><p>Hello World!</p></li></ol>|}
</li>
<li><p>Ubuntu Focal does not have Java compilation tools Before using the ROS tool, you first need to initialize rosdep. Then when compiling the source code, you can quickly install some system dependencies and running environment installed by defaultsome core components in ROS.</p></li><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p>| <pbig>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</pspan style="color:#FF0000"></li><li><p>After installationNote that when running the following command, you need to ensure that the development board can check the Java version.</p><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.04access github normally, mixed mode, sharing)</p></li><li><p>Write the Java version of '''hello_worldotherwise an error will be reported due to network problems.java'''</p><pspan>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("Hello World!");</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</p><p>orangepi@orangepi:~$ '''javac hello_world.java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol>
'''<span idstyle="how-to-upload-files-using-scp-commandcolor:#FF0000">ERROR: error loading sources list:</span>==== How to upload files using scp command ===='''
::'''<ol span style="list-style-typecolor: decimal;#FF0000">The read operation timed out<li/span><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'''</pbig><ol |}{| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to > be uploaded</p></li>|-<li><p>'''orangepi: '''This is the user name of the development board's > Linux system. It can also be replaced with something else, > such as root.</p></li>| <li><p>'''192.168.xx.xx:''' This is the IP address of the development > board. Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux > system can also be modified to other paths.</p><p>test@testorangepi:~$ '''scp file_path orangepi@192.168.xx.xx:/homesource /orangepiopt/'''<ros/p></li></ol></li><li><p>If you want to upload a folder, you need to add the -r parameter<noetic/p><p>test@test:~$ '''scp -r dir_path orangepi@192.168.xxsetup.xx:/home/orangepi/bash'''</p></li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li></ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select open a command line terminal window on the '''Always trust this hostdesktop''' , and click then use the '''OKtest_ros.sh'''script to start a small turtle routine to test whether ROS can be used normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''test_ros.sh'''</p>|}</li><li><p>After running the '''test_ros.sh''' script, a small turtle as shown in the picture below will pop up.</p><p>[[File:zero2w-img248.png]]</p></li><li><p>Then please keep the terminal window you just opened at the top</p></olli>
<div class="figure">
[[File:zero2w-img266img249.png]]
</div></ol><ol start="79" style="list-style-type: decimal;"><li>After the connection is successful<p>At this time, you can see press the directory structure of direction keys on the development board's Linux file system on keyboard to control the little turtle to move up, down, left, and right side of the filezilla software.</p><p>[[File:zero2w-img250.png]]</p></li></ol>
<div classspan id="figurehow-to-install-ros-2-galactic-on-ubuntu20.04"></span>
<span id="instructionsp>ros2 is an extensible command-line tool for-using-the-logo-on-and-off-the-machine">ROS 2.</spanp>== Instructions for using the logo on and off the machine ==
<span id="how-to-turn-onp>optional arguments:</p>:<p>-theh, -power-button-in-linux5.4">help show this help message and exit</spanp>== How to turn on the power button in Linux5.4 ==
:<ol style="listp>Call `ros2 <command> -style-type: decimal;"h` for more detailed usage.</p>|}</li><li><p>First run Then you can use the '''orangepi-configtest_ros.sh'''script to test whether ROS 2 is installed successfully. Ordinary users remember to add '''sudo''' permissionsIf you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-configtest_ros.sh'''</p></li><li><p>Then select '''System'[INFO] [1671174101.200091527] [talker]: Publishing: 'Hello World: 1'</p><p>[INFO] [File:zero2w-img801671174101.png235661048][listener]: I heard: [Hello World: 1]</p></li><li><p>Then select '''Hardware'[INFO] [1671174102.199572327] [talker]: Publishing: 'Hello World: 2'</p><p>[INFO] [File:zero2w-img811671174102.png204196299] [listener]: I heard: [Hello World: 2]</p></li><li><p>Then use the keyboard[INFO] [1671174103.199580322] [talker]: Publishing: 's arrow keys to locate the position shown in the picture below, and then use the Hello World: 3'''space''' to select the dtbo configuration of the SPI you want to open.</p><p>[INFO] [File:zero2w-img2701671174103.png204019965][listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Then select '''<Save>''' Run the following command to saveopen rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img83~$ '''source /opt/ros/galactic/setup.png]]bash'''</p></li><li><p>Then select orangepi@orangepi:~$ '''<Back>ros2 run rviz2 rviz2'''</p>|}<p>[[File:zero2w-img84img253.png]]</p></li><li><p>Then select '''<Reboot>''' For how to restart the system use ROS, please refer to make the configuration take effectdocumentation of ROS 2.</p>{| class="wikitable" style="width:800px;" |-| <p>[[Filehttp://docs.ros.org/en/galactic/Tutorials.html '''http:zero2w-img85//docs.ros.org/en/galactic/Tutorials.png]html''']</p>|}</li></ol> <span id="how-to-install-ros-2-humble-on-ubuntu22.04"></span>
<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 Use the file system to lose some datainstall_ros. It is recommended sh script to use the '''poweroffinstall_ros.sh''' 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 poweroffinstall_ros.sh ros2'''</p><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>|}</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><p>The '''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 the method of opening the power button in Linux5.4install_ros.sh'''</p></li><li><p>Use script will automatically run the '''rebootros2 -h''' command to restart after installing ros2. If you can see the Linux system in following print, it means that the development boardros2 installation is complete.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepiusage:~$ '''sudo''' '''reboot'''</p></li></ol> <span id="linuxros2 [-sdkorangepi-buildh] Call `ros2 <command> -h` for more detailed usage-instructions">. ...</spanp>
<span id="compilationp>ros2 is an extensible command-system-requirements">line tool for ROS 2.</spanp>== Compilation system requirements ==
<ol style="list-style-type: lower-alphadecimal;"><li>For <p>The Linux image released by OPi comes with the method deb package of replacing Tsinghua Sourcethe kernel header file by default, please refer to and the instructions on this pagestorage location is '''/opt/'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}</li><li><p>Use the following command to install the deb package of the kernel header file</olp>{| class="wikitable" style="width:800px;" [https|-| <p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/mirrorslinux-headers*.tuna.tsinghua.edu.cndeb'''</helpp>|}</ubuntuli><li><p>After installation, you can see the folder where the kernel header file is located under '''/ usr/src'''https.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /usr/src'''</mirrorsp><p>linux-headers-x.tunax.tsinghuax</p>|}</li><li><p>Then you can compile the source code of the hello kernel module that comes with the Linux image.edu.cnThe source code of the hello module is in '''/helpusr/ubuntusrc/hello''']. After entering this directory, then use the make command to compile.</p> <ol start{| class="2wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</p><p>make -typeC /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1]: lowerEntering directory '/usr/src/linux-alpha;"headers-5.4.125'</p>:<lip>Note that the Ubuntu version needs to be switched to 22CC [M] /usr/src/hello/hello.04o</p>:<p>Building modules, stage 2.</lip>:<p>MODPOST 1 modules</olp>:<p>CC [M] /usr/src/hello/hello.mod.o</p>:<p>LD [M] /usr/src/hello/hello.ko</p><p>make[File1]:zero2wLeaving directory '/usr/src/linux-img271headers-5.png]]4.125'</p>|}<ol start/li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p>{| class="3wikitable" style="list-style-typewidth: lower-alpha800px;"|-| <p>orangepi@orangepi:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p>|}</li><li>The contents of <p>Use the '''insmod''' command to insert the '''hello.ko''' kernel module into the kernel</etcp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/aptusr/sourcessrc/hello$ '''sudo insmod hello.listko''' file that need to be replaced are:</p>|}</li><li><p>Then use the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If you can see the following output, it means that the '''hello.ko''' kernel module is loaded correctly.</olp>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/usr/src/hello$ '''sudo mv dmesg | grep "Hello"'''</etc/apt/sourcesp><p>[ 2871.list cat 893988] '''Hello Orange Pi -- init'''</etcp>|}</apt/sourcesli><li><p>Use the '''rmmod''' command to uninstall the '''hello.list.bakko'''kernel module</p>{| class="wikitable" style="width:800px;" |-| test<p>orangepi@testorangepi:~/usr/src/hello$ '''sudo vim rmmod hello'''</etcp><p>orangepi@orangepi:/aptusr/sourcessrc/hello$ '''dmesg | grep "Hello"'''</p><p>[ 2871.list893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}# The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary.</li></ol>
|-
| '''branch'''| <p>orangepi@orangepi:~$ '''ugcc -boot Versiono hello_world hello_world.c'''</p>| <p>orangepi@orangepi:~$ '''linux Kernel version./hello_world'''</p><p>Hello World!</p>|-}</li></ol></li>| '''current'''<li><p>Debian Bullseye has Python3 installed by default</p>| '''u<ol style="list-style-type: lower-boot v2018.05'''alpha;"><li><p>The specific version of Python is as follows</p>{| '''linux5.4'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''python3'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)</p><p>[GCC 10.2.1 20210110] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></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 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 version in Debian Bullseye is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''nextsudo 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:~$ '''ujava --boot v2021version'''</p>|}</li><li><p>Write the Java version of '''hello_world.07java'''</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("Hello World!");</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''linux6javac hello_world.1java'''</p><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p>
|}
</li></ol>
</li></ol>
<ol style="list-style-type: decimal;">
<li><p>Debian Bookworm is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<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:~$ '''build.shgcc --version''': Compile startup script</p><p>gcc (Debian 12.2.0-14) 12.2.0</lip><lip>Copyright (C) 2022 Free Software Foundation, Inc.</p><p>'''external''': Contains configuration files needed to compile This is free software; see the image, specific scripts, and source code of some programs, etcfor copying conditions.There is NO</p></li><li><p>'''LICENSE''': GPL 2 license filewarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''READMEhello_world.mdc''': orangepi-build documentationprogram in C language</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''scriptsvim hello_world.c''': Common script for compiling linux images</p></lip>#include <stdio.h></olp>
:<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>linux5<p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.411.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type "help", "copyright", "credits" or "license" for more information.</p><p>>>></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 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("Hello World!");</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>
<ol style="list-style-type: decimal;">
<li><p>Ubuntu Focal is installed with the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018<p>The version of a.05gcc 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 <stdio.h></olp>
<ol start="2" style="list-style-type: lower-alpha;"p>int main(void)</p><lip>v2021.07{</lip>:<p>printf("Hello World!\n");</olp>
:<span id="orangepi-build-complete-directory-structure-description"p>return 0;</spanp>=== orangepi-build complete directory structure description ===<p>}</p>|}<ol style="list-style-type: decimal;"/li><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot Then compile and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouserun '''hello_world.c'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li>|-| <p>The git warehouse where the linux kernel source code is stored is as followsorangepi@orangepi:~$ '''gcc -o hello_world hello_world. Please note that the branch of the linux-orangepi warehouse is switched toc'''</p><ol style="list-style-typep>orangepi@orangepi: lower-alpha;"~$ '''./hello_world'''</p><lip>Linux5.4Hello World!</li></olp>|}
</li></ol>
</li></ol> https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-5.4-sun50iw9''' <ol start="2" style="list-style-type: lower-alpha;"><li>Linux6.1</li></ol> https://github.com/orangepi-xunlong/linux-orangepi/tree/'''orange-pi-6.1-sun50iw9''' <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 toUbuntu Focal has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018.05</lip>The specific version of Python3 is as follows</olp>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''python3'''</olp> https<p>Python 3.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</githubp><p>Type "help", "copyright", "credits" or "license" for more information.com</orangepi-xunlongp><p>>>></up>|}{| class="wikitable" style="background-bootcolor:#ffffdc;width:800px;" |-orangepi| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></treebig>|}</li><li><p>Write the '''v2018hello_world.05-h618py'''program in Python language</p> <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>v2021orangepi@orangepi:~$ '''vim hello_world.07py'''</lip><p>print('Hello World!')</olp>|}https://github.com/orangepi-xunlong/u-boot-orangepi/tree</li><li><p>The result of running '''v2021hello_world.07-sunxipy'''is as follows</p> <ol start{| class="2wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>When orangepi-build is run for the first time, it will download the cross-Ubuntu Focal does not have Java compilation tool chain, u-boot tools and linux kernel source coderunning environment installed by default. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</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:~$ '''build.shsudo apt install -y openjdk-17-jdk''': Compile startup script</p>|}</li><li><p>'''external''': Contains the configuration files needed to compile the imageAfter installation, scripts for specific functions, and you can check the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in externalJava version.</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''kerneljava --version''': Store the source code of the linux kernel</p><p>openjdk 17.0.2 2022-01-18</lip><lip>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>'''LICENSE''': GPL OpenJDK 64-Bit Server VM (build 17.0.2 license file+8-Ubuntu-120.04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''READMEhello_world.mdjava''': orangepi-build documentation</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''outputvim hello_world.java''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p><p>public class hello_world</lip><lip>{</p>'''scripts''': Common script for compiling linux images</p>public static void main(String[] args)</lip>:<lip>{</p>'''toolchains''':: Store cross-compilation tool chain</p>System.out.println("Hello World!");</lip>:<lip>}</p><p>'''u-boot''': Store the source code of u-boot}</p>|}</li><li><p>Then compile and run '''userpatcheshello_world.java''': Store the configuration files needed to compile the script</p></li></ol>{| class="wikitable" style="width:800px;" |-| </lip></ol> testorangepi@testorangepi:~/orangepi-build$ '''lsjavac hello_world.java'''</p> <p>orangepi@orangepi:~$ '''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatchesjava hello_world'''</p><span id="compile-u-boot"p>Hello World!</spanp>== Compile u-boot ==|}</li></ol># Run the build.sh script, remember to add sudo permissions test@test:~</orangepi-build$ '''sudo .li></build.sh'''ol>
<ol startspan id="2" style="listubuntu-stylejammy-type: decimal;system"><li>Select '''U-boot package''' and press Enter</li></olspan>
<ol style="list-style-type: lower-alpha;">
<li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 imageof a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</lip><li><p>The next branch will compile the ugcc (Ubuntu 11.3.0-boot v20211ubuntu1~22.07 version code that needs to be used by the linux604.1 image) '''11.3.0'''</p><p>[[File:zero2w-img276Copyright (C) 2021 Free Software Foundation, Inc.png]]</p><p>This is free software; see the source for copying conditions. There is NO</lip><p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</olp>|}
</li>
<li><p>If you select Write the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch'''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</lip><p>#include <stdio.h></olp>
<blockquotep>int main(void)</p><p>{</p>:<p>printf("Hello World!\n");</p>a. If the development board you purchased has a memory size of 1.5GB, please select the first option.
:<p>return 0;<ol start/p><p>}</p>|}</li><li><p>Then compile and run '''hello_world.c'''</p>{| class="6wikitable" style="listwidth:800px;" |-style| <p>orangepi@orangepi:~$ '''gcc -typeo hello_world hello_world.c'''</p><p>orangepi@orangepi: decimal;"~$ '''./hello_world'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Then it will start to compile u-boot. Some of the information prompted when compiling the next branch is as follows:Ubuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>Version <p>The specific version of uPython3 is as follows</p>{| class="wikitable" style="width:800px;" |-boot source code| <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 "help", "copyright", "credits" or "license" for more information.</p><p>>>></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("Hello World!");</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>
<ol startspan id="7" style="listmethod-to-upload-files-styleto-type: decimal;"><li>View the compiled u-boot deb package</lidevelopment-board-linux-system-in-ubuntu-pc"></olspan>=== Method to upload files to the development board Linux system in Ubuntu PC ===
<ol style="list-style-type: lower-alpha;">
<li>First upload <p>'''file_path: '''Needs to be replaced with the compiled deb package path of u-boot the file to be uploaded</p></li><li><p>'''orangepi: '''This is the user name of the development board's Linux system . It can also be replaced with something else, such as root.</p></li><li><p>'''192.168.xx.xx:''' This is the IP address of the development board.Please modify it according to the actual situation.</p></li><li><p>'''/home/orangepi:''' The path in the development board Linux 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/'''</olp>|}
</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>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''man scp'''
|}
</ol>
<span id="how-to-upload-files-using-filezilla"></span>
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''linuxsudo apt install -uy filezilla'''</p>|}</li><li><p>Then use the following command to open filezilla</p>{| class="wikitable" style="width:800px;" |-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root| <p>test@192.168.1.xxxtest:~$ '''filezilla'''</root root@192p>|}</li><li><p>The interface after opening filezilla is as shown below.168At this time, the remote site on the right is empty.1.xxx:</root]'''p><div class="figure">
<ol startdiv class="3figure" style="list-style-type: lower-alpha;"><li>Then run the nand-sata-install script</li></ol>
</div></ol><ol start="45" style="list-style-type: lower-alphadecimal;"><li><p>Then select choose to '''save the password''' and click '''OK'''5 Install</p><p>[[File:zero2w-img257.png]]</Update the bootloader on SDp></eMMCli><li><p>Then select '''Always trust this host''' and click '''OK'''</lip></olli>
<ol startdiv class="6figure" 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-img280img259.png]]
</div></ol><ol start="78" style="list-style-type: lower-alphadecimal;"><li>Then you can restart select the path to be uploaded to the development board on the right side of the filezilla software, select the file to test whether be uploaded in Ubuntu PC on the uleft side of the filezilla software, right-boot modification has taken effectclick the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>
<span iddiv class="compile-the-linux-kernelfigure"></span>== Compile the linux kernel ==
</div>
<ol start="2" style="list-style-type: decimal;">
<li>Select <p>The downloaded installation package is as shown below, then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''Kernel packageFileZilla_Server_1.5.1_win64-setup.exe''' and press Enter</li></olp>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next>'''
<div class="figure">
[[File:zero2w-img281img263.png]]
</div>
</li></ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you will be prompted whether you need to display the kernel configuration The interfaceafter opening filezilla is as shown below. If you do not need to modify the kernel configurationAt this time, select the first one. If you need to modify the kernel configuration, select remote site on the second oneright is empty.</li> </oldiv class="figure">
[[File:zero2w-img282img264.png]]
</div></ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then select the model The method of connecting the development boardis as shown in the figure below:</li> </oldiv class="figure">
[[File:zero2w-img275img256.png]]
</div></ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then select choose to '''save the branch type of the kernel source codepassword''' and click '''OK'''</li></ol>
<blockquotediv class="figure">a. The current branch will compile the linux5.4 kernel source code
</div></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 Then select '''make menuconfigAlways trust this host''' 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.click '''OK'''</li></ol>
<ol startdiv class="2figure" 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-img284img267.png]]
</div></ol><ol start="78" style="list-style-type: decimal;"><li><p>Part Then select the path to be uploaded to the development board on the right side of the information prompted when compiling filezilla software, select the next branch kernel source code is explained as follows:</p><ol style="listfile to be uploaded on the Windows PC on the left side of the filezilla software, right-style-type: lower-alpha;"><li>Version of click the mouse, and then click the upload option to start uploading the file to the linux kernel source code</li></ol>development board.</li></ol>
<ol startspan id="3" style="listinstructions-stylefor-type: lowerusing-alpha;"><li>The default configuration file used by the kernel -logo-on-and -off-the path where it is stored are as follows</li-machine"></olspan>
<ol start="4" style="list-style-type: lowerdecimal;"><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;" |-alpha| <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 path 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 kernelfollowing command to take effect</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo update-initramfs -related deb package generated by compilationu'''</p>|}</li></ol>
<ol start="7" style="list-style-type: lower-alphadecimal;"><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.</lip></ol> [ oFirst run '''orangepi-config'''.k. ] Repeat Build Options [ Ordinary users remember to add '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]permissions.</p> <ol start{| class="8wikitable" style="list-style-typewidth: decimal800px;"|-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>View the kernel-related deb package generated by compilationThen select '''System'''</p><ol style="list-style-typep>[[File: lowerzero2w-alpha;"img80.png]]</p></li><li><p>Then select '''linux-dtb-nextHardware'''</p><p>[[File:zero2w-sun50iw9_ximg81.x.x_arm64.debpng]]</p></li><li><p>Then use the keyboard's arrow keys to locate the position shown in the picture below, and then use the '''space''' Contains dtb files used by to select the dtbo configuration of the kernelSPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''linux-headers-next-sun50iw9_x.x.x_arm64.deb<Save>''' Contains kernel header filesto save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''linux-image-next-sun50iw9_x.x.x_arm64.deb<Back>''' Contains kernel images and kernel modules</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''<Reboot>''' to restart the system to make the configuration take effect.</olp><p>[[File:zero2w-img85.png]]</p></li></ol>
<blockquotespan id="compilation-system-requirements">Set the IGNORE_UPDATES variable in '''userpatches/config-default.conf''' to "yes"</blockquotespan>test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''== Compilation system requirements ==
{| 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>Install Note that the deb package of the new linux kernel just uploadedUbuntu version needs to be switched to 22.04.</li></ol> orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''
[[File:zero2w-img271.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Then restart The contents of the development board and check whether the kernel-related modifications have taken effect'''/etc/apt/sources.list''' file that need to be replaced are:</li><{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo mv /etc/apt/sources.list cat /etc/apt/ol>sources.list.bak'''
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="64" style="list-style-type: decimallower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.<p/li>Then select the type of image{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</pol><ol start="5" style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents <span style="color:#FF0000">In addition, since the image source code of the server versionkernel and Uboot are stored on GitHub, which it is relatively small in sizevery important to ensure that the computer can download the code from GitHub normally when compiling the image.</p></li><li><pspan>'''Image with desktop environment''' Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div classspan id="figureobtain-the-source-code-of-linux-sdk"></span>
</div><ol start="7" stylespan id="listdownload-styleorangepi-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 prebuild-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not prefrom-installed by default. Some functions may not be available''')</ligithub"></olspan>=== Download orangepi-build from github ===
<ol style="list-style-type: lower-alpha;">
<li><p>'''bullseye-xfce-arm64build.5250ec7002de9e81a41de169f1f89721.tar.lz4sh''': Compile startup script</p></li><li><p>'''external''' It is a compressed package : Contains configuration files needed to compile the image, specific scripts, and source code of rootfssome programs, etc. The meaning of each field in the name is</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></olli><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
<ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;" |-| '''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''|}</divol><ol start="82" style="list-style-type: decimallower-alpha;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal versionv2021. The Minimal version will have much less pre07</li>{| class="wikitable" style="width:800px;" |-installed software than the Standard version (| '''please do not choose the Minimal version without special needs, because many things are not pregcc-installed by defaultarm-11.2-2022. Some functions may not be available02-x86_64-aarch64-none-linux-gnu''')|}</liol><span id="orangepi-build-complete-directory-structure-description"></olspan>
<ol style="list-style-type: lower-alpha;">
<li>The storage path <p>If the development board you purchased has a memory size of 1.5GB, please select the first option.</p></li><li><p>If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the compiled imagesecond option.</p><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>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Done building Compiling u-boot [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_xv2021.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img07''' ]|}</ol>
<ol start="2" style="list-style-type: lower-alpha;">
<li>Compilation timeVersion of the cross-compilation tool chain</li></ol>{| class="wikitable" style="width:800px;" |-| '''[ o.k. ] Runtime Compiler version [ 19 min ]'''aarch64-linux-gnu-gcc 11''' ]|}</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>Repeat the command Path to compile the image. Use the following command to start compiling the image directly without selecting it through the graphical interface.compiled u-boot deb package</li></ol>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options Target directory [ '''sudo .orangepi-build/output/debs/build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yesu-boot''' ]|}</ol><span idol start="4" style="instructions-for-using-the-orange-pilist-osstyle-archtype: lower-systemalpha;"></spanli> = '''Instructions for using The package name of the Orange Pi OS Arch system''' = <span id="orange-pi-os-arch-system-function-adaptationcompiled u-status">boot deb package</spanli>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''Motherboard functionslinux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''']|}</ol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| '''OPi OS Arch'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''HDMI video1 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>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''HDMI Audiosudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''']| '''OK'''}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''ls output/debs/u-boot/''' '''Typelinux-u-boot-next-C USB2orangepizero2w_x.0 x 2.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> Set the IGNORE_UPDATES variable in u'OK''userpatches/config-default.conf''' to "yes" {| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''TF Card Startupvim userpatches/config-default.conf'''| ...... IGNORE_UPDATES="'''OK<span style="color:#FF0000">yes</span>'''" ......|}</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>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''cd output/debs/u-boot''' test@test:~/orangepi_build/output/debs/u-boot$ '''WIFIscp \'''| '''OKlinux-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>{| class="wikitable" style="width:800px;"
|-
| orangepi@orangepi:~$ '''Bluetoothsudo dpkg -i'''| '''OKlinux-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>{| class="wikitable" style="width:800px;"
|-
| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| orangepi@orangepi:~$ '''OK'''|sudo nand-| '''Mali GPU'''| '''NO'''|sata-| '''Video codec'''| '''NOinstall'''
|}
</ol>
<ol start="4" style="list-style-type: lower-alpha;">
<li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[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>
[[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>
|-
| '''USB2.0 HOST x 2'''| '''OK'''|test@test:~/orangepi-| build$ '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''Onsudo ./off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NObuild.sh'''
|}
<span idol start="orange-pi-os-arch-system-user2" style="list-guidestyle-instructionstype: decimal;"><li>Select '''Kernel package''' and press Enter</spanli>== Orange Pi OS Arch System User Guide Instructions ==
</div></ol ><ol start="3" style="list-style-type: lower-alphadecimal;"><li><p>After burning Then you will be prompted whether you need to display the kernel configuration interface. If you do not need to modify the systemkernel configuration, when you start it for select the first time and enter one. If you need to modify the desktopkernel configuration, you will see the user wizard program shown in select the figure belowsecond one.</p><div class="figure"li>
[[File:zero2w-img293img282.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img275.png]]</divol></liol start="5" style="list-style-type: decimal;"><li><p>First you need to Then select the language you wantbranch type of the kernel source code</p><div class="figure"li>
::[[File:zero2w-img295img276.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>
[[File:zero2w-img284.png]]</divol></liol><ol start="7" style="list-style-type: decimal;"><li><p>Then select Part of the information prompted when compiling the keyboard modelnext branch kernel source code is explained as follows:</p><div classol style="figurelist-style-type: lower-alpha;"><li>Version of the linux kernel source code</li>[[File{| class="wikitable" style="width:zero2w800px;" |-img297| [ o.k.png]Compiling current kernel [ '''6.1.31''' ]|}</divol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><liol start="3" style="list-style-type: lower-alpha;"><pli>Then create a new username The default configuration file used by the kernel and set a passwordthe path where it is stored are as follows</pli><div {| class="figurewikitable">style="width:800px;" |-| [o.k. ] Using kernel config file [File:zero2w'''orangepi-build/external/config/kernel/linux-6.1-sun50iw9-img298next.png]config''' ]|}</divol></liol start="4" style="list-style-type: lower-alpha;"><li>The path to the kernel-related deb package generated by compilation<p/li>Then make sure there is no problem with the selection, and then click the install {| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''buttonoutput/debs/''']|}</pol><ol start="5" style="list-style-type: lower-alpha;"><div li>The package name of the kernel image deb package generated by compilation</li>{| class="figurewikitable" style=">width:800px;" |-| [o.k. ] File name [File:zero2w'''linux-image-next-img299sun50iw9_x.x.x_arm64.png]deb''' ]|}</divol><ol start="6" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''10 min''' ]|}</ol><liol start="7" style="list-style-type: lower-alpha;"><pli>Then wait for Finally, the installation compilation command to completerepeatedly 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.</pli><div {| class="figurewikitable" style="width:800px;">|-| [o.k. ] Repeat Build Options [File:zero2w-img300'''sudo ./build.png]sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</divol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>After the installation is complete, you need to click View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''Finishlinux-dtb-next-sun50iw9_x.x.x_arm64.deb''' button to restart Contains dtb files used by the systemkernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><div li><p>'''linux-image-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel images and kernel modules</p></li>{| class="figurewikitable" style=">width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/linux-*'''
# First open Run the '''/boot/extlinux/extlinuxbuild.conf''' configuration filesh script, remember to add sudo permissions
<ol start="2" style="list-style-type: decimal;">
<li>Then open the corresponding configuration by adding Select '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.confRootfs and all deb packages'''and press Enter</li></ol>
[orangepi@orangepi[File:zero2w-pc ~img285.png]]$ '''sudo vim /boot/extlinux/extlinux.conf'''
[[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)'''FDTOVERLAYS Represents the image of the server version, which is relatively small in size.</dtbsp></allwinner/overlay/xxx.dtboli><li><p>'''Image with desktop environment''' #Configuration that needs to be addedRepresents an image with a desktop, which is relatively large in size.</p></li>
<ol startdiv class="3figure" 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><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>
[[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> <div class="figure"> [[File:zero2w-img288.png]] </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> [[File:zero2w-img289.png]] [[File:zero2w-img290.png]] You can then select additional packages that need to be installed. Please press the Enter key here to skip directly. [[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>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] local not found [ Creating new rootfs cache for '''Functions on the development boardbullseye''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| '''Corresponding DT overlays configuration'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin orangepi- i2c0build/external/cache/rootfs''']| '''sun50i}</ol><ol start="3" style="list-h616style-pitype: lower-i2c0.dtbo'''alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin bullseye- i2c1xfce-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> :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'sun50i'' 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</ol><ol start="2" style="list-h616style-pitype: lower-i2c1alpha;"><li>'''bullseye-xfce-arm64.dtbo5250ec7002de9e81a41de169f1f89721.tar.lz4.list'''Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - i2c2'''| '''sun50i-h616-pi-i2c2.dtbo'''|-| '''40pin - uart2'''| '''sun50i-h616-pi-uart2.dtbo'''|-| '''40pin - uart3'''| '''sun50i-h616-pi-uart3.dtbo'''|-| '''40pin - uart4'''| '''sun50i-h616-pi-uart4.dtbo'''|-| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|-| '''40pin - pwm3'''| '''sun50i-h616-pi-pwm3.dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''|-| '''40pin - spi1 cs0'''| '''sun50i-h616-spi1-cs0-spidev.dtbo'''|-| '''40pin - spi1 cs1'''| '''sun50i-h616-spi1-cs1-spidev.dtbo'''|-| '''40pin test@test:~/orangepi- spi1 cs0 cs1build$ '''| ls external/cache/rootfs/'''sun50i-h616-spi1-cs0-cs1-spidev.dtbo'''|-| '''设Set USB0 to Host mode'''| '''sun50i-h616-usb0-host.dtbo'''|-| '''Turn off the green LED light'''| '''sun50i-h616-zero2w-disable-led.dtbo'''|-| '''How to close the UART0 debugging serial port'''| '''sun50i-h616-disable-uart0.dtbo'''|}
# Run the '''FDTOVERLAYS /dtbs/allwinner/overlay/sun50i-h616-pi-i2c1build.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbosh'''script, remember to add sudo permissions
[[File:zero2w-img275.png]]</ol><span idol start="4" style="howlist-style-totype: 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-installstyle-softwaretype: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></spanli>== How to install software ==<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
[orangepi@orangepi[File:zero2w-pc ~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>'''sudo pacman -Syy vimImage 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>
<span iddiv class="android-12-tv-system-usage-instructionsfigure"></span>
<span id/div></ol></li></ol><ol start="supported8" style="list-androidstyle-versionstype: 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''')</spanli>== Supported Android versions ==
|-
| [ o.k. ] Done building [ '''Type-C USB2output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.0 x 2.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''']| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;"
|-
| '''TF card startup[ o.k. ] Runtime [ 19 min ]'''| '''OK'''}</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>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''WIFIsudo ./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> = '''OKInstructions for using the Orange Pi OS Arch system'''= <span id="orange-pi-os-arch-system-function-adaptation-status"></span>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''BluetoothMotherboard functions'''| '''OPi OS Arch'''|-| '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''|-| '''Type-C USB2.0 x 2'''| '''OK'''|-| '''TF Card Startup'''| '''OK'''|-| '''WIFI'''
| '''OK'''
|-
| '''USB CameraBluetooth'''
| '''OK'''
|-
| '''OK'''
|-
| '''40pin SPI1SPI'''
| '''OK'''
|-
|-
| '''Mali GPU'''
| '''OK<span style="color:#FF0000">NO</span>'''
|-
| '''Video codec'''
| '''OK<span style="color:#FF0000">NO</span>'''
|}
{| class="wikitable" style="width:800px;text-align: center;"
|-
| '''24pin Expansion expansion board function'''| '''Android12 TVOPi OS Arch'''
|-
| '''100M network port'''
|-
| '''LRADC''' '''Custom buttons x 2'''
| '''OK, The default setting is the volume up and down keys.'''
|-
| '''TV-OUT'''
| '''OK<span style="color:#FF0000">NO</span>'''
|}
<span id="onboardorange-ledpi-lightos-displayarch-system-user-guide-instructions"></span>== Onboard LED light display instructions ==
[[File:zero2w-img303img293.png]]
<span id="how-to-use-adb"/div></spanli>== How <li><p>First you need to use ADB =select the language you want</p><div class="figure">
[service.adb.tcp[File:zero2w-img296.portpng]: [5555]
<ol start="2" style="list-style-type: decimal;"/div></li><li>If '''service.adb.tcp.port''' is not set, you can use the following command in the serial port to set <p>Then select the port number of the network adbkeyboard model</lip></oldiv class="figure">
<ol start="4" style="list-style-type: decimal;"/div></li><li><p>Then connect network adb on Ubuntu PCwait for the installation to complete</lip></oldiv class="figure">
'''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>Check whether <p>The storage path of xxx.dtbo in the ADB device OPi OS Arch image is recognizedas 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></olli>
<!span id="android-12- tv-system-><ol start="2" style="list-styleusage-type: decimal;instructions"><li>HDMI to VGA display test is as follows</li></olspan>
<div classspan id="figureonboard-led-light-display-instructions"></span>== Onboard LED light display instructions ==
</div><ol startspan id="7" style="listhow-to-return-to-the-previous-interface-stylein-type: decimal;android"><li>The display after successful WI-FI connection is as shown below</li></olspan>== How to return to the previous interface in Android ==
<ol startspan id="3" style="listuse-network-connection-styleadb-type: decimal;debugging"><li>Then select '''Network & Internet'''</li></olspan>=== Use network connection adb debugging ===
test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="74" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different Then connect network adb on different mobile phones, the specific interface is subject to the one displayed on your mobile phone)Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.168. At this time, you can open a web page on your mobile phone to see if you can access the Internet1. If the web page can be opened normally, it means that the xxx:5555'''WI-FI Hotspot''' (Need to be modified to the IP address of the development board can be used normally.</li></ol>)'''
<span id="how-to-check-the-ip-address-of-the-ethernet-port"p>* daemon started successfully</spanp>== How to check the IP address of the Ethernet port ==
apollo-p2:/ #|}</ol><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-img306img305.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then select '''Bluetooth'''Install adb tool on Ubuntu PC</li></ol>{| class="wikitable" style="width:800px;" |-| [[Filetest@test:zero2w~$ '''sudo apt-img327.png]]get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open Check whether the ADB device is recognized</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''Bluetooth Enableadb devices'''</li></ol>
4c00146473c28651dd0 device
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''Pair new deviceadb shell'''to start scanning for surrounding Bluetooth devices</li></ol>
<ol style="list-style-type: decimal;"><li><p>Enter first '''Settings'''</p><p>[[File:zero2w-img306.png]]</p></li><li><p>Then select '''Device Preferences'''</p><p>[[File:zero2w-img307.png]]</p></li><li><p>Then select '''Display & Sound'''</p><p>[[File:zero2w-img308.png]]</p></li><li><p>Then select '''Advanced display settings'''</p><p>[[File:zero2w-img309.png]]</p></li><li><p>Then select '''HDMI output mode'''</p><p>[[File:zero2w-img310.png]]</p></li><li><p>Then you can see the list of resolutions supported by the monitor. At this time, clicking the corresponding option will switch to the corresponding resolution. Please note that different monitors may support different resolutions. If you connect it to a TV, you will generally see more resolution options than the picture below.</p><p>[[File:zero2w-img311.png]]</p></li><li><p>The HDMI output of the development board supports 4K display. When connected to a 4K TV, you can see the 4K resolution option.</p><p>[[File:zero2w-img330img312.png]]</p></li></ol>
<ol startspan id="6" style="listhdmi-to-vga-display-styletest-type: decimal;1"><li/span>Then click on the Bluetooth device you want === HDMI to connect to start pairing. When the following interface pops up, please use the mouse to select the '''Pair'''option</li></ol>VGA display test ===
[[File:zero2w-img144.png]]</ol><ol start="72" style="list-style-type: decimallower-alpha;"><li>What is tested here is the Bluetooth configuration process between the development board A VGA cable and the Android phone. At this time, the following confirmation interface will pop up on the phone. Click the pairing button on the phone a Mini HDMI male to start the pairing process.HDMI female adapter</li></ol>
[[File:zero2w-img332img145.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="82" style="list-style-type: decimal;"><li>After pairing HDMI to VGA display test is completed, open '''Paired devices''' and you will see the paired Bluetooth devices.as follows</li></ol>
[[File:zero2w-img333img313.png]]
::[[File:zero2w-img335img306.png]]
<span idol start="how-to-set-usb0-to-host2" style="list-modestyle-1type: decimal;"><li>Then select '''Network & Internet'''</spanli>== How to set USB0 to HOST mode ==
[[File:zero2w-img160img315.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>
</div></ol><ol start="27" style="list-style-type: lower-alphadecimal;"><li>Run the following command to switch back to Device modeThe display after successful WI-FI connection is as shown below</li></ol>
[[File:zero2w-img320.png]]<span id/ol><ol start="5" style="howlist-tostyle-use-usb-cameratype: 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)</spanli>== How to use USB camera ==
[[File:zero2w-img323.png]]</devol><span id="how-to-check-the-ip-address-of-the-ethernet-port"></video0span>
::[[File:zero2w-img336img107.png]]
<ol start="2" style="list-style-type: decimal;"><li><p>Then make sure the network port of the expansion board is connected to the router or switch</p></li><li><p>Then open '''Settings'''</p><p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''Network & Internet'''</p><p>[[File:zero2w-img325.png]]</divp></li><div class="figure"li><p>Then you can see the IP address of the development board's wired network port at the location shown in the picture below.</p><p>[[File:zero2w-img326.png]]</p></li></ol>
[[File:zero2w-img327.png]]</ol><ol start="73" 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.Open '''Bluetooth Enable'''</li></ol>
[[File:zero2w-img328.png]]<span id/ol><ol start="4" style="android-systemlist-rootstyle-descriptiontype: decimal;"><li>Then click '''Pair new device'''to start scanning for surrounding Bluetooth devices</spanli>== Android system ROOT description ==
[[File:zero2w-img329.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The searched Bluetooth devices will be displayed under '''The Android system released by Orange Pi has been ROOT and can be tested using the following method.Available devices'''</li>
[[File:zero2w-img331.png]]<div class/ol><ol start="7" style="figurelist-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>
[[File:zero2w-img336img332.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>
[[File:zero2w-img333.png]]</divol><div classol start="figure9"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>
[[File:zero2w-img339img334.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>
[[File:zero2w-img335.png]]</divol><ol startspan id="2" style="listhow-to-set-usb0-to-host-stylemode-type: decimal;1"><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 "'''How to use ADB'''".</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></olspan>
[[File:zero2w-img340img160.png]]
<ol start="6" style="list-style-type: decimallower-alpha;"><li>Then you can click Run the following command to set USB0 to HOST mode:</li>{| class="wikitable" style="width:800px;" |-| apollo-p2:/ # '''CHECK NOWcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host''' 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>
apollo-p2:/ #|}</ol><span idol start="2" style="howlist-tostyle-use-miracastreceivertype: lower-alpha;"><li>Run the following command to-cast-the-mobile-phone-screen-switch back to-the-development-board">Device mode</spanli>{| class="wikitable" style= How to use MiracastReceiver to cast the mobile phone screen to the development board =="width:800px;" |-| apollo-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''
<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 "[[File:zero2w-img269.pngOrange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</p></li><li><p>Download the USB camera test APP from the '''official tool''' on the development board information download page</p></li>
[[File:zero2w-img349img336.png]]
[[File:zero2w-img350img337.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>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install usbcamera.apk'''|}</ol><ol start="6" style="list-style-type: decimal;"><li>After shutting downinstallation, press and hold you can see the power button or startup icon of the power button USB camera on the infrared remote control again to turn it onAndroid desktop.</li>
[[File:zero2w-img338.png]]</ol><span idol start="7" style="pinlist-interfacestyle-gpiotype: decimal;"><li>Then double-uart-spi-test"click to open the USB camera APP and you can see the output video of the USB camera.</li></spanol>== 40pin interface GPIO, UART, SPI test ==
{| class="wikitable" style="background-color:# First open wiringOP APP on ffffdc;width:800px;" |-| <big>'''The Android system released by Orange Pi has been ROOT and can be tested using the desktopfollowing method.'''</big>|}
<ol startdiv class="2figure" style="list-style-type: decimal;"><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li></ol>
::[[File:zero2w-img352img336.png]]
<ol start="3" style="list-style-type: decimal;"/div><li>The GPIO test interface is as shown in the div class="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-img353img339.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 "[[Orange Pi Zero 2W#How to use ADB|'''How to use ADB''']]".</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>
{| class="wikitable" style="width:800px;"
|-
|
test@test:~$ '''adb install rootcheck.apk'''
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li> [[File:zero2w-img340.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The display interface after opening the '''GPIO READALLROOT test tool''' button, and for the output information first time is as shown below</li> [[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> [[File:zero2w-img342.png]]</ol><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>
<li><p>The interface after '''MiracastReceiver''' is opened is as follows</p>
<div class="figure">
[[File:zero2w-img354img344.png]]
</div><ol start="5" style="list-style-type: decimal;"/li><li>There are a total of 28 GPIO ports available <p>Then find the screen mirroring function in the 40-pin development boardphone settings. The following takes pin 12 - corresponding to GPIO PI01 - corresponding to wPi serial number 6 - Here we take '''Xiaomi 12S Pro mobile phone''' as an example to demonstrate how to set the high and low levels . Please research other brands of mobile phones by yourself. As shown in the GPIO port. First picture below, click the '''CheckBox''' button corresponding in the red box to pin 12open the screen mirroring function of the phone.</p><p>[[File:zero2w-img345. When the button is selectedpng]]</p></li><li><p>After waiting for a period of time, pin 12 you will be set able to high level. After settingsee the searched connectable devices on your mobile phone, you and then we can use a multimeter select the device corresponding to measure the value of development board to connect.</p><p>[[File:zero2w-img346.png]]</p></li><li><p>Then the selection box shown in the figure below will pop up in the voltage '''MiracastReceiver''' application interface of the pindevelopment board. If it is Here we can select '''3.3vAccept''', it means </p><p>[[File:zero2w-img347.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the setting High level successdevelopment board</p><p>[[File:zero2w-img348.png]]</p></li></ol>
[[File:zero2w-img350.png]] After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on. <span id="pin-interface-gpio-uart-spi-test"></span>== 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>=== 40pin GPIO port test method === # 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> [[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> [[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> <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> [[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> [[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> [[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> [[File:zero2w-img358.png]]</ol><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'''
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''<span style="color:#FF0000">226</span>'''| '''<span style="color:#FF0000">PH2</span>'''| '''<span style="color:#FF0000">UART5_TX</span>'''| '''11'''|| '''12'''| <span style="text-aligncolor: left;#FF0000"|| '''PI1'''| '''257>11</span>'''
|-
| '''<span style="color:#FF0000">227</span>'''| '''<span style="color:#FF0000">PH3</span>'''| '''<span style="color:#FF0000">UART5_RX</span>'''| '''13'''|| '''14'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>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'''|| '''16'''| '''PWM4'''| '''PI14'''| '''270</span>'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}
|-
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''228'''
|-
| '''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>'''
|-
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''34'''
| '''GND'''
| 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>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 /dev/ttyAS1 '''<span style="color:#FF0000">/dev/spidev1.0 ttyAS2 /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 '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the upper left cornerselection box</p><p>[[File:zero2w-img361. If png]]</p></li><li><p>Enter the baud rate you test want to set in the onboard SPIFlash directlyedit box, just keep and then click the default '''/dev/spidev0.0OPEN'''button to open the uart node. If After the opening is successful, the '''w25qxxOPEN''' module is connected to button becomes unselectable, and the 40pin spi1 cs0, then please select'''/dev/spidev1.0CLOSE''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select button and '''/dev/spidev1.1SEND'''button become selectable.</p><div class="figure"/li>
[[File:zero2w-img366img362.png]]</ol><ol start="8" style="list-style-type: decimal;"><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>
[[File:zero2w-img363.png]]</divol></liol start="10" style="list-style-type: decimal;"><li><p>Then click If everything is normal, the '''OPEN''' button to initialize received string will be displayed in the SPI</p>receiving box</li></ol>
[[File:zero2w-img367img364.png]]</ol><span id="pin-spi-test-method"></span>
<ol start="9" div style="list-style-typedisplay: decimalflex;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></ol> [[File:zero2w-img369.png]] <ol start:{| class="10wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li>If the w25qxx module connected to 40pin SPI1 is read, the ID information of the onboard SPI Flash is also similar.</li></ol> <span id="pin-i2c-test-method"></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"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PWM3'''
| '''7'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|}{| '''36'''| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''Pin'''| '''Function'''| '''PC12GPIO'''| '''76GPIO NO.'''
|-
| '''2722'''| '''PI165V'''| 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;"|
| '''PI3'''| '''259'''|} <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to i2c1 is '''/dev/i2c-1''', and the device node corresponding to i2c2 is '''/dev/i2c-2'''</li></ol> apollo-p2:/ # '''ls /dev/i2c-*''' '''/dev/i2c-1 /dev/i2c-2''' /dev/i2c-5 <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 '''I2C_TEST''' button to open the i2c test interface</li></ol> [[File:zero2w-img370.png]] <ol start="5" style="list-style-type: decimal;"><li>The i2c test interface of wiringOP is shown in the figure below</li></ol> [[File:zero2w-img371.png]] <ol start="6" style="listtext-style-typealign: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</li></ol> [[File:zero2w-img372.png]] <ol start="7" style="list-style-type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</li></ol> [[File:zero2w-img178.png]] <ol start="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:zero2w-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;"><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></ol> <span id="pin-pwm-test"></span>=== 40pin PWM test === # As can be seen from the table below, the available pwm are pwm1, pwm2, pwm3 and pwm4. {| class="wikitable"|-| '''GPIO serial number'''| '''GPIO'''| '''Function'''| '''pin'''|| '''pin16'''| '''FunctionPWM4'''| '''GPIOPI14'''| '''GPIO serial number270'''
|-
| '''18'''
| style="text-align: left;"|
|-
| '''26420'''| '''PI8'''| '''TWI1-SDA'''| '''3'''|| '''4'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26322'''| '''PI7UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''28'''| '''TWI2-SCL'''| '''5PI9'''|'''265'''|-| '''630'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26932'''| '''PI13PWM1'''| '''PWM3PI11'''| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0'''| '''224267'''
|-
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1236'''
| style="text-align: left;"|
| '''PI1PC12'''| '''25776'''|}</div> <ol start="2" style="list-style-type: decimal;"><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;" |-| apollo-p2:/ # '''ls /dev/spidev1.*''' '''<span style="color:#FF0000">/dev/spidev1.0 /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 open wiringOP APP on the desktop</li> [[File:zero2w-img351.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="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'''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please select'''/dev/spidev1.0''', if the w25qxx module is connected to the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''</p><div class="figure"> [[File:zero2w-img366.png]] </div></li><li><p>Then click the '''OPEN''' button to initialize the SPI</p></li> [[File:zero2w-img367.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="9" style="list-style-type: decimal;"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li> [[File:zero2w-img369.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> <span id="pin-i2c-test-method"></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. <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''<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>'''|-| '''<span style="color:#FF0000">263</span>'''| '''<span style="color:#FF0000">PI7</span>'''| '''<span style="color:#FF0000">TWI1-SCL</span>'''| '''<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3'''| '''7'''|-| style="text-align: left;"|| style="text-align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''
| '''UART2_TX'''
| '''15'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|-
| '''<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'''
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| 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'''| '''405V'''
| style="text-align: left;"|
| style="text-align: left;"||-| '''PI36'''| '''259GND'''|} <ol startstyle="2text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''8'''| '''UART0_TX'''| '''PH0'''| '''224'''|-| '''10'''| '''UART0_RX'''<li>First click the wiringOP icon to open wiringOP APP</li></ol>| '''PH1'''| '''225'''[[File:zero2w|-img351.png]]| '''12'''<ol start="3" | style="list-styletext-typealign: decimalleft;">|<li>Then click the | '''PWM_TESTPI1''' button on the main interface of wiringOP to enter the PWM test interface</li></ol>| '''257'''[[File:zero2w|-img380.png]]| '''14'''| '''GND'''<ol start| style="4text-align: left;" || style="list-styletext-typealign: decimalleft;">||-<li>The PWM test interface is as follows</li></ol>| '''16'''| '''PWM4'''<div class="figure">| '''PI14'''| '''270'''[[File:zero2w|-img381.png]]| '''18'''</div><ol start="5" | style="listtext-style-typealign: decimalleft;">|<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></ol>| '''PH4'''| '''228'''[[File:zero2w|-img382.png]]| '''20'''| '''GND'''<ol start| style="6text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''|-| '''24'''<li>Then you can set the PWM period. The default configuration is | '''50000nsSPI1_CS0'''. The converted PWM frequency is | '''20KHzPH5'''</li></ol>| '''229'''[[File:zero2w|-img383.png]]| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<ol start="7" span style="list-style-typecolor: decimal;#FF0000">28<li/span>Then click the '''EXPORT| '''button to export PWM</lispan style="color:#FF0000">TWI2-SCL</olspan>''' [[File:zero2w-img384.png]] | '''<ol start="8" span style="list-style-typecolor: decimal;#FF0000">PI9<li/span>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable| ''' to output the PWM waveform.</lispan style="color:#FF0000">265</olspan>'''|-[[File:zero2w-img385.png]]| '''30'''| '''GND'''<ol start| style="9text-align: left;" || style="listtext-style-typealign: decimalleft;">||-| '''32'''| '''PWM1'''<li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li></ol>| '''PI11'''| '''267'''[[File:zero2w|-img386.png]]| '''34'''<span id| '''GND'''| style="howtext-toalign: left;"|| style="text-compile-android-12-source-codealign: left;"></span>||-= | '''How to compile Android 12 source code36''' = <span id| style="downloadtext-the-source-code-of-android-12align: left;"></span>|| '''PC12'''| '''76'''== Download the source code of Android 12 ==|-| '''38'''<ol | style="list-styletext-typealign: decimalleft;">|| '''PI4'''| '''260'''|-<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>| '''40'''<ol | style="listtext-style-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''<li>Google Cloud Drive</li></ol>|}</li></oldiv>
'''<span style="color:#FF0000">/dev/i2c-1 /dev/i2c-2</span>''' /dev/i2c-5
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then you need to merge multiple compressed files into one, and then extract First open wiringOP APP on the Android source code. The command looks like this:desktop</li></ol>
[[File:zero2w-img371.png]]</ol><ol start="46" style="list-style-type: decimal;"><li>Then unzip click the compressed package of device node selection box in the files modified by Orange Pi Zero2wupper left corner to select the i2c you want to test</li></ol>
[[File:zero2w-img178.png]]</ol><ol start="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>{| class="wikitable" style="width:800px;" |-| <p>apollo-p2:/ # '''i2cdetect -y 1'''</p><p>'''Or'''</p><p>apollo-p2:/ # '''i2cdetect -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 '''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@testwriting 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;"><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 '''lsREAD 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>
<span iddiv style="display: flex;">::{| class="wikitable" style="compilewidth:390px;margin-theright: 20px;text-sourcealign: center;"|-code| '''GPIO NO.'''| '''GPIO'''| '''Function'''| '''Pin'''|-of| style="text-androidalign: left;"|| style="text-12align: left;"></span>|| '''3.3V'''== Compile the source code of Android 12 ==| '''1'''|-| '''Android12 is compiled on an x86_64 computer with Ubuntu 22.04 installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 amd64 version is as follows:264'''| '''PI8'''[https://repo.huaweicloud.com/ubuntu| '''TWI1-releases/22.04/ubuntuSDA'''| '''3'''|-22.04.2| '''263'''| '''PI7'''| '''TWI1-desktopSCL'''| '''5'''|-amd64.iso | '''<span style="color:#FF0000">269</span>'''| '''https<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</repo.huaweicloud.comspan>'''| '''<span style="color:#FF0000">7</ubuntuspan>'''|-releases/22.04/ubuntu| style="text-22.04.2align: left;"|| style="text-desktopalign: left;"|| '''GND'''| '''9'''|-amd64.iso| '''226''']| '''PH2'''| '''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.UART5_TX'''| '''11'''# First install the software packages needed to compile Android12 source code|-| '''227'''test@test:~$ | '''sudo apt-get updatePH3'''| '''UART5_RX'''test@test:~$ | '''13'''sudo apt|-get install -y git gnupg flex bison gperf build-essential \| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''zip curl zlib1g|-dev gcc| style="text-multilib g++align: left;"|| style="text-multilib libc6align: left;"|| '''3.3V'''| '''17'''|-dev| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-i386 \| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21''lib32ncurses5'|-dev x11proto| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-core| style="text-dev libx11align: left;"|| style="text-dev lib32z1align: left;"|| '''GND'''| '''25'''|-dev ccache \| '''266'''| '''PI10'''| '''libgl1TWI2-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \SDA'''| '''27'''|-| '''libssl-dev libncurses5 clang gawk256'''| '''PI0'''<ol start| style="2text-align: left;" || '''29'''|-| '''271'''| '''PI15'''| style="listtext-style-typealign: decimalleft;">|| '''31'''|-| '''<lispan style="color:#FF0000"><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel268</pspan>'''| '''<ol span style="list-style-typecolor: lower-alpha;#FF0000">PI12<li/span>First run '''./build.sh config| ''' to set compilation options</lispan style="color:#FF0000">PWM2</olspan>'''| '''</lispan style="color:#FF0000">33</olspan>'''|-| '''258'''| '''PI2'''test@test| style="text-align:~$ left;"|| '''35'''cd H618|-Android12| '''272'''| '''PI16'''| style="text-Src/longanalign: left;"|| '''37'''|-test@test| style="text-align:~/H618left;"|| style="text-Android12-Src/longan$ align: left;"|| '''GND'''| '''./build.sh config39'''|}Welcome to mkscript setup progress{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'''All available platform:| '''Function'''| '''GPIO'''0| '''GPIO NO. android'''|-| '''2'''1. linux| '''5V'''| style="text-align: left;"|Choice [android]| style="text-align: left;"||-| '''04'''| '''5V'''All available ic| style="text-align:left;"|| style="text-align: left;"|0. h618|-| '''6'''Choice [h618]: | '''0GND'''| style="text-align: left;"|All available board| style="text-align:left;"||-| '''8'''0. ft| '''UART0_TX'''| '''PH0'''| '''224'''1. p1|-| '''10'''2. p2| '''UART0_RX'''| '''PH1'''3. p7| '''225'''|-4. p7l| '''12'''| style="text-align: left;"|5. perf1| '''PI1'''| '''257'''6. perf2|-| '''14'''7. perf3| '''GND'''| style="text-align: left;"|8. qa| style="text-align: left;"||-Choice [p2]| '''<span style="color: #FF0000">16</span>'''| '''2<span style="color:#FF0000">PWM4</span>'''| '''<span style="color:#FF0000">PI14</span>'''All available flash| '''<span style="color:#FF0000">270</span>'''|-| '''18'''0. default| style="text-align: left;"|| '''PH4'''1. nor| '''228'''|-Choice [default]: | '''020'''| '''GND'''All available kern_ver| style="text-align:left;"|| style="text-align: left;"|0. linux|-5.4| '''22'''| '''UART2_RX'''| '''PI6'''| '''262'''Choice [linux|-5.4]: | '''024'''| '''SPI1_CS0'''All available arch:| '''PH5'''| '''229'''0. arm|-| '''26'''1. arm64| '''SPI1_CS1'''| '''PH9'''Choice [arm64]: | '''1233'''|-| '''......28'''| '''TWI2-SCL'''*** Default configuration is based on | '''PI9''sun50iw9p1smp_h618_android_defconfig'| '''265'''#|-| '''30'''# configuration written to .config| '''GND'''| style="text-align: left;"|#| style="text-align: left;"||-make[1]| '''<span style="color: Leaving directory #FF0000">32</span>'''| '''<span style="color:#FF0000">PWM1</homespan>'''| '''<span style="color:#FF0000">PI11</testspan>'''| '''<span style="color:#FF0000">267</H618span>'''|-Android12-Src/longan/out/kernel/build| '''34'''| '''GND'''| style="text-align: left;"|make| style="text-align: Leaving directory left;"||-| '/home/test/H618''36'''| style="text-Android12align: left;"|| '''PC12'''| '''76'''|-Src/longan/kernel/linux| '''38'''| style="text-5.4align: left;"|| '''PI4'''| '''260'''|-| '''40'''INFO| style="text-align: clean buildserverleft;"|| '''PI3'''| '''259'''|}INFO: prepare_buildserver</div> <ol start="2" style="list-style-type: lowerdecimal;"><li>First click the wiringOP icon to open wiringOP APP</li> [[File:zero2w-img351.png]]</ol><ol start="3" style="list-style-alphatype: decimal;"><li>Then run click the '''./build.shPWM_TEST''' script button on the main interface of wiringOP to start compilation.enter the PWM test interface</li></ol> test@test[[File:~/H618-Android12zero2w-Src/longan$ '''img380.png]]</build.sh'''ol><ol start="34" style="list-style-type: lower-alphadecimal;"><li>After compilation The PWM test interface is completed, you will see the following outputas follows</li> </oldiv class="figure"> sun50iw9p1 compile Kernel successful INFO[[File: Prepare toolchain ... '''......''' INFO: build kernel OKzero2w-img381.png]]
[[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>* > 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></ol>{| 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'''|-| 202 3style="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
Opios-arch-aarch64-xfce-opizero2w-23.09-linux6.1.31.img.xz