Flashing Android 11 on VIM3

Hi, sorry for raising a duplicated topic, but all similar ones didn’t not provide a solution to my problem.

I’m trying to build and flash Android version 11.0.0_r26 on VIM3 board. (In fact i will be happy if I’m able to flash any release of Android 11)

Instructions available on source.android.com and Khadas website work perfectly fine for master branch, but it is Android S Beta version, and is not suitable for my needs.

Main issue seems to be different partitions structure between VIM3 board and what is built out of AOSP.

Images that are being built for yukawa-userdebug target in my AOSP version are: boot.img, system.img, vendor.img, cache.img, userdata.img, ramdisk.img

However, images that are needed in order to flash the VIM3 board are: boot.img, super.img, cache.img, userdata.img, recovery.img, dtbo-unsigned.img.

So missing images are:

  • super.img
  • recovery.img
  • dtbo-unsigned.img

And it seems that they should be somehow built instead of

  • system.img
  • vendor.img
  • ramdisk.img

Or maybe a subset of those.

I’ve looked into the diff between master and 11.0.0_r26 for device/amlogic/yukawa and it seems like a substantial amount of changes to understand for an AOSP noob like me :confused:

My ideal solution as i see it would be one of the two:

  • a post-build script that I will run on output directory that will recombine the generated images into the ones i need
  • a minimal patch to device/amlogic/yukawa which will make necessary images come out of the build system

Can someone help with either approach please? Would also be grateful for any useful links to read in order to come up with a solution myself

1 Like

Since i lased checked, the master branch is android R(11) and that the s beta is a different branch. Many of the 11.0.0_rxx branches are incomplete and we’re probably for boot and possibly driver validation.

Afraid your information is incorrect, here’s proof:

> /opt/amlogic/yukawa > master > git describe
android-s-beta-1-6-gcbed20b

and it is 367 commits ahead of android-11.0.0_r37 (which as i understand is the latest Android 11 tag)

> /opt/amlogic/yukawa > master > git log --pretty=oneline android-11.0.0_r37..master | wc -l
367

or am i looking at wrong tag for Android 11 latest?

currently the yukawa source is maintained by Bayliber and r37 hasnt been updated in a year. here the build.prop from the image i built about 1~2 weeks ago and it says that the version is 11 at ro.build.version.release
from what i can see atleast, they may be using the same BoardConfigCommon.mk between the master and s beta branches with some changes but forgot to change other bits of the config

####################################

from generate-common-build-props

These properties identify this partition image.

####################################
ro.product.system.brand=Android
ro.product.system.device=yukawa
ro.product.system.manufacturer=SEI Robotics
ro.product.system.model=ATV on yukawa
ro.product.system.name=yukawa
ro.system.product.cpu.abilist=arm64-v8a,armeabi-v7a,armeabi
ro.system.product.cpu.abilist32=armeabi-v7a,armeabi
ro.system.product.cpu.abilist64=arm64-v8a
ro.system.build.date=Tue May 18 20:08:05 UTC 2021
ro.system.build.date.utc=1621368485
ro.system.build.fingerprint=Android/yukawa/yukawa:S/AOSP.MASTER/serv-dan05182008:userdebug/test-keys
ro.system.build.id=AOSP.MASTER
ro.system.build.tags=test-keys
ro.system.build.type=userdebug
ro.system.build.version.incremental=eng.serv-d.20210518.200936
ro.system.build.version.release=11
ro.system.build.version.release_or_codename=S
ro.system.build.version.sdk=30
####################################

from out/target/product/yukawa/obj/PACKAGING/system_build_prop_intermediates/buildinfo.prop

####################################

begin build properties

autogenerated by buildinfo.sh

