H96 Max+ Android box as a Linux server

- rk3328 linux rockchip

The H96 Max + is an Android 8.1 box with a Rockchip 3328, 4Gb RAM and 32G or 64G builtin eMMC, it’s the same chipset as the Rock64, it costs around 60 USD.
The only downside of this board is the 100Mb network link, can be a non issue using a USB network adapter.

July 2020 EDIT: Works with mainline, look at the bottom.

Here are some notes how to install Arch Linux on the H96 to make it a small server appliance.

Serial Console Pins

Video output won’t work while installing you need to establish a serial connection to the board.

Baudrate 1500000 8N1 3.3V

DTB

DTS/DTB are Device Tree Blob describing the hardware to the kernel.

You can extract the DTB from the Android H96 image but I’m using rk3328-t9.dtb from armbian forum

Unbrick

If you write to mmcblk2 you may override the rockchip firmware located on the eMMC, which will result in a non booting device …

Since this box does not have any reset button you need to short two pins as described in this post.

You also need a male male USB connector (it’s a straight cable, black, green, white and red on both ends).

Shorts the two pins while inserting the USB cable, do not plug the power cable.

Find an image for the H96 somewhere or dump yours, it’s only useful to recover the boot image, then write it to the eMMC with upgrade_tool

sudo ./upgrade_tool uf RK3328-H96MAX+_hs2734_8.1.0_20180823.1108.img

Installation

Prepare an SD card as described in the Rock64 Arch installation.

Note the output of blkid for this partition.

Before unmounting root, create a new file root/boot/boot.txt.

part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=ttyS2,1500000 root=UUID=a3490212-03b6-46a6-9e6b-7733513a3efa storagemedia=emmc rw rootwait earlycon=uart8250,mmio32,0xff130000
setenv fdtfile rockchip/rk3328-t9.dtb

if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/Image; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
              fdt addr ${fdt_addr_r}
              fdt resize
              if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
                booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
              else
                booti ${kernel_addr_r} - ${fdt_addr_r};
    	fi;
	fi;
fi

Copy the dtb file:

cp rk3328-t9.dtb root/boot/dtbs/rockchip

Update the bootloader:

cd root/boot
mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr

mkimage is provided by uboot-tools on Arch.

Mainline kernel won’t work properly for now here is a copy ayufan kernel 1187 untar in root/boot

This is a one time thing only…

First boot

Boot with the SD, you should be able to see /dev/mmblck2. It should be safe to write after the block 32768, create a partition, (it’s here I’ve bricked then unbricked mine).

Device         Boot Start       End   Sectors  Size Id Type
/dev/mmcblk2p1      32768 122142719 122109952 58.2G 83 Linux

You can safely perform a normal Arch install on it, then remember to modify the UUID in boot.txt from the SD Card to boot / from the newly created /dev/mmblck2p1 partition, (the SD card is /dev/mmblck0).

Reboot, the SD card is only needed to find the kernel, the rest is read off the eMMC.

Kernel Updates

Until mainline is stable for the rk3328, you can use my updated Arch rockchip ayufan pkg.

mount /dev/mmblck0 /mnt
mount --bind /mnt/boot /boot
cd linux-aarch64-rock64-bin
makepkg -si

Stability

I had tons of issues but it seems it was related to USB 3.0.

I’ve blacklisted video output since it’s not used , create /etc/modprobe.d/video-blacklist.conf

blacklist mali 
blacklist dw_hdmi_i2s_audio

Do not use USB 3 port and you should be fine, (until mainline is stable).

3D Printed rack

Since this board is not standard, I’ve made a 3D printed rack for the H96 and with a support for Rpis/Odroid and Rock64.

Conclusions

It should be possible to boot directly from the eMMC without the SD Card.

This board is incredibly fast and convenient for the price, it’s a perfect target to play with edge clusters.
It’s a bit hacky and I don’t recommend it if you are not ready to debug from a serial console.

July 2020 EDIT:

Mainline kernel

As of July 2020 it’s possible to boot using the mainline kernel:

Boot on a recent Arch ARM for rock64 from SD card or USB, use rk3328-box-h96mp.dtb found on Armbian forum, with the mkimage described early in this post.

6c19d9dd3fede7708272c5c070082416  /boot/dtbs/rockchip/rk3328-box-h96mp.dtb

Then partition the EMMC, using a FAT primary and extlinux, it will boot using the instruction from the extlinux.conf.

/dev/mmcblk1p1 *      2048    264191    262144  128M  b W95 FAT32
/dev/mmcblk1p2      264192 122142719 121878528 58.1G 83 Linux

mkfs.msdos -F 32 /dev/mmcblk1p1
mkfs.ext4 /dev/mmcblk1p2
e2label  /dev/mmcblk1p2 root_emmc

mkdir root
mount /dev/mmcblk1p2 root

blkid
/dev/mmcblk1p1: UUID="71FE-481E" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="832a8558-01"
/dev/mmcblk1p2: LABEL="root_emmc" UUID="d73d44a4-a415-4fa4-8ffd-73612051ff8e" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="832a8558-02"

bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C root

mkdir boot
mount /dev/mmcblk1p1 boot
cp root/boot/Image boot
cp root/boot/initramfs-linux.img boot/initramfs
mkdir -p boot/dtb/rockchip
cp rk3328-box-h96mp.dtb boot/dtb/rockchip/rk3328-h96.dtb

mkdir boot/extlinux

Create boot/extlinux/extlinux.conf as follow.

LABEL Arch
  LINUX /Image
  INITRD /initramfs
  FDT /dtb/rockchip/rk3328-h96.dtb
  APPEND root=LABEL=root_emmc rootwait rw console=ttyS2,1500000 earlycon=uart8250,mmio32,0xff130000

Next reboot.

reboot

# interrupt boot by hitting keyboard
setenv devnum 0; run mmc_boot


pacman-key --init
pacman-key --populate archlinuxarm
pacman -Suy

# in case of kernel update
mkdir /bootfat
mount /dev/mmcblk1p1 /bootfat 
cp /boot/Image /bootfat/Image
cp /boot/initramfs-linux.img /bootfat/initramfs

I have 3 of them running in clustered mode for several days, without any problem.

Linux rk0 5.7.8-1-ARCH #1 SMP Sun Jul 12 03:38:28 UTC 2020 aarch64 GNU/Linux