Dev/OPi/OPiZero: Difference between revisions
No edit summary |
|||
Line 8: | Line 8: | ||
== Base system == | == Base system == | ||
You can get the detailed information on the [[/Dev/Embedded/FromScratch|Create initial system from scratch (sources)]] page. | |||
* [[Dev/ | Here are only the specific parts or options. | ||
* | |||
=== Specific options === | |||
* '''Compiler :''' | |||
Compile using "arm-linux-gnueabihf-" toolchain prefix | |||
* '''Devuan architecture :''' | |||
Devuan architecture is "armhf" | |||
=== Sources and versions === | |||
==== U-Boot ==== | |||
* '''u-boot sources :''' | |||
Use official git "git://git.denx.de/u-boot.git" - checkout tag "v2019.07". | |||
* '''u-boot config :''' | |||
Use "orangepi_zero_defconfig" | |||
* '''u-boot environment :''' | |||
You can get my example [http://data.nathael.net/Dev/OPi/OPiZero/boot.cmd boot.cmd file] | |||
==== Linux Kernel ==== | |||
* '''Linux kernel sources :''' | |||
Use Kernel 5.3 from kernel.org | |||
* '''Linux kernel configuration :''' | |||
Use "sunxi_defconfig" or my own [http://data.nathael.net/Dev/OPi/OPiZero/config_opizero Linux kernel configuration]. | |||
* '''Linux kernel device tree :''' | |||
Use the "sun8i-h2-plus-orangepi-zero" device-tree or my own [http://data.nathael.net/Dev/OPi/OPiZero/sun8i-h2-plus-orangepi-zero-ed3l.dts orangepi-zero device tree]. | |||
=== Results === | |||
* '''u-boot result image :''' | |||
Compilation should produce the file "u-boot-sunxi-with-spl.bin" which seems to be an aggregate of spl/u-boot-spl.bin and u-boot.bin with the proper offset for u-boot image. | |||
* '''Linux kernel image :''' | |||
Compilation results are arch/arm/boot/zImage and arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero-ed3l.dtb plus the associated modules. | |||
* '''Download :''' | |||
You can get my own images from my server : [http://data.nathael.net/Dev/OPi/OPiZero/results_opizero_ed3l_2021-09-11.tar.bz2 results_opizero_ed3l_2021-09-11.tar.bz2] | |||
== Use == | |||
As for most of my systems I'm using a µSD card to store the images and rootfs. | |||
=== SD Card creation === | |||
Original information from [http://linux-sunxi.org/Bootable_SD_card linux-sunxi wiki] | |||
You will need a DOS partition table as GUID partition tables (GPT) will go further than 8k and erase the initial SPL loader. | |||
* '''SD card architecture :''' | |||
{| class="wikitable" | |||
! start | |||
! sector | |||
! size | |||
! usage | |||
|- | |||
| 0KB || 0 || 8KB || Unused, available for a DOS MBR or (limited) GPT partition table | |||
|- | |||
| 8KB || 16 || 32KB || Initial SPL loader | |||
|- | |||
| 40KB || 80 || - || U-Boot proper | |||
|} | |||
Typically partitions start at 1MB (which is the default setting of most partitioning tools), but there is no hard requirement for this, so U-Boot can grow bigger than 984KB, if needed. | |||
The 8KB offset is dictated by the Boot ROM which will check for a valid eGON/TOC0 header at this location. The 40KB offset for U-Boot proper is the default U-Boot setting and can be changed at build time using the <code>CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR</code> configuration variable. | |||
* '''Cleaning :''' | |||
Erase the first Mo of the SD card while keeping the partition table: | |||
dd if=/dev/zero of=${card} bs=1k count=1016 seek=8 | |||
(Use count=1024 and remove "seek" option to also erase the partition table) | |||
* '''Write Bootloader :''' | |||
Copy uboot images (u-boot-sunxi-with-spl.bin, found in u-boot main directory after compilation) to the SD card: | |||
dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8 | |||
=== First partition === | |||
The first partition must start at +1Mo, and be a few Mo (50 Mo should be OK) and be formated using ext2/3/4<br /> | |||
Place the Linux kernel image (zImage), the device tree (sun8i-h2-plus-orangepi-zero-ed3l.dtb) and the boot script (boot.scr) on this first partition. | |||
Create file "boot.scr" from "boot.cmd" file (you can use my example [http://data.nathael.net/Dev/OPi/OPiZero/boot.cmd boot.cmd file]) using mkimage after updating file names to your needs : | |||
mkimage -C none -A arm -T script -d boot.cmd boot.scr | |||
If you want to use an initramfs or an initrd, it will also go on this partition. | |||
=== Second partition === | |||
The second partition must be formated using ext4 and starts right after the first one. It can take all the remaining size unless you have other specific needs. | |||
This partition holds the root filesystem (rootfs). | |||
== Rootfs == | |||
This board uses an ARM processor with hardfloat support, thus the root filesystem should be built using "arm-linux-gnueabihf-" cross-toolchain or use the armhf architecture for Devuan or other Debian based distribution. | |||
Refer to [[Dev/Embedded/Rootfs|the rootfs creation page]] for more information. | |||
== Connection and startup == | == Connection and startup == |
Revision as of 14:33, 9 December 2024
Description
Official website : http://www.orangepi.org/orangepizero/ (Backup)
New one : https://orangepi.com/index.php?route=product/product&product_id=844
The OrangePi Zero board is an Open-source Single Board Computer (SBC) of 48x46mm created and sold by Xunlong.
Base system
You can get the detailed information on the Create initial system from scratch (sources) page. Here are only the specific parts or options.
Specific options
- Compiler :
Compile using "arm-linux-gnueabihf-" toolchain prefix
- Devuan architecture :
Devuan architecture is "armhf"
Sources and versions
U-Boot
- u-boot sources :
Use official git "git://git.denx.de/u-boot.git" - checkout tag "v2019.07".
- u-boot config :
Use "orangepi_zero_defconfig"
- u-boot environment :
You can get my example boot.cmd file
Linux Kernel
- Linux kernel sources :
Use Kernel 5.3 from kernel.org
- Linux kernel configuration :
Use "sunxi_defconfig" or my own Linux kernel configuration.
- Linux kernel device tree :
Use the "sun8i-h2-plus-orangepi-zero" device-tree or my own orangepi-zero device tree.
Results
- u-boot result image :
Compilation should produce the file "u-boot-sunxi-with-spl.bin" which seems to be an aggregate of spl/u-boot-spl.bin and u-boot.bin with the proper offset for u-boot image.
- Linux kernel image :
Compilation results are arch/arm/boot/zImage and arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero-ed3l.dtb plus the associated modules.
- Download :
You can get my own images from my server : results_opizero_ed3l_2021-09-11.tar.bz2
Use
As for most of my systems I'm using a µSD card to store the images and rootfs.
SD Card creation
Original information from linux-sunxi wiki
You will need a DOS partition table as GUID partition tables (GPT) will go further than 8k and erase the initial SPL loader.
- SD card architecture :
start | sector | size | usage |
---|---|---|---|
0KB | 0 | 8KB | Unused, available for a DOS MBR or (limited) GPT partition table |
8KB | 16 | 32KB | Initial SPL loader |
40KB | 80 | - | U-Boot proper |
Typically partitions start at 1MB (which is the default setting of most partitioning tools), but there is no hard requirement for this, so U-Boot can grow bigger than 984KB, if needed.
The 8KB offset is dictated by the Boot ROM which will check for a valid eGON/TOC0 header at this location. The 40KB offset for U-Boot proper is the default U-Boot setting and can be changed at build time using the CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
configuration variable.
- Cleaning :
Erase the first Mo of the SD card while keeping the partition table:
dd if=/dev/zero of=${card} bs=1k count=1016 seek=8
(Use count=1024 and remove "seek" option to also erase the partition table)
- Write Bootloader :
Copy uboot images (u-boot-sunxi-with-spl.bin, found in u-boot main directory after compilation) to the SD card:
dd if=u-boot-sunxi-with-spl.bin of=${card} bs=1024 seek=8
First partition
The first partition must start at +1Mo, and be a few Mo (50 Mo should be OK) and be formated using ext2/3/4
Place the Linux kernel image (zImage), the device tree (sun8i-h2-plus-orangepi-zero-ed3l.dtb) and the boot script (boot.scr) on this first partition.
Create file "boot.scr" from "boot.cmd" file (you can use my example boot.cmd file) using mkimage after updating file names to your needs :
mkimage -C none -A arm -T script -d boot.cmd boot.scr
If you want to use an initramfs or an initrd, it will also go on this partition.
Second partition
The second partition must be formated using ext4 and starts right after the first one. It can take all the remaining size unless you have other specific needs.
This partition holds the root filesystem (rootfs).
Rootfs
This board uses an ARM processor with hardfloat support, thus the root filesystem should be built using "arm-linux-gnueabihf-" cross-toolchain or use the armhf architecture for Devuan or other Debian based distribution.
Refer to the rootfs creation page for more information.
Connection and startup
USB-UART serial console connection
On the J3 connector (3 pins male 2.54mm, next to the Ethernet connector, pin 1 on the board edge) :
- pin 1 - GND : Black
- pin 2 - UART RX : Orange
- pin 3 : UART TX : Yellow
SD card boot
The OrangePi Zero board boots from the SD card which has to be prepared following specific steps. Follow the "SD card creation" section from the "from scratch" page
Extension ports
The OrangePi Zero board has two extension ports using common 2.54mm (0.1inch) pitch:
- con4 : 2x13
- con5 : 1x13
con4 : 2x13 Header | |||
---|---|---|---|
1 | 3.3V | 2 | 5V |
3 | TWI0_SDA / PA12 / GPIO12 | 4 | 5V |
5 | TWI0_SCK / PA11 / GPIO11 | 6 | GND |
7 | PWM1 / PA06 / GPIO6 | 8 | UART1_TX / PG06 / GPIO198 |
9 | GND | 10 | UART1_RX / PG07 / GPIO199 |
11 | UART2_RX / PA01 / GPIO1 | 12 | SIM_CLK/PA_EINT7 / PA07 / GPIO7 |
13 | UART2_TX / PA00 / GPIO0 | 14 | GND |
15 | UART2_CTS / PA03 / GPIO3 | 16 | TWI1-SDA / PA19 / GPIO19 |
17 | 3.3V | 18 | TWI1-SCK / PA18 / GPIO18 |
19 | SPI1_MOSI / PA15 / GPIO15 | 20 | GND |
21 | SPI1_MISO / PA16 / GPIO16 | 22 | UART2_RTS / PA02 / GPIO2 |
23 | SPI1_CLK / PA14 / GPIO14 | 24 | SPI1_CS / PA13 / GPIO13 |
25 | GND | 26 | SIM_DET/PA_EINT10 / PA10 / GPIO10 |
con5 1x13 Header | |
---|---|
1 | 5V |
2 | GND |
3 | USB-DM2 |
4 | USB-DP2 |
5 | USB-DM3 |
6 | USB-DP3 |
7 | LINEOUTR |
8 | LINEOUTL |
9 | TV-OUT |
10 | MIC-BIAS |
11 | MIC1P |
12 | MIC1N |
13 | CIR-RX |
External links
(Pseudo)random list of links to pages with information to compile u-boot, the Linux kernel, and create a root filesystem.
- Xunlong Orange Pi Wiki : http://www.orangepi.org/Docs/mainpage.html
- Xunlong Orange Pi Github : https://github.com/orangepi-xunlong/OrangePi_Build
- Linux Sunxi Wiki : Orange Pi Zero(open source software community dedicated to providing open source operating system support for Allwinner SoC based devices).
- FreeBSD : https://wiki.freebsd.org/FreeBSD/arm/Allwinner
- Armbian : https://www.armbian.com/orange-pi-zero/