ro.build.id=AOSP.MASTER
ro.build.display.id=yukawa-userdebug S AOSP.MASTER eng.serv-d.20210518.200936 test-keys
ro.build.version.incremental=eng.serv-d.20210518.200936
ro.build.version.sdk=30
ro.build.version.preview_sdk=1
ro.build.version.preview_sdk_fingerprint=61ba06fc7de6b604982f3f4ef6feb28e
ro.build.version.codename=S
ro.build.version.all_codenames=S
ro.build.version.release=11
ro.build.version.release_or_codename=S
ro.build.version.security_patch=2021-05-05
ro.build.version.base_os=
ro.build.version.min_supported_target_sdk=23
ro.build.date=Tue May 18 20:08:05 UTC 2021
ro.build.date.utc=1621368485
ro.build.type=userdebug
ro.build.user=serv-dan
ro.build.host=build-serv
ro.build.tags=test-keys
ro.build.flavor=yukawa-userdebug

ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,

use ro.product.cpu.abilist instead.

ro.product.cpu.abi=arm64-v8a
ro.wifi.channels=

ro.build.product is obsolete; use ro.product.device

ro.build.product=yukawa

Do not try to parse description or thumbprint

ro.build.description=yukawa-userdebug S AOSP.MASTER eng.serv-d.20210518.200936 test-keys

end build properties

####################################

from variable ADDITIONAL_SYSTEM_PROPERTIES

####################################

Removed by post_process_props.py because ro.product.first_api_level is a disallowed key

#ro.product.first_api_level=29
ro.treble.enabled=true
ro.actionable_compatible_property.enabled=true
persist.debug.dalvik.vm.core_platform_api_policy=just-warn
ro.postinstall.fstab.prefix=/system
ro.secure=1
security.perf_harden=1
ro.allow.mock.location=0
ro.debuggable=1
dalvik.vm.lockprof.threshold=500
net.bt.name=Android
####################################

from variable PRODUCT_SYSTEM_PROPERTIES

####################################
debug.atrace.tags.enableflags=0
persist.traced.enable=1
dalvik.vm.image-dex2oat-Xms=64m
dalvik.vm.image-dex2oat-Xmx=64m
dalvik.vm.dex2oat-Xms=64m
dalvik.vm.dex2oat-Xmx=512m
dalvik.vm.usejit=true
dalvik.vm.usejitprofiles=true
dalvik.vm.dexopt.secondary=true
dalvik.vm.dexopt.thermal-cutoff=2
dalvik.vm.appimageformat=lz4
ro.dalvik.vm.native.bridge=0
pm.dexopt.first-boot=verify
pm.dexopt.boot-after-ota=verify
pm.dexopt.post-boot=extract
pm.dexopt.install=speed-profile
pm.dexopt.install-fast=skip
pm.dexopt.install-bulk=speed-profile
pm.dexopt.install-bulk-secondary=verify
pm.dexopt.install-bulk-downgraded=verify
pm.dexopt.install-bulk-secondary-downgraded=extract
pm.dexopt.bg-dexopt=speed-profile
pm.dexopt.ab-ota=speed-profile
pm.dexopt.inactive=verify
pm.dexopt.shared=speed
dalvik.vm.dex2oat-updatable-bcp-packages-file=/system/etc/updatable-bcp-packages.txt
dalvik.vm.dex2oat-resolve-startup-strings=true
dalvik.vm.dex2oat-max-image-block-size=524288
dalvik.vm.minidebuginfo=true
dalvik.vm.dex2oat-minidebuginfo=true
ro.iorapd.enable=true
dalvik.vm.madvise.vdexfile.size=104857600
dalvik.vm.madvise.odexfile.size=104857600
dalvik.vm.madvise.artfile.size=4294967295
####################################

from variable PRODUCT_SYSTEM_DEFAULT_PROPERTIES

####################################

Auto-added by post_process_props.py

persist.sys.usb.config=adb

end of file

Thanks a lot for looking into this! I will try to amend BoardConfigCommon.mk according to your suggestions. Is my understanding correct that it should be the only file i will need to change?

im not too sure, there may be other changes in the sepolicy folder, the device-common.mk, device-yukawa.mk and the yukawa.mk & yukawa-common.mk

