I don’t have my Hikey 960 with me so I can’t check that every step is right, but these are the notes I made to get Debian working with Hynix UFS. You need to have a serial interface connected to the Hikey.
Thanks to Bas Vermeulen on this thread: How to enable Opencl support on hikey960? for the kernel and useful hints.
The steps are:
- Build patched kernel
- Convert rootfs from android sparse image to standard image and mount
- Copy new kernel into rootfs
- Convert back to sparse image and flash
- Boot and modify boot command to point to new kernel
Below assumes you have a directory structure of
./images downloaded disk images from Linaro
./linux where the kernel is cloned
./hynix_patch where the patch is cloned
# Get the patch git clone email@example.com:snippets/siteks/eaz9Gp/hynix_patch.git # Get a build environment sudo apt install build-essential gcc-aarch64-linux-gnu # Get the kernel git clone https://github.com/TallGuy74/linux.git cd linux/ git checkout daedalean # Apply the patch git apply ../hynix_patch/hynix.patch # Build the kernel make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu daedalean_defconfig make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu Image modules # Install all the stuff somewhere mkdir -p /tmp/tmp_install/boot make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/tmp/tmp_install INSTALL_MOD_STRIP=1 modules_install cp arch/arm64/boot/Image /tmp/tmp_install/boot/Image # Turn rootfs image from sparse into normal cd ../images simg2img debian-hikey960-public.rootfs.img debian-hikey960-public.rootfs.raw.img # Mount it and copy the new kernel in with a new name mkdir tmp sudo mount debian-hikey960-public.rootfs.raw.img tmp sudo cp /tmp/tmp_install/boot/Image tmp/boot/Image_new sudo umount tmp # Repack as a sparse image and flash img2simg debian-hikey960-public.rootfs.raw.img repacked_debian.img sudo fastboot flash system repacked_debian.img # Reboot Hikey960 sudo fastboot reboot # In the UEFI menu, navigate to edit menu item, change name of kernel, ctrl-x to save and reboot
There may be mistakes above but it should be roughly right… Probably the patch will work on the standard kernel but I haven’t tried it.
EDITED to fix typo in last instruction