Difference between revisions of "Orange Pi 3"

From Wiki-Orange Pi
Jump to: navigation, search
Line 283: Line 283:
 
<br>
 
<br>
 
According to the prompt, you can see the generated Android firmware sun50iw6p1_android_petrel-p1_uart0.img in the OrangePi_3 / lichee / tools / pack / directory. Below, please refer to the "Android Firmware Burning" section to complete the Android firmware burning.
 
According to the prompt, you can see the generated Android firmware sun50iw6p1_android_petrel-p1_uart0.img in the OrangePi_3 / lichee / tools / pack / directory. Below, please refer to the "Android Firmware Burning" section to complete the Android firmware burning.
 +
<br>
 +
<br>
 +
== '''Setting up a Linux compilation environment''' ==
 +
<br>
 +
=== '''Get the Linux SDK source code from Github''' ===
 +
<br>
 +
# '''Orange Pi Linux source downloader'''
 +
 Orange Pi 3's Linux source code has been uploaded to GitHub. The currently supported kernel version is '''Linux 4.9 and the mainline kernel''' (some drivers are still under development). We can use the Orange Pi Linux source-specific downloader to download and obtain the downloader source code. Here's the way:
 +
<div style="border:1px solid #dddddd;background:#f1f1f1;padding:5px;">
 +
$ sudo apt-get install git<br>
 +
$ git clone '''https://github.com/orangepi-xunlong/OrangePi_Build.git'''<br>
 +
$ cd OrangePi_Build<br>
 +
$ ls<br>
 +
Build_OrangePi.sh lib README.md
 +
</div>
 +
<br>
 +
# '''Run the downloader'''
 +
<br>
 +
<div style="border:1px solid #dddddd;background:#f1f1f1;padding:5px;">
 +
$ ./Build_OrangePi.sh
 +
</div>
 +
<br>
 +
Enter the root password and press enter
 +
<div style="padding-left:200px;">[[文件:Orange-pi-3-img5.png|600px]]</div>
 +
<br>
 +
Select 0 Build system with uboot / kernel / rootfs / image to enter the interface of development board model selection.
 +
<br>
 +
<br>
 +
<div style="padding-left:200px;">[[文件:Orange-pi-3-img6.png|600px]]</div>
 +
<br>
 +
Select orange pi 3, enter the kernel version selection interface after entering<br>
 +
<br>
 +
<div style="padding-left:200px;">[[文件:Orange-pi-3-img7.png|600px]]</div>
 +
<br>
 +
At present, the orangepi 3 development board supports the kernel code of '''Linux 4.9 and mainline.''' Select one of them and press Enter to start downloading the corresponding SDK source code.<br>
 +
<div style="padding-left:200px;">[[文件:Orange-pi-3-img8.png|600px]]</div>
 +
The downloaded source code will be stored in the same directory of OrangePi_Build<br>
 +
<br>
 +
<div style="border:1px solid #dddddd;background:#f1f1f1;padding:5px;">
 +
$ ls ../OrangePi_Build -l OrangePi_Build<br>
 +
<p style="padding-left:20px;">'''OrangePiH6_Linux4.9''' (Where the kernel version is Linux4.9)<br>
 +
'''OrangePiH6_mainline''' (The current kernel version is Linux5.3.5)</p>
 +
</div>
 +
<br>
 +
=== '''Get the source code of Linux SDK from Baidu Cloud Disk''' ===
 +
<br>
 +
If GitHub fails to download the code, you can download the source code compression package of Linux SDK directly from Baidu Cloud Disk.<br>
 +
Download link is:
 +
=== '''Set up a compilation environment''' ===
 +
<br>
 +
 Orange Pi H6 Linux SDK has only been tested on PCs with Ubuntu 18.04. Please prepare the host environment of ubuntu 18.04 before use.<br>
 +
The Linux source directory structure for Orange Pi H6 is shown below:
 +
<div style="border:1px solid #dddddd;background:#f1f1f1;padding:5px;">
 +
$ cd OrangePiH6_Linux4.9<br>
 +
$ tree -L 1<br>
 +
.<br>
 +
├── build.sh -> scripts/build.s&nbsp;&nbsp;&nbsp;&nbsp;Compile startup script<br>
 +
