[ALIEN BUILD] /e/OS for Banana Pi M5

Hi,

This is my journey for porting /e/OS to this device :smiley_cat:

Disclaimer: I tagged it “ALIEN” as it doesn’t fit the requirements: here and here.

The hardware

The software

What’s needed for flashing

  • Windows (tested OK with Windows 11 latest regular build)
    • sorry Linux users, I can’t get aml-flash-tool to work (and the script may probably need a little rework for LOS/eOS)
    • a Windows virtual machine may work, as long as it can use persistent USB mapping
  • USB Burning Tool: https://wiki.banana-pi.org/Getting_Started_with_M5/M2Pro#Prepare_2
  • an image to flash: https://www.androidfilehost.com/?w=files&flid=339471
    • note: only /e/OS T (Android 13) for this device, but it’s not being officially released yet
    • “m5” image is AndroidTV mode, “m5_tab” is tablet mode
  • flashing method is documented here, it is very straightforward
    • please remove any SDCard before!
    • you will lose all your eMMC data!

What’s needed for running

  • I managed to make this build usable with scrcpy
  • it should also work with HDMI touch screen (see “Hardware” chapter)
  • Ethernet cable plugged in
  • BPI M5 USB-C connected to a PC computer

Let’s take it for a test drive!

  • (optional) if you have a HDMI display connected to the BPI M5, or a serial console for the USB-TTL adapter, you can follow the boot process
  • about 2 minutes after power-on, scrcpy should find the device and display the setup screen
    • hint : if BPI M5 USB-C is connected to a Windows computer, listen the plug/unplug sounds :wink:
  • AndroidTV build specific
    • for now, I couldn’t figure how to bypass the Bluetooth remote pairing at startup :confused:
    • issue the following commands in a ADB shell, wait about 2mn, reboot the device
settings put global setup_wizard_has_run 1
settings put secure user_setup_complete 1
settings put global device_provisioned 1
  • tablet build specific
    • you may see some errors about MicroG and Bluetooth, simply ignore them and close apps:
    • I strongly advise to choose 3-buttons navigation
    • please choose Trebuchet as launcher (you can click “Just once” is you want to try Bliss later, but it’s not doing very well :confused: ):
      image
  • about location (may also apply to AndroidTV, untested): as we don’t have a GPS module, some apps incl. MicroG, Night Light scheduler, … won’t work OOTB. However, enabling “Fake location” in Advanced Privacy helps a lot! :smiley_cat:
  • if you have some .apk files, it is also very easy to install apps with scrcpy: just drag it onto the window!

What’s working, or not

  • working:
    • Ethernet
    • HDMI display (touch support is probably OK)
    • SafetyNet (once Fake Location enabled)
    • HDMI audio (use scrcpy --otg --serial 1234567890 with HDMI display sound-capable connected)
  • won’t work unless hardware addition:
    • GPS
    • Bluetooth
    • WiFi
    • Phone and related services
    • various sensors (compass, barometer, …)
  • to be tested (may need additional development):
    • USB HID (keyboard, mouse)
    • USB Bluetooth
    • USB WiFi
    • USB storage
    • 3.5 jack audio
    • you tell me :wink:

About build

  • as a reminder, /e/OS has not been released for Android 13, yet
  • I couldn’t get /e/OS Trebuchet (a.k.a. launcher3) to work. LOS Trebuchet is however working fine
    • no /e/ home screen with specific widgets and weather (this is the “Alien build” root cause)
  • device security has to be adjusted for tablet mode, in order to get scrcpy to work OOTB
    • to be investigated, I suspect a problem with the “m5_tab” device name, especially the “_”
  • building for this device cannot be done using the Docker method, unless some heavy modifications
    • m5_tab is a sub-device of m5, so we have to breakfast for m5 then brunch for m5_tab
    • extra step is needed to build flashable image (this could probably be added to Docker build as an extra script, didn’t try)

Building steps

<?xml version="1.0" encoding="UTF-8"?>
<manifest>
  <project name="TheMuppets/proprietary_vendor_amlogic_g12-common" path="vendor/amlogic/g12-common" revision="lineage-20" clone-depth="1" />
  <project name="TheMuppets/proprietary_vendor_amlogic_m5" path="vendor/amlogic/m5" revision="lineage-20" clone-depth="1" />
</manifest>
  • repo sync
  • source build/envsetup.sh then breakfast m5
  • modify vendor/lineage/config/common.mk, lines 16 to 25 (this will enable insecure ADB for scrcpy):
	#ifeq ($(TARGET_BUILD_VARIANT),eng)
	# Disable ADB authentication
	PRODUCT_SYSTEM_DEFAULT_PROPERTIES += ro.adb.secure=0
	#else
	# Enable ADB authentication
	#PRODUCT_SYSTEM_DEFAULT_PROPERTIES += ro.adb.secure=1

	# Disable extra StrictMode features on all non-engineering builds
	#PRODUCT_SYSTEM_DEFAULT_PROPERTIES += persist.sys.strictmode.disable=true
	#endif
  • croot, then export WITH_GMS=false if you generated a previous .img
  • brunch m5_tab for tablet variant, or brunch m5 for TV variant
  • export WITH_GMS=true: this will free reserved space for Google apps, as we need more space for /e/OS
  • make aml_upgrade: this will overwrite out/target/product/m5_tab/aml_upgrade_package.img or out/target/product/m5/aml_upgrade_package.img, depending on the target you choose at brunch time
1 Like

U-Boot

One important file, added by make aml_upgrade to flashable image, is the boot loader (https://u-boot.readthedocs.io/en/latest/index.html). Look at device/bananapi/m5/factory.mk for reference.

LOS builders included this file in TheMuppets tree, but never specified how they get it… So, although it’s working fine, I decided to go the hard way and rebuild my own :smiley_cat:
After some investigations (it took me hours to find the repo!), I can come up with a fairly simple method.

  • git clone https://github.com/Stricted/deadpool_u-boot_build.git
  • this comes with an embedded FIP, but it’s old and for another device, so I decided not to trust it
  • modify collect-m5_binaries-git-refboard.sh:
    • fix the line #55: cp $TMP_GIT/u-boot/build/board/*/${REFBOARD}/firmware/acs.bin $TMP/
  • issue ./collect-m5_binaries-git-refboard.sh odroidg12-v2015.01-c4-m5 sm1 bananapi_m5 to build a new binary tree (for example, mine was fip-collect-g12a-bananapi_m5-odroidg12-v2015.01-c4-m5-20230917-175205)
  • generate U-Boot with ./build.sh android-tv-13.0.0_r1 g12a_bananapim5_v1
  • then merge all together with ./generate-bins-new.sh fip-collect-g12a-bananapi_m5-odroidg12-v2015.01-c4-m5-20230917-175205 out/u-boot/build/u-boot.bin
    • note: replace the FIP dir name with your own!
  • you will find the u-boot.bin file in a dir named after uboot-bins-<date>-<time>/
  • copy it to your source tree for /e/OS or LOS, path device/bananapi/m5/factory/

File is available here: https://androidfilehost.com/?fid=10620683726822079769.

2 Likes