ok, understood, thx a lot anyway!

  • Use android11 branch when doing repo init
  repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r31
  repo sync -j12
  • Use the the master branch of device/amlogic-yukawa kernel
  cd device/amlogic/yukawa-kernel
  git pull aosp
  git checkout -f aosp/master
  • Fixups. There are few things that need tweaking in yukawa repo
    because they are meant for the master branch.
    Use my work-in-progress branch for device/amlogic/yukawa:
  cd device/amlogic/yukawa
  git remote add --no-tags baylibre https://gitlab.com/baylibre/amlogic/atv/aosp/device/amlogic/yukawa.git
  git pull baylibre
  git checkout -f baylibre/wip/android11
1 Like
  • build the AOSP for VIM3:
source build/envsetup.sh
lunch yukawa-userdebug
make TARGET_USE_TABLET_LAUNCHER=true TARGET_VIM3=true TARGET_KERNEL_USE=5.4 -j16
  • if you see “build completed successfully (xxx (mm:ss))”,you will get some img files.
  • flash Uboot:
cd path/to/aosp/device/amlogic/yukawa/bootloader/
./tools/update write u-boot_kvim3_noab.bin 0xfffa0000 0x10000
./tools/update run 0xfffa0000
./tools/update bl2_boot u-boot_kvim3_noab.bin
fastboot oem format
fastboot flash bootloader u-boot_kvim3_noab.bin
fastboot erase bootenv
fastboot reboot bootloader
  • press reset key.

  • flash img:

cd out/target/product/yukawa
fastboot flash boot boot.img
fastboot flash super super.img
fastboot flash cache cache.img
fastboot flash userdata userdata.img
fastboot flash recovery recovery.img
fastboot flash dtbo dtbo-unsigned.img
fastboot reboot
2 Likes

@tenk.wang thank you very much for your help. With your suggested branch i got this error (similar for 5.4 kernel version)

FAILED: ninja: 'device/amlogic/yukawa-kernel/4.19/Image.lz4', needed by 'out/target/product/yukawa/kernel', missing and no known rule to make it

which to me seems like i also needed to pull aosp/master for device/amlogic/yukawa-kernel. Does that seem like a sensible idea?

Build is going to take a while now, as it seems that its a complete rebuild, but I will keep this thread updated.

  • you need check kernel files
cd device/amlogic/yukawa-kernel
ls -al

image

You’d better download AOSP again, use android-11.0.0_r31 branch.

yes i do have all three kernel dirs now after i’ve checked out master. Could be a problem of my build cache, as i’ve already built my branch before and then switch branch of device/amlogic/yukawa according to your suggesion and built again in hope it will take less time.

Thx, i will do a clean build in case the one i’m doing now fails

Okay, I’ll follow up this.

i’ve now successfully built and flashed Android 11 (android-11.0.0_r26) with help of instructions suggested by @tenk.wang , thx a lot!

I did it for default kernel version (4.19) and did not yet try 5.4, but i’d expect that to be fine as well.

The only thing i’d add is that i also had to checkot aosp/master for device/amlogic/yukawa-kernel in order to do a successfull build

1 Like

Successfully flashed 11 on VIM3. But when trying to keep the debugging on (done from UI settings option), the VIM3 keeps restarting. Is this a known issue? Any fix for this?

@tenk.wang
Can I follow your step to get kvim source code to build android 11

repo init -u https://github.com/khadas/android_manifest.git -b khadas-vims-pie

repo sync -j4

@fiveshit It is android 9 branch.

@tenk.wang

Hi, I followed all the instructions given by you to generate and flash asop images, I checked out to android-11.0.0_r48 branch. But seems that surflaceflinger keeps Crashing and i am not able to see anything on the HDMI out and scrcpy also throws error

some of the dmesg logs i captured

[ 106.074806] init: starting service ‘surfaceflinger’…
[ 106.075070] init: Could not create socket ‘pdx/system/vr/display/client’: Failed to bind socket ‘pdx/system/vr/display/client’: No such file or directory
[ 106.088275] init: Could not create socket ‘pdx/system/vr/display/manager’: Failed to bind socket ‘pdx/system/vr/display/manager’: No such file or directory
[ 106.102106] init: Could not create socket ‘pdx/system/vr/display/vsync’: Failed to bind socket ‘pdx/system/vr/display/vsync’: No such file or directory