├── external&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Store additional configuration files<br>
 +
├── kernel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Linux kernel source<br>
 +
├── output&nbsp;&nbsp;&nbsp;&nbsp;Store output files, only generated after compiling source code<br>
 +
├── scripts&nbsp;&nbsp;&nbsp;&nbsp;Script files used during compilation<br>
 +
├── toolchain&nbsp;&nbsp;&nbsp;&nbsp;Cross-compilation toolchain used by the kernel and u-boot<br>
 +
└── uboot&nbsp;&nbsp;&nbsp;&nbsp;Store boot0 and u-boot source code6 directories, 1 file<br>
 +
</div>
 +
<br>
 +
=== '''Compile Linux and U-boot source code''' ===
 +
<br>
 +
* execute the compilation start up script
 +
<br>
 +
<div style="border:1px solid #dddddd;background:#f1f1f1;padding:5px;">
 +
$ cd OrangePiH6_Linux4.9<br>
 +
$ sudo ./build.sh
 +
</div>
 +
<br>
 +
Select OrangePi 3 and press Enter
 +
<div>[[文件:Orange-pi-3-img9.png|600px]]</div>
 +
The functions of each option are as follows:<br>
 +
<div style="font-weight:700">
 +
* 0 Build Release Image —— Compile ubuntu or debian distribution images
 +
* 1 Build Rootfs —— Compile rootfs for ubuntu or debian
 +
* 2 Build Uboot —— Compile boot0 and u-boot source code
 +
* 3 Build Linux —— Compile Linux kernel source code
 +
* 4 Build Module only —— Compile Linux kernel modules
 +
* 5 Update kernel Image —— Update kernel in SD card Linux system
 +
* 6 Update Module —— Update the kernel module in SD card Linux system
 +
* 7 Update Uboot —— Update boot0 and u-boot and dtb configuration of SD card Linux system
 +
</div>
 +
<div>[[文件:Orange-pi-3-img10.png|600px]]</div>
 +
The final file generated by the compilation will be saved in the output directory<br>

Revision as of 16:23, 17 June 2022

Basic Features of Orange Pi 3

What is Orange Pi 3

 Orange Pi is an open source single board card computer, a new generation of arm64 development board, which can run Android 7.0, Ubuntu and Debian operating systems. The Orange Pi single board computer uses Allwinner H6 system-on-chip and has 1GB or 2GB LPDDR3 memory.

Use of Orange Pi 3

We can use it to build:

  • A computer
  • A web server
  • Game console
  • HD video player
  • Speaker
  • Android
  • ......

Who is the Orange Pi 3 designed for?

Orange Pi 3 is not just a consumer product, it is also designed for anyone who wants to use technology for creative creation. It is a very simple, fun and practical tool that you can use to build the world around you.

Orange Pi 3 hardware parameters

800px
800px
800px

GPIO specifications


The following figure is the GPIO pin function diagram of Orange Pi 3:

800px
Orange Pi 3 pin correspondence table
CON12-P01 VCC-3.3V VCC-IO
CON12-P02 VCC-5V DCIN
CON12-P03 TWI0-SDA PD26
CON12-P04 VCC-5V DCIN
CON12-P05 TWI0-SCK PD25
CON12-P06 GND GND
CON12-P07 PWM0 PD22
CON12-P08 S-UART-TX PL02
CON12-P09 GND GND
CON12-P10 S-UART-RX PL03
CON12-P11 UART3-RX PD24
CON12-P12 PD18 PD18
CON12-P13 UART3-TX PD23
CON12-P14 GND GND
CON12-P15 PL10 PL10
CON12-P16 PD15 PD15
CON12-P17 VCC-3.3V VCC-IO
CON12-P18 PD16 PD16
CON12-P19 SPI1_MOSI PH05
CON12-P20 GND GND
CON12-P21 SPI1_MISO PH06
CON12-P22 PD21 PD21
CON12-P23 SPI1_CLK PH04
CON12-P24 SPI1_CS PH03
CON12-P25 GND GND
CON12-P26 PL08 PL08


Development board instructions

Prepare hardware and software tools

