Orange Pi flasher
- Orange Pi flasher
Installing armbian on Orange Pi
Prepare a SD card with armbian image on it first. Download the image from here and extract it to your SD card.
Installing flashrom on Orange Pi
Put the SD card into Orange Pi and boot it. Then install flashrom using the following commands:
git clone https://github.com/flashrom/flashrom.git cd flashrom make CONFIG_ENABLE_LIBPCI_PROGRAMMERS=no install
Enable SPI on Orange Pi:
echo "overlays=spi-spidev" >> /boot/armbianEnv.txt echo "param_spidev_spi_bus=1" >> /boot/armbianEnv.txt reboot
Important! Put these lines in armbianEnv.txt file only once. This file contains overall system configuration and should not contain duplicates.
Orange Pi pinout:
|Orange Pi pins||APU2 pin J6|
Also shorten 2-3 pins on APU2 J2 to enable S5 state.
Make sure that APU2 was powered up with shortened 2-3 pins on J2. After Orange Pi reboot type following command:
flashrom -p linux_spi:dev=/dev/spidev1.0 -w coreboot.rom
Note that coreboot.rom should be the rom file You are trying to write.
Correct output should look like this:
root@orangepizero:~# flashrom -w ./apu2_v4.6.0.rom -p linux_spi:dev=/dev/spidev1.0 flashrom 0.9.9-45-g4d440a7 on Linux 4.11.3-sun8i (armv7l) flashrom is free software, get the source code at https://flashrom.org Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns). Found Winbond flash chip "W25Q64.V" (8192 kB, SPI) on linux_spi. Reading old flash chip contents... done. Erasing and writing flash chip... Warning: Chip content is identical to the requested image. Erase/write done.
Be sure to use stable power supply. Do no supply OrangePi from PC USB. Its efficiency is not enough for proper operating of Orange Pi. It is strongly recommended to use 5V power supply connected to microUSB socket (a trusted USB charger will make it too). Using uncertain power supply leads to flash writing errors, which may brick your target device.
Customizing kernel for armbian
Clone the repository first and then run script
compile.sh (must run as root):
git clone --depth 1 https://github.com/armbian/build cd build sudo ./compile.sh
compile.sh takes care of everything. Downloads cross compilation toolchain and
all necessary tools.
It works only with Ubuntu Xenial (16.04), other distros are supposed to be not supported. Refer to README
This command will pop up a menu. Many options can be chosen there, but the most important options are:
- Select to build only kernel and uboot packages
- Show a kernel configuration menu before compilation
- Choose target board (in this case
- Select the target kernel branch as
devfor newest development version
- Accept to enter export mode
I followed this approach and I strongly recommend to use it this way.
Now the kernel menuconfig should pop up and the customization process begin. Make changes here for Your use case and needs, then save the changes and exit.
If do not want to make changes, just leave
menuconfigby saving the configuration and exiting. Kernel will be built with default configuration.
After saving config and exiting, the kernel compilation will start.
Updating kernel on Orange Pi Zero
Debian packages created after compilation are in
build/output/debs$ ls extra linux-firmware-image-dev-sun8i_5.32_armhf.deb linux-image-dev-sun8i_5.32_armhf.deb linux-u-boot-dev-orangepizero_5.32_armhf.deb linux-dtb-dev-sun8i_5.32_armhf.deb linux-headers-dev-sun8i_5.32_armhf.deb linux-source-dev-sun8i_5.32_all.deb
scp linux-image-dev-sun8i_5.32_armhf.deb firstname.lastname@example.org:/root/ scp linux-dtb-dev-sun8i_5.32_armhf.deb email@example.com:/root/ scp linux-firmware-image-dev-sun8i_5.32_armhf.deb firstname.lastname@example.org:/root/ scp linux-u-boot-dev-orangepizero_5.32_armhf.deb email@example.com:/root/
Now connect to Orange Pi, via SSH for example, as root. Default password is
armbian1234. Install the packages:
cd dpkg -i linux-firmware-image-dev-sun8i_5.32_armhf.deb dpkg -i linux-dtb-dev-sun8i_5.32_armhf.deb dpkg -i linux-image-dev-sun8i_5.32_armhf.deb dpkg -i linux-u-boot-dev-orangepizero_5.32_armhf.deb
I recommend to install them one by one, because the operation takes some time and happens to hang.