Difference between revisions of "BSP Linux on Orange Pi 4"
| (18 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[[BSP Linux]] used on an [[Orange Pi 4]] | [[BSP Linux]] used on an [[Orange Pi 4]] | ||
| − | {{Warning|[[Xunlong]]'s provided Linux is an | + | {{Warning|[[Xunlong]]'s provided Linux is an older 4.4 series kernel.}} |
== Installing Pre-Built Images == | == Installing Pre-Built Images == | ||
| + | {{Warning|Pre-Built kernel doesn't have support for [[CIFS]] (Samba file sharing)}} | ||
# Download compressed *.img files from the [http://www.orangepi.org/Orange%20Pi%204/ vendor's page] | # Download compressed *.img files from the [http://www.orangepi.org/Orange%20Pi%204/ vendor's page] | ||
# Extract the image files | # Extract the image files | ||
| Line 9: | Line 10: | ||
== Building Custom Images == | == Building Custom Images == | ||
| + | {{Warning|Supplied build scripts use [[Rockchip]]'s closed source binary toolkit ''rkbin/tools''. This makes it unusable for running on the [[Orange Pi 4]] (or any [[ARM devices|ARM device]]). The repository is usable only as a learning material.}} | ||
| + | |||
| + | {{Info|1= | ||
| + | The build tool is designed to be executed on Ubuntu (preferably 18.04 Bionic) on a x86_64 machine. | ||
| + | |||
| + | Best option is to use [[vagrant]] and run the build OS virtually. If you by any chance run Ubuntu, feel free to ignore the vagrant-related instructions and run the other commands directly on your machine. | ||
| + | }} | ||
| + | |||
The build tool is using these repositories: | The build tool is using these repositories: | ||
* [https://github.com/orangepi-xunlong/OrangePiRK3399_kernel OrangePiRK3399_kernel] | * [https://github.com/orangepi-xunlong/OrangePiRK3399_kernel OrangePiRK3399_kernel] | ||
| − | * [https://github.com/orangepi-xunlong/OrangePiRK3399_uboot] | + | * [https://github.com/orangepi-xunlong/OrangePiRK3399_uboot OrangePiRK3399_uboot] |
| − | * [https://github.com/orangepi-xunlong/OrangePiRK3399_scripts] | + | * [https://github.com/orangepi-xunlong/OrangePiRK3399_scripts OrangePiRK3399_scripts] |
| − | * [https://github.com/orangepi-xunlong/OrangePiRK3399_external] | + | * [https://github.com/orangepi-xunlong/OrangePiRK3399_external OrangePiRK3399_external] |
| − | * [https://github.com/orangepi-xunlong/toolchain] | + | * [https://github.com/orangepi-xunlong/toolchain toolchain] |
| + | |||
| + | === Vagrant setup === | ||
| + | <pre> | ||
| + | vagrant init hashicorp/bionic64 | ||
| + | vagrant up | ||
| + | vagrant ssh | ||
| + | # inside vagrant: | ||
| + | sudo apt-get update | ||
| + | # additional packages not installed by the build tool | ||
| + | # ...to build kernel: | ||
| + | sudo apt-get install liblz4-tool | ||
| + | # ...to build rootfs: | ||
| + | sudo apt-get install qemu-user-binfmt | ||
| + | sudo apt-get install qemu-utils qemu-user-static | ||
| + | # ...to flash SD card: | ||
| + | sudo apt-get install gdisk | ||
| + | exit | ||
| + | </pre> | ||
| + | |||
| + | === Build Tools === | ||
| + | <pre> | ||
| + | vagrant ssh | ||
| + | <nowiki>#</nowiki> inside vagrant: | ||
| + | git clone https://github.com/orangepi-xunlong/OrangePi_Build.git | ||
| + | cd OrangePi_Build | ||
| + | ./Build_OrangePi.sh | ||
| + | exit | ||
| + | </pre> | ||
| + | |||
| + | Enter your (sudo) password (empty when running under [[vagrant]]), let it download the repositories (listed above). | ||
| + | |||
| + | === Building === | ||
| + | <pre> | ||
| + | vagrant ssh | ||
| + | # inside vagrant: | ||
| + | cd OrangePiRK3399 | ||
| + | ./build.sh | ||
| + | exit | ||
| + | </pre> | ||
| + | |||
| + | Select '0 Orange Pi 4', '0 Build Release Image' and wait for the image to be built. | ||
| + | |||
| + | {{Todo|{{IconWarn}} The image got built without problems but it didn't actually fully boot. It only started the kernel boot process and then it crashed.}} | ||
| + | |||
| + | === Flashing === | ||
| + | The same process applies as for the Pre-Built Images, see [[Flashing Linux to SD Card]]. | ||
| + | |||
| + | == Troubleshooting == | ||
| + | === chroot Exec format error === | ||
| + | ==== Error ==== | ||
| + | <pre>chroot: failed to run command ‘mount’: Exec format error</pre> | ||
| + | ==== Solution ==== | ||
| + | Install qemu-user-binfmt and then qemu-user-static. This will re-populate [[binfmt]] registrations: | ||
| + | |||
| + | <pre>sudo apt-get install qemu-user-binfmt</pre> | ||
| + | <pre>sudo apt-get install qemu-user-static</pre> | ||
| − | + | To check if the registrations are correct, run this and you should see a lot of qemu-user-static entries: | |
| + | <pre>update-binfmts --display</pre> | ||
== External Links == | == External Links == | ||
| Line 24: | Line 90: | ||
** GIT repository: [https://github.com/orangepi-xunlong?tab=repositories github.com/orangepi-xulong] | ** GIT repository: [https://github.com/orangepi-xunlong?tab=repositories github.com/orangepi-xulong] | ||
*** Build Tools repository: [https://github.com/orangepi-xunlong/OrangePi_Build] | *** Build Tools repository: [https://github.com/orangepi-xunlong/OrangePi_Build] | ||
| + | *** Kernel compilation scripts: [https://github.com/orangepi-xunlong/OrangePiRK3399_scripts/blob/master/kernel_compile.sh] | ||
| + | *** Build image script: [https://github.com/orangepi-xunlong/OrangePiRK3399_scripts/blob/orangepi_4/lib/build_image.sh] | ||
Latest revision as of 08:28, 11 April 2020
BSP Linux used on an Orange Pi 4
(!) Xunlong's provided Linux is an older 4.4 series kernel.
Contents
Installing Pre-Built Images
(!) Pre-Built kernel doesn't have support for CIFS (Samba file sharing)
- Download compressed *.img files from the vendor's page
- Extract the image files
- Flash the image to an SD Card
Building Custom Images
(!) Supplied build scripts use Rockchip's closed source binary toolkit rkbin/tools. This makes it unusable for running on the Orange Pi 4 (or any ARM device). The repository is usable only as a learning material.
The build tool is using these repositories:
Vagrant setup
vagrant init hashicorp/bionic64 vagrant up vagrant ssh # inside vagrant: sudo apt-get update # additional packages not installed by the build tool # ...to build kernel: sudo apt-get install liblz4-tool # ...to build rootfs: sudo apt-get install qemu-user-binfmt sudo apt-get install qemu-utils qemu-user-static # ...to flash SD card: sudo apt-get install gdisk exit
Build Tools
vagrant ssh # inside vagrant: git clone https://github.com/orangepi-xunlong/OrangePi_Build.git cd OrangePi_Build ./Build_OrangePi.sh exit
Enter your (sudo) password (empty when running under vagrant), let it download the repositories (listed above).
Building
vagrant ssh # inside vagrant: cd OrangePiRK3399 ./build.sh exit
Select '0 Orange Pi 4', '0 Build Release Image' and wait for the image to be built.
TODO: ⚠ The image got built without problems but it didn't actually fully boot. It only started the kernel boot process and then it crashed.
Flashing
The same process applies as for the Pre-Built Images, see Flashing Linux to SD Card.
Troubleshooting
chroot Exec format error
Error
chroot: failed to run command ‘mount’: Exec format error
Solution
Install qemu-user-binfmt and then qemu-user-static. This will re-populate binfmt registrations:
sudo apt-get install qemu-user-binfmt
sudo apt-get install qemu-user-static
To check if the registrations are correct, run this and you should see a lot of qemu-user-static entries:
update-binfmts --display