Hardware requirements:

  • Orange Pi 3 development board
  • TF card, minimum 8GB capacity, class 10, it is recommended to use brand TF card, such as SanDisk 16G TF card
  • For a compiling host, the configuration should preferably meet the following conditions:

64bit CPU;
8 GB and above;
100GB of free disk space;

The operating system is preferably

Ubuntu14.04 (for compiling Android source code)
Ubuntu18.04 (for compiling Linux source code)

Software Requirements:


  • Orange Pi 3 SDK
  • Orange Pi 3 firmware
  • Android and Linux programming tools

The above software can be obtained through Github, Google Web Disk and Baidu Cloud Disk.

http://www.orangepi.org/downloadresources/
http://www.orangepi.cn/downloadresourcescn/

Power supply mode of development board

There are two ways to power the development board:

  • DC (5V 2A) power supply: Power on after inserting the DC adapter
  • Micro USB (5V 2A) OTG power supply:Plug in the Micro USB adapter to power on.

Android compilation environment

The following operations are performed on a PC with Ubuntu 14.04 installed. Other versions of Ubuntu systems or Linux distributions may have some differences.

Get SDK source code zip

After downloading the Android source package, first you need to combine multiple compressed files into one and then decompress them.

$ mkdir OrangePi_3
$ cat H6-2018-1-2.tar.gza* > OrangePi_3.tar
$ tar xf OrangePi_3.tar -C OrangePi_3

Build a compilation environment

  • Install JDK

Android 7.0 development can only use the version of openjdk8, higher or lower than this version and Oracle's JDK will cause the compilation to fail. Openjdk-8 installation command is as follows:

$ sudo add-apt-repository ppa:openjdk-r/ppa
$ sudo apt-get update
$ sudo apt-get install openjdk-8-jdk

  • Configure JAVA environment variables

 For example, the installation path is / usr / lib / jvm / java-8-openjdk-amd64. You can run the following command in the terminal to configure the environment variables:

$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ export PATH=$JAVA_HOME/bin:$PATH
$ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

  • Install platform support software

For Ubuntu 14.04:

$ sudo apt-get update
$ sudo apt-get install 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

$ sudo apt-get install u-boot-tools

Compile SDK source code

After the SDK is decompressed, there will be two subdirectories andorid and lichee under the decompressed directory. The main contents of the lichee directory are as follows:

lichee/brandy/u-boot-2014.07     #uboot Code directory
lichee/bootloader/uboot_2014_sunxi_spl   #boot0 Code directory
lichee/linux-3.10      #Kernel code
lichee/tools       #Solution hardware configuration, packaging tools, etc.


  • Kernel compilation process


Enter the following command in the lichee directory:

$ cd OrangePi_3/lichee
$ ./build.sh config

Welcome to mkscript setup progress
All available chips:

  1. sun50iw1p1
  2. sun50iw2p1
  3. sun50iw6p1
  4. sun8iw11p1
  5. sun8iw12p1
  6. sun8iw6p1
  7. sun8iw7p1
  8. sun8iw8p1
  9. sun9iw1p1

Choice: 2
All available platforms:

  1. android
  2. dragonboard
  3. linux
  4. eyeseelinux

Choice: 0
All available business:

  1. 5.1
  2. 4.4
  3. 7.x

Choice: 2


The output after compilation is as follows:

regenerate rootfs cpio
15757 blocks
17099 blocks
build_ramfs
Copy boot.img to output directory ...
Copy modules to target ...

sun50iw6p1 compile Kernel successful
INFO: build kernel OK.

INFO: build rootfs ...
INFO: skip make rootfs for android
INFO: build rootfs OK.
build sun50iw6p1 android 7.x lichee OK


The kernel code is in the lichee / linux-3.10 directory. Executing the above commands will automatically copy the configuration file from lichee / linux-3.10 / arch / arm64 / configs / sun50iw6p1smp_android_7.x_defconfig to lichee / linux-3.10 / .config as the default configuration before compiling , You can run ./build.sh directly in the lichee directory for the next compilation, and will continue to use the previous .config configuration.

  • uboot / boot0 compilation process (optional)


Normally, you do not need to recompile uboot, but if you have custom modifications to uboot, you can compile. The compilation method is as follows:

