User:Lafleur/NanoPi M1

From ArchWiki
Jump to navigation Jump to search

Note: The device is not officially supported neither by Archlinux or by the ALARM project, i.e. please refrain from submitting patches, feature requests or bug reports for it.
Note: This page was apparently created by Ls256 on the main Arch wiki ; I'm copying it here before it gets wiped from the wiki. I did use it to successfully install Arch linux on this hardware. Ls256 said they were still trying to figure the graphics components support. Anyone with background on this is welcome to modify the page accordingly.

The NanoPi M1 is a small, arm-based computer. It contains an Allwinner H3 processor and either 512 or 1024 MB of RAM. This article is strongly based on Orange Pi.

Create the base system

This NanoPi M1 boots from a single ext4 partition, imaged with Das U-Boot. An ArchLinuxArm RootFS can then be downloaded to the card.

Create development environment

Create a directory system to store the development files:

$ mkdir -p nanopi_arch/mnt

Partition, format and mount SD card

Use fdisk to partition the SD card, and use mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdX1 to format it. The mount the card with:

# mount /dev/sdX1 mnt

Install ArchLinuxArm RootFS

Download the RootFS from ArchLinuxArm's website:

$ wget

Extract the RootFS to the SD card:

# bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C mnt/
# sync

Configure U-Boot

Create a file with the following boot script:

part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
  if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
    if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
      bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
      bootz ${kernel_addr_r} - ${fdt_addr_r};

if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then
  if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then
    setenv bootm_boot_mode sec;
    bootm 0x48000000;

Compile it and write it to the SD-card using the package uboot-tools:

# mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "NanoPi M1 Boot Script" -d boot.cmd mnt/boot/boot.scr

Unmount the SD Card

# umount mnt

Install U-Boot

Install swig package. Clone U-Boot from the offical git repository:

$ git clone

Checkout to latest stable tag e.g.: v2019.04

$ git checkout tags/v2019.04

The NanoPi shares many similarities with the OrangePi PC, so use this as the target until better support is available. Build U-Boot:

$ cd u-boot
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- nanopi_m1_defconfig
$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-

This process should have generated an image called u-boot-sunxi-with-spl.bin. Write this to your SD card:

# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
$ cd ..

Configure the base system

Boot the NanoPi

Apply 5V power to the NanoPi. It should boot successfully. If not, then attach the UART serial debugger as shown here and here.

Login over SSH with alarm/alarm.

Root password: root.

Configure Linux

First, SSH into the machine and change the root password.

# passwd

You must install the base-devel group as well as Git in order to continue. Do this and update the Linux system using:

# pacman -Syu base-devel git

Open Source Mali driver (lima)

Since linux 5.2 lima drm driver was merged in the mainline kernel.

# pacman -Syu linux-armv7-rc

Mali Binary driver

Now you should download and install the drivers for the Mali graphics card inside the SoC.

# git clone
# cd sunxi-mali
# ./ -r r6p2 -b
# ./ -r r6p2 -i

Finally, install the UserSpace blobs from arm using these commands:

# git clone
# cd mali-blobs
# cp -a r6p2/fbdev/lib/lib_fb_dev/lib* $TARGET_DIR/usr/lib