NanoPi M1

From ArchWiki
Jump to: navigation, search

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Graphics is still to be documented. (Discuss in Talk:NanoPi M1#)

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

The upstream U-Boot repository has no graphics support as of May 2017. Clone U-Boot from the jernejsk git repository:

$ git clone --depth 1

There is a bug in the U-Boot code for Arch. Correct this with:

$ sed -i -e 's/\#\!\/usr\/bin\/env\ python/\#\!\/usr\/bin\/env\ python2/g' tools/binman/binman

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- orangepi_pc_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

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