[HOWTO] create TWRP image for U9-H (any firmware)

mnxguest

New member
Last time I checked no TWRP recovery image was released for U9-H/AMLogic S912.
You should check again and if a working one is available now: take it and skip this howto.

If still none is available you can learn how to create your very own TWRP recovery image here.

Disclaimer:
This procedure is not officially endorsed by MINIX.
By following it you accept full responsibility for any and all consequences.


Credits and stuff:
A special kudos to the Minixforum Dev Team that has brought us Community Edition Nougat firmware: great work, your efforts have been well spent and are very appreciated!
  • This is a collection gathered from howtos and tools from all over the net
  • All credit remains with creators of original images, tools and howtos
  • With that said: I will not provide repackaged TWRP recovery images, stock recovery images, tools or anything else for download. Do not ask, you would only be disappointed.
  • My working environment is Linux (Debian). Required tools are reported to be available and working for Windows, too.
  • This has worked for me. It might also work for you. Apply common sense, read instructions carefully. If you are brave and skilled enough to flash new firmware to your box then you already have the mindset and skills required to succeed. Try, be patient, and grow with the task.

Step 1: get a stock recovery.img
  • If an official recovery.img should be available for download: take it and be done with step #1
  • Otherwise you can extract it from a stock full flash image:
    • You need the stock full flash image you used/intend to use for flashing your box, eg from Official Firmwares Thread: U9-H-CE FW001 Android 7.1.2 20191120 [Community Edition Nougat Firmware]
    • On Linux recovery.PARTITION can be extracted from full flash image using "linux-amlogic-toolkit". Rename to recovery.img, tools in step #3 expect this file name.
    • On Windows "AMlogic Tools" is reported to work. If you did this on Windows and any file renaming or other changes are required please add a post below.
Step 2: find a matching TWRP recovery.img
  • For official NEO U9-H: 008FW "Marshmallow" firmware there is/was mention of "TWRP 3.0.2 by Abdul" somewhere in this forum. That has worked for me: without further modification on MINIX NEO U9-H: 008FW "Marshmallow" firmware. Also as input for repackaging with stock recovery.img of community edition U9-H-CE FW001 (as extracted in step #1).
  • Also working for me for repackaging with community edition U9-H-CE FW001 stock recovery.img is twrp.q20x-3.2.3-0.img. Look for files released by "Magendanz q20x".
  • The versions of TWRP I had success with are 3.0.2 and 3.2.3. So probably any TWRP 3.x version should be good enough.
  • U9-H is similar to "q200", "q201" or "q20x" AMLogic reference boards, you could look for that
  • U9-H is based on S912 AMLogic chip, so TWRP images for other boxes with this chip could also work
  • Whether the TWRP image mentioned "Nougat"/7.1/7.1.1/7.1.2 or not did not not seem to make any difference in my trials
Step 3: repackage TWRP recovery.img with kernel and configuration from stock recovery.img
You need "[TOOL] Android Image Kitchen" (available for Linux and Windows).
Find and follow the 25 steps of "[GUIDE]Porting TWRP without source".
Mind that you already have TWRP and stock recovery.img files available from step #1 and #2: those referenced in [GUIDE] do not work for U9-H.
Important: additionally to the steps in [GUIDE] you have to find and replace all ".ko" (compiled Linux kernel module) files with same from "stock ramdisk". After finishing step #22 "Edit default.prop" and before continuing with steps #23/#24 "repackaging" in [GUIDE]:
  • Find all files of type/with file suffix "ko" anywhere in "new ramdisk" folder. I found: dwc3.ko and dwc_otg.ko.
  • If no such files are found: thats ok, nothing to do here.
  • Find files with same name in "stock ramdisk" folder. For me again dwc3.ko and dwc_otg.ko were available.
  • Copy all files found from "stock ramdisk" to "new ramdisk" folder: overwrite exising files
  • If some files are only found in "new ramdisk" but not in "stock ramdisk" folder: delete them from "new ramdisk" folder. Better to see "file not found" error messages then risk boot failure because kernel modules fail to load ...
  • Don't forget to continue with step #23 of [GUIDE] after managing the "ko" files ...
If all steps of [GUIDE] suceeded then you now have file "image-new.img" in "Android Image Kitchen" folder.

Step 4: copy to SD and boot to recovery (if you don't know already)
Because booting recovery from SD is much simpler than booting it from internal memory I would advise to never install TWRP to internal memory.
  • copy image-new.img to the root of a micro SD
  • rename it to recovery.img
  • shut down your box and insert the SD
  • start your box by using the on/off button on the box (do not use the remote) and keep it pressed down for at least 6 seconds (I usually keep it pressed until TWRP comes up on screen ...)
If all is well you should now have TWRP running on your box :cool:
 
Last edited:
Back
Top