cd lichee/brandy/u-boot-2014.07
make distclean && make sun50iw6p1_config && make -j5 # compile uboot

cd lichee/brandy/u-boot-2014.07
make distclean && make sun50iw6p1_config && make spl # compile boot0

If uboot / boot0 is not compiled, the default is to use the pre-compiled results of lichee / tools / pack / chips / sun50iw6p1 / bin. After recompiling with the above command, the above files will be replaced automatically.

  • Android code compilation process


$ cd android
$ source ./build/envsetup.sh
$ lunch petrel_fvd_p1-eng
$ extract-bsp
$ make -j8 && pack


The pack command is used to generate the firmware. If the compilation and packaging process passes successfully, the following message will be prompted:

Dragon execute image.cfg SUCCESS !


image is at----------

OrangePi_3/lichee/tools/pack/sun50iw6p1_android_petrel-p1_uart0.img

pack finish


According to the prompt, you can see the generated Android firmware sun50iw6p1_android_petrel-p1_uart0.img in the OrangePi_3 / lichee / tools / pack / directory. Below, please refer to the "Android Firmware Burning" section to complete the Android firmware burning.

Setting up a Linux compilation environment


Get the Linux SDK source code from Github


  1. Orange Pi Linux source downloader

 Orange Pi 3's Linux source code has been uploaded to GitHub. The currently supported kernel version is Linux 4.9 and the mainline kernel (some drivers are still under development). We can use the Orange Pi Linux source-specific downloader to download and obtain the downloader source code. Here's the way:

$ sudo apt-get install git
$ git clone https://github.com/orangepi-xunlong/OrangePi_Build.git
$ cd OrangePi_Build
$ ls
Build_OrangePi.sh lib README.md


  1. Run the downloader


$ ./Build_OrangePi.sh


Enter the root password and press enter

600px


Select 0 Build system with uboot / kernel / rootfs / image to enter the interface of development board model selection.

600px


Select orange pi 3, enter the kernel version selection interface after entering

600px


At present, the orangepi 3 development board supports the kernel code of Linux 4.9 and mainline. Select one of them and press Enter to start downloading the corresponding SDK source code.

600px

The downloaded source code will be stored in the same directory of OrangePi_Build

$ ls ../OrangePi_Build -l OrangePi_Build

OrangePiH6_Linux4.9 (Where the kernel version is Linux4.9)
OrangePiH6_mainline (The current kernel version is Linux5.3.5)


Get the source code of Linux SDK from Baidu Cloud Disk


If GitHub fails to download the code, you can download the source code compression package of Linux SDK directly from Baidu Cloud Disk.
Download link is:

Set up a compilation environment


 Orange Pi H6 Linux SDK has only been tested on PCs with Ubuntu 18.04. Please prepare the host environment of ubuntu 18.04 before use.
The Linux source directory structure for Orange Pi H6 is shown below:

$ cd OrangePiH6_Linux4.9
$ tree -L 1
.
├── build.sh -> scripts/build.s    Compile startup script
├── external       Store additional configuration files
├── kernel       Linux kernel source
├── output    Store output files, only generated after compiling source code
├── scripts    Script files used during compilation
├── toolchain    Cross-compilation toolchain used by the kernel and u-boot
└── uboot    Store boot0 and u-boot source code6 directories, 1 file


Compile Linux and U-boot source code


  • execute the compilation start up script


$ cd OrangePiH6_Linux4.9
$ sudo ./build.sh


Select OrangePi 3 and press Enter

600px

The functions of each option are as follows:

  • 0 Build Release Image —— Compile ubuntu or debian distribution images
  • 1 Build Rootfs —— Compile rootfs for ubuntu or debian
  • 2 Build Uboot —— Compile boot0 and u-boot source code
  • 3 Build Linux —— Compile Linux kernel source code
  • 4 Build Module only —— Compile Linux kernel modules
  • 5 Update kernel Image —— Update kernel in SD card Linux system
  • 6 Update Module —— Update the kernel module in SD card Linux system
  • 7 Update Uboot —— Update boot0 and u-boot and dtb configuration of SD card Linux system
600px

The final file generated by the compilation will be saved in the output directory