Open main menu

Wiki-Orange Pi β

Changes

Orange Pi Zero 2W

25,612 bytes added, 20:33, 27 September 2023
Download orangepi-build from github
<div class="figure">
[[File:zero2w-img3.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img4.png|800px]]
</div>
<div class="figure">
[[File:zero2w-img5.png|800px]]
</div>
<span id="orange-pi-zero-2w-24pin-expansion-board-interface-details"></span>
 
== Orange Pi Zero 2w 24pin expansion board interface details ==
<div class="figure">
[[File:zero2w-img6.png|800px]]
</div>
[[File:zero2w-img7.png|800px]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;"
<li><p>In Linux systems, spi1 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-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>
{| class="wikitable" style="width:800px;"
|-
<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 &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI you want to open.</p></li>
{| class="wikitable" style="width:800px;text-align: center;"
<li><p>Then select '''&lt;Back&gt;'''</p>
<p>[[File:zero2w-img84.png]]</p></li>
<li><p>Then select '''&lt;Reboot&gt;'''to restart the system to make the &gt; configuration take effect.</p>
<p>[[File:zero2w-img85.png]]</p></li></ol>
</li></ol>
=== 40pin GPIO port test ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Like wiringOP, wiringOP-Python can also determine which GPIO pin to operate by specifying the wPi number. Because there is no command to view the wPi number in wiringOP-Python, you can only view the board's wPi number and physics through the gpio command in wiringOP Correspondence of pins.'''</big>
[[File:zero2w-img170.png|center]]|}
<ol style="list-style-type: decimal;">
<li><p>The steps for testing directly with commands are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First set the GPIO port to output mode, where the first &gt; parameter of the '''pinMode''' function is the serial number of &gt; the wPi corresponding to the pin, and the second parameter is &gt; the GPIO mode.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ; \'''</p>
<p>'''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>) ; &quot;'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)&quot;'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p>{| class="wikitable" style="width:800px;" |-|
<p>root@orangepi:~/wiringOP-Python# '''python3 -c &quot;import wiringpi; \'''</p>
<p>'''from wiringpi import GPIO; wiringpi.wiringPiSetup() ;\'''</p>
<p>'''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)&quot;'''</p>|}</li></ol>
</li>
<li><p>The steps for testing in the command line of python3 are as follows:</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First use the python3 command to enter the command line mode of &gt; python3</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~# '''python3'''</p>|}</li>
<li><p>Then import the python module of wiringpi</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>&gt;&gt;&gt; '''import wiringpi'''</p>
<p>&gt;&gt;&gt; '''from wiringpi import GPIO'''</p>|}</li><li><p>Then set the GPIO port to output mode, where the first parameter &gt; of the '''pinMode'''function is the serial number of the wPi &gt; corresponding to the pin, and the second parameter is the GPIO &gt; mode.</p>{| class="wikitable" style="width:800px;" |-|
<p>&gt;&gt;&gt; '''wiringpi.wiringPiSetup()'''</p>
<p>0</p>
<p>&gt;&gt;&gt; '''wiringpi.pinMode(<span style="color:#FF0000">2, GPIO.OUTPUT</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a low level. After setting, you &gt; can use a multimeter to measure the voltage value of the pin. &gt; If it is 0v, it means the low level is set successfully.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.LOW</span>)'''</p>|}</li><li><p>Then set the GPIO port to output a high level. After setting, &gt; you can use a multimeter to measure the voltage value of the &gt; pin. If it is 3.3v, it means the setting of the high level is &gt; successful.</p>{| class="wikitable" style="width:800px;" |-| <p>&gt;&gt;&gt; '''wiringpi.digitalWrite(2, <span style="color:#FF0000">GPIO.HIGH</span>)'''</p>|}</li></ol>
</li>
<li><p>For wiringOP-Python to set the GPIO high and low levels in the python code, you can refer to the '''blink.py''' test program in the examples. The '''blink.py''' test program will set the voltage of all GPIO ports in the 40 Pin of the development board to continuously change high and low.</p>
{| class="wikitable" style="width:800px;"
|-
|
<p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p>
<p>root@orangepi:~/wiringOP-Python/examples# '''ls blink.py'''</p>
<p>'''blink.py'''</p>
<p>root@orangepi:~/wiringOP-Python/examples'''# python3 blink.py'''</p>|}</li></ol>
<span id="pin-spi-test-1"></span>
 
=== 40pin SPI test ===
# As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1
<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO NO.'''
| '''Function'''
| '''Pin'''
|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3/UART4_TX'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''TWI0_SCL/UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4/UART4_RX'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''<span style="color:#FF0000">231</span>'''| '''<span style="color:#FF0000">PH7</span>'''| '''<span style="color:#FF0000">SPI1_MOSI</span>'''| '''19'''|| '''20'''| '''GND'''| <span style="text-aligncolor: left;#FF0000"|| style="text-align: left;"|>19</span>'''
|-
| '''<span style="color:#FF0000">232</span>'''| '''<span style="color:#FF0000">PH8</span>'''| '''<span style="color:#FF0000">SPI1_MISO</span>'''| '''<span style="color:#FF0000">21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''| '''PI6'''| '''262span>'''
|-
| '''<span style="color:#FF0000">230</span>'''| '''<span style="color:#FF0000">PH6</span>'''| '''<span style="color:#FF0000">SPI1_CLK</span>'''| '''<span style="color:#FF0000">23'''|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229</span>'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA/UART3_RX'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL/UART3_TX'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''40Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''6'''| '''GND'''| style="text-align: left;"|
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 
<ol start="2" style="list-style-type: decimal;">
<li><p>In Linux systems, spi1 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-style-type: lower-alpha;">
<li><p>First run '''orangepi-config'''. Ordinary users remember to add &gt; '''sudo''' permissions.</p>
<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 &gt; in the figure below, and then use the '''space''' to select the &gt; dtbo configuration of the SPI you want to open.</p></li></ol>
</li></ol>
 
{| class="wikitable"
|-
| '''dtbo configuration8'''| '''illustrateUART0_TX'''| '''PH0'''| '''224'''
|-
| '''spi1-cs0-cs1-spidev10'''| '''Open cs0 and cs1 of spi1 at the same timeUART0_RX'''| '''PH1'''| '''225'''
|-
| '''spi112'''| style="text-cs0-spidevalign: left;"|| '''PI1'''| '''Only open cs0 of spi1257'''
|-
| '''spi1-cs1-spidev14'''| '''Only open cs1 of spi1GND'''|} <ol start="5" style="listtext-style-typealign: lower-alphaleft;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>Then check whether there is a '''spidev1.x''' device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p><p>orangepi@orangepi:~$ '''ls /dev/spidev1*'''</p><p>/dev/spidev1.0 /dev/spidev1.1</p><p>'''Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></li><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;"><li><p>'''--channel''': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…RX | FF FF FF FF FF FF '''FF FF FF FF FF FF''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….<ol start="6" style="listtext-style-typealign: decimalleft;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p></li></ol> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''40 00 00 00 00 95''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| <span id="pin-i2c-test-1"></span>=== 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 {| class="wikitable"
|-
| '''GPIO NO.16'''| '''GPIOPWM4/UART4_RX'''| '''FunctionPI14'''| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO.270'''
|-
| '''18'''
| style="text-align: left;"|
| style="text-align: left;"|| '''3.3VPH4'''| '''1228'''|-| '''220'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26422'''| '''PI8TWI0_SDA/UART2_RX'''| '''TWI1PI6'''| '''262'''|-| '''<span style="color:#FF0000">24</span>'''| '''<span style="color:#FF0000">SPI1_CS0</span>'''| '''<span style="color:#FF0000">PH5</span>'''| '''<span style="color:#FF0000">229</span>'''|-| '''<span style="color:#FF0000">26</span>'''| '''<span style="color:#FF0000">SPI1_CS1</span>'''| '''<span style="color:#FF0000">PH9</span>'''| '''<span style="color:#FF0000">233</span>'''|-| '''28'''| '''TWI2-SDASCL/UART3_TX'''| '''3PI9'''|'''265'''|-| '''430'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26332'''| '''PI7PWM1'''| '''TWI1-SCLPI11'''| '''5267'''|-| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| style="text-align: left;"|| '''GND'''| '''9'''|| '''10'''| '''UART0_RX'''| '''PH1PI4'''| '''225260'''
|-
| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''1240'''
| style="text-align: left;"|
| '''PI1PI3'''| '''257259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li><p>In Linux systems, spi1 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-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><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 figure below, and then use the '''space''' to select the dtbo configuration of the SPI you want to open.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''227dtbo configuration'''| '''PH3illustrate'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''261spi1-cs0-cs1-spidev'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270Open cs0 and cs1 of spi1 at the same time'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''| style="textspi1-cs0-align: left;"|| '''PH4spidev'''| '''228Only open cs0 of spi1'''
|-
| '''231spi1-cs1-spidev'''| '''PH7Only open cs1 of spi1'''| }</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''SPI1_MOSI&lt;Save&gt;'''to save</p><p>[[File:zero2w-img83.png]]</p></li>| <li><p>Then select '''19&lt;Back&gt;'''</p>|<p>[[File:zero2w-img84.png]]</p></li>| <li><p>Then select '''20&lt;Reboot&gt;'''to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;">| <li><p>Then check whether there is a '''GNDspidev1.x'''device node in the Linux system. If it exists, it means that the SPI1 configuration has taken effect.</p>{| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| '''232'''| <p>orangepi@orangepi:~$ '''PH8ls /dev/spidev1*'''</p>| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA<p>/dev/spidev1.0 /dev/spidev1.1</UART2_RX'''p>| '''PI6'''}{| '''262'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''230Note that only when you open spi1-cs0-cs1-spidev, you will see the device nodes of the two spi.'''</p></big>| }</li><li><p>Then you can use the '''spidev_test.py''' program in examples to test the SPI loopback function. The '''spidev_test.py''' program needs to specify the following two parameters:</p><ol style="list-style-type: lower-alpha;"><li><p>'''--channel''PH6': Specify the channel number of SPI</p></li><li><p>'''--port''': Specify the port number of the SPI</p></li></ol></li><li><p>Without shorting the mosi and miso pins of SPI1, the output result of running spidev_test.py is as follows. You can see that the data of TX and RX are inconsistent.</p>{| class="wikitable" style="width:800px;" | -| <p>root@orangepi:~/wiringOP-Python# '''SPI1_CLKcd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''23<span style="color:#FF0000">40 00 00 00 00 95</span>'''FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''<span style="color:#FF0000">FF FF FF FF FF FF</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF |.............….||}</li></ol><ol start="6" style="list-style-type: decimal;"><li><p>Then use Dupont wire to short-circuit the txd (pin 19 in the 40pin interface) and rxd (pin 21 in the 40pin interface) of SPI1 and then run spidev_test.py. The output is as follows, you can see If the data sent and received are the same, it means that the SPI1 loopback test is normal.</p>{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p> root@orangepi:~/wiringOP-Python/examples# '''python3 spidev_test.py \''' '''--channel 1 --port 0''' spi mode: 0x0 max speed: 500000 Hz (500 KHz) Opening device /dev/spidev1.1 TX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…| RX | FF FF FF FF FF FF '''<span style="color:#FF0000">40 00 00 00 00 95</span>''' FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D |......@.......…||}</li></ol><span id="pin-i2c-test-1"></span> === 40pin I2C test === # As can be seen from the table below, the i2c available for the 40pin interface are i2c0, i2c1 and i2c2 <div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''24GPIO NO.'''| '''SPI1_CS0GPIO'''| '''PH5Function'''| '''229Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND3.3V'''| '''25'''|| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''2331'''
|-
| '''266<span style="color:#FF0000">264</span>'''| '''PI10<span style="color:#FF0000">PI8</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SDA</UART3_RXspan>'''| '''27<span style="color:#FF0000">3</span>'''|-| '''<span style="color:#FF0000">263</span>'''| '''28<span style="color:#FF0000">v</span>'''| '''TWI2<span style="color:#FF0000">TWI1-SCL</UART3_TXspan>'''| '''PI9<span style="color:#FF0000">5</span>'''|-| '''269'''| '''PI13'''| '''PWM3/UART4_TX'''| '''2657'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''style="text-align: left;"|| '''30'''
| '''GND'''
| style="text'''9'''|-align: left;"| '''226'''| '''PH2'''| '''UART5_TX'''|'''11'''| style="text-align: left;"| '''227'''| '''PH3'''| '''UART5_RX'''|'''13'''
|-
| '''271<span style="color:#FF0000">261</span>'''| '''PI15'''| <span style="text-aligncolor: left;#FF0000"|| '''31>PI5</span>'''|| '''32<span style="color:#FF0000">TWI0_SCL</span>/UART2_TX'''| '''PWM1'''| '''PI11'''| '''267<span style="color:#FF0000">15</span>'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|-
| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-| style="text-align: left;"|| 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>/UART3_RX'''| '''<span style="color:#FF0000">27</span>'''|-| '''256'''| '''PI0'''| style="text-align: left;"|| '''29'''|-| '''271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''
| '''259'''
|}
 <ol start{| class="2wikitable" style="listwidth:390px;margin-styleright: 20px;text-typealign: decimalcenter;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it|-| '''Pin'''| '''Function'''| '''GPIO'''| '''GPIO NO. The opening steps are as follows:</p>'''|-| '''2'''| '''5V'''<ol | style="listtext-align: left;"|| style="text-typealign: lower-alphaleft;">|<li><p>First run |-| '''orangepi-config4'''. Ordinary users remember to add &gt; | '''sudo5V''' permissions.</p><p>orangepi@orangepi| style="text-align: left;"|| style="text-align:~$ left;"||-| '''sudo orangepi-config6'''</p></li><li><p>Then select | '''SystemGND'''</p><p>[[File| style="text-align:zero2wleft;"|| style="text-align: left;"||-img80.png]]</p></li><li><p>Then select | '''Hardware8'''</p><p>[[File:zero2w-img81.png]]</p></li>| '''UART0_TX'''<li><p>Then use the keyboard| 's arrow keys to locate the position shown &gt; in the picture below, and then use the ''PH0'space''' to select the &gt; corresponding i2c configuration in the picture below.</p></li></ol></li></ol> {| class="wikitable"'''224'''
|-
| '''Multiplexing function in 40pin10'''| '''Corresponding dtbo configurationUART0_RX'''| '''PH1'''| '''225'''
|-
| '''40pin 12'''| style="text- i2c0align: left;"|| '''PI1'''| '''pi-i2c0257'''
|-
| '''40pin - i2c114'''| '''pi-i2c1GND'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - i2c216'''| '''pi-i2c2PWM4/UART4_RX'''|} [[File:zero2w-img173.png]] <ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select <span class="mark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;Reboot&gt;</span> to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p><p>orangepi@orangepi:~$ '''ls /dev/i2c-*'''</p><p>'''/dev/i2c-*'''</p><p>'''Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p><p>'''The method to accurately confirm the device node under /dev corresponding to the i2c bus is:'''</p></li></ol> <!-- --><ol start="3" style="list-style-type: lower-alpha;"><li><p>'''First run the following command to check the corresponding relationship of i2cPI14'''</p><p>orangepi@orangepizero2w:~$ '''ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li><li><p>'''In the above output270'''</p></li></ol> <!-- --><ol start="4" style="list-style-type: lower-alpha;"><li><p>002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol> <!-- --><ol start="4" style="list-style-type: decimal;"><li><p>Then start testing i2c, first install i2c-tools</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo''' '''apt-get install -y i2c-tools'''</p></li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li><li><p>Then use the '''i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p><p>'''Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></li></ol> [[File:zero2w-img179.png]] <ol start="7" style="list-style-type: decimal;"><li><p>Then you can run the '''ds1307.py''' test program in '''examples''' to read the RTC time</p><p>'''Note that the x in i2c-x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p><p>root@orangepi:~/wiringOP-Python# '''cd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p></li></ol> <span id="pin-uart-test-1"></span>=== 40pin UART test === # 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. {| class="wikitable"
|-
| '''GPIO NO.18'''| '''GPIO'''| '''Function'''style="text-align: left;"| '''Pin'''|| '''Pin'''| '''Function'''| '''GPIOPH4'''| '''GPIO NO.228'''
|-
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">TWI0_SDA</span>/UART2_RX'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''|-| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| '''26'''| '''SPI1_CS1'''| '''PH9'''| '''233'''|-| '''<span style="color:#FF0000">28</span>'''| '''<span style="color:#FF0000">TWI2-SCL</span>/UART3_TX'''| '''3.3V<span style="color:#FF0000">PI9</span>'''| '''1<span style="color:#FF0000">265</span>'''|-| '''230'''| '''5VGND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26432'''| '''PI8PWM1'''| '''TWI1-SDAPI11'''| '''3267'''|| '''4'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''263'''| '''PI7'''| '''TWI1-SCL'''| '''5'''|| '''634'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''26936'''| '''PI13'''| '''PWM3/UART4_TX'''style="text-align: left;"| '''7'''|| '''8'''| '''UART0_TX'''| '''PH0PC12'''| '''22476'''
|-
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''40'''
| style="text-align: left;"|
| '''GNDPI3'''| '''9259'''|}</div> <ol start="2" style="list-style-type: decimal;"><li><p>i2c is turned off by default in Linux systems and needs to be turned on manually to use it. The opening steps are as follows:</p><ol style="list-style-type: lower-alpha;"><li><p>First run '''orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''10sudo orangepi-config'''</p>| }</li><li><p>Then select '''UART0_RXSystem'''</p><p>[[File:zero2w-img80.png]]</p></li>| <li><p>Then select '''PH1Hardware'''</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 '''225space'''to select the corresponding i2c configuration in the picture below.</p></li> {| class="wikitable" style="width:800px;text-align: center;"
|-
| '''226Multiplexing function in 40pin'''| '''PH2'''| '''UART5_TX'''| '''11'''|| '''12'''| style="text-align: left;"|| '''PI1'''| '''257Corresponding dtbo configuration'''
|-
| '''22740pin - i2c0'''| '''PH3'''| '''UART5_RX'''| '''13'''|| '''14'''| '''GNDpi-i2c0'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''26140pin - i2c1'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''|| '''16'''| '''PWM4/UART4_RX'''| '''PI14'''| '''270pi-i2c1'''
|-
| '''40pin - i2c2'''| '''pi-i2c2'''|} [[File:zero2w-img173.png]]</ol><ol start="5" style="textlist-style-aligntype: leftlower-alpha;"|>| style<li><p>Then select <span class="textmark">&lt;Save&gt;</span> to save</p><p>[[File:zero2w-alignimg83.png]]</p></li><li><p>Then select <span class="mark">&lt;Back&gt;</span></p><p>[[File: leftzero2w-img84.png]]</p></li><li><p>Then select <span class="mark">&lt;"|Reboot&gt;</span> to restart the system to make the configuration take effect.</p>| '''3<p>[[File:zero2w-img85.3V'''png]]</p></li></ol>| '''17'''</li></ol>|<!-- -->| '''18'''| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| '''PH4'''<li><p>After starting the Linux system, first confirm that there is an open i2c device node under <span class="mark">/dev</span></p>{| '''228'''class="wikitable" style="width:800px;"
|-
| '''231'''| <p>orangepi@orangepi:~$ '''PH7ls /dev/i2c-*'''</p>| <p>'''SPI1_MOSI/dev/i2c-*'''</p>| '''19'''}{|| '''20'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| '''232'''| ''<big>'PH8''注意,这里说的Linux镜像具体指的是从Orange Pi资料下载页面下载的Debian或者Ubuntu这样的Linux发行版镜像。'| '''SPI1_MISO'''| '''21'''|| '''22'''| '''TWI0_SDA</UART2_RX'''big>| '''PI6'''}{| '''262'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''230Sometimes the i2c device node and the i2c bus serial number do not correspond one to one. For example, the i2c device node of the i2c1 bus may be /dev/i2c-3.'''</p>| <p>'''PH6The method to accurately confirm the device node under /dev corresponding to the i2c bus is: '''</p></big>  | <ol style="list-style-type: lower-alpha;"><li><p>'''SPI1_CLKFirst run the following command to check the corresponding relationship of i2c'''</p>| <p>orangepi@orangepizero2w:~$ '''23ls /sys/devices/platform/soc*/*/i2c-* | grep &quot;i2c-[0-9]&quot;'''</p><p>/sys/devices/platform/soc/5002000.i2c/i2c-0:</p><p>/sys/devices/platform/soc/5002400.i2c/i2c-3:</p><p>/sys/devices/platform/soc/5002800.i2c/i2c-4:</p><p>/sys/devices/platform/soc/5002c00.i2c/i2c-5:</p><p>/sys/devices/platform/soc/6000000.hdmi/i2c-2:</p><p>/sys/devices/platform/soc/7081400.i2c/i2c-1:</p></li> || <li><p>'''24In the above output'''</p><ol style="list-style-type: none;"><li><p>a) 5002000 is the register base address of the i2c0 bus, and i2c-0 shown behind it is its corresponding i2c device node</p></li><li><p>b) 5002400 is the register base address of the i2c1 bus, and i2c-3 shown behind it is its corresponding i2c device node</p></li><li><p>c) 5002800 is the register base address of the i2c2 bus, and i2c-4 shown behind it is its corresponding i2c device node</p></li></ol></li></ol>| '''SPI1_CS0'''}</li></ol><ol start="4" style="list-style-type: decimal;">| '''PH5'''<li><p>Then start testing i2c, first install i2c-tools</p>{| '''229'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="text-align<p>orangepi@orangepi: left;"|| ~$ '''GNDsudo apt-get update'''</p>| <p>orangepi@orangepi:~$ '''25sudo'''|| '''26apt-get install -y i2c-tools'''</p>| '''SPI1_CS1'''}</li><li><p>Then connect an i2c device to the i2c pin of the 40pin connector. Here we take the DS1307 RTC module as an example.</p><p>[[File:zero2w-img178.png]]</p></li>| <li><p>Then use the '''PH9i2cdetect -y x'''command. If the address of the connected i2c device can be detected, it means that the i2c device is connected correctly.</p>{| '''233'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''266'''| <big>'''PI10<p>'''| Note that x in the i2cdetect -y x command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''TWI2-SDA</UART3_RXp>'''</big>| '''27'''} [[File:zero2w-img179.png]]|</li></ol>| '''28'''<ol start="7" style="list-style-type: decimal;">| <li><p>Then you can run the '''TWI2-SCL/UART3_TXds1307.py'''| test program in '''PI9examples'''to read the RTC time</p>{| '''265'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| '''256'''| <big><p>'''PI0'''| style="textNote that the x in i2c-align: left;"|| '''29x in the following command needs to be replaced with the serial number of the device node corresponding to the i2c bus.'''</p></big>|}{| '''30'''| '''GND'''| styleclass="text-align: left;wikitable"|| style="text-alignwidth: left800px;"|
|-
| <p>root@orangepi:~/wiringOP-Python# '''271cd examples'''</p>| <p>root@orangepi:~/wiringOP-Python/examples# '''python3 ds1307.py --device \'''</p><p>'''PI15&quot;/dev/i2c-x&quot;'''</p><p>Thu 2022-06-16 04:35:46</p><p>Thu 2022-06-16 04:35:47</p><p>Thu 2022-06-16 04:35:48</p><p>^C</p><p>exit</p>|}</li></ol> <span id="pin-uart-test-1"></span> === 40pin UART test === # 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: leftcenter;"|| '''31'''|-| '''32GPIO NO.'''| '''PWM1GPIO'''| '''PI11Function'''| '''267Pin'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|-
| '''269'''
| '''PI13'''
| '''PWM3/UART4_TX'''
| '''7'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12GND'''| '''769'''|-| '''226'''| '''PH2'''| '''UART5_TX'''| '''11'''|-| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-| '''261'''| '''PI5'''| '''TWI0_SCL/UART2_TX'''| '''15'''
|-
| '''272'''
| '''PI16'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI43.3V'''| '''26017'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA/UART3_RX'''| '''27'''|-| '''256'''| '''PI0'''
| style="text-align: left;"|
| '''PI329'''|-| '''259271'''|}'''PI15''' <ol start="2" | style="listtext-style-typealign: decimalleft;">|<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>| '''31'''<ol style="list-style-type: lower|-alpha;"><li><p>First run | '''orangepi-config268'''. Ordinary users remember to add &gt; | '''sudoPI12''' permissions.</p><p>orangepi@orangepi:~$ | '''sudo orangepi-configPWM2'''</p></li><li><p>Then select | '''System33'''</p><p>[[File:zero2w|-img80.png]]</p></li><li><p>Then select | '''Hardware258'''</p><p>[[File:zero2w-img81.png]]</p></li><li><p>Then use the keyboard| 's arrow keys to locate the position shown &gt; in the picture below, and then use the ''PI2'space''' to select the &gt; serial port you want to open.</p></li></ol></li></ol> {| classstyle="wikitabletext-align: left;"|| '''35'''
|-
| '''Multiplexing function in 40pin272'''| '''Corresponding dtbo configurationPI16'''| style="text-align: left;"|| '''37'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''40pin - uart2GND'''| '''pi-uart239'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''40pin - uart3Pin'''| '''pi-uart3Function'''| '''GPIO'''| '''GPIO NO.'''
|-
| '''40pin - uart42'''| '''pi-uart45V'''| style="text-align: left;"|| style="text-align: left;"|
|-
| '''40pin - uart54'''| '''ph-uart55V'''|} [[File:zero2w-img175.png]] <ol startstyle="5text-align: left;" || style="listtext-style-typealign: lower-alphaleft;">|<li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w|-img83.png]]</p></li><li><p>Then select | '''&lt;Back&gt;6'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select | '''&lt;Reboot&gt;GND''' to restart the system to make the &gt; configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol> <!-- --><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>8'''</p><p>| '''注意, linux5.4系统为/dev/ttyASx.UART0_TX'''</p><p>orangepi@orangepi:~$ | '''ls /dev/ttyS*PH0'''</p><p>/dev/ttySx</p></li>| '''224'''<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 | '''gpio10''' 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.UART0_RX'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttySx # linux-6.1 test commandPH1'''</p><p>orangepi@orangepi:~$ | '''gpio serial /dev/ttyASx # linux-5.4 test command225'''</p><p>Out: 0: |-&gt; 0</p><p>Out: 1: -&gt; 1</p>| '''12'''<p>Out: 2: | style="text-&gt; 2</p><p>Outalign: 3: -&gtleft; 3^C</p></li>"|<li><p>Finally, you can run the | '''serialTest.pyPI1''' 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.257'''</p><p>root@orangepi:~/wiringOP|-Python# | '''cd examples14'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''GND'''python3 serialTest.py | style="text-align: left;"|| style="text-device &quotalign: left;/dev/ttySx&quot; # linux6.1 use"||-| '''16'''</p><p>root@orangepi:~/wiringOP-Python/examples# | '''python3 serialTest.py --device &quot;PWM4/dev/ttyASx&quot; # linux5.4 useUART4_RX'''</p><p>Out: 0: -&gt; 0</p>| '''PI14'''<p>Out: 1: -&gt; 1</p>| '''270'''<p>Out: 2: |-&gt; 2</p><p>Out: 3: -&gt; 3</p>| '''18'''<p>Out: 4:^C</p><p>exit</p></li></ol> <span id| style="hardwaretext-watchdog-testalign: left;"></span>|| '''PH4'''== Hardware watchdog test ==| '''228''' The watchdog_test program is pre|-installed in the Linux system released by Orange Pi and can be tested directly.| '''20'''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>|-<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 &quot;keep alive&quot; to indicate that the dog feeding is successful.</p><p>orangepi@orangepi:~$ | '''sudo watchdog_test 1022'''</p><p>open success<| '''TWI0_SDA/p>UART2_RX'''<p>options is 33152,identity is sunxi-wdt</p>| '''PI6'''<p>put_usr return,if 0,success:0</p>| '''262'''<p>The old reset time is: 16</p><p>return ENOTTY,if |-1,success:0</p><p>return ENOTTY,if -1,success:0</p>| '''24'''<p>put_user return,if 0,success:0</p>| '''SPI1_CS0'''<p>put_usr return,if 0,success:0</p>| '''PH5'''<p>keep alive</p>| '''229'''<p>keep alive</p><p>keep alive</p></li></ol> <span id="check|-the-chipid-of-h618-chip"></span>== Check the chipid of H618 chip ==| '''26'''| '''SPI1_CS1'''The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards.| '''PH9''' orangepi@orangepi:~$ | '''cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;233'''|-sunxi_chipid : 338020004c0048080147478824681ed1| '''28''' <span id="python| '''TWI2-related-instructions"><SCL/span>UART3_TX'''== Python related instructions ==| '''PI9'''| '''265'''<span id="how-to-compile-and-install|-python-source-code"></span>=== How to compile and install Python source code === | '''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.30''' | '''The following demonstration is to compile and install the latest version of Python 3.9. If you want to compile and install other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).GND''' <ol | style="listtext-align: left;"|| style="text-typealign: decimalleft;">|<li><p>First install the dependency packages needed to compile Python</p>|-<p>orangepi@orangepi:~$ | '''sudo apt-get update32'''</p><p>orangepi@orangepi:~$ | '''sudo apt-get install -y build-essential zlib1g-dev \PWM1'''</p><p>| '''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \PI11'''</p><p>| '''267'''libreadline|-dev libffi-dev curl libbz2-dev| '''34'''</p></li><li><p>Then download the latest version of Python3.9 source code and unzip it</p><p>orangepi@orangepi:~$ | '''wget \GND'''</p><p>[https| style="text-align: left;"|| style="text-align://www.python.org/ftp/python/3.9.10/Pythonleft;"||-3.9.10.tgz | '''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz36''']</p><p>orangepi@orangepi| style="text-align:~$ left;"|| '''tar xvf Python-3.9.10.tgzPC12'''</p></li><li><p>Then run the configuration command</p><p>orangepi@orangepi:~$ | '''cd Python-3.9.1076'''</p><p>orangepi@orangepi:~$ |-| '''./configure --enable-optimizations38'''</p></li><li><p>Then compile and install Python3.9. The compilation time takes about half an hour.</p>| style="text-align: left;"|<p>orangepi@orangepi:~$ | '''make -j4PI4'''</p><p>orangepi@orangepi:~$ | '''sudo make altinstall260'''</p></li><li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>|-<p>orangepi@orangepi:~$ | '''python3.9 --version40'''</p><p>| style="text-align: left;"|| '''Python 3.9.10PI3'''</p></li><li><p>Then update pip</p><p>orangepi@orangepi:~$ | '''/usr/local/bin/python3.9 -m pip install --upgrade pip259'''|}</p></li></oldiv>
<span idol start="how-to-replace-pip-source-in-python2"></span>=== How to replace pip source in Python === '''The default source used by Linux system pip is the official source of Python. However, accessing the official source of Python in China is very slow, and the installation of Python software packages often fails due to network reasons. So when using pip to install the Python library, please remember to change the pip source.''' <ol style="list-style-type: decimal;"><li><p>First install '''python3-pip'''</p><p>orangepi@orangepiIn 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:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y python3-pip'''</p></li><li><p>How to permanently change the pip source under Linux</p>
<ol style="list-style-type: lower-alpha;">
<li><p>First create a new run '''~/.piporangepi-config''' directory, then . Ordinary users remember to add the &gt; '''pip.confsudo''' configuration file, and set the pip source in it &gt; to Tsinghua sourcepermissions.</p><p>orangepi@orangepi{| class="wikitable" style="width:~$ '''mkdir 800px;" |-p ~/.pip'''</p>| <p>orangepi@orangepi:~$ '''cat &lt;&lt;EOF &gt; ~/.pip/pip.conf'''</p><p>'''[global]'''</p><p>'''timeout = 6000'''</p><p>'''index-url = https://pypi.tuna.tsinghua.edu.cn/simple'''</p><p>'''trustedsudo orangepi-host = pypi.tuna.tsinghua.edu.cn'''</p><p>'''EOFconfig'''</p></li><li><p>Then use pip3 to install the Python library very quickly</p></li></ol>|}
</li>
<li><p>How to temporarily change the pip source under Linux, where Then select '''&lt;packagename&gt;System''' needs to be replaced with a specific package name</p><p>orangepi@orangepi[[File:~$ zero2w-img80.png]]</p></li><li><p>Then select '''pip3 install &lt;packagename&gt; -i \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 '''https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cnspace'''to select the serial port you want to open.</p></li></ol>
<span id{| class="howwikitable" style="width:800px;text-align: center;"|-| '''Multiplexing function in 40pin'''| '''Corresponding dtbo configuration'''|-to| '''40pin -installuart2'''| '''pi-docker"></span>uart2'''|-| '''40pin - uart3'''| '''pi-uart3'''|-| '''40pin - uart4'''| '''pi-uart4'''|-| '''40pin - uart5'''| '''ph-uart5'''== How to install Docker ==|}
The [[File:zero2w-img175.png]]</ol><ol start="5" style="list-style-type: lower-alpha;"><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol></li></ol><!-- --><ol start="3" style="list-style-type: decimal;"><li><p>After entering the Linux image provided by Orange Pi has Docker presystem, first confirm whether there is a uart5 device node under '''<span class="mark">/dev</span>'''</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-installed| <big><p>'''注意, but linux5.4系统为/dev/ttyASx.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''ls /dev/ttyS*'''</p><p>/dev/ttySx</p>|}</li><li><p>Then start testing the uart interface. First use Dupont wire to short-circuit the rx and tx pins of the Docker service is not turned on by defaultuart interface to be tested. </p></li><li><p>Use the '''enable_docker.shgpio''' script command in wiringOP to enable test the loopback function of the docker service, and then serial port as shown below. If you can start using see the docker commandfollowing print, and it means the serial port communication is normal.</p>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the last x in the docker service will gpio serial /dev/ttySx command needs to be automatically started replaced with the next time you start serial number of the systemcorresponding uart device node.'''</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gpio serial /dev/ttySx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-6.1 test command'''</p><p>orangepi@orangepi:~$ '''gpio serial /dev/ttyASx &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # linux-5.4 test command'''</p>
orangepi@orangepi:~$ '''enable_docker.sh'''
You <p>Out: 0: -&gt; 0</p><p>Out: 1: -&gt; 1</p><p>Out: 2: -&gt; 2</p><p>Out: 3: -&gt; 3^C</p>|}</li><li><p>Finally, you can use run the '''serialTest.py''' 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>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Note that the x in /dev/ttySx or /dev/ttyASx in the command needs to test dockerbe replaced with the serial number of the corresponding uart device node. If '''hello</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>root@orangepi:~/wiringOP-worldPython# ''' can be run, docker can be used normallycd examples'''</p><p>root@orangepi:~/wiringOP-Python/examples# '''python3 serialTest.py --device &quot;/dev/ttySx&quot; # linux6.1 use'''</p> orangepi<p>root@orangepi:~$ /wiringOP-Python/examples# '''docker run hellopython3 serialTest.py --worlddevice &quot;/dev/ttyASx&quot; # linux5.4 use'''</p>
Unable to find image 'hello-world:latest' locally
latest<p>Out: Pulling from library0: -&gt; 0</p><p>Out: 1: -&gt; 1</hellop><p>Out: 2: -world&gt; 2</p><p>Out: 3: -&gt; 3</p><p>Out: 4:^C</p><p>exit</p>|}</li></ol>
256ab8fe8778: Pull complete<span id="hardware-watchdog-test"></span>
Digest: sha256:7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5== Hardware watchdog test ==
Status: Downloaded newer image for helloThe watchdog_test program is pre-world:latestinstalled in the Linux system released by Orange Pi and can be tested directly.
'''Hello from Docker!'''The method to run the watchdog_test program is as follows:
<ol style="list-style-type: lower-alpha;"><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><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 &quot;keep alive&quot; to indicate that the dog feeding is successful.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''This message shows that your installation appears to be working correctly.sudo watchdog_test 10'''</p><p>open success</p><p>options is 33152,identity is sunxi-wdt</p><p>put_usr return,if 0,success:0</p><p>The old reset time is: 16</p><p>return ENOTTY,if -1,success:0</p><p>return ENOTTY,if -1,success:0</p><p>put_user return,if 0,success:0</p><p>put_usr return,if 0,success:0</p><p>keep alive</p><p>keep alive</p><p>keep alive</p>|}</li></ol>
'''.….'''<span id="check-the-chipid-of-h618-chip"></span>
When using == Check the docker command, if you are prompted for '''permission denied''', please add the current user to the docker user group so that you can run the docker command without sudo.chipid of H618 chip ==
orangepi@orangepi:~$ '''sudo usermod -aG docker $USER'''The command to view the H618 chip chipid is as follows. The chipid of each chip is different, so you can use chipid to distinguish multiple development boards.
{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''Note: You need to log out and log in again to the system to take effect. You can also restart the system.cat /sys/class/sunxi_info/sys_info | grep &quot;chipid&quot;'''
<span id="how-to-install-home-assistant"></span>sunxi_chipid : 338020004c0048080147478824681ed1== 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 of Home Assistant, please refer to the official documentation or corresponding books.'''<span id="python-related-instructions"></span>
<span id="installation-via-docker"></span>=== Installation via docker =Python related instructions ==
<ol stylespan id="listhow-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 to Install Docker''']] section.</p></li><li><p>Then you can search for the docker image of Home Assistant</p><p>orangepi@orangepi:~$ '''docker search homeassistant'''</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/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-assistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/homecompile-assistant:latest</p><p>docker.io/homeassistant/homeand-assistant:latest</p></li><li><p>Then you can use the following command to view the docker image of Home Assistant you just downloaded</p><p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''</p><p>REPOSITORY TAG IMAGE ID CREATED SIZE</p><p>homeassistant/home-assistant latest bfa0ab9e1cf5 2 months ago '''1.17GB'''</p></li><li><p>At this point you can run the Home Assistant docker container</p><p>orangepi@orangepi:~$ '''docker run install-d \'''</p><p>'''python-source-name homeassistant \'''</p><pcode">'''--privileged \'''</pspan><p>'''--restart=unless-stopped \'''</p><p>'''-e TZ=Asia/Shanghai \'''</p><p>'''-v /home/orangepi/home-assistant:/config \'''</p><p>'''--network=host \'''</p><p>'''homeassistant/home-assistant:latest'''</p></li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</p><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 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 How to check whether there is a problem with the previous installation compile and setting process.'''</p><div classinstall Python source code ==="figure">
[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img180| <big>'''If the Python version in the Ubuntu or Debian system software repository you are using does not meet the development requirements and you want to use the latest version of Python, you can use the following method to download the Python source code package to compile and install the latest version of Python.png]]'''
</div></li><li><p>Then enter your '''name, username''' The following demonstration is to compile and '''password''' install the latest version of Python 3.9. If you want to compile and click '''Create Accountinstall other versions of Python, the method is the same (you need to download the source code corresponding to the Python you want to install).'''</pbig><div class="figure">|}
[[File<ol style="list-style-type: decimal;"><li><p>First install the dependency packages needed to compile Python</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:zero2w~$ '''sudo apt-img181.png]]get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y build-essential zlib1g-dev \'''</p><p>'''libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev \'''</p><p>'''libreadline-dev libffi-dev curl libbz2-dev'''</divp>|}</li><li><p>Then follow download the interface prompts to set according to your own preferences, latest version of Python3.9 source code and then click Nextunzip it</p><div {| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''wget \'''</p><p>'''https://www.python.org/ftp/python/3.9.10/Python-3.9.10.tgz'''</p>[[File<p>orangepi@orangepi:zero2w~$ '''tar xvf Python-img1823.png]]9.10.tgz'''</p>|}</divli><li><p>Then run the configuration command</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''cd Python-3.9.10'''</p><p>orangepi@orangepi:~$ '''./configure --enable-optimizations'''</p>|}</li><li><p>Then click Nextcompile and install Python3.9. The compilation time takes about half an hour.</p><div {| class="figurewikitable" style="width:800px;"|-| <p>orangepi@orangepi:~$ '''make -j4'''</p><p>orangepi@orangepi:~$ '''sudo make altinstall'''</p>|}</li>[[File<li><p>After installation, you can use the following command to check the version number of the Python you just installed.</p>{| class="wikitable" style="width:zero2w800px;" |-img183.png]]| <p>orangepi@orangepi:~$ '''python3.9 --version'''</divp><p>'''Python 3.9.10'''</p>|}</li><li><p>Then click Finishupdate pip</p><div {| class="figurewikitable"style="width:800px;" |-| <p>orangepi@orangepi:~$ '''/usr/local/bin/python3.9 -m pip install --upgrade pip'''</p>|}</li></ol>
[[File:zero2w<span id="how-img184.png]]to-replace-pip-source-in-python"></span>
</div></li><li><p>The main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img185.png]]</p></li><li><p>Method === How to stop Home Assistant container</p><ol stylereplace pip source in Python ==="list-style-type: lower-alpha;"><li><p>The command to view the docker container is as follows</p><p>orangepi@orangepi:~$ '''docker ps -a'''</p></li><li><p>The command to stop the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ '''docker stop homeassistant'''</p></li><li><p>The command to delete the Home Assistant container is as follows</p><p>orangepi@orangepi:~$ '''docker rm homeassistant'''</p></li></ol></li></ol>
<span id{| class="wikitable" style="installationbackground-via-pythoncolor:#ffffdc;width:800px;"></span>=== Installation via python ===|-| <big>'''Before installationThe default source used by Linux system pip is the official source of Python. However, please change accessing the official source of pip to a domestic source to speed up Python in China is very slow, and the installation of Python software packagesoften fails due to network reasons. For So when using pip to install the configuration methodPython library, see the instructions in the section &quot;[[\l|How please remember to Change change the Pip Source of Python]]&quot;pip source.'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First install dependency packages'''python3-pip'''</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 \pip'''</p><p>'''python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''|}</pli><p>'''libopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</pli><p>'''If it is debian12, please use How to permanently change the following command:'''pip source under Linux</p><p>orangepi@orangepiol style="list-style-type:~$ '''sudo aptlower-get update'''</palpha;"><pli>orangepi@orangepi:~$ '''sudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>First create a new '''python3-~/.pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>'''libopenjp2-7 libturbojpeg0-dev tzdata'''</p></li><li><p>Then you need to compile and install Python3.9. For the methoddirectory, please refer to then add the [[\l|'''Python source code compilation and installation method''']] sectionpip.</p><p>conf'''The default Python version of Debian Bullseye is Python3.9configuration file, so there is no need to compile and install set the pip source in itto Tsinghua source.'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''The default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install itmkdir -p ~/.pip'''</p><p>orangepi@orangepi:~$ '''The default Python version of Debian Bookworm is Python3cat &lt;&lt;EOF &gt; ~/.11, so there is no need to compile and install itpip/pip.conf'''</p></li><li><p>Then create a Python virtual environment</p><p>'''Debian Bookworm is python3.11, please remember to replace the corresponding command.[global]'''</p><p>orangepi@orangepi:~$ '''sudo mkdir /srv/homeassistanttimeout = 6000'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepiindex-url = https:orangepi /srv/homeassistant'''<pypi.tuna.tsinghua.edu.cn/p><p>orangepi@orangepi:~$ '''cd /srv/homeassistantsimple'''</p><p>orangepi@orangepi:~$ '''python3trusted-host = pypi.tuna.tsinghua.9 -m venv edu.cn'''</p><p>orangepi@orangepi:~$ '''source bin/activateEOF'''</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$</p>|}</li><li><p>Then use pip3 to install the required Python packageslibrary very quickly</p><p/li>(homeassistant) orangepi@orangepi:/srv/homeassistant$ '''python3 -m pip install wheel'''</pol></li><li><p>Then you can install Home Assistant Core</p><p>(homeassistant) orangepi@orangepi:/srv/homeassistant$ How to temporarily change the pip source under Linux, where '''pip3 install homeassistant&lt;packagename&gt;'''needs to be replaced with a specific package name</p></li><li><p>Then enter the following command to run Home Assistant Core</p>{| class="wikitable" style="width:800px;" |-| <p>(homeassistant) orangepi@orangepi:/srv/homeassistant~$ '''hasspip3 install &lt;packagename&gt; -i \'''</p></li><li><p>Then enter【'''development board IP addresshttps: 8123'''】 in the browser to see the Home Assistant interface</p><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/pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi. This process may take several minutestuna. Note that you cannot see the Home Assistant interface in the browser at this timetsinghua. Please wait for a while and then refresh itedu.cn'''</p>|}<div class="figure"/li></ol>
[[File:zero2w<span id="how-img180.png]]to-install-docker"></span>
</div></li></ol>== How to install Docker ==
<span id="opencvThe Linux image provided by Orange Pi has Docker pre-installation-method"></span>== OpenCV installation method ==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.
<span id{| class="usewikitable" style="width:800px;" |-apt-to-install-opencv"></span>=== Use apt to install OpenCV ===| orangepi@orangepi:~$ '''enable_docker.sh'''|}
<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p><p>orangepi@orangepi:~$ '''sudo apt-get update'''</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p></li><li><p>Then You can use the following command to print the version number of OpenCVtest docker. The output is normal, indicating that the OpenCV installation is successful.</p><ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p><p>orangepi@orangepi:~$ If '''python3 hello-c &quot;import cv2; print(cv2.__version__)&quot;world'''</p><p>'''4.5.4'''</p></li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.2.0'''</p></li><li><p>The version of OpenCV in Debian11 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2can be run, docker can be used normally.__version__)&quot;'''</p><p>'''4.5.1'''</p></li><li><p>The version of OpenCV in Debian12 is as follows:</p><p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.6.0'''</p></li></ol></li></ol>
<span id{| class="setwikitable" style="width:800px;" |-up| orangepi@orangepi:~$ '''docker run hello-the-chinese-environment-and-install-the-chineseworld''' Unable to find image 'hello-input-method"></span>== Set up the Chinese environment and install the Chinese input method ==world:latest' locally
'''Note, before installing the Chinese input method, please make sure that the Linux system used by the development board is a desktop version.'''latest: Pulling from library/hello-world
<span id="debian-system-installation-method"></span>=== Debian system installation method ===256ab8fe8778: Pull complete
<ol style="list-style-typeDigest: decimal;"><li><p>First set the default '''locale''' to Chinese</p><ol style="list-style-typesha256: lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p><p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p></li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-up interface (use &gt; the up and down keys on the keyboard to move up and down, use &gt; the space bar to select, and finally use the Tab key to move &gt; the cursor to '''&lt;OK&gt;''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</p><p>[[File:zero2w-img187.png]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin. &gt; The output displayed on the command line is as follows:</p><p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p><p>Generating locales (this might take a while)...</p><p>en_US.UTF-8... done</p><p>zh_CN.UTF-8... done</p><p>Generation complete.</p></li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.png]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effect.'''</p></li><li><p>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">7f0a9f93b4aa3022c3a4c147a449ef11e0941a1fd0bf4a8e6c9408b2600777c5
[[FileStatus:zero2wDownloaded newer image for hello-img195.png]]world:latest
</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 to test the Chinese input method</p>
<p>[[File:zero2w-img198.png]]</p></li>
<li><p>The Chinese input method test is as follows</p>
<p>[[File:zero2w-img199.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-8'''</p>
<p>orangepi@orangepi:~$ '''sudo vim /etc/default/locale'''</p>
<p># File generated by update-locale</p>
<p>LC_MESSAGES='''zh_CN.UTF-8'''</p>
<p>LANG='''zh_CN.UTF-8'''</p>
<p>LANGUAGE='''zh_CN.UTF-8'''</p></li>
<li><p>Then '''restart the system''' and you will see that the system is displayed in Chinese.</p>
<p>[[File:zero2w-img200.png]]</p></li></ol>
'''<span idstyle="installation-method-of-ubuntu-20.04-systemcolor:#FF0000">Hello from Docker!</span>=== Installation method of Ubuntu 20.04 system ==='''
'''<ol span style="list-style-typecolor: decimal;#FF0000"><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-img202This message shows that your installation appears to be working correctly.png]]</pspan></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></ol>
'''Note that this step is not easy to drag, please be patient and try it a few times.….'''|}
<ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply When using 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>docker command, if you are prompted for '''Then restart the Linux system to make the configuration take effectpermission denied'''</p></li><li><p>After re-entering the system, please select '''Do not ask me again''' in add the following interface, and then please decide according current user 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 docker user group so that 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 run 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-img209docker command without sudo.png]]</p></li></ol>
<span id{| class="installationwikitable" style="width:800px;" |-method-of| orangepi@orangepi:~$ '''sudo usermod -ubuntu-22.04-system"></span>aG docker $USER'''=== Installation method of Ubuntu 22.04 system ===|}
<ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>First open '''Language Support'''</p>|-<p>[[File:zero2w-img201.png]]</p></li>| <li><pbig>Then find the '''Chinese (China)''' option</p><p>[[FileNote:zero2w-img210.png]]</p></li><li><p>Then please use the left button of the mouse You need to select '''Chinese (China)''' log out and hold it down, then drag it up log in again to the starting positionsystem to take effect. After dragging, You can also restart the display will be as shown below:system.'''</pbig><p>[[File:zero2w-img211.png]]</p></li></ol>|}
'''Note that this step is not easy <span id="how-to drag, please be patient and try it a few times.'''-install-home-assistant"></span>
<ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' How to apply the Chinese settings to the entire system</p><p>[[File:zero2w-img212.png]]</p></li><li><p>'''Then restart the Linux system to make the configuration take effect'''</p></li><li><p>After re-entering the system, please select '''Do 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>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-img213.png]]</p></li><li><p>Then choose to use Pinyin input method</p><div classinstall Home Assistant =="figure">
[[File{| class="wikitable" style="background-color:zero2w#ffffdc;width:800px;" |-img214| <big>'''Note that this article will only provide methods for installing Home Assistant in Ubuntu or Debian systems. For detailed usage of Home Assistant, please refer to the official documentation or corresponding books.png]]'''</big>|}
</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''' 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 enter Chinese.</p><p>[[File:zero2w-img216.png]]</p></li></ol> <span id="howinstallation-tovia-remotely-log-in-to-the-linux-system-desktopdocker"></span>== How to remotely log in to the Linux system desktop == <span id="remote-login-using-nomachine"></span>=== Remote login using NoMachine Installation via docker === '''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. The document link is as follows:''' '''https://knowledgebase.nomachine.com/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.'''
<ol style="list-style-type: decimal;">
<li><p>First download , please install docker and ensure that docker can run normally. For the installation package steps of docker, please refer to the NoMachine software Linux instructions in the [[Orange Pi Zero 2W#How to install Docker|'''arm64How to Install Docker''' deb version]] section.</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 homeassistant'''</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 then install it into the Linux system of download time will be relatively long. Please be patient and wait for the development boarddownload to complete.</p><ol {| class="wikitable" style="listwidth:800px;" |-| <p>orangepi@orangepi:~$ '''docker pull homeassistant/home-assistant'''</p><p>Using default tag: latest</p><p>latest: Pulling from homeassistant/home-styleassistant</p><p>be307f383ecc: Downloading</p><p>5fbc4c07ac88: Download complete</p><p>'''...... (Omit some output)'''</p><p>3cc6a1510c9f: Pull complete</p><p>7a4e4d5b979f: Pull complete</p><p>Digest: sha256:81d381f5008c082a37da97d8b08dd8b358dae7ecf49e62ce3ef1eeaefc4381bb</p><p>Status: Downloaded newer image for homeassistant/home-typeassistant: lowerlatest</p><p>docker.io/homeassistant/home-alpha;"assistant:latest</p>|}</li><li>Since H618 is an ARMv8 architecture SOC and <p>Then you can use the system we use is &gt; Ubuntu or Debian, we need following command to download view the docker image of Home Assistant you just downloaded</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''docker images homeassistant/home-assistant'''NoMachine for ARM </p><p>REPOSITORY &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TAG &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMAGE &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ID &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CREATED &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE</p><p>homeassistant/home-assistant &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; latest &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bfa0ab9e1cf5 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2 months ago &nbsp;&nbsp;&nbsp;&nbsp;&gtnbsp; ARMv8 DEB''' installation package<span style="color:#FF0000">1. The download link is as &gt17GB</span>'''</p>|}</li><li><p>At this point you can run the Home Assistant docker container</p>{| class="wikitable" style="width:800px; follows" |-| <p>orangepi@orangepi:~$ '''docker run -d \'''</p>:<p>'''--name homeassistant \'''</p>:<p>'''--privileged \'''</p>:<p>'''--restart=unless-stopped \'''</p>:<p>'''-e TZ=Asia/Shanghai \'''</p>:<p>'''-v /home/orangepi/home-assistant:/config \'''</p>:<p>'''--network=host \'''</p>:<p>'''homeassistant/home-assistant:latest'''</p>|}</li><li><p>Then enter【the IP address of the development board: 8123】in the browser to see the Home Assistant interface</olp>{| 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 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.'''</lip></olbig>|}<div class="figure">
'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package[[File:zero2w-img180.'''png]]
[https:</div></www.nomachine.com/download/download&id=112&s=ARM li><li><p>Then enter your '''name, username''' and '''password''' and click '''https://downloads.nomachine.com/download/?id=118&amp;distro=ARMCreate Account''']</p><div class="figure">
[[File:zero2w-img217img181.png]]
<ol start="2" style="list-style-type: lower-alpha;"><li><p>In addition, you can also download the '''NoMachine''' installation &gt; 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]]</pdiv></li><li><p>Then upload follow the downloaded '''nomachine_x.x.x_x_arm64.deb''' interface prompts to the &gt; Linux system of the development board</p></li><li><p>Then use the following command set according to install '''NoMachine''' in the Linux &gt; system of the development boardyour own preferences, and then click Next</p><p>orangepi@orangepi:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p></li></oldiv class="figure">
<!-- [[File:zero2w--><ol start="2" style="list-style-type: decimal;"><li>Then download the installation package of the Windows version of the NoMachine softwareimg182. The download address is as follows</li></ol>png]]
'''Note that this download link may change</div></li><li><p>Then click Next</p><div class="figure"> [[File:zero2w-img183.'''png]]
'''https:</div></downloads.nomachine.comli><li><p>Then click Finish</download/?idp><div class=9'''"figure">
[[File:zero2w-img221img184.png]]
<ol start="3" style="list-style-type: decimal;"><li><p>Then install NoMachine in Windows. '''Please restart your computer after installation.'''</pdiv></li><li><p>Then open '''NoMachine''' in WindowThe main interface finally displayed by Home Assistant is as shown below</p><p>[[File:zero2w-img222img185.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 Method to the Linux system desktop of the development board.stop Home Assistant container</p><p>[[Fileol style="list-style-type:zero2wlower-img223.png]]</p></lialpha;"><li><p>Then click '''OK'''The command to view the docker container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w~$ '''docker ps -img224.png]]a'''</p>|}</li><li><p>Then enter The command to stop 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.Home Assistant container is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img225.png]]~$ '''docker stop homeassistant'''</p>|}</li><li><p>Then click OK in The command to delete the next interface.Home Assistant container is as follows</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>Finally you can see the desktop of the development board Linux systemorangepi@orangepi:~$ '''docker rm homeassistant'''</p>|}<p/li>[[File:zero2w-img226.png]]</pol></li></ol>
<span id="remoteinstallation-loginvia-using-vncpython"></span>=== Remote login using VNC ===
'''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.'''=== Installation via python ===
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''There are many problems with VNC testing in Ubuntu20.04Before installation, please do not use this change the source of pip to a domestic source to speed up the installation of Python packages. For the configuration method., see the instructions in the section &quot;[[Orange Pi Zero 2W#How to replace pip source in Python|How to Change the Pip Source of Python]]&quot;'''</big>|}
<ol style="list-style-type: decimal;">
<li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''sinstall dependency packages</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 characterssudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>Verify: '''#Set the vnc password here, 8 characterspython3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential \'''</p><p>Would you like to enter a view-only password (y/n)? '''nlibopenjp2-7 libtiff5 libturbojpeg0-dev tzdata'''</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 use MobaXterm software to connect to the development board Linux system desktop are as follows:</p><ol style="list-style-type: lower-alpha;"><li>First click Session, then select VNC, then fill in the IP &gt; address and port of the development board, and finally click &gt; OK to confirm.</li></ol></li></ol> <div {| class="figure"> [[File:zero2w-img227.png]] </div><ol start="2wikitable" style="listbackground-style-typecolor: lower-alpha#ffffdc;"><li><p>Then enter the VNC password set earlier</p><p>[[Filewidth:zero2w-img228.png]]</p></li><li><p>After successful login, the interface is displayed as shown below, &gt800px; and then you can remotely operate the desktop of the development &gt; board Linux system.</p></li></ol>"  [[File:zero2w|-img229.png]] <span id="qt-installation-method"></span>== QT installation method ==| <ol style="list-style-type: decimal;"><libig><p>Use the following script to install QT5 and QT Creator</p><p>orangepi@orangepi:~$ '''install_qt.sh'''</p></li><li><p>After installationIf it is debian12, please use the QT version number will be automatically printed.</p><ol style="list-style-type: lower-alpha;"><li><p>The qt version that comes with Ubuntu20.04 is '''5.12.8'''</p><p>orangepi@orangepifollowing command:~$ '''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'''</pbig><p>orangepi@orangepi:~$ '''install_qt.sh'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.3''' in /usr/lib/aarch64-linuxsudo apt-gnu</p></li><li><p>The QT version that comes with Debian11 is '''5.15.2get update'''</p><p>orangepi@orangepi:~$ '''install_qt.shsudo apt-get install -y python3 python3-dev python3-venv \'''</p><p>......</p><p>QMake version 3.1</p><p>Using Qt version '''5.15.2''' in /usr/lib/aarch64python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-linuxdev autoconf build-gnu</p></li><li><p>The QT version that comes with Debian12 is '''5.15.8essential \'''</p><p>orangepi@orangepi:~$ '''install_qt.shlibopenjp2-7 libturbojpeg0-dev tzdata'''</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 need to compile and install Python3.9. For the method, please refer to the QT Creator startup icon in [[Orange Pi Zero 2W#Python related instructions|'''ApplicationsPython source code compilation and installation method''']] section.</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img230.png]]| </pbig><p>You can also use the following command '''The default Python version of Debian Bullseye is Python3.9, so there is no need to open QT Creatorcompile and install it.'''</p><p>orangepi@orangepi:~$ '''qtcreatorThe default Python version of Ubuntu Jammy is Python3.10, so there is no need to compile and install it.'''</p></li><li><p>'''The interface after QT Creator default Python version of Debian Bookworm is opened Python3.11, so there is as followsno need to compile and install it.'''</p><p>[[File:zero2w-img231.png]]</pbig>|}</li><li><p>The version of QT Creator is as followsThen create a Python virtual environment</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <libig><p>The default version of QT Creator in '''Ubuntu20Debian Bookworm is python3.11, please remember to replace the corresponding command.04''' is as &gt; follows</p></big>|}{| class="wikitable" style="width:800px;" |-| <p>[[Fileorangepi@orangepi:zero2w-img232.png]]~$ '''sudo mkdir /srv/homeassistant'''</p><p>orangepi@orangepi:~$ '''sudo chown orangepi:orangepi /srv/homeassistant'''</lip><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Ubuntu22.04cd /srv/homeassistant''' is as &gt; follows</p><p>[[Fileorangepi@orangepi:zero2w~$ '''python3.9 -img233m venv .png]]'''</p></li><li><p>The default version of QT Creator in orangepi@orangepi:~$ '''Debian11source bin/activate''' is as follows</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img234.png]]/srv/homeassistant$</p>|}</li><li><p>The default version of QT Creator in '''Debian12''' is as followsThen install the required Python packages</p>{| class="wikitable" style="width:800px;" |-| <p>[[File(homeassistant) orangepi@orangepi:zero2w/srv/homeassistant$ '''python3 -img235.png]]m pip install wheel'''</p></li></ol>|}
</li>
<li><p>Then set up QTyou can install Home Assistant Core</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>First open '''Help'''|-&gt;'''About Plugins...'''.</p><p>[[File:zero2w-img236.png]]</p></li>| <li><p>Then remove the check mark of '''ClangCodeModel'''</p><p>[[File(homeassistant) orangepi@orangepi:zero2w-img237.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 &gt; default is Clang, please change it to GCC.<srv/p><p>homeassistant$ '''Debian12 please skip this step.pip3 install homeassistant'''</p><p>[[File:zero2w-img238.png]]</p><p>[[File:zero2w-img239.png]]</p></li></ol>|}
</li>
<li><p>Then you can open a sample codeenter the following command to run Home Assistant Core</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img240.png]]</p></li><li><p>After clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.</p>| <p>[[File(homeassistant) orangepi@orangepi:zero2w-img241.png]]</p><srv/li><li><p>Then click homeassistant$ '''Configure Projecthass'''</p><p>[[File:zero2w-img242.png]]</p>|}</li><li><p>Then click the green triangle enter【'''development board IP address: 8123'''】 in the lower left corner browser to compile and run see the sample codeHome Assistant interface</p><p>[[File{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-img243.png]]</p></li>| <libig><p>After waiting '''When you run the hass command for a period of the first time, the interface shown in the figure below some libraries and dependency packages necessary for operation will pop upbe downloaded, which means that QT can compile installed and run normally.</p><p>[[File:zero2w-img244.png]]</p></li><li><p>References</p><p>[https://wikicached.qtThis process may take several minutes.io/Install_Qt_5_on_Ubuntu '''https://wikiNote that you cannot see the Home Assistant interface in the browser at this time.qtPlease wait for a while and then refresh it.io/Install_Qt_5_on_Ubuntu''']</p><p>[https://download.qt.io/archive/qtcreator '''https://download.qt.io/archive/qtcreator''']</p><p>[https://download.qt.io/archive/qt '''https://download.qt.io/archive/qt''']</p></li></olbig>|}<span iddiv class="ros-installation-methodfigure"></span>== ROS installation method ==
<span id="how[[File:zero2w-to-install-ros-1-noetic-on-ubuntu20.04"></span>=== How to install ROS 1 Noetic on Ubuntu20img180.04 ===png]]
# The currently active version of ROS 1 is as follows, the recommended version is '''Noetic Ninjemys'''</div></li></ol>
[[File:zero2w<span id="opencv-img245.png]]installation-method"></span>
[[File:zero2w-img246.png]]== OpenCV installation method ==
[http:<span id="use-apt-to-install-opencv"><//docs.ros.org/ '''http://docs.ros.org''']span>=== Use apt to install OpenCV ===
<ol style="list-style-type: decimal;"><li><p>The installation command is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt-get update'''https</p><p>orangepi@orangepi:~$ '''sudo apt-get install -y libopencv-dev python3-opencv'''</p>|}</wikili><li><p>Then use the following command to print the version number of OpenCV.rosThe output is normal, indicating that the OpenCV installation is successful.org</Distributionsp><ol style="list-style-type: lower-alpha;"><li><p>The version of OpenCV in Ubuntu22.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.5.4'''</p>|}</li><li><p>The version of OpenCV in Ubuntu20.04 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.2.0'''</p>|}</li><li><p>The version of OpenCV in Debian11 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.5.1'''</p>|}</li><li><p>The version of OpenCV in Debian12 is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 -c &quot;import cv2; print(cv2.__version__)&quot;'''</p><p>'''4.6.0'''</p>|}</li></ol></li></ol>
<ol startspan id="2" style="listset-styleup-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p><p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p></li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''Ubuntu20.04 desktop system'''.</p><p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p></li><li><p>Then use the script below to chinese-environment-and-install ros1</p><p>orangepi@orangepi:~$ '''install_ros.sh ros1'''</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 in ROS.</p></li-chinese-input-method"></olspan>
'''Note that when running == Set up the following command, you need to ensure that Chinese environment and install the development board can access github normally, otherwise an error will be reported due to network problems.'''Chinese input method ==
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''The install_ros.sh script will try to modify /etc/hosts and automatically run Note, before installing the following commands. However, this Chinese input 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 make sure that the linux Linux system of used by the development board to access github normally, and then manually run the following Orderis a desktop version.'''</big>|}
'''https://raw.githubusercontent.com/ros<span id="debian-system-installation-method"></rosdistro/master/rosdep/osx-homebrew.yaml'''span>=== Debian system installation method ===
<ol style="list-style-type: decimal;"><li><p>First set the default '''locale'''Hit httpsto Chinese</p><ol style="list-style-type:lower-alpha;"><li><p>Enter the following command to start configuring '''locale'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</p>|}</li><li><p>Then select '''zh_CN.UTF-8 UTF-8''' in the pop-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 Tab key to move the cursor to '''&lt;OK&gt;''', and then return Car can be used)</p><p>[[File:zero2w-img186.png]]</p></li><li><p>Then set the default '''locale''' to '''zh_CN.UTF-8'''</rawp><p>[[File:zero2w-img187.githubusercontentpng]]</p></li><li><p>After exiting the interface, the '''locale''' setting will begin.comThe output displayed on the command line is as follows:</rosp>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg-reconfigure locales'''</rosdistrop><p>Generating locales (this might take a while)...</masterp>:<p>en_US.UTF-8... done</rosdepp>:<p>zh_CN.UTF-8... done</basep><p>Generation complete.yaml</p>|}</li></ol></li><li><p>Then open '''Input Method'''</p><p>[[File:zero2w-img188.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img189.png]]</p></li><li><p>Then select '''Yes'''</p><p>[[File:zero2w-img190.png]]</p></li><li><p>Then select '''fcitx'''</p><p>[[File:zero2w-img191.png]]</p></li><li><p>Then select '''OK'''</p><p>[[File:zero2w-img192.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>Then open '''Fcitx configuration'''</p><p>[[File:zero2w-img193.png]]</p></li><li><p>Then click the + sign as shown in the picture below</p><p>[[File:zero2w-img194.png]]</p></li><li><p>Then search '''Google Pinyin''' and click '''OK'''</p><div class="figure">
'''ERROR[[File: error loading sources list:'''zero2w-img195.png]]
</div></li><li><p>Then put '''Google Pinyin'''The read operation timed outon top</p><p>[[File:zero2w-img196.png]]</p><p>[[File:zero2w-img197.png]]</p></li><li><p>Then open the '''Geany'''editor to test the Chinese input method</p><p>[[File:zero2w-img198.png]]</p></li><li><p>The Chinese input method test is as follows</p>orangepi@orangepi<p>[[File:~$ zero2w-img199.png]]</p></li><li><p>You can switch between Chinese and English input methods through the '''Ctrl+Space'''source shortcut key</optp></rosli><li><p>If you need the entire system to be displayed in Chinese, you can set all variables in '''/etc/noeticdefault/setuplocale''' to '''zh_CN.bashUTF-8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo rosdep initvim /etc/default/locale'''</p><p># File generated by update-locale</p>Wrote <p>LC_MESSAGES='''<span style="color:#FF0000">zh_CN.UTF-8</etcspan>'''</rosp><p>LANG='''<span style="color:#FF0000">zh_CN.UTF-8</rosdepspan>'''</sourcesp><p>LANGUAGE='''<span style="color:#FF0000">zh_CN.listUTF-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.d</20p><p>[[File:zero2w-defaultimg200.list Recommended: please runpng]]</p></li></ol>
rosdep update<span id="installation-method-of-ubuntu-20.04-system"></span>
orangepi@orangepi:~$ '''rosdep update'''=== Installation method of Ubuntu 20.04 system ===
reading in sources <ol style="list data from -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]]</etcp></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:</rosp><p>[[File:zero2w-img203.png]]</rosdepp></sourcesli>{| 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.dpng]]</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-img209.png]]</p></li></ol>
Hit https://raw<span id="installation-method-of-ubuntu-22.githubusercontent.com/ros/rosdistro04-system"></master/rosdep/osx-homebrew.yamlspan>
Hit https://raw=== Installation method of Ubuntu 22.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml04 system ===
Hit https<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-img210.png]]</rawp></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.githubusercontentAfter dragging, the display will be as shown below:</p><p>[[File:zero2w-img211.compng]]</rosp></rosdistroli>{| 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.'''</masterbig>|}</rosdepol><ol start="4" style="list-style-type: decimal;"><li><p>Then select '''Apply System-Wide''' to apply the Chinese settings to the entire system</pythonp><p>[[File:zero2w-img212.yamlpng]]</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 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>Then you can see that the desktop is displayed in Chinese</p><p>[[File:zero2w-img207.png]]</p></li><li><p>Then open the Fcitx5 configuration program</p><p>[[File:zero2w-img213.png]]</p></li><li><p>Then choose to use Pinyin input method</p><div class="figure">
Hit https[[File://rawzero2w-img214.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yamlpng]]
Hit https</div></li><li><p>The interface after selection is as shown below, then click OK</p><p>[[File:zero2w-img215.png]]</p></rawli><li><p>Then we can open '''Geany''' to test the Chinese input method.githubusercontentThe opening method is as shown in the figure below</p><p>[[File:zero2w-img208.compng]]</p></rosli><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.</rosdistrop><p>[[File:zero2w-img216.png]]</masterp></releasesli></fuerte.yamlol>
Query rosdistro index https://raw.githubusercontent.com<span id="how-to-remotely-log-in-to-the-linux-system-desktop"></ros/rosdistro/master/index-v4.yamlspan>
Skip end-of-life distro &quot;ardent&quot;== How to remotely log in to the Linux system desktop ==
Skip end<span id="remote-oflogin-life distro &quot;bouncy&quot;using-nomachine"></span>=== Remote login using NoMachine ===
Skip end{| class="wikitable" style="background-of-life distro &quotcolor:#ffffdc;crystal&quotwidth:800px;" |-| <big>'''Please ensure that the Ubuntu or Debian system installed on the development board is a <span style="color:#FF0000">desktop version</span> 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. The document link is as follows:'''
Skip end'''https://knowledgebase.nomachine.com/DT10R00166'''</big>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''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 ofthe Orange Pi development board through NoMachine in Windows. For installation methods on other platforms, please refer to NoMachine's official documentation.'''</big>|}{| class="wikitable" style="background-life distro &quotcolor:#ffffdc;dashing&quotwidth:800px;" |-| <big>'''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.'''</big>|}
Skip end<ol style="list-style-type: decimal;"><li><p>First download the installation package ofthe NoMachine software Linux '''<span style="color:#FF0000">arm64</span>''' deb version, and then install it into the Linux system of the development board</p><ol style="list-life distro style-type: lower-alpha;"><li>Since H618 is an ARMv8 architecture SOC and the system we use is Ubuntu or Debian, we need to download the '''NoMachine for ARM ARMv8 DEB''' installation package. The download link is as follows:</li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note that this download link may change, please look for the Armv8/Arm64 version of the deb package.'''</big>|}{| class="wikitable" style="width:800px;" |-| [https://www.nomachine.com/download/download&id=112&quot;eloquents=ARM '''https://downloads.nomachine.com/download/?id=118&quotamp;distro=ARM''']|}
Add distro &quot;foxy&quot[[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>Add distro &quot;galactic&quot;<p>[[File:zero2w-img218.png]]</p><p>First enter the '''remote login software-NoMachine''' folder</p>Skip end<p>[[File:zero2w-img219.png]]</p><p>Then download the arm64 version ofthe deb installation package</p><p>[[File:zero2w-life distro &quot;groovy&quotimg220.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:~$ '''sudo dpkg -i nomachine_x.x.x_x_arm64_arm64.deb'''</p>|}Add distro &quot;humble&quot;</li></ol></li></ol>Skip end<ol start="2" style="list-style-type: decimal;"><li>Then download the installation package ofthe Windows version of the NoMachine software. The download address is as follows</li>{| class="wikitable" style="background-life distro &quotcolor:#ffffdc;hydro&quotwidth:800px;" |-| <big>'''Note that this download link may change.'''</big>|}{| class="wikitable" style="width:800px;" Skip end|-of-life distro &quot;indigo&quot;| '''https://downloads.nomachine.com/download/?id=9'''|}
Skip end[[File:zero2w-img221.png]]</ol><ol start="3" style="list-style-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:zero2w-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 ofNoMachine, 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-life distro &quot;jade&quot;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:zero2w-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>
Skip end<span id="remote-oflogin-life distro &quot;kinetic&quot;using-vnc"></span>
Skip end-of-life distro &quot;lunar&quot;=== Remote login using VNC ===
Add distro &quot{| class="wikitable" style="background-color:#ffffdc;melodic&quotwidth:800px;" |-| <big>'''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.'''
Add distro &quot;noetic&quot;'''<span style="color:#FF0000">There are many problems with VNC testing in Ubuntu20.04, please do not use this method.</span>'''</big>|}
Add distro &quot<ol style="list-style-type: decimal;rolling&quot"><li><p>First run the '''set_vnc.sh''' script to set up vnc, '''remember to add sudo permission'''s</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo set_vnc.sh'''</p><p>You will require a password to access your desktops.</p>
updated cache in /home/orangepi/.ros/rosdep/sources.cache
<ol start="6" p>Password: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''<span style="list-style-typecolor: decimal;#FF0000">#Set the vnc password here, 8 characters<li/span><p>Then open a command line terminal window on the '''desktop''', and then use the '''test_ros.sh''' script to start a small turtle routine to test whether ROS can be used normally.</p><p>orangepi@orangepiVerify:~$ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '''test_ros.sh<span style="color:#FF0000">#Set the vnc password here, 8 characters</span>'''</p></li><li><p>After running the Would you like to enter a view-only password (y/n)? '''test_ros.sh<span style="color:#FF0000">n</span>''' script, a small turtle as shown in the picture below will pop up.</p><p>[[Filexauth:zero2w-img248.png]]<file /p><root/li><li><p>Then please keep the terminal window you just opened at the top.Xauthority does not exist</p></li></ol>
<div class="figure">
[[File<p>New 'X' desktop is orangepi:zero2w-img249.png]]1</p>
</div>
<ol start="9" style="list-style-type: decimal;">
<li><p>At this time, press the direction keys on the keyboard to control the little turtle to move up, down, left, and right.</p>
<p>[[File:zero2w-img250.png]]</p></li></ol>
<span id="how-to-install-ros-2-galactic-on-ubuntu20p>Creating default startup script /root/.04"vnc/xstartup</p><p>Starting applications specified in /root/.vnc/xstartup</spanp>=== How to install ROS 2 Galactic on Ubuntu20<p>Log file is /root/.04 ===vnc/orangepi:1.log</p>
<ol style="list-style-type: decimal;">
<li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p>
<p>[[File:zero2w-img251.png]]</p>
<p>[[File:zero2w-img252.png]]</p>
<p>[http://docs.ros.org/ '''http://docs.ros.org''']</p>
<p>'''http://docs.ros.org/en/galactic/Releases.html'''</p></li>
<li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>
<p>'''docs.ros.org/en/galactic/Installation.html'''</p>
<p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p></li>
<li><p>In the official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board is the '''Ubuntu20.04 desktop system'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li>
<li><p>Use the '''install_ros.sh''' script to install ros2</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 &lt;command&gt; -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 &lt;command&gt; -h` for more detailed usage.</p></li>
<li><p>Then you can use the '''test_ros.sh''' 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>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/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"p>Killing Xtightvnc process ID 3047</spanp>=== 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 &lt;command&gt; -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 &lt;command&gt; -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"p>New 'X' desktop is orangepi:1</spanp>== 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 '''Starting applications specified in /optroot/'''</p><p>orangepi@orangepi:~$ '''ls /opt.vnc/linux-headers*'''xstartup</p><p>Log file is /optroot/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p><vnc/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*1.deb'''log</p>|}</li><li><p>After installation, you can see The steps to use MobaXterm software to connect to the folder where the kernel header file is located under '''/usr/src'''.</p><p>orangepi@orangepidevelopment board Linux system desktop are as follows:~$ '''ls /usr/src'''</p><p>linuxol style="list-headersstyle-x.x.x</p></litype: lower-alpha;"><li><p>Then you can compile First click Session, then select VNC, then fill in the source code of the hello kernel module that comes with the Linux image. The source code IP address and port of the hello module is in '''/usr/src/hello'''. After entering this directorydevelopment board, then use the make command and finally click OK to compileconfirm.</pli><p>orangepi@orangepi:~$ '''cd /usr/src/hello/'''</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo make'''</pdiv class="figure"><p>make -C /lib/modules/5.4.125/build M=/usr/src/hello modules</p><p>make[1][File: Entering directory '/usr/src/linux-headerszero2w-5img227.4.125'</p><p>CC [Mpng]] /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</pdiv><p>LD [M] /usr/src/hello/hello.ko</pol><p>make[1]: Leaving directory '/usr/src/linuxol start="2" style="list-headersstyle-5.4.125'</p></li><li><p>After compilation, the '''hello.ko''' kernel module will be generated</p><p>orangepi@orangepitype:/usr/src/hello$ '''ls *.ko'''</p><p>hello.ko</p></lilower-alpha;"><li><p>Use the '''insmod''' command to insert Then enter the '''hello.ko''' kernel module into the kernelVNC password set earlier</p><p>orangepi@orangepi[[File:/usr/src/hello$ '''sudo insmod hellozero2w-img228.ko'''png]]</p></li><li><p>Then use After successful login, the '''demsg''' command to view the output of the '''hello.ko''' kernel module. If interface is displayed as shown below, and then you can see remotely operate the following output, it means that desktop of the '''hello.ko''' kernel module is loaded correctly.</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p></li><li><p>Use the '''rmmod''' command to uninstall the '''hellodevelopment board Linux system.ko''' kernel module</p><p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p></li></ol>
[[File:zero2w-img229.png]]</ol></li></ol><span id="testing-of-some-programming-languages-supported-byqt-linuxinstallation-systemmethod"></span>== Testing of some programming languages supported by Linux system ==
<span id="debian-bullseye-system"></span>=== Debian Bullseye system =QT installation method ==
<ol style="list-style-type: decimal;">
<li><p>Debian Bullseye is installed with Use the gcc compilation tool chain by default, which can directly compile C language programs in the Linux system of the development board.following script to install QT5 and QT Creator</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc -|-version'''</p><p>gcc (Debian 10.2.1-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 PURPOSE.</p></li><li><p>Write the '''hello_world.c''' program in C language</p>| <p>orangepi@orangepi:~$ '''vim hello_worldinstall_qt.csh'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>|}</p></li><li><p>Then compile and run '''hello_world.c'''</p><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 Bullseye has Python3 installed by defaultAfter installation, the QT version number will be automatically printed.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific qt version of Python that comes with Ubuntu20.04 is as follows'''5.12.8'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3install_qt.sh'''</p><p>'''Python 3.9.2''' (default, Feb 28 2021, 17:03:44)....</p><p>[GCC 10.2QMake version 3.1 20210110] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.Using Qt version '''</pspan style="color:#FF0000"><p>&gt;&gt;&gt;5.12.8</p><pspan>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>Write the The QT version that comes with Ubuntu22.04 is '''hello_world5.15.py3''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_worldinstall_qt.pysh'''</p><p>print(......</p><p>QMake version 3.1</p><p>Using Qt version ''Hello World!')<span style="color:#FF0000">5.15.3</span>''' in /usr/lib/aarch64-linux-gnu</p>|}</li><li><p>The result of running QT version that comes with Debian11 is '''hello_world5.py15.2''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_worldinstall_qt.pysh'''</p><p>Hello World!......</p><p>QMake version 3.1</lip><p>Using Qt version '''<span style="color:#FF0000">5.15.2</span>''' in /usr/lib/aarch64-linux-gnu</olp>|}
</li>
<li><p>Debian Bullseye does not install Java compilation tools and operating environment by defaultThe QT version that comes with Debian12 is '''5.15.8'''</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk. The latest &gt; version in Debian Bullseye is openjdk|-17</p>| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdkinstall_qt.sh'''</p></li><li><p>After installation, you can check the Java version......</p><p>orangepi@orangepi:~$ '''java --QMake version'''3.1</p></li><li><p>Write the Java Using Qt version of '''hello_world.java'''</p><p>orangepi@orangepispan style="color:~$ '''vim hello_world.java'''</p#FF0000"><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System5.out15.println(&quot;Hello World!&quot;);</p><p>}8</pspan><p>}</p></li><li><p>Then compile and run '''hello_world.java'''<in /usr/p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<lib/p><p>orangepi@orangepi:~$ '''java hello_world'''aarch64-linux-gnu</p><p>Hello World!</p></li></ol>|}
</li></ol>
 
<span id="debian-bookworm-system"></span>
=== Debian Bookworm system ===
 
<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>
<p>orangepi@orangepi:~$ '''gcc --version'''</p>
<p>gcc (Debian 12.2.0-14) 12.2.0</p>
<p>Copyright (C) 2022 Free Software Foundation, Inc.</p>
<p>This is free software; see the source for copying conditions. There is NO</p>
<p>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p></li>
<li><p>Write the '''hello_world.c''' program in C language</p>
<p>orangepi@orangepi:~$ '''vim hello_world.c'''</p>
<p>#include &lt;stdio.h&gt;</p>
<p>int main(void)</p>
<p>{</p>
<p>printf(&quot;Hello World!\n&quot;);</p>
<p>return 0;</p>
<p>}</p></li>
<li><p>Then compile and run '''hello_world.c'''</p>
<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 defaultThen you can see the QT Creator startup icon in '''Applications'''</p><p>[[File:zero2w-img230.png]]</p><p>You can also use the following command to open QT Creator</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''qtcreator'''</p>|}</li><li><p>The interface after QT Creator is opened is as follows</p><p>[[File:zero2w-img231.png]]</p></li><li><p>The version of QT Creator is as follows</p>
<ol style="list-style-type: lower-alpha;">
<li><p>The specific default version of Python is as follows</p><p>orangepi@orangepi:~$ QT Creator in '''python3Ubuntu20.04'''is as follows</p><p>Python 3.11.2 (main, Mar 13 2023, 12:18[[File:29) [GCC 12zero2w-img232.2.0png]] on linux</p><p/li>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</pli><p>&gt;&gt;&gt;The default version of QT Creator in '''Ubuntu22.04''' is as follows</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode[[File:zero2w-img233.'''png]]</p></li><li><p>Write the The default version of QT Creator in '''hello_world.pyDebian11''' program in Python languageis as follows</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img234.py'''</p><p>print('Hello World!')png]]</p></li><li><p>The result default version of running QT Creator in '''hello_world.pyDebian12''' is as follows</p><p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img235.py'''</p><p>Hello World!png]]</p></li></ol>
</li>
<li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.Then set up QT</p>
<ol style="list-style-type: lower-alpha;">
<li><p>You can use the following command to install openjdk. The latest First open '''Help'''-&gt; version in Debian Bookworm is openjdk-17</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdkAbout Plugins...'''</p></li><li><p>After installation, you can check the Java version.</p><p>orangepi@orangepi[[File:~$ '''java zero2w--version'''img236.png]]</p></li><li><p>Write Then remove the Java version check mark of '''hello_world.javaClangCodeModel'''</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img237.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[png]] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></li><li><p>Then compile and run '''hello_world.java'''</pspan style="color:#FF0000"><p>orangepi@orangepi:~$ '''javac hello_world.java'''After setting up, you need to restart QT Creator</pspan><p>orangepi@orangepi:~$ '''java hello_world'''</p><p>Hello World!</p></li></ol></li></ol> <span id="ubuntu-focal-system"></span>=== Ubuntu Focal system === <ol style="list-style-type: decimal;"><li><p>Ubuntu Focal is installed with Then make sure the gcc compilation tool chain GCC compiler used by QT Creator. If the defaultis Clang, which can directly compile C language programs in the Linux system of the development boardplease change it to GCC.</p><ol {| class="wikitable" style="listbackground-style-typecolor:#ffffdc;width: lower-alpha800px;">|-| <li><p>The version of a.gcc is as follows</pbig><p>orangepi@orangepi:~$ '''gcc --versionDebian12 please skip this step.'''</p><p>gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0</pbig>|}<p>Copyright (C) 2019 Free Software Foundation, Inc[[File:zero2w-img238.png]]</p><p>This is free software; see the source for copying conditions[[File:zero2w-img239. There is NOpng]]</p><p/li>warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</pol></li><li><p>Write the '''hello_world.c''' program in C languageThen you can open a sample code</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img240.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}png]]</p></li><li><p>Then compile and run '''hello_worldAfter clicking on the sample code, the corresponding instruction document will automatically open. You can read the instructions carefully.c'''</p><p>orangepi@orangepi[[File:~$ '''gcc zero2w-o hello_world hello_worldimg241.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''png]]</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Focal has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ Then click '''python3Configure Project'''</p><p>Python 3.8.10 (default, Nov 14 2022, 12[[File:59:47)</p><p>[GCC 9zero2w-img242.4.0png]] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></li><li><p>Write Then click the '''hello_world.py''' program green triangle in Python languagethe lower left corner to compile and run the sample code</p><p>orangepi@orangepi[[File:~$ '''vim hello_worldzero2w-img243.py'''</p><p>print('Hello World!')png]]</p></li><li><p>The result After waiting for a period of running '''hello_worldtime, the interface shown in the figure below will pop up, which means that QT can compile and run normally.py''' is as follows</p><p>orangepi@orangepi[[File:~$ '''python3 hello_worldzero2w-img244.py'''</p><p>Hello World!png]]</p></li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.References</p><ol {| class="wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>You can use the following command to install openjdk|-17</p>| <p>orangepi@orangepi[https:~$ //wiki.qt.io/Install_Qt_5_on_Ubuntu '''sudo apt install -y openjdk-17-jdk'''<https:/p></li><li><p>After installation, you can check the Java versionwiki.qt.<io/p><p>orangepi@orangepi:~$ '''java --versionInstall_Qt_5_on_Ubuntu''']</p><p>openjdk 17.0.2 2022-01-18<[https:/p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0download.2+8-Ubuntu-120qt.04, mixed mode, sharing)<io/p><archive/li><li><p>Write the Java version of qtcreator '''hello_worldhttps://download.java'''<qt.io/archive/p><p>orangepi@orangepi:~$ '''vim hello_world.javaqtcreator''']</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)<https:/p><p>{</p><p>Systemdownload.outqt.println(&quot;Hello World!&quot;);</p><p>}<io/p><p>}<archive/p></li><li><p>Then compile and run qt '''hello_worldhttps://download.java'''<qt.io/p><p>orangepi@orangepi:~$ '''javac hello_world.java'''<archive/p><p>orangepi@orangepi:~$ '''java hello_worldqt''']</p><p>Hello World!</p></li></ol>|}
</li></ol>
<span id="ubunturos-jammyinstallation-systemmethod"></span> === Ubuntu Jammy system =ROS installation method ==
<ol stylespan id="listhow-styleto-type: decimal;"><li><p>Ubuntu Jammy 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="listinstall-styleros-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p><p>orangepi@orangepi:~$ '''gcc 1-noetic-version'''</p><p>gcc (Ubuntu 11.3.0on-1ubuntu1~22ubuntu20.04.1) '''11.3.0'''</p><p">Copyright (C) 2021 Free Software Foundation, Inc.</pspan><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><p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p><p>int main(void)</p><p>{</p><p>printf(&quot;Hello World!\n&quot;);</p><p>return 0;</p><p>}</p></li><li><p>Then compile and run '''hello_world.c'''</p><p>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</p><p>orangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p></li></ol></li><li><p>Ubuntu Jammy has Python3 installed by default</p><ol style="list-style-type: lower-alpha;"><li><p>The specific version of Python3 is as follows</p><p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p><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_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 = How to install openjdk-18</p><p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-18-jdk'''</p></li><li><p>After installation, you can check the Java version.</p><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-222ROS 1 Noetic on Ubuntu20.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><p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p><p>public static void main(String[] args)</p><p>{</p><p>System.out.println(&quot;Hello World!&quot;);</p><p>}</p><p>}</p></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 id="method-# The currently active version of-uploading-files-to-ROS 1 is as follows, the-development-board-linux-system"></span>== Method of uploading files to the development board Linux system ==recommended version is '''Noetic Ninjemys'''
<span id="method::[[File:zero2w-to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===img245.png]]
<span id="how::[[File:zero2w-to-upload-files-using-scp-command"></span>==== How to upload files using scp command ====img246.png]]
<ol style::{| class="list-style-type: decimal;wikitable"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-typewidth: lower-alpha800px;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to &gt; be uploaded</p></li>|-| <li><p>'''orangepi[http: '''This is the user name of the development board's &gt; Linux system. It can also be replaced with something else, &gt; such as root.</p></li><li><p>'''192.168.xxdocs.xx:''' This is the IP address of the development &gt; boardros. Please modify it according to the actual situation.</p><org/li><li><p>'''/home/orangepihttp:''' The path in the development board Linux &gt; system can also be modified to other paths.</p><p>test@test:~$ '''scp file_path orangepi@192.168.xx.xx:/home/orangepi/'''</p></li></ol></li><li><p>If you want to upload a folder, you need to add the -r parameter</p><p>test@test:~$ '''scp -r dir_path orangepi@192docs.168ros.xx.xx:/home/orangepi/org'''</p></li><li><p>There are more usages of scp, please use the following command to view the man manual</p></li></ol>]
test'''https://wiki.ros.org/Distributions'''|} <ol start="2" style="list-style-type: decimal;"><li><p>The link to the official installation documentation of ROS 1 '''Noetic Ninjemys''' is as follows:</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation/Ubuntu '''http://wiki.ros.org/noetic/Installation/Ubuntu''']</p>|}</li><li><p>In the official installation documentation of ROS '''Noetic Ninjemys''', Ubuntu recommends using Ubuntu20.04, so please ensure that the system used by the development board is '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://wiki.ros.org/noetic/Installation '''http://wiki.ros.org/noetic/Installation''']</p><p>[[File:zero2w-img247.png]]</p>|}</li><li><p>Then use the script below to install ros1</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''man scpinstall_ros.sh ros1'''</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 in ROS.</p></li>{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''<span style="color:#FF0000">Note that when running 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.</span>'''
<span id="how-to-upload-files-using-filezilla"></span>
==== How to upload files using filezilla ====
<ol style="list-style-type: decimal;"><li><p>First install filezilla in Ubuntu PC</p><p>test@test:~$ '''sudo apt install -y filezilla'''<The install_ros.sh script will try to modify /p><etc/li><li><p>Then use hosts and automatically run the following command to open filezilla</p><p>test@test:~$ '''filezilla'''</p></li><li><p>The interface after opening filezilla is as shown belowcommands. At 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 remote site on linux system of the right is emptydevelopment board to access github normally, and then manually run the following Order.</p><div class="figure">'''
[[File:zero2w-img255.png]]
<'''https:/div></li><li><p>The method of connecting the development board is as shown in the figure below<raw.githubusercontent.com/p><ros/li><rosdistro/ol>master/rosdep/osx-homebrew.yaml'''
<div class="figure">'''Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml'''
[[File'''<span style="color:zero2w-img256.png]]#FF0000">ERROR: error loading sources list:</span>'''
::'''</div><ol start="5" span style="list-style-typecolor: decimal;#FF0000">The read operation timed out<li/span><p>Then choose to '''save the password''' and click '''OK'''</pbig><p>[[File|}{| class="wikitable" style="width:zero2w800px;" |-img257.png]]</p></li><li><p>Then select | orangepi@orangepi:~$ '''Always trust this host''' and click '''OKsource /opt/ros/noetic/setup.bash'''</p></li></ol>
<div class="figure">orangepi@orangepi:~$ '''sudo rosdep init'''
[[File:zero2wWrote /etc/ros/rosdep/sources.list.d/20-img258default.png]]list
</div><ol start="7" style="list-style-typeRecommended: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.</li></ol>please run
<div class="figure">
[[File:zero2w-img259.png]]:rosdep update
</div><ol start="8" style="list-style-typeorangepi@orangepi: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li></ol>~$ '''rosdep update'''
<div class="figure">reading in sources list data from /etc/ros/rosdep/sources.list.d
[[FileHit https:zero2w//raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-img260homebrew.png]]yaml
<Hit https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/div>base.yaml<ol start="9" style="list-style-typeHit https: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file//raw.githubusercontent.<com/p><ros/li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.<rosdistro/p><master/li><rosdep/ol>python.yaml
<span id="method-to-upload-files-from-windows-pc-to-development-board-linux-system"><Hit https:/span>=== Method to upload files from Windows PC to development board Linux system ===/raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
<span id="how-to-upload-files-using-filezilla-1"><Hit https:/span>==== How to upload files using filezilla ====/raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml
# First download the installation file of the Windows version of the filezilla softwareQuery rosdistro index https://raw. The download link is as followsgithubusercontent.com/ros/rosdistro/master/index-v4.yaml
[https://filezillaSkip end-project.org/download.php?type=client '''https://filezillaof-project.org/download.php?type=client''']life distro &quot;ardent&quot;
[[File:zero2wSkip end-img261.png]]of-life distro &quot;bouncy&quot;
<div class="figure">Skip end-of-life distro &quot;crystal&quot;
[[File:zero2wSkip end-img262.png]]of-life distro &quot;dashing&quot;
</div><ol start="2" style="listSkip end-styleof-type: decimallife distro &quot;eloquent&quot;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p><p>'''FileZilla_Server_1.5.1_win64-setup.exe'''</p></li></ol>
During the installation process, please select '''Decline''' on the following installation interface, and then select '''NextAdd distro &gtquot;foxy&quot;'''
<div class="figure">Add distro &quot;galactic&quot;
[[File:zero2wSkip end-img263.png]]of-life distro &quot;groovy&quot;
</div><ol start="3" style="list-style-type: decimalAdd distro &quot;humble&quot;"><li>The interface after opening filezilla is as shown below. At this time, the remote site on the right is empty.</li></ol>
<div class="figure">Skip end-of-life distro &quot;hydro&quot;
[[File:zero2wSkip end-img264.png]]of-life distro &quot;indigo&quot;
</div><ol start="4" style="listSkip end-styleof-type: decimallife distro &quot;jade&quot;"><li>The method of connecting the development board is as shown in the figure below:</li></ol>
<div class="figure">Skip end-of-life distro &quot;kinetic&quot;
[[File:zero2wSkip end-img256.png]]of-life distro &quot;lunar&quot;
</div><ol start="5" style="list-style-type: decimalAdd distro &quot;melodic&quot;"><li>Then choose to '''save the password''' and click '''OK'''</li></ol>
<div class="figure">Add distro &quot;noetic&quot;
[[File:zero2w-img265.png]]Add distro &quot;rolling&quot;
updated cache in /home/orangepi/.ros/rosdep/sources.cache|}</divol>
<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>
[[File:zero2w-img267=== How to install ROS 2 Galactic on Ubuntu20.png]]04 ===
<ol style="list-style-type: decimal;"><li><p>The currently active version of ROS 2 is as follows, the recommended version is '''Galactic Geochelone'''</p><p>[[File:zero2w-img251.png]]</divp><ol startp>[[File:zero2w-img252.png]]</p>{| class="8wikitable" style="listwidth:800px;" |-| <p>[http://docs.ros.org/ '''http://docs.ros.org''']</p><p>'''http://docs.ros.org/en/galactic/Releases.html'''</p>|}</li><li><p>The link to the official installation documentation of ROS 2 '''Galactic Geochelone''' is as follows:</p>{| class="wikitable" style-type="width: decimal800px;"|-| <p>'''docs.ros.org/en/galactic/Installation.html'''</p><p>'''http://docs.ros.org/en/galactic/Installation/Ubuntu-Install-Debians.html'''</p>|}</li><li>Then select <p>In the path to be uploaded to official installation documentation of ROS 2 '''Galactic Geochelone''', Ubuntu Linux recommends using Ubuntu20.04, so please ensure that the system used by the development board on is the right side of '''<span style="color:#FF0000">Ubuntu20.04 desktop system</span>'''. There are several ways to install ROS 2. The following demonstrates how to install ROS 2 '''Galactic Geochelone''' through '''Debian packages'''.</p></li><li><p>Use the filezilla software, select the file '''install_ros.sh''' script to be uploaded on the Windows PC on the left side of install ros2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''install_ros.sh ros2'''</p>|}</li><li><p>The '''install_ros.sh''' script will automatically run the filezilla software, right'''ros2 -click h''' command after installing ros2. If you can see the mousefollowing print, and then click it means that the upload option to start uploading the file to the development boardros2 installation is complete.</lip>{| class="wikitable" style="width:800px;" |-| <p>usage: ros2 [-h] Call `ros2 &lt;command&gt; -h` for more detailed usage. ...</olp>
<div class="figure">
[[File:zero2w<p>ros2 is an extensible command-img268line tool for ROS 2.png]]</p>
</div>
<ol start="9" style="list-style-type: decimal;">
<li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</p></li>
<li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
<span id="instructions-for-using-thep>optional arguments:</p>:<p>-logoh, -on-help show this help message and-off-the-machine">exit</spanp>== Instructions for using the logo on and off the machine ==
<ol style="list-style-type: decimal;">
<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>
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>'''bootlogo=false'''</p></li>
<li><p>Set the '''bootlogo''' variable to '''true''' in '''/boot/orangepiEnv.txt''' to enable the power on/off logo.</p>
<p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p>
<p>verbosity=1</p>
<p>'''bootlogo=true'''</p></li>
<li><p>The location of the boot logo picture in the Linux system is</p>
<p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p></li>
<li><p>After replacing the boot logo image, you need to run the following command to take effect</p>
<p>orangepi@orangepi:~$ '''sudo update-initramfs -u'''</p></li></ol>
<span id="howp>Commands:</p>:<p>action Various action related sub-tocommands</p>:<p>bag Various rosbag related sub-turncommands</p>:<p>component Various component related sub-oncommands</p>:<p>daemon Various daemon related sub-thecommands</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-powercommands</p>:<p>multicast Various multicast related sub-buttoncommands</p>:<p>node Various node related sub-incommands</p>:<p>param Various param related sub-linux5.4"commands</p>:<p>pkg Various package related sub-commands</spanp>== How :<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 turn on the power button in Linux5.4 ==`doctor`</p> 
There is no power on:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p>|}</off button on li><li><p>Then you can use the main board of the development board'''test_ros.sh''' script to test whether ROS 2 is installed successfully. We If you can expand see the following print, it through a 24pin expansion boardmeans ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <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. The location of 199580322] [talker]: Publishing: 'Hello World: 3'</p><p>[INFO] [1671174103.204019965] [listener]: I heard: [Hello World: 3]</p>|}</li><li><p>Run the power onfollowing command to open rviz2</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''source /opt/ros/galactic/setup.bash'''</p><p>orangepi@orangepi:~$ '''ros2 run rviz2 rviz2'''</off button on p>|}<p>[[File:zero2w-img253.png]]</p></li><li><p>For how to use ROS, please refer to the expansion board is as followsdocumentation of ROS 2.</p>{| class="wikitable" style="width:800px;" |-| <p>[http://docs.ros.org/en/galactic/Tutorials.html '''http://docs.ros.org/en/galactic/Tutorials.html''']</p>|}</li></ol>
[[File:zero2w<span id="how-img269to-install-ros-2-humble-on-ubuntu22.png]]04"></span>
The power on/off button of the Linux 6.1 image is turned on by default, but the power on/off button of the Linux 5.4 kernel image is turned off by default and needs === How to be turned install ROS 2 Humble on manually for normal useUbuntu22. The steps are as follows:04 ===
<ol style="list-style-type: decimal;">
<li><p>First run '''orangepi-config'''Use the install_ros. Ordinary users remember sh script to add '''sudoinstall_ros.sh''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-configinstall_ros.sh ros2'''</p></li><li><p>Then select '''System'''</p>|}<p>[[File:zero2w-img80.png]]</p></li><li><p>Then select The '''Hardwareinstall_ros.sh'''</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 script will automatically run the '''spaceros2 -h''' to select command after installing ros2. If you can see the dtbo configuration of following print, it means that the SPI you want to openros2 installation is complete.</p><p>[[File{| class="wikitable" style="width:zero2w800px;" |-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p>| <p>usage: ros2 [[File:zero2w-img83.pngh]]</p></li><li><p>Then select '''Call `ros2 &lt;Backcommand&gt;'''</p><p>[[File:zero2w-img84h` for more detailed usage. ..png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>
<span id="howp>ros2 is an extensible command-to-shut-down-and-restart-the-development-board">line tool for ROS 2.</spanp>== How to shut down and restart the development board ==
<ol style="list-style-type: decimal;">
<li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</p>
<p>orangepi@orangepi:~$ '''sudo poweroff'''</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>'''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.4.'''</p></li>
<li><p>Use the '''reboot''' command to restart the Linux system in the development board</p>
<p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p></li></ol>
<span id="linux-sdkorangepip>optional arguments:</p>:<p>-buildh, -usage-instructions">help show this help message and exit</spanp>
= '''Linux SDK——orangepi-build usage instructions''' =
<span id="compilationp>Commands:</p>:<p>action Various action related sub-commands</p>:<p>bag Various rosbag related sub-commands</p>:<p>component Various component related sub-systemcommands</p>:<p>daemon Various daemon related sub-requirements"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</spanp>== Compilation system requirements ==:<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>
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''Ubuntu 22.04''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the Release field does not display '''22.04''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
:<p>Call `ros2 &lt;command&gt; -h` for more detailed usage.</p>|}</li><li><p>Then you can use the '''test_ros.sh''' script to testwhether ROS 2 is successfully installed. If you can see the following print, it means ROS 2 can run normally.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@testorangepi:~$ '''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>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''source /opt/ros/humble/setup.bash'''</p><p>orangepi@orangepi:~$ '''lsb_release ros2 run rviz2 rviz2'''</p><p>[[File:zero2w-img254.png]]</p>|}</li><li><p>Reference documentation</p>{| class="wikitable" style="width:800px;" |-| <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-aDebians.html''']</p>|}</li></ol>
No LSB modules are available.<span id="how-to-install-kernel-header-files"></span>
Distributor ID: Ubuntu== How to install kernel header files ==
Description{| class="wikitable" style="background-color: Ubuntu 22#ffffdc;width:800px;" |-| <big>'''Debian11 system with <span style="color:#FF0000">Linux6.1</span> kernel will report GCC error when compiling kernel module. So if you want to compile the kernel module, please use Debian12 or Ubuntu22.04 LTS.'''</big>|}
Release<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 '''22.04/opt/'''</p>{| class="wikitable" style="width:800px;" |-| Codename<p>orangepi@orangepi: ~$ '''jammyls /opt/linux-headers*'''</p><p>/opt/linux-headers-xxx-sun50iw9_x.x.x_arm64.deb</p>|}If </li><li><p>Use the following command to install the deb package of the computer is installed with a Windows system and does not have Ubuntu 22kernel header file</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg -i /opt/linux-headers*.04 installed on itdeb'''</p>|}</li><li><p>After installation, you can consider usingsee the folder where the kernel header file is located under '''VirtualBox/usr/src''' or .</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''VMwarels /usr/src''' to install an Ubuntu 22</p><p>linux-headers-x.04 virtual machine in the Windows systemx. But please note, do not x</p>|}</li><li><p>Then you can compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in source code of the hello kernel module that comes with the Linux image. The source code of the WSL virtual machine, so there hello module is no guarantee that orangepi-build can be used normally in WSL'''/usr/src/hello'''. In additionAfter entering this directory, please do not then use the make command to compile the Linux system on the development board. Use </p>{| class="wikitable" style="width:800px;" |-| <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/buildM=/usr/src/hello modules</p><p>make[1]: Entering directory '/usr/src/linux-headers-5. The installation image download address of Ubuntu 224.125'</p>:<p>CC [M] /usr/src/hello/hello.04 amd64 version iso</p>:<p>Building modules, stage 2.</p>:<p>MODPOST 1 modules</p>:<p>CC [https:M] /usr/src/hello/repohello.huaweicloudmod.como</ubuntu-releasesp>:<p>LD [M] /usr/src/hello/21hello.04ko</p><p>make[1]: Leaving directory '/usr/src/ubuntulinux-21headers-5.04-desktop-amd644.125'</p>|}</li><li><p>After compilation, the '''hello.iso ko'''httpskernel module will be generated</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/mirrorshello$ '''ls *.tunako'''</p><p>hello.tsinghuako</p>|}</li><li><p>Use the '''insmod''' command to insert the '''hello.edu.cnko''' kernel module into the kernel</ubuntup>{| class="wikitable" style="width:800px;" |-releases| <p>orangepi@orangepi:/usr/22.04src/ubuntu-22hello$ '''sudo insmod hello.04-desktop-amd64.isoko''']</p>|}</li>After installing Ubuntu 22.04 on your computer or virtual machine, please first set <li><p>Then use the '''demsg''' command to view the software source output of Ubuntu 22the '''hello.ko''' kernel module.04 to Tsinghua source (or other domestic sources that If you think is fast)can see the following output, otherwise it means that the '''hello.ko''' kernel module is easy loaded correctly.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] '''Hello Orange Pi -- init'''</p>|}</li><li><p>Use the '''rmmod''' command to make errors due to network reasons when installing uninstall the software later'''hello. The steps to replace Tsinghua Source are as followsko''' kernel module</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:/usr/src/hello$ '''sudo rmmod hello'''</p><p>orangepi@orangepi:/usr/src/hello$ '''dmesg | grep &quot;Hello&quot;'''</p><p>[ 2871.893988] Hello Orange Pi -- init</p><p>[ 3173.800892] '''Hello Orange Pi -- exit'''</p>|}</li></ol>
<ol stylespan id="listtesting-styleof-some-programming-languages-supported-by-type: lowerlinux-alpha;system"><li>For the method of replacing Tsinghua Source, please refer to the instructions on this page.</li></olspan>
[https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ '''https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/''']== Testing of some programming languages supported by Linux system ==
<ol startspan id="2" style="listdebian-stylebullseye-type: lower-alpha;system"><li>Note that the Ubuntu version needs to be switched to 22.04.</li></olspan>=== Debian Bullseye system ===
[[File<ol style="list-style-type:zero2wdecimal;"><li><p>Debian Bullseye 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-img271style-type: lower-alpha;"><li><p>The version of a.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc --version'''</p><p>gcc (Debian 10.2.1-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 PURPOSE.</p>|}</li><li><p>Write the '''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.png]]h&gt;</p>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The contents of the '''/etc/apt/sources.list''' file that need to be replaced are:</li></ol>
test@test:~$ '''sudo mv <p>int main(void)</etcp><p>{</apt/sources.list cat /etc/aptp>:<p>printf(&quot;Hello World!\n&quot;);</sources.list.bak'''p>
test@test:~$ '''sudo vim /etc/apt/sources.list'''
# The source code image is commented by default to improve apt update speed. You can uncomment it yourself if necessary. deb https:<p>return 0;</p><p>}</mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiversep>|}# deb-src https:<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverseli> deb https://mirrors<li><p>Then compile and run '''hello_world.tuna.tsinghua.edu.cnc'''</ubuntu/ jammy-updates main restricted universe multiversep> # deb-src https{| class="wikitable" style="width://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse800px;"  deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy|-backports main restricted universe multiverse| # deb-src https<p>orangepi@orangepi://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy~$ '''gcc -backports main restricted universe multiverse deb https://mirrorso hello_world hello_world.tuna.tsinghua.edu.cnc'''</ubuntu/ jammy-security main restricted universe multiversep> # deb-src https<p>orangepi@orangepi://mirrors.tuna.tsinghua.edu~$ '''.cn/ubuntuhello_world'''</ jammy-security main restricted universe multiversep> # Pre-release software source, not recommended to be enabled # deb https:<p>Hello World!<//mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiversep>|}# deb-src https:</li></mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverseol><ol start="4" style="list-style-type: lower-alpha;"/li><li>After the replacement, you need to update the package information and ensure that no errors are reported.</lip>Debian Bullseye has Python3 installed by default</olptest@test:~$ '''sudo apt-get update''' <ol start="5" style="list-style-type: lower-alpha;"><li>'''In addition, since the source code <p>The specific version of the kernel and Uboot are stored on GitHub, it Python is very important to ensure that the computer can download the code from GitHub normally when compiling the image.'''</li>as follows</olp<span id{| class="obtain-the-source-code-of-linux-sdkwikitable"></span>== Obtain the source code of linux sdk == <span idstyle="download-orangepi-build-from-githubwidth:800px;"></span>=== Download orangepi|-build from github ===| Linux sdk refers to the <p>orangepi-build set of codes. Orangepi-build is modified based on the armbian build compilation system. Multiple versions of Linux images can be compiled using @orangepi-build. Use the following command to download the orangepi-build code: test@test:~$ '''sudo apt-get updatepython3'''</p> test@test:~$ <p>'''sudo apt-get install -y gitPython 3.9.2''' test@test(default, Feb 28 2021, 17:~$ '''git clone https03:44)<//github.com/orangepi-xunlong/orangepi-build.git -b next''' '''Note that when using the H618 Soc development board, you need to download the source code of the next branch of orangepi-build. The above git clone command needs to specify the branch of the orangepi-build source code as next.'''p><div class="figure"p> [[File:zero2w-img272GCC 10.2.png1 20210110]] on linux</divp>'''When downloading the orangepi-build code through the git clone command<p>Type &quot;help&quot;, &quot;copyright&quot;, you do not need to enter the user name and password of the github account (the same is true &quot;credits&quot; or &quot;license&quot; for downloading other codes in this manual)more information. If after entering the git clone command, Ubuntu PC prompts you to enter the user name of the github account. The name and password are usually entered incorrectly in the address of the orangepi-build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the username and password of the github account.'''</p><p>&gt;&gt;&gt;</p>The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:|}{| class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| <big><p>'''branchUse the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>| }</li><li><p>Write the '''u-boot Versionhello_world.py'''program in Python language</p>{| '''linux Kernel version'''class="wikitable" style="width:800px;"
|-
| <p>orangepi@orangepi:~$ '''currentvim hello_world.py'''</p>| '''u-boot v2018.05'<p>print('Hello World!')</p>| }</li><li><p>The result of running '''linux5hello_world.4py'''is as follows</p>{| class="wikitable" style="width:800px;"
|-
| '''next'''| <p>orangepi@orangepi:~$ '''u-boot v2021python3 hello_world.07py'''</p>| '''linux6.1'''<p>Hello World!</p>
|}
</li></ol>'''The branch mentioned here is </li><li><p>Debian Bullseye does not the same thing as the branch of orangepi-build source code, please don't get confused. This branch is mainly used to distinguish different kernel source code versions.''' '''We define the linux5.4 bsp kernel currently provided install Java compilation tools and operating environment by Allwinner as the current branchdefault. The latest linux6.1 LTS kernel is defined as the next branch.''' After downloading, the following files and folders will be included:</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:~$ '''build.shsudo apt install -y openjdk-17-jdk''': Compile startup script</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''externaljava --version''': Contains configuration files needed to compile the image, specific scripts, and source code of some programs, etc.</p>|}</li><li><p>Write the Java version of '''LICENSEhello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi: GPL 2 license file~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</li><li><p>Then compile and run '''READMEhello_world.mdjava'''</p>{| class="wikitable" style="width: orangepi800px;" |-build documentation| </p>orangepi@orangepi:~$ '''javac hello_world.java'''</lip><li><p>orangepi@orangepi:~$ '''scriptsjava hello_world''': Common script for compiling linux images</p><p>Hello World!</p>|}</li></ol></li></ol>
test@test:~<span id="debian-bookworm-system"></orangepi-build$ '''ls'''span>
'''build.sh external LICENSE README.md scripts'''=== Debian Bookworm system ===
'''If you downloaded the orangepi<ol style="list-build code from github, after downloading, you may find that orangepistyle-build does not contain type: decimal;"><li><p>Debian Bookworm is installed with the source code of u-boot and linux kernel, and there is no cross-gcc compilation tool required to compile u-boot and linux kernel. chainby default, this is normal, because these things are stored which can directly compile C language programs in other separate github repositories or some servers (their addresses will be detailed below)the Linux system of the development board. Orangepi</p><ol style="list-style-type: lower-build will specify the addresses alpha;"><li><p>The version of ua.gcc is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''gcc -boot, Linux kernel and cross-compilation tool chain in the script and configuration fileversion'''</p><p>gcc (Debian 12.2. When running orangepi0-build14) 12.2.0</p><p>Copyright (C) 2022 Free Software Foundation, when it finds that these things are Inc.</p><p>This is free software; see the source for copying conditions. There is NO</p><p>warranty; not available locally, it will automatically download them from even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the corresponding places'''hello_world.c''' program in C language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.c'''</p><p>#include &lt;stdio.h&gt;</p>
<span id="download-the-cross-compilation-tool-chain"></span>
=== Download the cross-compilation tool chain ===
When orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Every time you run orangepi-build's build.sh script, it will check whether the cross-compilation toolchain in toolchains exists. If If it does not exist, the download will be restarted. If it exists, it will be used directly without repeated downloading.<p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
<div class="figure">
[[File:zero2w-img273.png]] </divp>The mirror URL of the cross-compilation tool chain in China is the open source software mirror site of Tsinghua University: [https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/'''] After toolchains is downloaded, it will contain multiple versions of cross-compilation t'''toolchain''': test@test:~/orangepi-build$ '''ls toolchains/''' gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu gcc-linaro-4.9.4-2017.01-x86_64_aarch64-linux-gnu gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi gcc-arm-11.2-2022.02-x86_64-arm-none-linux-gnueabihf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabi gcc-linaro-aarch64-none-elf-4.8-2013.11_linux gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu gcc-linaro-5.5.return 0-2017.10-x86_64_arm-linux-gnueabihf gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu gcc-linaro-arm-none-eabi-4.8-2014.04_linux The cross-compilation tool chain used to compile the H618 Linux kernel source code is: ;<ol style="list-style-type: lower-alpha;"/p><li>linux5.4</lip>}</olp'''gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''|}<ol start="2" style="list-style-type: lower-alpha;"/li><li>linux6.1</lip></ol> Then compile and run '''gcc-arm-11.2-2022hello_world.02-x86_64-aarch64-none-linux-gnuc''' The cross-compilation tool chain used to compile the H618 u-boot source code is: <ol style="list-style-type: lower-alpha;"><li>v2018.05</lip></ol> '''gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi''' <ol start{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;">|-| <lip>v2021.07</li></ol> orangepi@orangepi:~$ '''gcc-arm-11o hello_world hello_world.2-2022.02-x86_64-aarch64-none-linux-gnuc''' <span id="orangepi-build-complete-directory-structure-description"></span>=== orangepi-build complete directory structure description === <ol style="list-style-type: decimal;"p><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse@orangepi:~$ '''./hello_world'''</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched toHello World!</p><ol style="list-style-type: lower-alpha;"><li>Linux5.4</li></ol>|}
</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 toDebian Bookworm has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>v2018<p>The specific version of Python is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.0511.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Debian Bookworm does not install Java compilation tools and operating environment by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk. The latest version in Debian Bookworm is openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</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>
https://github.com/orangepi<span id="ubuntu-xunlong/ufocal-boot-orangepisystem"></tree/'''v2018.05-h618'''span>
<ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li></ol>= Ubuntu Focal system ===
https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''v2021.07-sunxi''' <ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build Ubuntu Focal is run for installed with the first time, it will download the cross-gcc compilation tool chainby default, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that which can be seen directly compile C language programs in orangepi-build are:the Linux system of the development board.</p>
<ol style="list-style-type: lower-alpha;">
<li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code The version of some programsa. The rootfs compressed package cached during the image compilation process gcc is also stored in external.as follows</p></li><li><p>'''kernel'''{| class="wikitable" style="width: Store the source code of the linux kernel</p></li>800px;" |-| <li><p>orangepi@orangepi:~$ '''LICENSEgcc --version''': GPL 2 license file</p></li><li><p>'''READMEgcc (Ubuntu 9.4.md''': orangepi0-build documentation1ubuntu1~20.04.1) 9.4.0</p></li><li><p>'''output''': Store compiled u-bootCopyright (C) 2019 Free Software Foundation, linux and other deb packages, compilation logs, and compiled images and other filesInc.</p></li><li><p>'''scripts''': Common script This is free software; see the source for compiling linux imagescopying conditions. There is NO</p></li><li><p>'''toolchains''': Store cross-compilation tool chainwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>|}</li><li><p>Write the '''u-boothello_world.c''': Store the source code of u-bootprogram in C language</p></li><li>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''userpatchesvim hello_world.c''': Store the configuration files needed to compile the script</p></li></ol></lip>#include &lt;stdio.h&gt;</olp>
test@test:~/orangepi-build$ '''ls'''
'''build.sh external kernel LICENSE output README.md scripts toolchains u-boot userpatches'''<p>int main(void)</p><p>{</p>:<span id="compile-u-boot"p>printf(&quot;Hello World!\n&quot;);</spanp>== Compile u-boot ==
# Run the build.sh script, remember to add sudo permissions
test@test:~/orangepi-build$ '''sudo ./build.sh''' <ol start="2" style="list-style-type: decimal;"><li>Select '''U-boot package''' and press Enter</li></ol> <div class="figure"> [[File:zero2w-img274.png]] </div><ol start="3" style="list-style-type: decimal;"><li>Then select the model of the development board</li></ol> [[File:zero2w-img275.png]] <ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of u-boot</p><ol style="list-style-type: lower-alphareturn 0;"><li><p>The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.}</p><p>[[File:zero2w-img276.png]]</p></li></ol>|}
</li>
<li><p>If you select the next branch, you will also be prompted to select the memory size, Then compile and you do not need to select the current branchrun '''hello_world.c'''</p>{| class="wikitable" style="width:800px;" |-| </lip>orangepi@orangepi:~$ '''gcc -o hello_world hello_world.c'''</olp> <blockquotep>a. If the development board you purchased has a memory size of 1.5GB, please select the first optionorangepi@orangepi:~$ '''./hello_world'''</p><p>Hello World!</p>b. If the development board you purchased has 1GB or 2GB or 4GB memory size, please choose the second option.|}</blockquoteli></ol>[[File:zero2w-img277.png]] <ol start="6" style="list-style-type: decimal;"/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 Focal 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.8.10 (default, Nov 14 2022, 12:59:47)</p><p>[GCC 9.4.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the '''hello_world.py''' program in Python language</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.py'''</p><p>print('Hello World!')</p>|}</li><li><p>The result of running '''hello_world.py''' is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3 hello_world.py'''</p><p>Hello World!</p>|}</li></ol></li><li><p>Ubuntu Focal does not have Java compilation tools and running environment installed by default.</p><ol style="list-style-type: lower-alpha;"><li><p>You can use the following command to install openjdk-17</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo apt install -y openjdk-17-jdk'''</p>|}</li><li><p>After installation, you can check the Java version.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''java --version'''</p><p>openjdk 17.0.2 2022-01-18</p><p>OpenJDK Runtime Environment (build 17.0.2+8-Ubuntu-120.04)</p><p>OpenJDK 64-Bit Server VM (build 17.0.2+8-Ubuntu-120.04, mixed mode, sharing)</p>|}</li><li><p>Write the Java version of '''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</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>
[ o.k. ] Compiling u-boot [ '''v2021.07''' ] <ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</li></ol> [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ] <ol startspan id="3" style="list-styleubuntu-type: lowerjammy-alpha;system"><li>Path to the compiled u-boot deb package</li></olspan[ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ] <ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the compiled u-boot deb package</li></ol> [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ] <ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol> [ o.k. ] Runtime [ '''1 min''' ] <ol start="6" style="list-style-type: lower-alpha;"><li>Repeat the command to compile u-boot. Use the following command without selecting through the graphical interface. You can start compiling u-boot directly.</li></ol> [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ] <ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li></ol> test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''=== Ubuntu Jammy system ===
<ol start="8" style="list-style-type: decimal;"><li>When <p>Ubuntu Jammy is installed with the orangepi-bulid gcc compilation tool chain by default, which can directly compile C language programs in the Linux system compiles of the udevelopment board.</p><ol style="list-boot source code, it will first synchronize the ustyle-boot source code with the utype: lower-boot source code alpha;"><li><p>The version of the github servera. Therefore, if you want to modify the ugcc is as follows</p>{| class="wikitable" style="width:800px;" |-boot source code, you first need to turn off the download and update function of the source code. (| <p>orangepi@orangepi:~$ '''You need to completely compile ugcc --boot before you can turn off this function, otherwise it will prompt that the source code of uversion'''</p><p>gcc (Ubuntu 11.3.0-boot cannot be found1ubuntu1~22.04.1) '''11.3.0'''</p><p>Copyright (C)2021 Free Software Foundation, otherwise Inc.</p><p>This is free software; see the modifications will be restoredsource for copying conditions. The method There is as followsNO</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'''</lip><p>#include &lt;stdio.h&gt;</olp>
<blockquote>Set the IGNORE_UPDATES variable in u'''userpatches/config-default.conf''' to &quot;yes&quot;
</blockquote>
test@test:~/orangepi-build$ '''vim userpatches/config-default.conf'''
......<p>int main(void)</p><p>{</p>:<p>printf(&quot;Hello World!\n&quot;);</p>
IGNORE_UPDATES=&quot;'''yes'''&quot;
......:<p>return 0;</p><p>}</p>|}</li><ol startli><p>Then compile and run '''hello_world.c'''</p>{| class="9wikitable" 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>When debugging u-boot code, you can use the following method to update u-boot in the linux image for testingUbuntu Jammy has Python3 installed by default</p>
<ol style="list-style-type: lower-alpha;">
<li>First upload <p>The specific version of Python3 is as follows</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''python3'''</p><p>Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux</p><p>Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.</p><p>&gt;&gt;&gt;</p>|}{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big><p>'''Use the Ctrl+D shortcut key to exit python's interactive mode.'''</p></big>|}</li><li><p>Write the compiled deb package '''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 urunning '''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-boot 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 Linux system Java version of the development board'''hello_world.java'''</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''vim hello_world.java'''</p><p>public class hello_world</p><p>{</p>:<p>public static void main(String[] args)</p>:<p>{</p>::<p>System.out.println(&quot;Hello World!&quot;);</p>:<p>}</p><p>}</p>|}</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>
test@test:~/orangepi-build$ '''cd output/debs/u-boot''' test@test:~/orangepi_build/output/debs/u-boot$ '''scp \''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]''' <ol startspan id="2" style="listmethod-styleof-type: loweruploading-alpha;"><li>Install the new ufiles-boot deb package just uploaded</li></ol> orangepi@orangepi:~$ '''sudo dpkg to-i''' '''linuxthe-udevelopment-bootboard-next-orangepizero2w_x.x.x_arm64.deb''' <ol start="3" style="list-style-type: lowerlinux-alpha;system"><li>Then run the nand-sata-install script</li></olspanorangepi@orangepi:~$ '''sudo nand-sata-install'''
<ol start="4" style="list-style-type: lower-alpha;"><li>Then select '''5 Install/Update Method of uploading files to the bootloader on SD/eMMC'''</li></ol>development board Linux system ==
[[File:zero2w<span id="method-img278.png]]to-upload-files-to-the-development-board-linux-system-in-ubuntu-pc"></span>=== Method to upload files to the development board Linux system in Ubuntu PC ===
<ol startspan id="5" style="listhow-to-upload-files-styleusing-type: lowerscp-alpha;command"><li>After pressing the Enter key, a Warning will pop up first.</li></olspan>==== How to upload files using scp command ====
[[File<ol style="list-style-type: decimal;"><li><p>Use the scp command to upload files to the Linux system of the development board in Ubuntu PC. The specific command is as follows</p><ol style="list-style-type: lower-alpha;"><li><p>'''file_path: '''Needs to be replaced with the path of the file to 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:zero2w/home/orangepi/'''</p>|}</li></ol></li><li><p>If you want to upload a folder, you need to add the -img279r parameter</p>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''scp <span style="color:#FF0000">-r</span> dir_path orangepi@192.png]]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 start="6" style="list-style-type: lower-alpha;"><li>Press the Enter key again == How to start updating u-boot. After the update is completed, the following information will be displayed.</li></ol>upload files using filezilla ====
[[File:zero2w-img280.png]] <ol start="7" style="list-style-type: lower-alphadecimal;"><li><p>First install filezilla in Ubuntu PC</p>{| class="wikitable" style="width:800px;"|-| <p>test@test:~$ '''sudo apt install -y filezilla'''</p>|}</li><li><p>Then you can restart use the development board following command to open filezilla</p>{| class="wikitable" style="width:800px;" |-| <p>test whether @test:~$ '''filezilla'''</p>|}</li><li><p>The interface after opening filezilla is as shown below. At this time, the remote site on the u-boot modification has taken effectright is empty.</lip></oldiv class="figure"[[File:zero2w-img255.png]]
<span id="compile-the-linux-kernel"/div></spanli>== Compile <li><p>The method of connecting the linux kernel ==development board is as shown in the figure below</p></li>
# Run the '''build.sh''' script, remember to add sudo permissions<div class="figure">
test@test[[File:~/orangepizero2w-build$ '''sudo img256./build.sh'''png]]
</div></ol><ol start="25" style="list-style-type: decimal;"><li>Select <p>Then choose to '''Kernel packagesave the password''' and press Enterclick '''OK'''</p><p>[[File:zero2w-img257.png]]</p></li><li><p>Then select '''Always trust this host''' and click '''OK'''</p></olli>
<div class="figure">
[[File:zero2w-img281img258.png]]
</div></ol><ol start="37" style="list-style-type: decimal;"><li>Then you will be prompted whether you need to display After the kernel configuration interface. If connection is successful, you do not need to modify can see the kernel configuration, select directory structure of the first one. If you need to modify development board's Linux file system on the kernel configuration, select right side of the second onefilezilla software.</li></ol>
[[File:zero2w-img282.png]]<div class="figure">
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then select the model of the development board</li></ol>img259.png]]
[[File</div></ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded in Ubuntu PC on the left side of the filezilla software, right-img275click the mouse, and then click the upload option to start uploading the file to the development board.png]]</li>
<ol startdiv class="5figure" style="list-style-type: decimal;"><li>Then select the branch type of the kernel source code</li></ol>
<blockquote>a[[File:zero2w-img260. The current branch will compile the linux5.4 kernel source codepng]]
b</div></ol><ol start="9" style="list-style-type: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file. </p></li><li><p>The next branch will compile method of uploading a folder is the same as the linux6method of uploading a file, so I won't go into details here.1 kernel source code</blockquotep></li></ol>[[File:zero2w-img276.png]]
<ol startspan id="6" style="listmethod-to-upload-files-from-windows-pc-to-development-board-stylelinux-type: decimal;system"><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></olspan>
[[File:zero2w-img283.png]]=== Method to upload files from Windows PC to development board Linux system ===
<ol stylespan id="listhow-styleto-upload-files-using-type: lowerfilezilla-alpha;1"><li/span>If you do not need ==== How to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGUREupload files using filezilla ====no''' to temporarily block the pop-up of the kernel configuration interface.</li></ol>
test@test:~/orangepi-build$ '''sudo # First download the installation file of the Windows version of the filezilla software./build.sh KERNEL_CONFIGURE=no'''The download link is as follows
<ol start::{| class="2wikitable" style="list-style-typewidth: lower-alpha800px;"><li><p>b|-| [https://filezilla-project.org/download. You can also set '''KERNEL_CONFIGUREphp?type=noclient ''' in the orangepi-buildhttps:/userpatches/configfilezilla-defaultproject.confconfiguration file to permanently disable this function.<org/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 displayeddownload. Please increase the Ubuntu PC terminal to the maximum size, and then rerun the build.sh script.</p></li></ol>php?type=client'''][[File:zero2w-img284.png]]|}
<ol start="7" style="list-style-type: decimal;"><li><p>Part of the information prompted when compiling the next branch kernel source code is explained as follows:</p><ol style="list-style-type[[File: lowerzero2w-alpha;"><li>Version of the linux kernel source code</li></ol></li></ol>img261.png]]
[ o.k. ] Compiling current kernel [ '''6.1.31''' ]<div class="figure">
<ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross:[[File:zero2w-compilation tool chain used</li></ol>img262.png]]
[ o</div><ol start="2" style="list-style-type: decimal;"><li><p>The downloaded installation package is as shown below, then double-click to install it directly</p>{| class="wikitable" style="width:800px;" |-| <p>'''FileZilla_Server_1.k5. ] Compiler version [ 1_win64-setup.exe'''aarch64-linux-gnu-gcc 11</p>|}During the installation process, please select '''Decline''' on the following installation interface, and then select '''Next&gt;''' ]
<ol startdiv class="3figure" style="list-style-type: lower-alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li></ol>
[ o.k. ] Using kernel config file [ '''orangepi-build/external/config/kernel/linuxFile:zero2w-6img263.1-sun50iw9-next.config''' png]]
</div></li></ol><ol start="43" style="list-style-type: lower-alphadecimal;"><li>The path to interface after opening filezilla is as shown below. At this time, the remote site on the kernel-related deb package generated by compilationright is empty.</li></ol>
[ o.k. ] Target directory [ '''output/debs/''' ]<div class="figure">
<ol start="5" style="list-style-type[[File: lowerzero2w-alpha;"><li>The package name of the kernel image deb package generated by compilation</li></ol>img264.png]]
[ o.k. ] File name [ '''linux</div></ol><ol start="4" style="list-imagestyle-next-sun50iw9_x.x.x_arm64.deb''' ]type: decimal;"><li>The method of connecting the development board is as shown in the figure below:</li>
<ol startdiv class="6figure" style="list-style-type: lower-alpha;"><li>Compilation time</li></ol>
[ o.k[File:zero2w-img256. png] Runtime [ '''10 min''' ]
</div></ol><ol start="75" style="list-style-type: lower-alphadecimal;"><li>Finally, the compilation command Then choose to repeatedly compile '''save the last selected kernel will be displayed. Use the following command without selecting through the graphical interface, password''' and you can directly start compiling the kernel source code.click '''OK'''</li></ol>
[ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD<div class=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]"figure">
<ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type[[File: lower-alpha;"><li><p>'''linux-dtb-nextzero2w-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''linux-headers-next-sun50iw9_x.x.x_arm64.deb''' Contains kernel header files</p></li><li><p>'''linux-image-next-sun50iw9_x.x.x_arm64img265.deb''' Contains kernel images and kernel modules</p></li></ol></li></ol>png]]
test@test:~</div></orangepiol><ol start="6" style="list-style-build$ type: decimal;"><li>Then select '''Always trust this host''' and click '''ls output/debs/linux-*OK'''</li>
output/debs/linux-dtb-next-sun50iw9_x.x.x_arm64.deb<div class="figure">
output/debs/linux[[File:zero2w-headers-next-sun50iw9_x.x.x_arm64img266.debpng]]
output</debsdiv></linuxol><ol start="7" style="list-imagestyle-next-sun50iw9_xtype: decimal;"><li>After the connection is successful, you can see the directory structure of the development board's Linux file system on the right side of the filezilla software.x.x_arm64.deb</li>
<ol startdiv class="9figure" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li></ol>
<blockquote>Set the IGNORE_UPDATES variable in '''userpatches/config-default.conf''' to &quot;yes&quot;</blockquote>test@test[[File:~/orangepi-build$ '''vim userpatches/configzero2w-defaultimg267.conf'''png]]
IGNORE_UPDATES</div></ol><ol start=&quot;'''yes'''&quot"8" style="list-style-type: decimal;"><li>Then select the path to be uploaded to the development board on the right side of the filezilla software, select the file to be uploaded on the Windows PC on the left side of the filezilla software, right-click the mouse, and then click the upload option to start uploading the file to the development board.</li>
<ol startdiv class="10figure" style="list-style-type: decimal;"><li><p>If the kernel is modified, you can use the following method to update the kernel and kernel module of the development board Linux system</p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the Linux kernel to the Linux system of the development board</li></ol></li></ol>
test@test[[File:~/orangepizero2w-build$ '''cd output/debs'''img268.png]]
test@test:~</div></orangepiol><ol start="9" style="list-style-buildtype: decimal;"><li><p>After the upload is completed, you can go to the corresponding path in the development board Linux system to view the uploaded file.</outputp></debs$ '''scp \''li><li><p>The method of uploading a folder is the same as the method of uploading a file, so I won't go into details here.</p></li></ol>
'''linux<span id="instructions-imagefor-nextusing-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:the-logo-on-and-off-the-machine"></root'''span>
<ol start="2" style="list-style-type: lower-alpha;"><li>Install Instructions for using the deb package of logo on and off the new linux kernel just uploaded.</li></ol>machine ==
<ol style="list-style-type: decimal;"><li><p>The power on/off logo will only be displayed on the desktop version of the system by default.</p></li><li><p>Set the '''bootlogo''' variable to '''false''' in '''/boot/orangepiEnv.txt''' to turn off the switch logo.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo dpkg 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;" |-i linux| <p>orangepi@orangepi:~$ '''sudo vim /boot/orangepiEnv.txt'''</p><p>verbosity=1</p><p>'''<span style="color:#FF0000">bootlogo=true</span>'''</p>|}</li><li><p>The location of the boot logo picture in the Linux system is</p>{| class="wikitable" style="width:800px;" |-| <p>'''/usr/share/plymouth/themes/orangepi/watermark.png'''</p>|}</li><li><p>After replacing the boot logo image, you need to run the following command to take effect</p>{| class="wikitable" style="width:800px;" |-next| <p>orangepi@orangepi:~$ '''sudo update-initramfs -sun50iw9_x.x.x_arm64.debu'''</p>|}</li></ol>
<ol startspan id="3" style="listhow-to-styleturn-type: loweron-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effectpower-button-in-linux5.</li4"></olspan>
orangepi@orangepi:~$ '''sudo''' '''reboot'''== How to turn on the power button in Linux5.4 ==
<span id="compile-rootfs"><There is no power on/span>== Compile rootfs ==off button on the main board of the development board. We can expand it through a 24pin expansion board. The location of the power on/off button on the expansion board is as follows:
# Run the build[[File:zero2w-img269.sh script, remember to add sudo permissionspng]]
test@test:~The power on/orangepi-build$ '''sudo off button of the Linux 6.1 image is turned on by default, but the power on/buildoff button of the Linux 5.sh'''4 kernel image is turned off by default and needs to be turned on manually for normal use. The steps are as follows:
<ol start="2" style="list-style-type: decimal;"><li>Select <p>First run '''Rootfs orangepi-config'''. Ordinary users remember to add '''sudo''' permissions.</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo orangepi-config'''</p>|}</li><li><p>Then select '''System'''</p><p>[[File:zero2w-img80.png]]</p></li><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 all deb packagesthen use the ''' and press Enterspace''' to select the dtbo configuration of the SPI you want to open.</p><p>[[File:zero2w-img270.png]]</p></li><li><p>Then select '''&lt;Save&gt;''' to save</p><p>[[File:zero2w-img83.png]]</p></li><li><p>Then select '''&lt;Back&gt;'''</p><p>[[File:zero2w-img84.png]]</p></li><li><p>Then select '''&lt;Reboot&gt;''' to restart the system to make the configuration take effect.</p><p>[[File:zero2w-img85.png]]</p></li></ol>
<div classspan id="figurehow-to-shut-down-and-restart-the-development-board"></span>
[[File:zero2w-img285.png]]== How to shut down and restart the development board ==
<ol style="list-style-type: decimal;"><li><p>During the running of the Linux system, if you directly unplug the power supply, it may cause the file system to lose some data. It is recommended to use the '''poweroff''' command to shut down the Linux system of the development board before powering off, and then unplug the power supply.</divp>{| class="wikitable" style="width:800px;" |-| <ol startp>orangepi@orangepi:~$ '''sudo poweroff'''</p>|}{| class="3wikitable" style="listbackground-color:#ffffdc;width:800px;" |-| <big><p>'''Note that after turning off the development board, you need to unplug and replug the power supply before it can be turned on.'''</p></big>|}</li><li><p>In addition to using the poweroff command to shut down, you can also use the power on/off button on the expansion board to shut down.</p><p>[[File:zero2w-img269.png]]</p>{| class="wikitable" style="background-typecolor:#ffffdc;width: decimal800px;"|-| <big><p>'''Note that Linux 5.4 requires manual configuration of the power on/off button before it can be used. For the opening method, please refer to [[Orange Pi Zero 2W#How to turn on the power button in Linux5.4|the method of opening the power button in Linux5.4]].'''</p></big>|}</li><li>Then select <p>Use the model of '''reboot''' command to restart the Linux system in the development board</p>{| class="wikitable" style="width:800px;" |-| <p>orangepi@orangepi:~$ '''sudo''' '''reboot'''</p>|}</li></ol>
[[File:zero2w<span id="linux-img275.png]]sdkorangepi-build-usage-instructions"></span>
<ol start="4" style="list'''Linux SDK——orangepi-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol stylebuild usage instructions''' ="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>
[[File:zero2w<span id="compilation-img276.png]]system-requirements"></span>== Compilation system requirements ==
The Linux SDK, '''orangepi-build''', only supports running on X64 computers with '''<ol start="5" span style="list-style-typecolor: decimal;#FF0000">Ubuntu 22.04<li/span>Then select ''' installed. Therefore, before downloading orangepi-build, please first ensure that the Ubuntu version installed on your computer is Ubuntu 22.04. The command to check the Ubuntu version installed on the computer is as follows. If the type of rootfsRelease field does not display '''</lispan style="color:#FF0000">22.04</olspan>''', it means that the Ubuntu version currently used does not meet the requirements. Please change the system before performing the following operations.
[[File:zero2w-img286.png]] <ol start{| class="6wikitable" style="list-style-typewidth: decimal800px;"><li><p>Then select the type of image</p><ol style="list-style-type: lower|-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li>| <li><p>test@test:~$ '''Image with desktop environmentlsb_release -a''' Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></ol>
<div class="figure">No LSB modules are available.
[[FileDistributor ID:zero2w-img287.png]]Ubuntu
</div><ol start="7" style="list-style-typeDescription: decimal;"><li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal versionUbuntu 22. The Minimal version will have much less pre-installed software than the Standard version ('''please do not choose the Minimal version without special needs, because many things are not pre-installed by default. Some functions may not be available''')</li></ol> <div class="figure">04 LTS
[[FileRelease:zero2w-img288'''<span style="color:#FF0000">22.png]]04</span>'''
</div><ol start="8" style="list-style-typeCodename: decimal;">'''jammy'''<li>If you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>|}
[[File:zero2wIf the computer is installed with a Windows system and does not have Ubuntu 22.04 installed on it, you can consider using'''VirtualBox''' or '''VMware''' to install an Ubuntu 22.04 virtual machine in the Windows system. But please note, do not compile orangepi-build on the WSL virtual machine, because orangepi-build has not been tested in the WSL virtual machine, so there is no guarantee that orangepi-build can be used normally in WSL. In addition, please do not compile the Linux system on the development board. Use orangepi-img289build.png]]The installation image download address of Ubuntu 22.04 amd64 version is:
{| class="wikitable" style="width:800px;" |-| [[Filehttps://repo.huaweicloud.com/ubuntu-releases/21.04/ubuntu-21.04-desktop-amd64.iso '''https:zero2w//mirrors.tuna.tsinghua.edu.cn/ubuntu-img290releases/22.png]04/ubuntu-22.04-desktop-amd64.iso''']|}
You can then select additional packages After installing Ubuntu 22.04 on your computer or virtual machine, please first set the software source of Ubuntu 22.04 to Tsinghua source (or other domestic sources that need you think is fast), otherwise it is easy to be installedmake errors due to network reasons when installing the software later. Please press the Enter key here The steps to skip directly. [[Filereplace Tsinghua Source are as follows:zero2w-img291.png]]
<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 For the method of rootfsreplacing Tsinghua Source, please refer to the instructions on this page.</li></ol></li></ol> [ o.k. ] local not found [ Creating new rootfs cache for '''bullseye''' ]
{| 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>The storage path of Note that the compiled rootfs compressed packageUbuntu version needs to be switched to 22.04.</li></ol> [ o.k. ] Target directory [ '''orangepi-build/external/cache/rootfs''' ]
[[File:zero2w-img271.png]]
</ol>
<ol start="3" style="list-style-type: lower-alpha;">
<li>The name contents of the rootfs compressed package generated by compilation'''/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'''
[ o.k. ] File name [ test@test:~$ '''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tarsudo vim /etc/apt/sources.lz4list''' ]
<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 The source code image is a compressed package of rootfscommented by default to improve apt update speed. You can uncomment it yourself if necessary. The meaning of each field in the name is</li></ol></li></ol>
<blockquote>a) '''bullseye''' represents the type of Linux distribution of rootfsdeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
b) '''xfce#''' indicates that the rootfs is the desktop version, and if it is cli, it indicates the server versiondeb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
c) '''arm64''' represents the architecture type of rootfsdeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
d) '''25250ec7002de9e81a41de169f1f89721#''' is the MD5 hash value generated by the package names of all software packages installed by rootfs. As long as the list of software packages installed by rootfs is not modified, this value will not change. The compilation script will use this MD5 hash value. Determine whether rootfs needs to be recompiled</blockquote><ol start="2" style="listdeb-style-typesrc https: lower-alpha;"><li>'''bullseye-xfce-arm64//mirrors.5250ec7002de9e81a41de169f1f89721tuna.tartsinghua.lz4edu.list''' Lists the package names of all packages installed by rootfs<cn/li><ubuntu/ol>jammy-updates main restricted universe multiverse
test@testdeb https:~/orangepi-build$ '''ls external/cachemirrors.tuna.tsinghua.edu.cn/rootfsubuntu/'''jammy-backports main restricted universe multiverse
bullseye'''#''' deb-xfce-arm64src https://mirrors.tuna.5250ec7002de9e81a41de169f1f89721tsinghua.taredu.lz4cn/ubuntu/ jammy-backports main restricted universe multiverse
bullseye-xfce-arm64deb https://mirrors.5250ec7002de9e81a41de169f1f89721tuna.tartsinghua.lz4edu.currentcn/ubuntu/ jammy-security main restricted universe multiverse
bullseye'''#''' deb-xfce-arm64src https://mirrors.5250ec7002de9e81a41de169f1f89721tuna.tartsinghua.lz4edu.listcn/ubuntu/ jammy-security main restricted universe multiverse
<ol start="11" style="list-style-type: decimal;">
<li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>
<span id="compile'''#''' Pre-linux-image"></span>== Compile linux image ==release software source, not recommended to be enabled
# Run the '''build.sh#''' script, remember to add sudo permissionsdeb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
'''#''' deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>After the replacement, you need to update the package information and ensure that no errors are reported.</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update'''|}</orangepiol><ol start="5" style="list-style-type: lower-build$ alpha;"><li>'''sudo <span style="color:#FF0000">In addition, since the source code of the kernel and Uboot are stored on GitHub, it is very important to ensure that the computer can download the code from GitHub normally when compiling the image.</build.shspan>'''</li></ol>
<ol startspan id="2" style="listobtain-the-source-code-of-stylelinux-type: decimal;sdk"><li>Select '''Full OS image for flashing''' and press Enter</li></olspan>
<div class="figure">= Obtain the source code of linux sdk ==
[[File:zero2w<span id="download-img292.png]]orangepi-build-from-github"></span>=== Download orangepi-build from github ===
</div><ol start="3" style="listLinux sdk refers to the orangepi-stylebuild set of codes. Orangepi-type: decimal;"><li>Then select build is modified based on the model armbian build compilation system. Multiple versions of Linux images can be compiled using orangepi-build. Use the development board</li></ol>following command to download the orangepi-build code:
[[File{| class="wikitable" style="width:zero2w800px;" |-img275.png]]| test@test:~$ '''sudo apt-get update'''
<ol start="4" style="list-style-typetest@test: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style~$ '''sudo apt-type: lowerget install -alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li></ol></li></ol>y git'''
[[Filetest@test:zero2w~$ '''git clone https://github.com/orangepi-xunlong/orangepi-img276build.png]]git -b next'''|}<ol start{| class="5wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not need to select the current branch.</p>|-<ol style="list-style-type: lower-alpha;">| <libig><p>If '''Note that when using the H618 Soc 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 need to download the second option.</p><p>[[File:zero2w-img277.png]]</p></li></ol></li><li><p>Then select source code of the type of rootfs</p></li></ol> [[File:zero2w-img286.png]] <ol start="7" span style="list-style-typecolor: decimal;#FF0000">next<li/span><p>Then select the type branch of image</p><ol style="listorangepi-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents build. The above git clone command needs to specify the image branch of the server version, which is relatively small in sizeorangepi-build source code as next.</p></li><li><p>'''Image with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li></ol></li></olbig>
<div class="figure">
[[File:zero2w-img287img272.png|center|800px]]
</div>
<ol start|}{| class="8wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>If '''When downloading the orangepi-build code through the git clone command, you are compiling do not need to enter the server version user name and password of the imagegithub account (the same is true for downloading other codes in this manual). If after entering the git clone command, Ubuntu PC prompts you can also choose to compile enter the Standard version or user name of the Minimal versiongithub account. The Minimal version will have much less prename and password are usually entered incorrectly in the address of the orangepi-installed software build warehouse behind git clone. Please carefully check whether there are any errors in the spelling of the command, rather than thinking that we have forgotten to provide the Standard version ('''please do not choose username and password of the Minimal version without special needs, because many things are not pre-installed by defaultgithub account. Some functions may not be available''')</li></olbig>|}
<div class="figure">The u-boot and linux kernel versions currently used by the H618 series development boards are as follows:
[[File{| class="wikitable" style="width:zero2w800px;text-img288align: center;"|-| '''branch'''| '''u-boot Version'''| '''linux Kernel version'''|-| '''current'''| '''u-boot v2018.05'''| '''linux5.4'''|-| '''next'''| '''u-boot v2021.07'''| '''linux6.png]]1'''|}
</div><ol start{| class="9wikitable" style="listbackground-style-typecolor:#ffffdc;width: decimal800px;">|-| <libig>If you are compiling a desktop version of '''The branch mentioned here is not the image, you also need to select same thing as the type branch of desktop environmentorangepi-build source code, please don't get confused. Currently, only XFCE This branch is maintained, so please select an XFCE type desktopmainly used to distinguish different kernel source code versions.</li></ol>'''
[[File:zero2w-img289'''We define the linux5.png]]4 bsp kernel currently provided by Allwinner as the current branch. The latest linux6.1 LTS kernel is defined as the next branch.'''</big>|}
[[FileAfter downloading, the following files and folders will be included:zero2w-img290.png]]
You can then select additional packages that need <ol style="list-style-type: lower-alpha;"><li><p>'''build.sh''': Compile startup script</p></li><li><p>'''external''': Contains configuration files needed to be installedcompile the image, specific scripts, and source code of some programs, etc. Please press the Enter key here to skip directly</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li></ol>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls'''
[[File'''build.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts'''|}{| class="wikitable" style="background-color:#ffffdc;width:zero2w800px;" |-| <big>'''If you downloaded the orangepi-build code from github, after downloading, you may find that orangepi-build does not contain the source code of u-boot and linux kernel, and there is no cross-compilation tool required to compile u-boot and linux kernel. chain, this is normal, because these things are stored in other separate github repositories or some servers (their addresses will be detailed below). Orangepi-build will specify the addresses of u-boot, Linux kernel and cross-compilation tool chain in the script and configuration file. When running orangepi-img291build, when it finds that these things are not available locally, it will automatically download them from the corresponding places.png]]'''</big>|}
<ol startspan id="10" style="listdownload-the-cross-compilation-styletool-type: decimal;chain"><li>Then the compilation of the linux image will begin. The general process of compilation is as follows</li></olspan>
a. Initialize === Download the cross-compilation environment of Ubuntu PC and install the software packages required for the compilation process.tool chain ===
bWhen orangepi-build is run for the first time, it will automatically download the cross-compilation '''toolchain''' and put it in the '''toolchains''' folder. Download Every time you run orangepi-build's build.sh script, it will check whether the source code of ucross-boot and linux kernel (if already cachedcompilation toolchain in toolchains exists. If If it does not exist, only update the code)download will be restarted. If it exists, it will be used directly without repeated downloading.
c. Compile u-boot source code and generate u-boot deb package<div class="figure">
d[[File:zero2w-img273. Compile linux source code and generate linux-related deb packagespng]]
e. Make </div>The mirror URL of the cross-compilation tool chain in China is the deb package open source software mirror site of linux firmwareTsinghua University:
f{| class="wikitable" style="width:800px;" |-| [https://mirrors.tuna.tsinghua.edu.cn/armbian-releases/_toolchain/ '''https://mirrors.tuna.tsinghua.edu. Make the deb package of orangepicn/armbian-config toolreleases/_toolchain/''']|}
g. Create a deb package with boardAfter toolchains is downloaded, it will contain multiple versions of cross-level supportcompilation '''toolchain''':
h. If you compile the desktop version image, you will also create a desktop{| class="wikitable" style="width:800px;" |-related deb package.| i. Check whether rootfs has been cached. If not, retest@test:~/orangepi-create rootfs. If it has been cached, decompress it directly and use it.build$ '''ls toolchains/'''
jgcc-arm-11. Install the deb package generated previously into rootfs2-2022.02-x86_64-aarch64-none-linux-gnu
kgcc-linaro-4.9. Make some specific settings for different development boards and different types of images, such as pre4-installing additional software packages, modifying system configurations, etc2017.01-x86_64_aarch64-linux-gnu
lgcc-linaro-7. Then create the image file and format the partition4. The default type is ext41-2019.02-x86_64_arm-linux-gnueabi
mgcc-arm-11. Then copy the configured rootfs to the mirror partition2-2022.02-x86_64-arm-none-linux-gnueabihf
ngcc-linaro-4. Then update initramfs9.4-2017.01-x86_64_arm-linux-gnueabi
ogcc-linaro-aarch64-none-elf-4. Finally, write the bin file of u8-boot into the image through the dd command2013.11_linux
<ol start="11" style="listgcc-stylearm-type: decimal;"><li><p>After compiling the image, the following message will be displayed</p><ol style="list9.2-style2019.12-type: lowerx86_64-alpha;"><li>The storage path of the compiled image</li></ol></li></ol>aarch64-none-linux-gnu
[ ogcc-linaro-5.k5. ] Done building [ '''output/images/orangepizero2w_x0-2017.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]10-x86_64_arm-linux-gnueabihf
<ol start="2" style="listgcc-stylelinaro-type: lowerarm-alpha;"><li>Compilation time</li></ol>linux-gnueabihf-4.8-2014.04_linux
'''[ ogcc-arm-9.k2-2019. ] Runtime [ 19 min ]'''12-x86_64-arm-none-linux-gnueabihf
<ol start="3" style="listgcc-stylelinaro-type: lower7.4.1-alpha;"><li>Repeat the command to compile the image2019. Use the following command to start compiling the image directly without selecting it through the graphical interface.</li></ol>02-x86_64_aarch64-linux-gnu
[ ogcc-linaro-arm-none-eabi-4.k8-2014. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]04_linux|}
<span id="instructions-for-usingThe cross-compilation tool chain used to compile the-orange-pi-os-arch-system"></span>H618 Linux kernel source code is:
= '''Instructions for using the Orange Pi OS Arch system''' = <span idol style="orange-pi-oslist-archstyle-systemtype: lower-function-adaptation-statusalpha;"><li>linux5.4</spanli>== Orange Pi OS Arch system function adaptation status == {| class="wikitable" style="width:800px;"
|-
| '''Motherboard functionsgcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OPi OS Arch'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| '''HDMI videogcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol>The cross-compilation tool chain used to compile the H618 u-boot source code is: <ol style="list-style-type: lower-alpha;"><li>v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| '''HDMI Audiogcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| '''Typegcc-arm-C USB211.0 x 2-2022.02-x86_64-aarch64-none-linux-gnu'''| '''OK'''}</ol><span id="orangepi-build-complete-directory-structure-description"></span> === orangepi-build complete directory structure description === <ol style="list-style-type: decimal;"><li><p>After downloading, the orangepi-build warehouse does not contain the source code of the linux kernel, u-boot and cross-compilation tool chain. The source code of the linux kernel and u-boot is stored in an independent git warehouse.</p><ol style="list-style-type: lower-alpha;"><li><p>The git warehouse where the linux kernel source code is stored is as follows. Please note that the branch of the linux-orangepi warehouse is switched to</p><ol style="list-style-type: none;"><li>a) Linux5.4</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''TF Card Startuporange-pi-5.4-sun50iw9'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) Linux6.1</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/linux-orangepi/tree/'''WIFIorange-pi-6.1-sun50iw9'''| '''OK'''}</ol></li></ol><ol start="2" style="list-style-type: lower-alpha;"><li><p>The git warehouse where the u-boot source code is stored is as follows. Please note that the branch of the u-boot-orangepi warehouse is switched to</p><ol style="list-style-type: lower-alpha;"><li>a) v2018.05</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''Bluetoothv2018.05-h618'''| '''OK'''}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>b) v2021.07</li>{| class="wikitable" style="width:800px;"
|-
| https://github.com/orangepi-xunlong/u-boot-orangepi/tree/'''LED Lightv2021.07-sunxi'''| }</ol></li></ol></li></ol><ol start="2" style="list-style-type: decimal;"><li><p>When orangepi-build is run for the first time, it will download the cross-compilation tool chain, u-boot and linux kernel source code. After successfully compiling a linux image, the files and folders that can be seen in orangepi-build are:</p><ol style="list-style-type: lower-alpha;"><li><p>'''OKbuild.sh''': Compile startup script</p></li><li><p>'''external''': Contains the configuration files needed to compile the image, scripts for specific functions, and the source code of some programs. The rootfs compressed package cached during the image compilation process is also stored in external.</p></li><li><p>'''kernel''': Store the source code of the linux kernel</p></li><li><p>'''LICENSE''': GPL 2 license file</p></li><li><p>'''README.md''': orangepi-build documentation</p></li><li><p>'''output''': Store compiled u-boot, linux and other deb packages, compilation logs, and compiled images and other files</p></li><li><p>'''scripts''': Common script for compiling linux images</p></li><li><p>'''toolchains''': Store cross-compilation tool chain</p></li><li><p>'''u-boot''': Store the source code of u-boot</p></li><li><p>'''userpatches''': Store the configuration files needed to compile the script</p></li>{| class="wikitable" style="width:800px;"
|-
| test@test:~/orangepi-build$ '''40pin GPIOls'''| '''OKbuild.sh &nbsp;&nbsp;&nbsp;&nbsp; external &nbsp;&nbsp;&nbsp;&nbsp; kernel &nbsp;&nbsp;&nbsp;&nbsp; LICENSE &nbsp;&nbsp;&nbsp;&nbsp; output &nbsp;&nbsp;&nbsp;&nbsp; README.md &nbsp;&nbsp;&nbsp;&nbsp; scripts &nbsp;&nbsp;&nbsp;&nbsp; toolchains &nbsp;&nbsp;&nbsp;&nbsp; u-boot &nbsp;&nbsp;&nbsp;&nbsp; userpatches'''|}</ol></li></ol> <span id="compile-u-boot"></span> == Compile u-boot == # Run the build.sh script, remember to add sudo permissions {| class="wikitable" style="width:800px;"
|-
| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|test@test:~/orangepi-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''NO'''|-| '''Video codec'''| build$ '''NOsudo ./build.sh'''
|}
{| class<ol start="wikitable2"|style="list-| '''24pin expansion board function'''| '''OPi OS Arch'''|style-type: decimal;">| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK<li>Select '''|U-| boot package'''Headphone audio playback'''| '''OK'''|-| '''Onand press Enter</off button'''| '''OK'''|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|-| '''TV-OUT'''| '''NO'''|}li>
<span iddiv class="orange-pi-os-arch-system-user-guide-instructionsfigure"></span>== Orange Pi OS Arch System User Guide Instructions ==
First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems[[File:zero2w-img274.png]]
When </div></ol><ol start="3" style="list-style-type: decimal;"><li>Then select the OPi OS Arch system is started for the first time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps model of the user wizard are as follows:development board</li>
[[File:zero2w-img275.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li><p>Then select the branch type of u-boot</p>
<ol style="list-style-type: lower-alpha;">
<li><p>After burning The current branch will compile the u-boot v2018.05 version code that needs to be used by the linux5.4 image.</p></li><li><p>The next branch will compile the u-boot v2021.07 version code that needs to be used by the linux6.1 image.</p><p>[[File:zero2w-img276.png]]</p></li></ol></li><li><p>If you select the systemnext branch, when you start it for will also be prompted to select the first time memory size, and enter you do not need to select the desktopcurrent branch.</p><ol style="list-style-type: lower-alpha;"><li><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 second 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 see 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. ] Compiling u-boot [ '''v2021.07''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Version of the cross-compilation tool chain</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Compiler version [ '''aarch64-linux-gnu-gcc 11''' ]|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Path to the user wizard program shown in compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Target directory [ '''orangepi-build/output/debs/u-boot''' ]|}</ol><ol start="4" style="list-style-type: lower-alpha;"><li>The package name of the figure belowcompiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] File name [ '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb''' ]|}</pol><ol start="5" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Runtime [ '''1 min''' ]|}</ol><ol start="6" style="list-style-type: lower-alpha;"><div 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>{| class="figurewikitable" style="width:800px;" |-| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=u-boot''' ]|}</ol></li></ol><ol start="7" style="list-style-type: decimal;"><li>View the compiled u-boot deb package</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''ls output/debs/u-boot/'''
[[File'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}</ol><ol start="8" style="list-style-type:zero2wdecimal;"><li>When the orangepi-bulid compilation system compiles the u-img293boot source code, it will first synchronize the u-boot source code with the u-boot source code of the github server.png]]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>
</div><Set the IGNORE_UPDATES variable in u'''userpatches/li><li><p>First you need config-default.conf''' to select the language you want</p><div class="figure">&quot;yes&quot;
[[File{| class="wikitable" style="width:zero2w800px;" |-img294| test@test:~/orangepi-build$ '''vim userpatches/config-default.png]]conf'''
</div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese</p><div class="figure">......
[[FileIGNORE_UPDATES=&quot;'''<span style="color:zero2w-img295.png]]#FF0000">yes</span>'''&quot;
......|}</divol></liol start="9" style="list-style-type: decimal;"><li><p>Then select When debugging u-boot code, you can use the areafollowing method to update u-boot in the linux image for testing</p><div 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="figurewikitable">style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/debs/u-boot'''
[[Filetest@test:zero2w~/orangepi_build/output/debs/u-img296.png]]boot$ '''scp \'''
'''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb [mailto:root@192.168.1.xxx:/root root@192.168.1.xxx:/root]'''|}</divol><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:~$ '''sudo dpkg -i''' '''linux-u-boot-next-orangepizero2w_x.x.x_arm64.deb'''|}<li/ol><ol start="3" style="list-style-type: lower-alpha;"><pli>Then select run the keyboard modelnand-sata-install script</pli>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo nand-sata-install'''|}<div class/ol><ol start="4" style="figurelist-style-type: lower-alpha;"><li>Then select '''5 Install/Update the bootloader on SD/eMMC'''</li>
[[File:zero2w-img297img278.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]]</divol></liol start="6" style="list-style-type: lower-alpha;"><li><p>Then create a new username and set a passwordPress the Enter key again to start updating u-boot. After the update is completed, the following information will be displayed.</p><div class="figure"li>
[[File:zero2w-img298img280.png]]</ol><ol start="7" style="list-style-type: lower-alpha;"><li>Then you can restart the development board to test whether the u-boot modification has taken effect.</li></ol></li></ol><span id="compile-the-linux-kernel"></span>
</div></li><li><p>Then make sure there is no problem with == Compile the selection, and then click the install '''button'''</p><div classlinux kernel =="figure">
[[File:zero2w-img299# Run the '''build.png]]sh''' script, remember to add sudo permissions
</div></li><li><p>Then wait for the installation to complete</p><div ::{| class="figurewikitable" style="width:800px;">|-| test@test:~/orangepi-build$ '''sudo ./build.sh'''|}
[[File<ol start="2" style="list-style-type:zero2w-img300.png]]decimal;"><li>Select '''Kernel package''' and press Enter</li>
</div></li>
<li><p>After the installation is complete, you need to click the '''Finish''' button to restart the system.</p>
<div class="figure">
[[File:zero2w-img301img281.png]]
</div></liol><liol start="3" style="list-style-type: decimal;"><pli>The Orange Pi Hello program Then you will automatically start after restartingbe prompted whether you need to display the kernel configuration interface. At this time, If you do not need to remove modify the check '''mark of Start on startup''' in kernel configuration, select the lower right corner, otherwise first one. If you need to manually close modify the kernel configuration, select the Orange Pi Hello program every time you start itsecond one.</p><div class="figure"li>
[[File:zero2w-img302img282.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><pol start="5" style="list-style-type: decimal;">At this point, you can use <li>Then select the newly created username and password to log in to branch type of the OPi OS system through the serial port or ssh.</p>kernel source code</li></ol>
<span id="how-to-set-dt-overlays"></span>== How to set DT overlays ==::a. The current branch will compile the linux5.4 kernel source code
::b. The multiplexing functions such as I2C/SPI/UART/PWM in the 40-pin development board are turned off by default in next branch will compile the linux6.1 kernel's dts, and the corresponding DT overlays need to be manually turned on before they can be used.source code
The method ::[[File:zero2w-img276.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>If you choose to open DT overlays display the kernel configuration menu (the second option) in OPi OS Arch system is as follows: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>
# First open the '''/boot/extlinux/extlinux[[File:zero2w-img283.conf''' configuration filepng]]
[orangepi<ol style="list-style-type: lower-alpha;"><li>If you do not need to modify the kernel configuration options, when running the build.sh script, pass '''KERNEL_CONFIGURE=no''' to temporarily block the pop-up of the kernel configuration interface.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-pc ~]build$ '''sudo vim ./bootbuild.sh KERNEL_CONFIGURE=no'''|}</extlinux/extlinuxol><ol start="2" style="list-style-type: lower-alpha;"><li><p>b.confYou 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 start="2" style="list[[File:zero2w-style-type: decimal;">img284.png]]<li>Then open the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.conf'''</liol></ol> '''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to be replaced with the specific dtbo configuration, please do not copy it.''' [orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf''' LABEL Orange Pi KERNEL /Image FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w.dtb '''FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo''' #Configuration that needs to be added <ol start="37" style="list-style-type: decimal;"><li><p>The storage path Part of xxx.dtbo in the OPi OS Arch image information prompted when compiling the next branch kernel source code is explained as follows. Please note that not all dtbo under this path can be used.:</p><p>'''/boot/dtbs/allwinner/overlay/'''</p></liol style="list-style-type: lower-alpha;"><li><p>The DT overlays configuration that can be used by Version of the development board is as follows</p>linux kernel source code</li></ol> {| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiling current kernel [ '''Functions on the development board6.1.31''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The version of the cross-compilation tool chain used</li>{| '''Corresponding DT overlays configuration'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Compiler version [ '''40pin aarch64- i2c0linux-gnu-gcc 11''']| '''sun50i}</ol><ol start="3" style="list-h616style-pitype: lower-i2c0.dtbo'''alpha;"><li>The default configuration file used by the kernel and the path where it is stored are as follows</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Using kernel config file [ '''40pin orangepi-build/external/config/kernel/linux- i2c16.1-sun50iw9-next.config''']| '''sun50i}</ol><ol start="4" style="list-style-h616type: lower-pialpha;"><li>The path to the kernel-i2c1.dtbo'''related deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''40pin - i2c2output/debs/''']| '''sun50i}</ol><ol start="5" style="list-h616style-pitype: lower-i2c2.dtbo'''alpha;"><li>The package name of the kernel image deb package generated by compilation</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] File name [ '''40pin linux-image-next- uart2sun50iw9_x.x.x_arm64.deb''']| '''sun50i}</ol><ol start="6" style="list-h616style-pitype: lower-uart2.dtbo'''alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Runtime [ '''40pin - uart310 min''']| '''sun50i}</ol><ol start="7" style="list-h616style-pitype: lower-uart3alpha;"><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.dtbo'''</li>{| class="wikitable" style="width:800px;"
|-
| [ o.k. ] Repeat Build Options [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=kernel KERNEL_CONFIGURE=no''' ]|}</ol></li></ol><ol start="8" style="list-style-type: decimal;"><li><p>View the kernel-related deb package generated by compilation</p><ol style="list-style-type: lower-alpha;"><li><p>'''linux-dtb-next-sun50iw9_x.x.x_arm64.deb''' Contains dtb files used by the kernel</p></li><li><p>'''40pin linux-headers-next- uart4sun50iw9_x.x.x_arm64.deb'''Contains kernel header files</p></li>| <li><p>'''sun50ilinux-h616image-pinext-uart4sun50iw9_x.x.x_arm64.dtbodeb'''Contains kernel images and kernel modules</p></li>{| class="wikitable" style="width:800px;"
|-
| '''40pin - uart5'''| '''sun50i-h616-ph-uart5.dtbo'''|-| '''40pin - pwm1'''| '''sun50i-h616-pi-pwm1.dtbo'''|-| '''40pin - pwm2'''| '''sun50i-h616-pi-pwm2.dtbo'''|test@test:~/orangepi-| build$ '''40pin ls output/debs/linux- 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 - spi1 cs0 cs1'''| '''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'''|}
<ol start="5" style="listoutput/debs/linux-dtb-stylenext-type: decimal;"><li>If you need to open multiple configurations at the same time, just add the paths of multiple configurations directly after '''FDTOVERLAYSsun50iw9_x.''' For example, the configuration of opening i2c1 and uart5 at the same time is as follows</li></ol>x.x_arm64.deb
[orangepi@orangepi-pc ~]$ '''sudo vim output/bootdebs/extlinux/extlinuxlinux-headers-next-sun50iw9_x.x.x_arm64.conf'''deb
LABEL Orange Pioutput/debs/linux-image-next-sun50iw9_x.x.x_arm64.deb|}</ol></li></ol><ol start="9" style="list-style-type: decimal;"><li>When the orangepi-bulid compilation system compiles the linux kernel source code, it will first synchronize the linux kernel source code with the linux kernel source code of the github server. Therefore, if you want to modify the linux kernel source code, you first need to turn off the update function of the source code ('''it needs to be completely compiled once This function can only be turned off after obtaining the Linux kernel source code, otherwise it will prompt that the source code of the Linux kernel cannot be found'''), otherwise the modifications will be restored. The method is as follows:</li>
KERNEL Set the IGNORE_UPDATES variable in '''userpatches/Imageconfig-default.conf''' to &quot;yes&quot;
FDT {| class="wikitable" style="width:800px;" |-| test@test:~/dtbsorangepi-build$ '''vim userpatches/allwinner/sun50i-h616-orangepiconfig-zero2wdefault.dtbconf'''
IGNORE_UPDATES=&quot;'''FDTOVERLAYS <span style="color:#FF0000">yes</dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbospan>'''&quot;|}</ol><ol start="610" style="list-style-type: decimal;"><li>After setting<p>If the kernel is modified, you need can use the following method to restart update the kernel and kernel module of the development board Linux system for </p><ol style="list-style-type: lower-alpha;"><li>Upload the compiled deb package of the configuration Linux kernel to take effect.the Linux system of the development board</li><{| class="wikitable" style="width:800px;" |-| test@test:~/orangepi-build$ '''cd output/ol>debs'''
[orangepitest@test:~/orangepi-pc ~]build/output/debs$ '''sudo rebootscp \'''
'''linux-image-next-sun50iw9_x.x.x_arm64.deb root@192.168.1.xxx:/root'''|}</ol><span idol start="2" style="howlist-tostyle-installtype: lower-softwarealpha;"><li>Install the deb package of the new linux kernel just uploaded.</spanli>{| class="wikitable" style= How to install software "width:800px;" |-| orangepi@orangepi:~$ '''sudo dpkg -i linux-image-next-sun50iw9_x.x.x_arm64.deb'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Then restart the development board and check whether the kernel-related modifications have taken effect.</li>{| class="wikitable" style="width:800px;" |-| orangepi@orangepi:~$ '''sudo''' '''reboot'''|}</ol></li></ol><span id="compile-rootfs"></span>
You can use the pacman package management tool to install software that is not available in OPi OS. For example, the command to install the vim editor is as follows. If you want to install other software, you only need to replace vim with the package name of the software you want to install.== Compile rootfs ==
[orangepi@orangepi-pc ~]$ '''# Run the build.sh script, remember to add sudo pacman -Syy vim'''permissions
<span id::{| class="androidwikitable" style="width:800px;" |-12| test@test:~/orangepi-tv-system-usage-instructions"><build$ '''sudo ./span>build.sh'''|}
<ol start= "2" style="list-style-type: decimal;"><li>Select '''Android 12 TV system usage instructionsRootfs and all deb packages''' =and press Enter</li>
<span iddiv class="supported-android-versionsfigure"></span>== Supported Android versions ==
{| class="wikitable"|[[File:zero2w-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5img285.4'''|}png]]
<span id/div></ol><ol start="android3" style="list-12style-tv-function-adaptation-statustype: decimal;"><li>Then select the model of the development board</spanli>== Android 12 TV function adaptation status ==
{| class[[File:zero2w-img275.png]]</ol><ol start="4" style="list-style-type: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</p><ol style="list-style-type: lower-alpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></li><li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li> [[File:zero2w-img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li>Then select the type of rootfs</li> [[File:zero2w-img286.png]]</ol><ol start="6" style="wikitablelist-style-type: decimal;">|<li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''Image with console interface (server)''' Represents the image of the server version, which is relatively small in size.</p></li>| <li><p>'''Motherboard functionsImage with desktop environment'''Represents an image with a desktop, which is relatively large in size.</p></li> <div class="figure"> [[File:zero2w-img287.png]] </div></ol></li></ol><ol start="7" style="list-style-type: decimal;">| <li>If you are compiling the server version of the image, you can also choose to compile the Standard version or the Minimal version. The Minimal version will have much less pre-installed software than the Standard version ('''Android12 TVplease 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 '''HDMI videobullseye''']|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>The storage path of the compiled rootfs compressed package</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| [ o.k. ] Target directory [ '''HDMI Audioorangepi-build/external/cache/rootfs''']|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>The name of the rootfs compressed package generated by compilation</li>{| '''OK'''class="wikitable" style="width:800px;"
|-
| '''Type-C USB2[ o.k.0 x 2'] File name [ ''| '''OK'''|bullseye-| '''TF card startup'''| '''OK'''|xfce-| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|-| '''USB Camera'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI1'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''OK'''|-| '''Video codec'''| '''OKarm64.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''' 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-style-type: lower-alpha;"><li>'''bullseye-xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.list''' Lists the package names of all packages installed by rootfs</li>{| class="wikitable" style="width:800px;"
|-
| '''24pin Expansion board function'''| '''Android12 TV'''|test@test:~/orangepi-| build$ '''100M network portls external/cache/rootfs/'''| '''OK'''|bullseye-| '''100M Ethernet port light'''| '''OK'''|xfce-| '''USB2arm64.5250ec7002de9e81a41de169f1f89721.tar.0 HOST x 2'''lz4| '''OK'''|bullseye-| '''Infrared reception'''| '''OK'''|xfce-arm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.current| '''Headphone audio playback'''| '''OK'''|bullseye-| '''On/off button'''| '''OK'''|xfce-| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keysarm64.5250ec7002de9e81a41de169f1f89721.tar.lz4.'''|-| '''TV-OUT'''| '''OK'''list
|}
</ol>
</li></ol>
<ol start="11" style="list-style-type: decimal;">
<li>If the required rootfs already exists under '''external/cache/rootfs''', then compiling the rootfs again will directly skip the compilation process and will not restart the compilation. When compiling the image, it will also go to '''external/cache/rootfs''' to check whether it already exists. There is a cached rootfs available. If it is available, use it directly. This can save a lot of download and compilation time.</li></ol>
 
<span id="compile-linux-image"></span>
 
== Compile linux image ==
<span id="onboard-led-light-display-instructions"></span>== Onboard LED light display instructions ==# Run the '''build.sh''' script, remember to add sudo permissions
::{| class="wikitable" style="width:800px;"
|-
|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|test@test:~/orangepi-| '''Kernel boot to enter the system'''| '''on'''| build$ '''onsudo ./build.sh'''
|}
<span idol start="how2" style="list-tostyle-return-to-the-previous-interface-in-androidtype: decimal;"><li>Select '''Full OS image for flashing''' and press Enter</spanli>== How to return to the previous interface in Android ==
We generally use the mouse and keyboard to control the Android system of the development board. When entering certain interfaces and need to return to the previous interface or desktop, we can only return by right-clicking the mouse, and the keyboard cannot return.<div class="figure">
If you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menu[[File:zero2w-img292. The location of the return key is as shown below. Shown:png]]
[[File</div></ol><ol start="3" style="list-style-type:zero2w-img303.png]]decimal;"><li>Then select the model of the development board</li>
[[File:zero2w-img275.png]]</ol><span idol start="4" style="how-tolist-usestyle-adbtype: decimal;"><li><p>Then select the branch type of the kernel source code. Different versions of the kernel source code maintain different rootfs types.</spanp>== How to use ADB == <span idol style="uselist-networkstyle-connectiontype: lower-adb-debuggingalpha;"><li><p>In the current branch, you can see three options: debian11, ubuntu20.04, and ubuntu22.04.</p></spanli>=== Use network connection adb debugging ===<li><p>In the next branch, you can see three options: debian11, debian12, and ubuntu22.04.</p></li>
'''Using network adb does [[File:zero2w-img276.png]]</ol></li></ol><ol start="5" style="list-style-type: decimal;"><li><p>If you select the next branch, you will also be prompted to select the memory size, and you do not require a USB Typc C interface data cable need to connect select the computer and current branch.</p><ol style="list-style-type: lower-alpha;"><li><p>If the development boardyou purchased has a memory size of 1. Instead5GB, it communicates through please select the network, so first make sure that option.</p></li><li><p>If the development board's wired you purchased has 1GB or 2GB or wireless network is connected4GB memory size, and then obtain the IP address of please choose the development boardsecond option. Next To be used</p><p>[[File:zero2w-img277.'''png]]</p></li></ol></li><li><p>Then select the type of rootfs</p></li>
# Make sure [[File:zero2w-img286.png]]</ol><ol start="7" style="list-style-type: decimal;"><li><p>Then select the type of image</p><ol style="list-style-type: lower-alpha;"><li><p>'''service.adb.tcp.portImage with console interface (server)''' Represents the image of the Android system server version, which is set to 5555 port numberrelatively 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>
apollo-p2:/ # '''getprop | grep &quot;adb.tcp&quot;'''<div class="figure">
[service.adb.tcp[File:zero2w-img287.portpng]: [5555]
</div></ol></li></ol><ol start="28" 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 ('''serviceplease do not choose the Minimal version without special needs, because many things are not pre-installed by default.adb.tcp.portSome functions may not be available''' is not set, you can use the following command in the serial port to set the port number of the network adb)</li></ol>
apollo-p2:/ # '''setprop service.adb.tcp.port 5555'''<br /div class="figure">apollo-p2:/ # '''stop adbd'''
apollo[[File:zero2w-p2:/ # '''start adbd'''img288.png]]
</div></ol><ol start="39" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PCIf you are compiling a desktop version of the image, you also need to select the type of desktop environment. Currently, only XFCE is maintained, so please select an XFCE type desktop.</li></ol>
test@test[[File:~$ '''sudo aptzero2w-get update'''img289.png]]
test@test[[File:~$ '''sudo aptzero2w-get install -y adb'''img290.png]]
<ol start="4" style="list-style-type: decimal;"><li>Then connect network adb on Ubuntu PC</li></ol>You can then select additional packages that need to be installed. Please press the Enter key here to skip directly.
test@test[[File:~$ '''adb connect 192zero2w-img291.168.1.xxxpng]]</ol><ol start="10" style="list-style-type:5555''' '''(Need to be modified to decimal;"><li>Then the IP address compilation of the development board)''' * daemon not running; starting now at tcp:5037linux image will begin. The general process of compilation is as follows</li>
* daemon started successfully::a. Initialize the compilation environment of Ubuntu PC and install the software packages required for the compilation process.
connected to 192::b.168.1.xxx:5555Download the source code of u-boot and linux kernel (if already cached, only update the code)
test@test:~$ '''adb devices''':c. Compile u-boot source code and generate u-boot deb package
List of devices attached::d. Compile linux source code and generate linux-related deb packages
192::e.168.1.xxx:5555 deviceMake the deb package of linux firmware
<ol start="5" style="list-style-type: decimal;"><li>Then you can log in to :f. Make the android system through adb shell on Ubuntu PC</li></ol>deb package of orangepi-config tool
test@test:~$ '''adb shell''':g. Create a deb package with board-level support
apollo::h. If you compile the desktop version image, you will also create a desktop-p2:/ #related deb package.
<span id="::i. Check whether rootfs has been cached. If not, re-create rootfs. If it has been cached, decompress it directly and use-data-cable-to-connect-adb-debugging"></span>=== Use data cable to connect adb debugging ===it.
# Prepare a USB Type C interface data cable, plug one end of ::j. Install the USB interface deb package generated previously 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.rootfs
[[File:zero2w-img304:k.png]] [[File:zero2wMake some specific settings for different development boards and different types of images, such as pre-img305installing additional software packages, modifying system configurations, etc.png]]
<ol start="2" style="list-style-::l. Then create the image file and format the partition. The default type: decimal;"><li>Install adb tool on Ubuntu PC</li></ol>is ext4.
test@test:~$ '''sudo apt-get update''':m. Then copy the configured rootfs to the mirror partition.
test@test:~$ '''sudo apt-get install -y adb''':n. Then update initramfs
<ol start="3" style="list-style-type: decimal;"><li>Check whether the ADB device is recognized</li></ol> test@test:~$ '''adb devices''' List of devices attached 4c00146473c28651dd0 device <ol start="4" style="list-style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li></ol> test@test:~$ '''adb shell''' apollo-p2:/ $ <span id="view-how-to-set-hdmi-display-resolution"></span>== View how to set HDMI display resolution == <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-img307o.png]]</p></li><li><p>Then select '''Display &amp; 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 Finally, write the list bin file 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:zero2wu-img311.png]]</p></li><li><p>The HDMI output of boot into the development board supports 4K display. When connected to a 4K TV, you can see image through the 4K resolution optiondd command.</p><p>[[File:zero2w-img312.png]]</p></li></ol> <span idol start="hdmi-to-vga-display-test-111"></span>=== HDMI to VGA display test === <ol style="list-style-type: decimal;"><li><p>First you need to prepare After compiling the image, the following accessoriesmessage will be displayed</p>
<ol style="list-style-type: lower-alpha;">
<li>HDMI The storage path of the compiled image</li>{| class="wikitable" style="width:800px;" |-| [ o.k. ] Done building [ '''output/images/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop/orangepizero2w_x.x.x_debian_bullseye_linux6.1.xx_xfce_desktop.img''' ]|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Compilation time</li>{| class="wikitable" style="width:800px;" |-| '''[ o.k. ] Runtime [ 19 min ]'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>Repeat the command to VGA convertercompile 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 [ '''sudo ./build.sh BOARD=orangepizero2w BRANCH=next BUILD_OPT=image RELEASE=bullseye BUILD_MINIMAL=no BUILD_DESKTOP=no KERNEL_CONFIGURE=yes''' ]|}</ol>
</li></ol>
<span id="instructions-for-using-the-orange-pi-os-arch-system"></span>
[[File:zero2w-img144.png]]= '''Instructions for using the Orange Pi OS Arch system''' =
<ol startspan id="2" style="listorange-pi-os-arch-system-stylefunction-type: loweradaptation-alpha;status"><li>A VGA cable and a Mini HDMI male to HDMI female adapter</li></olspan>== Orange Pi OS Arch system function adaptation status ==
[[File{| class="wikitable" style="width:zero2w800px;text-img145align: center;"|-| '''Motherboard functions'''| '''OPi OS Arch'''|-| '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''|-| '''Type-C USB2.png]] [[File0 x 2'''| '''OK'''|-| '''TF Card Startup'''| '''OK'''|-| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|-| '''LED Light'''| '''OK'''|-| '''40pin GPIO'''| '''OK'''|-| '''40pin I2C'''| '''OK'''|-| '''40pin SPI'''| '''OK'''|-| '''40pin UART'''| '''OK'''|-| '''40pin PWM'''| '''OK'''|-| '''Temperature Sensor'''| '''OK'''|-| '''Hardware watchdog'''| '''OK'''|-| '''Mali GPU'''| '''<span style="color:zero2w#FF0000">NO</span>'''|-img146.png]]| '''Video codec'''| '''<span style="color:#FF0000">NO</span>'''|}
<ol start{| class="3wikitable" style="listwidth:800px;text-style-typealign: lower-alphacenter;"><li>A monitor or TV that supports VGA interface<|-| '''24pin expansion board function'''| '''OPi OS Arch'''|-| '''100M network port'''| '''OK'''|-| '''100M Ethernet port light'''| '''OK'''|-| '''USB2.0 HOST x 2'''| '''OK'''|-| '''Infrared reception'''| '''OK'''|-| '''Headphone audio playback'''| '''OK'''|-| '''On/li></ol>off button'''| '''OK'''<!|-| '''LRADC''' '''Custom buttons x 2'''| '''OK'''|- | '''TV-->OUT'''| '''<ol start="2" span style="list-style-typecolor: decimal;#FF0000"><li>HDMI to VGA display test is as followsNO</li></olspan>'''|}
[[File:zero2w<span id="orange-img313.png]]pi-os-arch-system-user-guide-instructions"></span>
'''When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is a problem with the HDMI to VGA converter, VGA cable and monitor.'''== Orange Pi OS Arch System User Guide Instructions ==
<span id="wi-fi-connection-method"></span>== WI-FI connection method ==First of all, please note that the OPi OS Arch system does not have a default orangepi user and password, so you cannot directly log in remotely through the serial port and ssh after the system is started after burning (not even the root user). This is different from Ubuntu and Debian systems.
# Choose When the OPi OS Arch system is started for the first '''Settings'''time, you need to connect an HDMI display and then initialize the system settings through the user wizard (including creating a new user name and setting a password). The setup steps of the user wizard are as follows:
[[File<ol style="list-style-type:zero2wlower-img306alpha;"><li><p>After burning the system, when you start it for the first time and enter the desktop, you will see the user wizard program shown in the figure below.png]]</p><div class="figure">
<ol start="2" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>img293.png]]
[[File:zero2w-img314.png]]</div></li><li><p>First you need to select the language you want</p><div class="figure">
<ol start="3" style="list-style-type[[File: decimal;"><li>Then turn on WIzero2w-FI</li></ol>img294.png]]
[[File:zero2w-img315.png]]</div></li><li><p>After selecting the language, the user wizard will immediately switch to the corresponding language interface, as shown below in Chinese</p><div class="figure">
<ol start="4" style="list-style-type[[File: decimal;"><li>After turning on WIzero2w-FI, you can see the searched signals under '''Available networks'''img295.</li></ol>png]]
[[File:zero2w-img316.png]]</div></li><li><p>Then select the area</p><div class="figure">
<ol start="5" style="list-style-type[[File: decimal;"><li>After selecting the WIzero2w-FI you want to connect to, the password input interface shown below will pop upimg296.</li></ol>png]]
</div></li>
<li><p>Then select the keyboard model</p>
<div class="figure">
[[File:zero2w-img317img297.png]] </div><ol start="6" style="list-style-type: decimal;"><li>Then use the keyboard to enter the password corresponding to the WI-FI, and then use the mouse to click the Enter button on the virtual keyboard to start connecting to the WI-FI.</li></ol>
</div></li>
<li><p>Then create a new username and set a password</p>
<div class="figure">
[[File:zero2w-img318img298.png]]
</div><ol start="7" style="list-style-type: decimal;"/li><li>The display after successful WI-FI connection <p>Then make sure there is as shown belowno problem with the selection, and then click the install '''button'''</lip></oldiv class="figure">
[[File:zero2w-img319img299.png]]
<span id="how-to-use-wi-fi-hotspot"/div></spanli>== How <li><p>Then wait for the installation to use WI-FI hotspot =complete</p><div class="figure">
# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally[[File:zero2w-img300.# Then select '''Settings'''png]]
[[File:zero2w-img306</div></li><li><p>After the installation is complete, you need to click the '''Finish''' button to restart the system.png]]</p><div class="figure">
<ol start="3" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li></ol>img301.png]]
[[File:zero2w-img314</div></li><li><p>The Orange Pi Hello program will automatically start after restarting.png]]At this time, you need to remove the check '''mark of Start on startup''' in the lower right corner, otherwise you need to manually close the Orange Pi Hello program every time you start it.</p><div class="figure">
<ol start="4" style="list[[File:zero2w-style-type: decimal;"><li>Then select '''WIFI hotspot'''</li></ol>img302.png]]
[[File:zero2w-img320</div><p>At this point, you can use the newly created username and password to log in to the OPi OS system through the serial port or ssh.png]]</p></li></ol>
<ol startspan id="5" style="listhow-to-set-styledt-type: decimal;overlays"><li/span>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 == How to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li></ol>set DT overlays ==
[[File:zero2wThe multiplexing functions such as I2C/SPI/UART/PWM in the 40-img321pin development board are turned off by default in the kernel's dts, and the corresponding DT overlays need to be manually turned on before they can be used.png]]
<ol start="6" style="list-style-type: decimal;"><li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''here AndroidAP_7132''') shown under the '''Hotspot name''' in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 The method to connect to the hotspot. The password can be seen under the '''Hotspot password''' open DT overlays in the picture above.</li></ol>OPi OS Arch system is as follows:
[[File:zero2w-img322# First open the '''/boot/extlinux/extlinux.png]]conf''' configuration file
<ol start::{| class="7wikitable" style="list-style-typewidth: decimal800px;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the |-| [orangepi@orangepi-pc ~]$ '''WI-FI Hotspotsudo vim /boot/extlinux/extlinux.conf''' of the development board can be used normally.</li></ol>|}
[[File<ol start="2" style="list-style-type:zero2w-img323decimal;"><li>Then open the corresponding configuration by adding '''FDTOVERLAYS''' '''/dtbs/allwinner/overlay/xxx.dtbo''' in '''/boot/extlinux/extlinux.png]]conf'''</li>
<span id{| class="wikitable" style="howbackground-color:#ffffdc;width:800px;" |-| <big>'''Note that xxx.dtbo in FDTOVERLAYS /dtbs/allwinner/overlay/xxx.dtbo needs to-check-the-ip-address-of-be replaced with the-ethernet-port">specific dtbo configuration, please do not copy it.'''</spanbig>|}{| class="wikitable" style= How to check the IP address of the Ethernet port =="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo vim /boot/extlinux/extlinux.conf'''
# There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board.LABEL Orange Pi
[[File:zero2w-img107.png]]KERNEL /Image
<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<FDT /p><dtbs/li><li><p>Then open '''Settings'''<allwinner/p><p>[[File:zero2wsun50i-img324.png]]</p></li><li><p>Then select '''Network &amp; Internet'''</p><p>[[File:zero2wh616-img325.png]]</p></li><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:zero2worangepi-img326.png]]</p></li></ol> <span id="bluetooth-connection-method"></span>== Bluetooth connection method == # Choose first '''Settings''' [[File:zero2w-img306.png]] <ol start="2" style="list-style-type: decimal;"><li>Then select '''Bluetooth'''</li></ol> [[File:zero2w-img327.png]]dtb
'''FDTOVERLAYS /dtbs/allwinner/overlay/<span style="color:#FF0000">xxx.dtbo</span>''' #Configuration that needs to be added
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Then Open <p>The storage path of xxx.dtbo in the OPi OS Arch image is as follows. Please note that not all dtbo under this path can be used.</p>{| class="wikitable" style="width:800px;" |-| <p>'''Bluetooth Enable/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>
[[File:zero2w-img328.png]] <ol start{| class="4wikitable" style="list-stylewidth:800px;text-typealign: decimalcenter;"><li>Then click |-| '''Functions on the development board'''| '''Corresponding DT overlays configuration'''|-| '''40pin - i2c0'''| '''sun50i-h616-pi-i2c0.dtbo'''|-| '''40pin - i2c1'''| '''sun50i-h616-pi-i2c1.dtbo'''|-| '''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'''| '''Pair new devicesun50i-h616-pi-pwm2.dtbo'''to start scanning for surrounding Bluetooth devices</li></ol>|-| '''40pin - pwm3'''[[File:zero2w| '''sun50i-h616-pi-img329pwm3.png]]dtbo'''|-| '''40pin - pwm4'''| '''sun50i-h616-pi-pwm4.dtbo'''<ol start="5" style="list|-style| '''40pin -type: decimal;">spi1 cs0'''<li>The searched Bluetooth devices will be displayed under | '''Available devicessun50i-h616-spi1-cs0-spidev.dtbo'''</li></ol>|-| '''40pin - spi1 cs1'''[[File:zero2w| '''sun50i-h616-spi1-cs1-img330spidev.png]]dtbo'''|-<ol start="6" style="list| '''40pin - spi1 cs0 cs1'''| '''sun50i-h616-spi1-cs0-cs1-stylespidev.dtbo'''|-type: decimal;"><li>Then click on the Bluetooth device you want | '''设Set USB0 to connect to start pairingHost mode'''| '''sun50i-h616-usb0-host. When dtbo'''|-| '''Turn off the following interface pops up, please use the mouse green LED light'''| '''sun50i-h616-zero2w-disable-led.dtbo'''|-| '''How to select close the UART0 debugging serial port'''| '''Pairsun50i-h616-disable-uart0.dtbo'''option</li>|}</ol> [[File:zero2w-img331.png]] <ol start="75" style="list-style-type: decimal;"><li>What is tested here is the Bluetooth configuration process between If you need to open multiple configurations at the development board and the Android phone. At this same time, just add the following confirmation interface will pop up on the phonepaths of multiple configurations directly after '''FDTOVERLAYS. Click ''' For example, the pairing button on configuration of opening i2c1 and uart5 at the phone to start the pairing process.same time is as follows</li></ol[[File:zero2w-img332.png]] <ol start{| class="8wikitable" style="list-style-typewidth: decimal800px;"><li>After pairing is completed, open |-| [orangepi@orangepi-pc ~]$ '''Paired devicessudo vim /boot/extlinux/extlinux.conf''' and you will see the paired Bluetooth devices.</li></ol>
[[File:zero2w-img333.png]]LABEL Orange Pi
<ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''Accept''' to start receiving the pictures sent by the mobile phone.<KERNEL /li></ol>Image
[[File:FDT /dtbs/allwinner/sun50i-h616-orangepi-zero2w-img334.png]]dtb
'''FDTOVERLAYS <span style="color:#FF0000">/dtbs/allwinner/overlay/sun50i-h616-pi-i2c1.dtbo /dtbs/allwinner/overlay/sun50i-h616-ph-uart5.dtbo</span>'''|}</ol><ol start="106" style="list-style-type: decimal;"><li>Pictures received by After setting, you need to restart the Bluetooth system of for the development board Android system can be viewed in configuration to take effect.</li>{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''Received filessudo reboot'''.|}</liol><span id="how-to-install-software"></olspan>
[[File:zero2w-img335.png]]== How to install software ==
<span id="how-You can use the pacman package management tool to-set-usb0-install software that is not available in OPi OS. For example, the command to-host-mode-1"></span>== How install the vim editor is as follows. If you want to set USB0 install other software, you only need to HOST mode ==replace vim with the package name of the software you want to install.
As shown in the figure below, there are two Type{| class="wikitable" style="width:800px;" |-| [orangepi@orangepi-pc ~]$ '''sudo pacman -C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode.Syy vim'''|}
[[File:zero2w<span id="android-img160.png]]12-tv-system-usage-instructions"></span>
USB0 of the Android12 = '''Android 12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices .usage instructions''' =
If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:<span id="supported-android-versions"></span>== Supported Android versions ==
<ol {| class="wikitable" style="listwidth:800px;text-style-typealign: lower-alphacenter;"><li>Run the following command to set USB0 to HOST mode:</li></ol>|-| Android Version| Kernel version|-| '''Android 12 TV Version'''| '''linux5.4'''|}
apollo<span id="android-p2:/ # '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@012-tv-function-adaptation-status"></usb_host'''span>== Android 12 TV function adaptation status ==
host_chose finished! apollo-p2:/ # <ol start{| class="2wikitable" style="listwidth:800px;text-style-typealign: lower-alphacenter;"><li>Run the following command to switch back to Device mode</li></ol>|-| '''Motherboard functions'''apollo| '''Android12 TV'''|-p2:/ # | '''HDMI video'''| '''OK'''|-| '''HDMI Audio'''| '''OK'''|-| '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@Type-C USB2.0/usb_devicex 2'''| '''OK'''device_chose finished!|-| '''TF card startup'''| '''OK'''|-| '''WIFI'''| '''OK'''|-| '''Bluetooth'''| '''OK'''|-| '''USB Camera'''| '''OK'''apollo|-p2:/ #| '''LED Light'''<ol start="3" style="list| '''OK'''|-style| '''40pin GPIO'''| '''OK'''|-type: lower| '''40pin I2C'''| '''OK'''|-alpha;"><li>The command to view the current mode of USB0 is</li></ol>| '''40pin SPI1'''| '''OK'''apollo|-p2:/ # | '''40pin UART'''| '''cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_roleOK'''|-usb_host| '''40pin PWM'''| '''OK'''<span id="how|-to| '''Temperature Sensor'''| '''OK'''|-use| '''Hardware watchdog'''| '''OK'''|-usb| '''Mali GPU'''| '''OK'''|-camera"></span>== How to use USB camera ==| '''Video codec'''| '''OK'''|}
# First insert the USB (UVC protocol) camera into the USB interface of the development {| class="wikitable" style="width:800px;text-align: center;"|-| '''24pin Expansion boardfunction'''| '''Android12 TV'''|-| '''100M network port'''| '''OK'''# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev|-| '''100M Ethernet port light'''console:/ # | '''ls /dev/video0OK'''|-/dev/video0| '''USB2.0 HOST x 2'''| '''OK'''<ol start="3" style="list|-style| '''Infrared reception'''| '''OK'''|-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;| '''Headphone audio playback'''| '''OK'''How to use ADB|-| '''&quot;.<On/p></li>off button'''<li><p>Download the USB camera test APP from the | '''official toolOK''' on the development board information download page</p></li></ol>|-<div class="figure">| '''LRADC''' '''Custom buttons x 2'''| '''OK, The default setting is the volume up and down keys.'''[[File:zero2w|-img336.png]]| '''TV-OUT'''</div>| '''OK'''<div class="figure">|}
[[File:zero2w<span id="onboard-img337.png]]led-light-display-instructions"></span>== Onboard LED light display instructions ==
</div><ol start{| class="5wikitable" style="list-stylewidth:800px;text-typealign: decimalcenter;"><li>Then use the adb command |-|| '''green light'''| '''red light'''|-| '''u-boot startup phase'''| '''Off'''| '''on'''|-| '''Kernel boot to install enter the USB camera test APP into the Android system. Of course, you can also use a USB disk copy to install it.</li></ol>'''| '''on'''| '''on'''|}
test@test:~$ '''adb install usbcamera.apk'''<span id="how-to-return-to-the-previous-interface-in-android"></span>== How to return to the previous interface in Android ==
<ol start="6" style="list-style-type: decimal;"><li>After installation, you can see We generally use the mouse and keyboard to control the startup icon Android system of the USB camera on development board. When entering certain interfaces and need to return to the Android previous interface or desktop, we can only return by right-clicking the mouse, and the keyboard cannot return.</li></ol>
[[FileIf you have purchased the infrared remote control (other remote controls do not work) and a 24pin expansion board that come with the development board, after connecting the 24pin expansion board to the development board, you can also use the return key on the remote control to return to the previous menu. The location of the return key is as shown below. Shown:zero2w-img338.png]]
<ol start="7" style="list-style-type[[File: decimal;"><li>Then doublezero2w-click to open the USB camera APP and you can see the output video of the USB cameraimg303.</li></ol>png]]
<span id="androidhow-systemto-rootuse-descriptionadb"></span>== Android system ROOT description How to use ADB ==
'''The Android system released by Orange Pi has been ROOT and can be tested using the following method.'''<span id="use-network-connection-adb-debugging"></span>=== Use network connection adb debugging ===
{| class="wikitable" style="background-color:# Download from the ffffdc;width:800px;" |-| <big>'''official toolUsing network adb does not require a USB Typc C interface data cable to connect the computer and the development board. Instead, it communicates through the network, so first make sure that the development board''' on s wired or wireless network is connected, and then obtain the IP address of the development board data download page '''rootcheck.apkNext To be used.'''</big>|}
<div class="figure"># Make sure the '''service.adb.tcp.port''' of the Android system is set to 5555 port number
[[File:zero2w:{| class="wikitable" style="width:800px;" |-img336.png]]| <apollo-p2:/div><div class="figure"># '''getprop | grep &quot;adb.tcp&quot;'''
[[File:zero2w-img339service.adb.tcp.pngport]: [5555]|}
</div>
<ol start="2" style="list-style-type: decimal;">
<li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;If '''How to use ADB'''&quot;service.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android systemtcp. Of courseport''' is not set, you can also use a USB disk copy the following command in the serial port to install it.set the port number of the network adb</pli><{| class="wikitable" style="width:800px;" |-| apollo-p2:/li><# '''setprop service.adb.tcp.port 5555''' apollo-p2:/ol># '''stop adbd'''
apollo-p2:/ # '''start adbd'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Install adb tool on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb install rootcheck.apksudo apt-get update'''
test@test:~$ '''sudo apt-get install -y adb'''
|}
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>After installation, you can see Then connect network adb on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb connect 192.168.1.xxx:5555''' '''(Need to be modified to the startup icon IP address of the ROOT test tool on the Android desktop.development board)''' <p>* daemon not running; starting now at tcp:5037</lip> <p>* daemon started successfully</olp>
[[Fileconnected to 192.168.1.xxx:zero2w-img340.png]]5555
<ol start="5" style="list-style-type: decimal;">
<li>The display interface after opening the '''ROOT test tool''' for the first time is as shown below</li></ol>
[[Filetest@test:zero2w-img341.png]]~$ '''adb devices'''
<ol start="6" style="list-style-type: decimal;"><li>Then you can click '''CHECK NOW''' to start checking the ROOT status List 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>devices attached
[[File192.168.1.xxx:zero2w5555 device|}</ol><ol start="5" style="list-img342.png]]style-type: decimal;"><li>Then you can log in to the android system through adb shell on Ubuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb shell'''
apollo-p2:/ #|}</ol><span id="how-to-use-miracastreceiver-to-cast-the-mobiledata-phone-screencable-to-theconnect-developmentadb-boarddebugging"></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 == Use data cable to the same WIFI hotspot. For the method of connecting the development board to WIFI, please refer to '''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 classconnect adb debugging ==="figure">
[[File:zero2w-img344# 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.png]]
</div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''Xiaomi 12S Pro mobile phone''' as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p><p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the 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 '''MiracastReceiver''' application interface of the development board. Here we can select '''Accept'''</p><p>[[File:zero2w-img347img304.png]]</p></li><li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348img305.png]]</p></li></ol>
<span idol start="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared2" style="list-remotestyle-controltype: decimal;"><li>Install adb tool on Ubuntu PC</spanli>{| class="wikitable" style= Method of turning on and off the machine through buttons or infrared remote control =="width:800px;" |-| test@test:~$ '''sudo apt-get update'''
We can turn off or turn on the Android system of the development board through test@test:~$ '''sudo apt-get install -y adb'''|}</ol><ol start="3" style="list-style-type: decimal;"><li>Check whether the power on/off button or infrared remote control. However, it should be noted that there ADB device is no power onrecognized</off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board.li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb devices'''
[[File:zero2w-img107.png]]List of devices attached
The location of 4c00146473c28651dd0 device|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then you can log in to the power button android system through adb shell on the 24pin expansion board is as shown in the figure belowUbuntu PC</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''adb shell'''
[[Fileapollo-p2:zero2w/ $|}</ol><span id="view-how-to-set-hdmi-display-img269.png]]resolution"></span>
The location of the infrared remote control power button is as follows:== View how to set HDMI display resolution ==
<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 &amp; 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-img349img312.png]]</p></li></ol>
When shutting down, we need <span id="hdmi-to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''OK''' -vga-display-test-1"></span>=== HDMI to shut down the Android system.VGA display test ===
[[File<ol style="list-style-type: decimal;"><li><p>First you need to prepare the following accessories</p><ol style="list-style-type:zero2wlower-img350.png]]alpha;"><li>HDMI to VGA converter</li>
After shutting down, press [[File:zero2w-img144.png]]</ol><ol start="2" style="list-style-type: lower-alpha;"><li>A VGA cable and hold the power button a Mini HDMI male to HDMI female adapter</li> [[File:zero2w-img145.png]] [[File:zero2w-img146.png]]</ol><ol start="3" style="list-style-type: lower-alpha;"><li>A monitor or the power button on the infrared remote control again TV that supports VGA interface</li></ol></li></ol> <ol start="2" style="list-style-type: decimal;"><li>HDMI to turn it on.VGA display test is as follows</li>
<span id="pin[[File:zero2w-interface-gpio-uart-spi-test"></span>== 40pin interface GPIO, UART, SPI test ==img313.png]]
{| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Note: The pin header on When using HDMI to VGA display, the development board and the Android system of the development board do not need to make any settings. You only need the 40pin Mini HDMI interface of the development board to display normally. So if there is a problem with the test, please check whether there is not soldered by defaulta problem with the HDMI to VGA converter, VGA cable and you need to solder it yourself before it can be usedmonitor.'''</big>|}</ol><span id="wi-fi-connection-method"></span>
<span id="pin-gpio-port-test= WI-FI connection method"></span>=== 40pin GPIO port test method ===
# First open wiringOP APP on the desktopChoose first '''Settings'''
::[[File:zero2w-img351img306.png]]
<ol start="2" style="list-style-type: decimal;">
<li>Then click the select '''GPIO_TESTNetwork &amp; Internet''' button to open the GPIO test interface</li></ol> [[File:zero2w-img352.png]]
[[File:zero2w-img314.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 Then turn on the left have a oneWI-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.FI</li></ol>
[[File:zero2w-img353img315.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>
[[File:zero2w-img316.png]]</ol><ol start="45" style="list-style-type: decimal;"><li>Then click After selecting the '''GPIO READALL''' buttonWI-FI you want to connect to, and the output information is as password input interface shown below:will pop up.</li></ol>
<div class="figure">
[[File:zero2w-img354img317.png]]
</div></ol><ol start="56" style="list-style-type: decimal;"><li>There are a total of 28 GPIO ports available in Then use the 40-pin development board. The following takes pin 12 - corresponding keyboard to GPIO PI01 - enter the password corresponding to wPi serial number 6 the WI- as an example to demonstrate how to set the high FI, and low levels of then use the GPIO port. First mouse to click the '''CheckBox''' Enter button corresponding to pin 12. When on the button is selected, pin 12 will be set virtual keyboard to high level. After setting, you can use a multimeter start connecting to measure the value of the voltage of the pin. If it is '''3.3v''', it means the setting High level successWI-FI.</li></ol>
[[File:zero2w-img355.png]]<div class="figure">
<ol start="6" style="list-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is '''OUT''' and the pin level is high level.</li></ol> [[File:zero2w-img356img318.png]]
</div></ol>
<ol start="7" style="list-style-type: decimal;">
<li>Click the '''CheckBox''' button in the picture The display after successful WI-FI connection is as shown below again to uncheck it, and pin 12 will be set to low level. After setting, you can use a multimeter to measure the voltage value of the pin. If it is '''0v''', it means the low level setting is successful.</li></ol>
[[File:zero2w-img357img319.png]]</ol><span id="how-to-use-wi-fi-hotspot"></span>
<ol start="8" style="listHow to use WI-style-type: decimal;"><li>Then click the '''GPIO READALL''' button and you can see that the current pin 12 mode is OUT and the pin level is low level.</li></ol>FI hotspot ==
[[File:zero2w-img358# First, please make sure that the Ethernet port is connected to the network cable and can access the Internet normally.png]]# Then select '''Settings'''
<span id="pin::[[File:zero2w-uart-test-method"></span>=== 40pin UART test method ===img306.png]]
# 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.<ol start="3" style="list-style-type: decimal;"><li>Then select '''Network &amp; Internet'''</li>
{| class[[File:zero2w-img314.png]]</ol><ol start="wikitable4" style="|list-style-type: decimal;">| <li>Then select '''GPIO序号WIFI hotspot'''</li> | [[File:zero2w-img320.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>Then open '''GPIOHotspot Enable'''. You can also see the name and password of the generated hotspot in the picture below. Remember them and use them when connecting to the hotspot (if you need to modify the name and password of the hotspot, you need to close Hotspot Enable first. Then you can modify it)</li>| '''功能'''| '''引脚'''[[File:zero2w-img321.png]]</ol>|<ol start="6" style="list-style-type: decimal;">| <li>At this time, you can take out your mobile phone. If everything is normal, you can find the WIFI hotspot with the same name ('''引脚here AndroidAP_7132'''| ) shown under the '''功能Hotspot name'''| in the picture above in the WI-FI list searched by the mobile phone. Then you can click AndroidAP_7132 to connect to the hotspot. The password can be seen under the '''GPIOHotspot password'''in the picture above.</li>| [[File:zero2w-img322.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>After the connection is successful, it will be displayed as shown below (the interface will be different on different mobile phones, the specific interface is subject to the one displayed on your mobile phone). At this time, you can open a web page on your mobile phone to see if you can access the Internet. If the web page can be opened normally, it means that the '''GPIO序号WI-FI Hotspot'''of the development board can be used normally.</li> |[[File:zero2w-img323.png]]| style</ol><span id="texthow-alignto-check-the-ip-address-of-the-ethernet-port"></span> == How to check the IP address of the Ethernet port == # There is no wired network interface on the main board of the development board. We can expand the 100M Ethernet through a 24pin expansion board. :: left;[[File:zero2w-img107.png]] <ol start="2"|| style="textlist-style-aligntype: leftdecimal;"|><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 '''3.3VSettings'''</p>| <p>[[File:zero2w-img324.png]]</p></li><li><p>Then select '''1Network &amp; Internet'''</p>|<p>[[File:zero2w-img325.png]]</p></li>| '''2''<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> <span id="bluetooth-connection-method"></span> == Bluetooth connection method == | # Choose first '''5VSettings'''| style::[[File:zero2w-img306.png]] <ol start="text-align: left;2"|| style="textlist-alignstyle-type: leftdecimal;"|>|-| <li>Then select '''264Bluetooth'''</li> [[File:zero2w-img327.png]]</ol><ol start="3" style="list-style-type: decimal;">| <li>Then Open '''PI8Bluetooth Enable'''</li>| '''TWI1[[File:zero2w-img328.png]]</ol><ol start="4" style="list-style-SDA'''type: decimal;">| <li>Then click '''3Pair new device'''to start scanning for surrounding Bluetooth devices</li> |[[File:zero2w-img329.png]]</ol><ol start="5" style="list-style-type: decimal;">| <li>The searched Bluetooth devices will be displayed under '''4Available devices'''</li> [[File:zero2w-img330.png]]</ol><ol start="6" style="list-style-type: decimal;">| <li>Then click on the Bluetooth device you want to connect to start pairing. When the following interface pops up, please use the mouse to select the '''5VPair'''option</li> | [[File:zero2w-img331.png]]</ol><ol start="7" style="textlist-alignstyle-type: leftdecimal;"|><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-img332.png]]</ol>| <ol start="8" style="textlist-style-aligntype: leftdecimal;"||->| <li>After pairing is completed, open '''263Paired devices'''and you will see the paired Bluetooth devices.</li> | [[File:zero2w-img333.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>At this time, you can use the Bluetooth of your mobile phone to send a picture to the development board. After sending, you can see the following confirmation interface in the Android system of the development board, and then click '''PI7Accept'''to start receiving the pictures sent by the mobile phone.</li> [[File:zero2w-img334.png]]| '''TWI1</ol><ol start="10" style="list-style-SCL'''type: decimal;">| <li>Pictures received by the Bluetooth system of the development board Android system can be viewed in '''5Received files'''.</li> [[File:zero2w-img335.png]]</ol><span id="how-to-set-usb0-to-host-mode-1"></span> == How to set USB0 to HOST mode == As shown in the figure below, there are two Type-C interfaces on the motherboard of the development board: USB0 and USB1. Both of these interfaces can be used to power the development board, and they can also be used as USB2.0 HOST interfaces. The difference between USB0 and USB1 is that in addition to being set to HOST mode, USB0 can also be set to Device mode, while USB1 only has HOST mode. [[File:zero2w-img160.png]] USB0 of the Android12 TV system released by Orange Pi is set to Device mode by default, so when there is no need to use USB0 Device mode (ADB function needs to ensure that USB0 is in Device mode), it is recommended to use USB0 for power supply, so that USB1 can be directly used to connect USB devices .|| '''6'''If you want to use USB0 to connect USB devices, you need to set USB0 to HOST mode. The method is as follows:| '''GND'''| <ol style="textlist-alignstyle-type: leftlower-alpha;"|><li>Run the following command to set USB0 to HOST mode:</li>{| class="wikitable" style="text-alignwidth: left800px;"|
|-
| apollo-p2:/ # '''269cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_host'''| '''PI13'''| '''PWM3'''host_chose finished! | '''7'''apollo-p2:/ #|}| '''8'''</ol>| '''UART0_TX'''<ol start="2" style="list-style-type: lower-alpha;">| '''PH0'''<li>Run the following command to switch back to Device mode</li>{| '''224'''class="wikitable" style="width:800px;"
|-
| style="text-align: left;"|| style="textapollo-alignp2: left;"|| / # '''GNDcat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/usb_device'''| '''9'''device_chose finished! apollo-p2:/ #|}| '''10'''</ol>| '''UART0_RX'''<ol start="3" style="list-style-type: lower-alpha;">| '''PH1'''<li>The command to view the current mode of USB0 is</li>{| '''225'''class="wikitable" style="width:800px;"
|-
| apollo-p2:/ # '''226cat /sys/devices/platform/soc@3000000/soc@3000000\:usbc0@0/otg_role''' usb_host| '''PH2'''}</ol><span id="how-to-use-usb-camera"></span> == How to use USB camera ==| '''UART5_TX'''| '''11'''# First insert the USB (UVC protocol) camera into the USB interface of the development board|# If the USB camera is recognized normally, the corresponding video device node will be generated under /dev| '''12'''::{| class="wikitable" style="text-alignwidth: left800px;"|| '''PI1'''| '''257'''
|-
| console:/ # '''227ls /dev/video0''' /dev/video0| '''PH3'''} <ol start="3" style="list-style-type: decimal;"><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB| '''UART5_RXHow to use ADB''']]&quot;.</p></li>| <li><p>Download the USB camera test APP from the '''13official tool'''on the development board information download page</p></li> |<div class="figure"> [[File:zero2w-img336.png]] </div><div class="figure"> [[File:zero2w-img337.png]]| '''14'''| '''GND'''</div></ol>| <ol start="5" style="textlist-style-aligntype: leftdecimal;"|><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="text-alignwidth: left800px;"|
|-
| test@test:~$ '''261adb install usbcamera.apk'''| '''PI5'''}</ol><ol start="6" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the USB camera on the Android desktop.</li> [[File:zero2w-img338.png]]</ol><ol start="7" style="list-style-type: decimal;">| '''UART2_TX'''<li>Then double-click to open the USB camera APP and you can see the output video of the USB camera.</li></ol>| '''15'''|<span id="android-system-root-description"></span>| '''16'''| '''PWM4'''== Android system ROOT description ==| '''PI14'''{| '''270'''class="wikitable" style="background-color:#ffffdc;width:800px;"
|-
| style="text-align: left;"|| style="text-align: left;"|| <big>'''3The Android system released by Orange Pi has been ROOT and can be tested using the following method.3V'''</big>| } # Download from the '''17official tool'''|| on the development board data download page '''18rootcheck.apk'''| <div class="figure"> ::[[File:zero2w-img336.png]] </div><div class="figure"> ::[[File:zero2w-img339.png]] </div><ol start="2" style="textlist-style-aligntype: leftdecimal;"|><li><p>Then make sure that the adb connection between the Ubuntu PC and the development board is normal. For how to use adb, please refer to the instructions in the section &quot;[[Orange Pi Zero 2W#How to use ADB| '''PH4How to use ADB''']]&quot;.</p></li><li><p>Then use the adb command to install rootcheck.apk into the Android system. Of course, you can also use a USB disk copy to install it.</p></li>{| '''228'''class="wikitable" style="width:800px;"
|-
| test@test:~$ '''231adb install rootcheck.apk'''| }</ol><ol start="4" style="list-style-type: decimal;"><li>After installation, you can see the startup icon of the ROOT test tool on the Android desktop.</li> [[File:zero2w-img340.png]]</ol><ol start="5" style="list-style-type: decimal;"><li>The display interface after opening the '''PH7ROOT test tool'''for the first time is as shown below</li>| '''SPI1_MOSI'''| [[File:zero2w-img341.png]]</ol><ol start="6" style="list-style-type: decimal;"><li>Then you can click '''19CHECK 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>|| '''20'''[[File:zero2w-img342.png]]| '''GND'''</ol>| style<span id="texthow-align: left;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="textlist-alignstyle-type: leftdecimal;"|>|<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| '''232the instructions in the WI-FI connection method.''']]</p></li>| <li><p>Then open the '''PH8MiracastReceiver'''application in the Android system of the development board</p><p>[[File:zero2w-img343.png]]</p></li>| <li><p>The interface after '''SPI1_MISOMiracastReceiver'''is opened is as follows</p><div class="figure"> [[File:zero2w-img344.png]]| </div></li><li><p>Then find the screen mirroring function in the phone settings. Here we take '''21Xiaomi 12S Pro mobile phone'''as an example. Please research other brands of mobile phones by yourself. As shown in the picture below, click the button in the red box to open the screen mirroring function of the phone.</p>|<p>[[File:zero2w-img345.png]]</p></li><li><p>After waiting for a period of time, you will be able to see the searched connectable devices on your mobile phone, and then we can select the device corresponding to the 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 '''22MiracastReceiver'''| application interface of the development board. Here we can select '''UART2_RXAccept'''</p><p>[[File:zero2w-img347.png]]</p></li>| '''PI6'''<li><p>Then you can see the content of the mobile phone screen on the HDMI screen connected to the development board</p><p>[[File:zero2w-img348.png]]</p></li></ol> <span id="method-of-turning-on-and-off-the-machine-through-buttons-or-infrared-remote-control"></span> == Method of turning on and off the machine through buttons or infrared remote control == We can turn off or turn on the Android system of the development board through the power on/off button or infrared remote control. However, it should be noted that there is no power on/off button and infrared receiver on the main board of the development board, and it needs to be expanded through a 24pin expansion board. [[File:zero2w-img107.png]] The location of the power button on the 24pin expansion board is as shown in the figure below: [[File:zero2w-img269.png]] The location of the infrared remote control power button is as follows:| '''262'''|[[File:zero2w-img349.png]] | When shutting down, we need to press and hold the power button or the power button on the infrared remote control, and then the Android system will pop up the confirmation dialog box shown in the figure below, and then select '''230OK'''to shut down the Android system.| '''PH6'''| '''SPI1_CLK'''[[File:zero2w-img350.png]] | '''23'''After shutting down, press and hold the power button or the power button on the infrared remote control again to turn it on.|| '''24'''<span id="pin-interface-gpio-uart-spi-test"></span>| '''SPI1_CS0'''== 40pin interface GPIO, UART, SPI test ==| '''PH5'''{| '''229'''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="textlist-style-aligntype: leftdecimal;"|><li>Then click the '''GPIO_TEST''' button to open the GPIO test interface</li> [[File:zero2w-img352.png]]</ol>| <ol start="3" style="textlist-style-aligntype: leftdecimal;"|>| <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 '''GNDOUT'''| 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 '''25GPIO READALL'''|| button, you can get information such as wPi number, GPIO mode, pin level, etc.; when you click the'''26BLINK 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 '''SPI1_CS1GPIO 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 '''PH9CheckBox'''| 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 '''2333.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 '''266OUT'''and the pin level is high level.</li>| [[File:zero2w-img356.png]]</ol><ol start="7" style="list-style-type: decimal;"><li>Click the '''PI10CheckBox'''| 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 '''TWI2-SDA0v''', 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 '''27GPIO 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;"|-| '''28GPIO NO.'''| '''TWI2-SCLGPIO'''| '''PI9Function'''| '''265Pin'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|-
| '''271263'''| '''PI15PI7'''| style="text'''TWI1-align: left;"|SCL'''| '''315'''|-| '''32269'''| '''PWM1PI13'''| '''PI11PWM3'''| '''2677'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| 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>'''
| '''<span style="color:#FF0000">11</span>'''
|-
| '''<span style="color:#FF0000">227</span>'''
| '''<span style="color:#FF0000">PH3</span>'''
| '''<span style="color:#FF0000">UART5_RX</span>'''
| '''<span style="color:#FF0000">13</span>'''
|-
| '''<span style="color:#FF0000">261</span>'''
| '''<span style="color:#FF0000">PI5</span>'''
| '''<span style="color:#FF0000">UART2_TX</span>'''
| '''<span style="color:#FF0000">15</span>'''
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC123.3V'''| '''7617'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''
|-
| '''272230'''| '''PI16PH6'''| style="text-align: left;"|| '''37'''|| '''38'''| style="text-align: left;"|| '''PI4SPI1_CLK'''| '''26023'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''3925'''|-| '''40266'''| '''PI10'''| '''TWI2-SDA'''| '''27'''|-| '''256'''| '''PI0'''
| style="text-align: left;"|
| '''PI329'''| '''259'''|} <ol start="2" style="list-style-type: decimal;"><li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li></ol> apollo-p2:/ # ls /dev/ttyAS* /dev/ttyAS0 /dev/ttyAS1 '''/dev/ttyAS2 /dev/ttyAS5''' <ol start="3" style="list-style-type: decimal;"><li>First open wiringOP APP on the desktop</li></ol> [[File:zero2w-img351.png]] <ol start="4" style="list-style-type: decimal;"><li>Then click the '''UART_TEST'''button to open the UART test interface</li></ol> [[File:zero2w-img359.png]] <ol start="5" style="list-style-type: decimal;"><li>The serial port test interface of wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img360.png]] <ol start="6" style="list-style-type: decimal;"><li><p>Then select the '''/dev/ttyAS2''' or'''/dev/ttyAS5''' node in the selection box</p><p>[[File:zero2w-img361.png]]</p></li><li><p>Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to open the uart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img362.png]] <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></ol> [[File:zero2w-img363.png]] <ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li></ol> [[File:zero2w-img364.png]] <span id="pin-spi-test-method"></span>=== 40pin SPI test method === # As can be seen from the table below, the spi available for the 40pin interface is spi1, and there are two chip select pins cs0 and cs1 {| class="wikitable"
|-
| '''GPIO serial number271'''| '''PI15'''| style="text-align: left;"|| '''31'''|-| '''268'''| '''PI12'''| '''PWM2'''| '''33'''|-| '''258'''| '''PI2'''| style="text-align: left;"|| '''35'''|-| '''272'''| '''PI16'''| style="text-align: left;"|| '''GPIO37'''|-| style="text-align: left;"|| style="text-align: left;"|| '''FunctionGND'''| '''pin39'''|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''pinPin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberNO.'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''264'''
| '''PI8'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
|-
| '''263'''
| '''PI7'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
|-
| '''269'''
| '''PI13'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''224'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''225'''
|-
| '''226'''
| '''PH2'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''257'''
|-
| '''227'''
| '''PH3'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
|-
| '''261'''
| '''PI5'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''270'''
|-
| style="text-align: left;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''PH7'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
|-
| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|| '''<span style="color:#FF0000">22</span>'''| '''<span style="color:#FF0000">UART2_RX</span>'''| '''<span style="color:#FF0000">PI6</span>'''| '''<span style="color:#FF0000">262</span>'''
|-
| '''230'''
| '''PH6'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''229'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''233'''
|-
| '''266'''
| '''PI10'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''265'''
|-
| '''256'''
| '''PI0'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
|-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''267'''
|-
| '''268'''
| '''PI12'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
|-
| '''258'''
| '''PI2'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|}-| '''38'''<ol start="2" | style="list-styletext-typealign: decimalleft;">|<li>The device node corresponding to SPI1 CS0 is | '''/dev/spidev1.0PI4''', and the device node corresponding to SPI1 CS1 is | '''/dev/spidev1.1260'''</li></ol>|-| '''40'''apollo| style="text-p2align:/ # left;"|| '''ls /dev/spidev1.*PI3''' | '''/dev/spidev1.0 /dev/spidev1.1259'''|}</div>
<ol start="2" style="list-style-type: decimal;">
<li>The device node corresponding to uart2 is '''/dev/ttyAS2''', and the device node corresponding to uart5 is'''/dev/ttyAS5'''</li>
{| class="wikitable" style="width:800px;"
|-
|
<p>apollo-p2:/ # ls /dev/ttyAS*</p>
<p>/dev/ttyAS0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS1 &nbsp;&nbsp;&nbsp;&nbsp; '''<span style="color:#FF0000">/dev/ttyAS2 &nbsp;&nbsp;&nbsp;&nbsp; /dev/ttyAS5</span>'''</p>
|}
</ol>
<ol start="3" style="list-style-type: decimal;">
<li>Here is a demonstration to test the SPI1 interface through the '''w25qxx''' module. First, connect the w25qxx module to open wiringOP APP on the SPI1 interface.desktop</li></ol> '''It doesn't matter if there is no w25qxx module, because there is a SPIFlash on the development board connected to SPI0, and the configuration of SPI0 is also turned on by default in Android, so we can also directly use the onboard SPIFlash for testing.'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then click the '''UART_TEST'''button to open wiringOP APP on the desktopUART test interface</li></ol> [[File:zero2w-img351.png]]
[[File:zero2w-img359.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then click the '''SPI_TEST''' button to open the SPI The serial port test interfaceof wiringOP is as shown in the figure below</li></ol> [[File:zero2w-img365.png]]
[[File:zero2w-img360.png]]
</ol>
<ol start="6" style="list-style-type: decimal;">
<li><p>Then select the spi device node in the upper left corner. If you test the onboard SPIFlash directly, just keep the default '''/dev/spidev0.0'ttyAS2''. If the '''w25qxx''' module is connected to the 40pin spi1 cs0, then please selector'''/dev/spidev1.0ttyAS5''', if the w25qxx module is connected to node in the 40pin spi1 cs1, then please select '''/dev/spidev1.1'''selection box</p><div class="figure"p> [[File:zero2w-img366img361.png]] </divp></li><li><p>Then Enter the baud rate you want to set in the edit box, and then click the '''OPEN''' button to initialize open the SPIuart node. After the opening is successful, the '''OPEN''' button becomes unselectable, and the '''CLOSE''' button and '''SEND''' button become selectable.</p></li></ol> [[File:zero2w-img367.png]]
[[File:zero2w-img362.png]]
</ol>
<ol start="8" style="list-style-type: decimal;">
<li><p>Then fill in the bytes that need use Dupont wire to be sent, such as reading short the ID information rx and tx pins of uart</p></li><li><p>Then you can enter a paragraph of the onboard SPIFlash, filling characters in the address 0x9f in data[0], send edit box below and then click the '''TRANSFERSEND''' buttonto start sending.</lip></olli>
[[File:zero2w-img368img363.png]]</ol><ol start="10" style="list-style-type: decimal;"><li>If everything is normal, the received string will be displayed in the receiving box</li>
[[File:zero2w-img364.png]]</ol start><span id="9" style="listpin-spi-styletest-type: decimal;method"><li>Finally, the APP will display the read ID information of the onboard SPI Flash.</li></olspan>
[[File:zero2w-img369.png]]=== 40pin SPI test method ===
<ol start="10" style="list-style-type: decimal;"><li>If # As can be seen from the w25qxx module connected to 40pin SPI1 is readtable below, the ID information of spi available for the onboard SPI Flash 40pin interface is also similar.</li></ol>spi1, and there are two chip select pins cs0 and cs1
<span iddiv style="pin-i2c-test-methoddisplay: flex;"></span>=== 40pin I2C test method === # As can be seen from the table below, the Android12 TV system has i2c1 and i2c2 turned on by default. ::{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"
|-
| '''GPIO serial numberNO.'''
| '''GPIO'''
| '''Function'''
| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial numberPin'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''264'''
| '''TWI1-SDA'''
| '''3'''
|
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''263'''
| '''TWI1-SCL'''
| '''5'''
|
| '''6'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''269'''
| '''PWM3'''
| '''7'''
|
| '''8'''
| '''UART0_TX'''
| '''PH0'''
| '''224'''
|-
| style="text-align: left;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''226'''
| '''UART5_TX'''
| '''11'''
|
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''227'''
| '''UART5_RX'''
| '''13'''
|
| '''14'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''261'''
| '''UART2_TX'''
| '''15'''
|
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| style="text-align: left;"|
| '''3.3V'''
| '''17'''
|
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''231'''
| '''SPI1_MOSI'''
| '''19'''
|
| '''20'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''232'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|| '''24'''| '''SPI1_CS0'''| '''PH5'''| '''229'''|-| style="text-align: left;"|
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''266'''
| '''TWI2-SDA'''
| '''27'''
|
| '''28'''
| '''TWI2-SCL'''
| '''PI9'''
| '''265'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|
| '''30'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''271'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|}{| '''36'''| class="wikitable" style="width:390px;margin-right: 20px;text-align: leftcenter;"|-| '''Pin'''| '''Function'''| '''PC12GPIO'''| '''76GPIO NO.'''
|-
| '''2722'''| '''PI165V'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| '''4'''
| '''5V'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''6'''
| '''GND'''
| '''39'''
|
| '''40'''
| style="text-align: left;"|
| '''PI3'''| '''259'''|} <ol start="2" style="listtext-style-typealign: decimalleft;">|<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="list-style-type: 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 1UART0_TX'''</p><p>| '''OrPH0'''</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 BYTE224''' 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 number10'''| '''GPIOUART0_RX'''| '''FunctionPH1'''| '''pin'''|| '''pin'''| '''Function'''| '''GPIO'''| '''GPIO serial number225'''
|-
| '''12'''
| style="text-align: left;"|
| '''PI1'''
| '''257'''
|-
| '''14'''
| '''GND'''
| style="text-align: left;"|
| '''3.3V'''
| '''1'''
|
| '''2'''
| '''5V'''
| style="text-align: left;"|
|-
| '''16'''
| '''PWM4'''
| '''PI14'''
| '''270'''
|-
| '''18'''
| style="text-align: left;"|
| '''PH4'''
| '''228'''
|-
| '''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;"|
| '''GND'''
| '''9'''
|
| '''10'''
| '''UART0_RX'''
| '''PH1'''
| '''225'''
|-
| '''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:/ # '''227ls /dev/spidev1.*'''| '''PH3'''| '''UART5_RX<span style="color:#FF0000">/dev/spidev1.0 &nbsp;&nbsp;&nbsp;&nbsp; /dev/spidev1.1</span>'''| '''13'''}|</ol>| '''14'''<ol start="3" style="list-style-type: decimal;">| <li>Here is a demonstration to test the SPI1 interface through the '''GNDw25qxx'''module. First, connect the w25qxx module to the SPI1 interface.</li>{| styleclass="text-align: left;wikitable"|| style="textbackground-aligncolor: left#ffffdc;width:800px;"|
|-
| <big>'''261It 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'''PI5, 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 '''UART2_TXOPEN'''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 '''15TRANSFER'''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;"|-| '''16GPIO NO.'''| '''PWM4GPIO'''| '''PI14Function'''| '''270Pin'''
|-
| style="text-align: left;"|
| style="text-align: left;"|
| '''3.3V'''
| '''171'''|-| '''18<span style="color:#FF0000">264</span>'''| '''<span style="text-aligncolor: left;#FF0000"|>PI8</span>'''| '''PH4<span style="color:#FF0000">TWI1-SDA</span>'''| '''228<span style="color:#FF0000">3</span>'''
|-
| '''231<span style="color:#FF0000">263</span>'''| '''PH7<span style="color:#FF0000">PI7</span>'''| '''SPI1_MOSI<span style="color:#FF0000">TWI1-SCL</span>'''| '''19'''|| '''20'''| '''GND'''| style="text-align: left;"|| <span style="text-aligncolor: left;#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;"|| style="text-align: left;"|| '''3.3V'''| '''17'''|-| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''19'''|-| '''232'''
| '''PH8'''
| '''SPI1_MISO'''
| '''21'''
|
| '''22'''
| '''UART2_RX'''
| '''PI6'''
| '''262'''
|-
| '''230'''
| '''SPI1_CLK'''
| '''23'''
|
| '''24'''
| '''SPI1_CS0'''
| '''PH5'''
| '''229'''
|-
| style="text-align: left;"|
| '''GND'''
| '''25'''
|
| '''26'''
| '''SPI1_CS1'''
| '''PH9'''
| '''233'''
|-
| '''<span style="color:#FF0000">266</span>'''| '''<span style="color:#FF0000">PI10</span>'''| '''<span style="color:#FF0000">TWI2-SDA</span>'''| '''<span style="color:#FF0000">27'''|| '''28'''| '''TWI2-SCL'''| '''PI9'''| '''265</span>'''
|-
| '''256'''
| style="text-align: left;"|
| '''29'''
|| '''30'''| '''GND'''| style="text-align: left;"|| style="text-align: left;"||-
| '''271'''
| '''PI15'''
| style="text-align: left;"|
| '''31'''
|
| '''32'''
| '''PWM1'''
| '''PI11'''
| '''267'''
|-
| '''268'''
| '''PWM2'''
| '''33'''
|
| '''34'''
| '''GND'''
| style="text-align: left;"|
| style="text-align: left;"|
|-
| '''258'''
| style="text-align: left;"|
| '''35'''
|
| '''36'''
| style="text-align: left;"|
| '''PC12'''
| '''76'''
|-
| '''272'''
| style="text-align: left;"|
| '''37'''
|
| '''38'''
| style="text-align: left;"|
| '''PI4'''
| '''260'''
|-
| style="text-align: left;"|
| '''GND'''
| '''39'''
|}{| class="wikitable" style="width:390px;margin-right: 20px;text-align: center;"|-| '''Pin'40''| '''Function'''| '''GPIO'''| '''GPIO NO.'''|-| '''2'''| '''5V'''| style="text-align: left;"|| style="text-align: left;"||-| '''4'''| '''5V'''| 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="listtext-style-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'''| '''GND'''<span id| 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="listtext-style-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="list-styletext-typealign: lower-alphaleft;">|| '''PI3'''| '''259'''<li>Google Cloud Drive</li></ol>|}</lidiv></ol> [[File:zero2w-img387.png]]
<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 The device node corresponding to i2c1 is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:<''/li><dev/ol> test@test:~$ i2c-1'''md5sum -c H618-Android12-Src.tar.gz.md5sum, and the device node corresponding to i2c2 is ''' H618/dev/i2c-Android12-Src.tar.gzaa: '''OK2'''</li>{| class="wikitable" style="width:800px;" H618|-Android12| apollo-Src.tar.gzabp2: / # '''OKls /dev/i2c-*''' ......
'''<span style="color:#FF0000">/dev/i2c-1 &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-2</span>''' &nbsp;&nbsp;&nbsp;&nbsp; /dev/i2c-5
|}
</ol>
<ol start="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> test@test:~$ '''cat H618-Android12-Src.tar.gza* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''
[[File:zero2w-img351.png]]
</ol>
<ol start="4" style="list-style-type: decimal;">
<li>Then unzip click the compressed package of the files modified by Orange Pi Zero2w</li></ol> test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gzI2C_TEST''' button to open the i2c test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gzinterface</li>
[[File:zero2w-img370.png]]
</ol>
<ol start="5" style="list-style-type: decimal;">
<li>Then copy The i2c test interface of wiringOP is shown in the files modified by Orange Pi Zero2w to the Android source codefigure below</li></ol>
test@test[[File:~$ '''cp zero2w-rf opizero2w_android12_patchesimg371.png]]</* H618ol><ol start="6" style="list-Android12style-Srctype: decimal;"><li>Then click the device node selection box in the upper left corner to select the i2c you want to test</'''li>
[[File:zero2w-img372.png]]<span id/ol><ol start="compile-the7" style="list-sourcestyle-code-of-android-12type: decimal;"><li>Then connect an i2c device to the 40pin i2c pin. Here we take the ds1307 rtc module as an example.</spanli>== Compile the source code of Android 12 ==
[[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 '''Android12 is compiled i2cdetect -y 2''' command on an x86_64 computer with Ubuntu 22the serial port command line to check whether the i2c address of the ds1307 rtc module can be scanned.04 installedIf you can see the address 0x68, it means that the ds1307 rtc module is wired correctly. Other versions of Ubuntu system package dependencies may have some differences</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. The image download png]]</p></li><li><p>Then set the i2c address of to 0x68 in wiringOP, and then click the Ubuntu 22'''OPEN''' button to open i2c</p><p>[[File:zero2w-img374.04 amd64 version 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>
[https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2<span id="pin-desktoppwm-amd64.iso '''https:test"><//repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso''']span>
'''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.'''=== 40pin PWM test ===
# First install As can be seen from the software packages needed to compile Android12 source codetable below, the available pwm are pwm1, pwm2, pwm3 and pwm4.
test@test<div style="display: flex;">::{| class="wikitable" style="width:390px;margin-right: 20px;text-align:~$ center;"|-| '''GPIO NO.'''| '''GPIO'''| 'sudo apt-get update''Function'''| '''Pin'''|-test@test| style="text-align: left;"|| style="text-align:~$ left;"|| '''3.3V'''| '''1'sudo apt''|-get install | '''264'''| '''PI8'''| '''TWI1-y git gnupg flex bison gperf buildSDA'''| '''3'''|-essential \| '''263'''| '''PI7'''| '''zip curl zlib1gTWI1-dev gccSCL'''| '''5'''|-multilib g++| '''<span style="color:#FF0000">269</span>'''| '''<span style="color:#FF0000">PI13</span>'''| '''<span style="color:#FF0000">PWM3</span>'''| '''<span style="color:#FF0000">7</span>'''|-multilib libc6| style="text-devalign: left;"|| style="text-i386 \align: left;"|| '''GND'''| '''9'''|-| '''226'''| '''PH2'''| '''lib32ncurses5UART5_TX'''| '''11'''|-dev x11proto| '''227'''| '''PH3'''| '''UART5_RX'''| '''13'''|-core| '''261'''| '''PI5'''| '''UART2_TX'''| '''15'''|-dev libx11| style="text-align: left;"|| style="text-dev lib32z1align: left;"|| '''3.3V'''| '''17'''|-dev ccache \| '''231'''| '''PH7'''| '''SPI1_MOSI'''| '''libgl119'''|-mesa| '''232'''| '''PH8'''| '''SPI1_MISO'''| '''21'''|-dev libxml2| '''230'''| '''PH6'''| '''SPI1_CLK'''| '''23'''|-utils xsltproc unzip u| style="text-bootalign: left;"|| style="text-tools pythonalign: left;"|| '''GND'''| '''25'''|-is| '''266'''| '''PI10'''| '''TWI2-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;"|| '''cd H61835'''|-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;"|-All available platform:| '''Pin'''| '''Function'''0| '''GPIO'''| '''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>'''|-0. default| '''18'''| 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'''make| style="text-align: Leaving directory left;"|| style="text-align: 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> [[File:zero2w-img380.png]]</ol><ol start="4" style="list-style-type: decimal;"><li>The PWM test@testinterface is as follows</li> <div class="figure"> [[File:~/H618zero2w-Android12-Srcimg381.png]] </longan$ '''.div></build.sh'''ol><ol start="35" style="list-style-type: lower-alphadecimal;"><li>After compilation Then set which PWM you want to use in the Channel. The default is completedPWM1. If you want to set it to PWM2, you will see just enter 2 in the following outputChannel. PWM3 and PWM4 and so on.</li> [[File:zero2w-img382.png]]</ol><ol start="6" style="list-style-type: decimal;">sun50iw9p1 compile Kernel successful INFO: Prepare toolchain <li>Then you can set the PWM period.The default configuration is '''50000ns'''.. The converted PWM frequency is '''......20KHz'''</li> INFO[[File: build kernel OKzero2w-img383.png]]</ol>INFO<ol start="7" style="list-style-type: build rootfs ...decimal;"><li>Then click the '''EXPORT'''button to export PWM</li>
INFO[[File: skip make rootfs for androidzero2w-img384.png]]</ol><ol start="8" style="list-style-type: decimal;"><li>Then drag the progress bar below to change the PWM duty cycle, and then check '''Enable''' to output the PWM waveform.</li>
[[File:zero2w-img385.png]]</ol><ol start="9" style="list-style-type: decimal;"><li>Then use an oscilloscope to measure the corresponding pins in the 40pin development board and you can see the following waveform.</li> [[File:zero2w-img386.png]]</ol><span id="how-to-compile-android-12-source-code"></span> = '''How to compile Android 12 source code''' = <span id="download-the-source-code-of-android-12"></span>== Download the source code of Android 12 == <ol style="list-style-type: decimal;"><li><p>First download the compressed package of the Android 12 source code and the compressed package of the files modified by Orange Pi Zero2w from Google Cloud Drive</p><ol style="list-style-type: lower-alpha;"><li>Google Cloud Drive</li> [[File:zero2w-img387.png]]</ol></li></ol><ol start="2" style="list-style-type: decimal;"><li>After downloading the compressed package of Android 12 source code, please check whether the MD5 checksum is correct. If it is incorrect, please download the source code again. Here's how to check the MD5 checksum:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''md5sum -c H618-Android12-Src.tar.gz.md5sum''' H618-Android12-Src.tar.gzaa: '''<span style="color:#FF0000">OK</span>''' H618-Android12-Src.tar.gzab: '''<span style="color:#FF0000">OK</span>''' ......|}</ol><ol start="3" style="list-style-type: decimal;"><li>Then you need to merge multiple compressed files into one, and then extract the Android source code. The command looks like this:</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cat H618-Android12-Src.tar.gz<span style="color:#FF0000">a</span>* &gt; H618-Android12-Src.tar.gz''' test@test:~$ '''tar -xvf H618-Android12-Src.tar.gz'''|}</ol><ol start="4" style="list-style-type: decimal;"><li>Then unzip the compressed package of the files modified by Orange Pi Zero2w</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''tar zxf opizero2w_android12_patches.tar.gz''' test@test:~$ '''ls''' '''opizero2w_android12_patches''' opizero2w_android12_patches.tar.gz|}</ol><ol start="5" style="list-style-type: decimal;"><li>Then copy the files modified by Orange Pi Zero2w to the Android source code</li>{| class="wikitable" style="width:800px;" |-| test@test:~$ '''cp -rf opizero2w_android12_patches/* H618-Android12-Src/'''|}</ol><span id="compile-the-source-code-of-android-12"></span> == Compile the source code of Android 12 == {| class="wikitable" style="background-color:#ffffdc;width:800px;" |-| <big>'''Android12 is compiled on an x86_64 computer with <span style="color:#FF0000">Ubuntu 22.04</span> installed. Other versions of Ubuntu system package dependencies may have some differences. The image download address of the Ubuntu 22.04 <span style="color:#FF0000">amd64</span> version is as follows:''' [https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso '''https://repo.huaweicloud.com/ubuntu-releases/22.04/ubuntu-22.04.2-desktop-amd64.iso'''] '''The x86_64 computer hardware configuration for compiling Android12 source code recommends a memory of 16GB or more, and a hard disk space of 200GB or more is recommended. The more CPU cores, the better.'''</big>|} # First install the software packages needed to compile Android12 source code ::{| class="wikitable" style="width:800px;" |-| test@test:~$ '''sudo apt-get update''' test@test:~$ '''sudo apt-get install -y git gnupg flex bison gperf build-essential \''' '''zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \''' '''lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache \''' '''libgl1-mesa-dev libxml2-utils xsltproc unzip u-boot-tools python-is-python3 \''' '''libssl-dev libncurses5 clang gawk'''|} <ol start="2" style="list-style-type: decimal;"><li><p>Then compile the code in the longan folder, which mainly contains u-boot and linux kernel</p><ol style="list-style-type: lower-alpha;"><li>First run '''./build.sh config''' to set compilation options</li>{| class="wikitable" style="width:800px;" |-| <p>test@test:~$ '''cd H618-Android12-Src/longan'''</p><p>test@test:~/H618-Android12-Src/longan$ '''./build.sh config'''</p>  <p>Welcome to mkscript setup progress</p><p>All available platform:</p>:<p>0. android</p>:<p>1. linux</p><p>Choice [android]: '''<span style="color:#FF0000">0</span>'''</p><p>All available ic:</p>:<p>0. h618</p><p>Choice [h618]: '''<span style="color:#FF0000">0</span>'''</p><p>All available board:</p>:<p>0. ft</p>:<p>1. p1</p>:<p>2. p2</p>:<p>3. p7</p>:<p>4. p7l</p>:<p>5. perf1</p>:<p>6. perf2</p>:<p>7. perf3</p>:<p>8. qa</p><p>Choice [p2]: '''<span style="color:#FF0000">2</span>'''</p><p>All available flash:</p>:<p>0. default</p>:<p>1. nor</p><p>Choice [default]: '''<span style="color:#FF0000">0</span>'''</p><p>All available kern_ver:</p>:<p>0. linux-5.4</p><p>Choice [linux-5.4]: '''<span style="color:#FF0000">0</span>'''</p><p>All available arch:</p>:<p>0. arm</p>:<p>1. arm64</p><p>Choice [arm64]: '''<span style="color:#FF0000">1</span>'''</p><p>'''......'''</p><p>*** Default configuration is based on 'sun50iw9p1smp_h618_android_defconfig'</p><p>#</p><p># configuration written to .config</p><p>#</p><p>make[1]: Leaving directory '/home/test/H618-Android12-Src/longan/out/kernel/build'</p><p>make: Leaving directory '/home/test/H618-Android12-Src/longan/kernel/linux-5.4'</p><p>INFO: clean buildserver</p><p>INFO: prepare_buildserver</p>|}</ol><ol start="2" style="list-style-type: lower-alpha;"><li>Then run the '''./build.sh''' script to start compilation.</li>{| class="wikitable" style="width:800px;" |-| test@test:~/H618-Android12-Src/longan$ '''./build.sh'''|}</ol><ol start="3" style="list-style-type: lower-alpha;"><li>After compilation is completed, you will see the following output</li>{| class="wikitable" style="width:800px;" |-| sun50iw9p1 compile Kernel successful INFO: Prepare toolchain ... '''......''' INFO: build kernel OK. INFO: build rootfs ... INFO: skip make rootfs for android INFO: ----------------------------------------
INFO: build lichee OK.
INFO: ----------------------------------------|}</ol></li></ol><ol start="3" style="list-style-type: decimal;"><li>Then use the following command to compile the Android source code and generate the final Android image</li></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