AOSP+OP-TEE build and sync issue in Hikey960

@sreegink i appied the patch but still does not work. Aosp works over adb but haven’t appied the 4g patch.

EDIT: applied patch and does not work

Hi@quincysquarrel,
This is the issue i am stuck at.

01-01 00:08:50.349 12519 12519 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 00:08:50.350 12519 12519 F DEBUG   : Build fingerprint: 'Android/hikey960/hikey960:9/PQ1A.190105.004/root06081621:userdebug/test-keys'
01-01 00:08:50.350 12519 12519 F DEBUG   : Revision: '0'
01-01 00:08:50.350 12519 12519 F DEBUG   : ABI: 'arm64'
01-01 00:08:50.350 12519 12519 F DEBUG   : pid: 12436, tid: 12436, name: composer@2.1-se  >>> /vendor/bin/hw/android.hardware.graphics.composer@2.1-service <<<
01-01 00:08:50.350 12519 12519 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
01-01 00:08:50.350 12519 12519 F DEBUG   : Cause: null pointer dereference
01-01 00:08:50.350 12519 12519 F DEBUG   :     x0  0000007802673000  x1  0000000000000000  x2  0000000000000001  x3  0000000000000000
01-01 00:08:50.350 12519 12519 F DEBUG   :     x4  0000000000000067  x5  8000000000000000  x6  ff6b60477164726e  x7  7f7f7f7f7f7f7f7f
01-01 00:08:50.350 12519 12519 F DEBUG   :     x8  0000007802631b40  x9  004c489217350116  x10 0000007fea0f64c0  x11 000000000000001b
01-01 00:08:50.350 12519 12519 F DEBUG   :     x12 0000007fea0f65f8  x13 ffffffffffffffff  x14 ffffffffff000000  x15 ffffffffffffffff
01-01 00:08:50.350 12519 12519 F DEBUG   :     x16 000000780202fd58  x17 0000007802009858  x18 0000007fea0f5dba  x19 0000000000000000
01-01 00:08:50.350 12519 12519 F DEBUG   :     x20 0000007802673000  x21 000000780264d200  x22 0000000000000001  x23 00000078026315c0
01-01 00:08:50.350 12519 12519 F DEBUG   :     x24 0000007802631b40  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
01-01 00:08:50.350 12519 12519 F DEBUG   :     x28 0000000000000000  x29 0000007fea0f69f0
01-01 00:08:50.350 12519 12519 F DEBUG   :     sp  0000007fea0f69c0  lr  00000078020098f4  pc  0000000000000000
01-01 00:08:50.355 12519 12519 F DEBUG   : 
01-01 00:08:50.355 12519 12519 F DEBUG   : backtrace:
01-01 00:08:50.355 12519 12519 F DEBUG   :     #00 pc 0000000000000000  <unknown>
01-01 00:08:50.355 12519 12519 F DEBUG   :     #01 pc 00000000000198f0  /vendor/lib64/hw/hwcomposer.drm.so (android::DrmHwcTwo::RegisterCallback(int, void*, void (*)())+152)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #02 pc 000000000001b8f8  /vendor/lib64/hw/hwcomposer.drm.so (_ZN7android9DrmHwcTwo10DeviceHookIiMS0_FN4HWC25ErrorEiPvPFvvEEXadL_ZNS0_16RegisterCallbackEiS4_S6_EEJiS4_S6_EEET_P11hwc2_deviceDpT2_+8)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #03 pc 0000000000007304  /vendor/lib64/hw/android.hardware.graphics.composer@2.1-impl.so (android::hardware::graphics::composer::V2_1::passthrough::detail::HwcHalImpl<android::hardware::graphics::composer::V2_1::hal::ComposerHal>::unregisterEventCallback()+36)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #04 pc 000000000000b2ec  /vendor/lib64/hw/android.hardware.graphics.composer@2.1-impl.so (android::hardware::graphics::composer::V2_1::hal::detail::ComposerClientImpl<android::hardware::graphics::composer::V2_1::IComposerClient, android::hardware::graphics::composer::V2_1::hal::ComposerHal>::~ComposerClientImpl()+100)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #05 pc 000000000000b26c  /vendor/lib64/hw/android.hardware.graphics.composer@2.1-impl.so (_ZTv0_n24_N7android8hardware8graphics8composer4V2_13hal6detail18ComposerClientImplINS3_15IComposerClientENS4_11ComposerHalEED0Ev+36)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #06 pc 000000000000bdb0  /system/lib64/vndk-sp-28/libutils.so (android::RefBase::decStrong(void const*) const+112)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #07 pc 00000000000592b0  /system/lib64/vndk-sp-28/libhidltransport.so (android::hidl::base::V1_0::BnHwBase::~BnHwBase()+192)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #08 pc 0000000000034914  /system/lib64/vndk-28/android.hardware.graphics.composer@2.1.so (android::hardware::graphics::composer::V2_1::BnHwComposerClient::~BnHwComposerClient()+196)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #09 pc 0000000000034a74  /system/lib64/vndk-28/android.hardware.graphics.composer@2.1.so (_ZTv0_n24_N7android8hardware8graphics8composer4V2_118BnHwComposerClientD0Ev+36)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #10 pc 000000000000bdb0  /system/lib64/vndk-sp-28/libutils.so (android::RefBase::decStrong(void const*) const+112)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #11 pc 00000000000145e8  /system/lib64/vndk-sp-28/libhwbinder.so (android::hardware::IPCThreadState::joinThreadPool(bool)+184)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #12 pc 0000000000000e98  /vendor/bin/hw/android.hardware.graphics.composer@2.1-service
01-01 00:08:50.355 12519 12519 F DEBUG   :     #13 pc 0000000000000db8  /vendor/bin/hw/android.hardware.graphics.composer@2.1-service (main+232)
01-01 00:08:50.355 12519 12519 F DEBUG   :     #14 pc 00000000000ae7e0  /system/lib64/libc.so (__libc_init+88)

this is the error i’m getting from logcat

Do you have a monitor connected to the board?

no i didn’t but i was able to use the board normally if it was plugged in. i was able to get the ui over adb. but hdmi does not work still

I’m confused by this…
HDMI not plugged in → not working.
HDMI plugged in → working?
UI over ADB??? Explain.

Android requires a monitor to be plugged in.

so i was able to remotely see the screen with https://github.com/MajeurAndroid/Java-Adb-Remote-Screen but it requires the hdmi to be plugged in

@Zacchaeus_Liang is this for 3.4.2 or 3.8.3?

the branch that i’m using is 3.4.2

Hi @Zacchaeus_Liang,
Does your HDMI issue solved??If no,Please try with the following set of patches
https://android-review.googlesource.com/c/kernel/hikey-linaro/+/889696
https://android-review.googlesource.com/c/kernel/hikey-linaro/+/889697
https://android-review.googlesource.com/c/kernel/hikey-linaro/+/889698

1 Like

@sreegink do you have tried the patches with 3.8.3?

@sreegink @Zacchaeus_Liang @liuyunli @quincysquarrel

Just want to clarify some things. The 3.4.2 build can boot to the Home screen, but the kernel for the build has issues displaying properly on some/certain/many(?) monitors, which can be resolved by the 3 kernel/hikey-linaro (889696-889698) patches mentioned above. The 3.8.3 build cannot boot to the Home screen. The root cause is unknown. If any one of you guys can figure it out that’d be great, but applying those 3 patches won’t help, because they should have already been applied. You can verify by checking the source code under kernel/linaro/hisilicon-4.14.

@vchong
Is 3.4.2 the latest version that is known to be able to boot to home screen ? What about 3.6.x ?

You all can try below if you want. It’s a temporary/wip/messy/unsupported build so use at your own risk.

  • AOSP somewhere between 11 and 12
  • OP-TEE 3.9
  • Fully Clang built bootloader
  • FBE enabled by default
  • Kernel 4.14 (can possibly try building with 5.4 but haven’t tried and don’t know what will happen)
  • Boot to home screen. Ignore the initial home screen error message about problem with the device and contacting the manufacturer. It happens with stock AOSP builds too so not sure what’s going on there.
  • No adb over usb, but over tcp is ok

so i tried to flash the image and it didn’t work. I had to change my flashing script since i’m building remotely
essentially i’m copying over what’s in the device/linaro/hikey/installer/hikey960 and moving it onto my local machine

fastboot flash ptable ptable-aosp-32g.img
fastboot flash xloader hisi-sec_xloader.img
fastboot reboot-bootloader

fastboot flash fastboot l-loader.bin
fastboot flash fip fip.bin
#fastboot flash nvme hisi-nvme.img
fastboot flash nvme nvme_bs4096_js_raw.img
fastboot flash fw_lpm3 hisi-lpm3.img
fastboot flash trustfirmware hisi-bl31.bin
fastboot reboot-bootloader

fastboot flash ptable ptable-aosp-32g.img
fastboot flash xloader hisi-sec_xloader.img
fastboot flash fastboot l-loader.bin
fastboot flash fip fip.bin

fastboot flash boot boot.img
fastboot flash system system.img
fastboot flash vendor vendor.img

fastboot flash userdata userdata.img

my question is am i using the right files?

  1. You need to run the fastboot commands on the same machine that the hikey960 is plugged into via USB.
  2. The hikey960 needs to be in fastboot mode (see hardware documentation).
  3. Only the LAST FOUR of those lines listed are necessary or should be used regularly, since they are the only ones that actually change when you generate a build.
  4. The location for those files will be {AOSP ROOT}/out/target/platform/hikey960/ on the machine on which they are built.

1,2 i’m doing them
3. i’ll try doing that
4. yes and there’s a command to transfer to the other directory that i’m referring to
cp -a out/target/product/hikey/*.img device/linaro/hikey/installer/hikey/

EDIT: i flashed the last 4 lines and no lights turn on once it boots

Anything on your debug console or adb logcat?

no sign of life from the board

@Zacchaeus_Liang You’re using the right files but please remove all the fastboot reboot-bootloader commands. Those aren’t required anymore afaict. Also, the list of images to be flashed can be reduced to:

    fastboot flash ptable ptable-aosp-32g.img
    fastboot flash xloader hisi-sec_xloader.img
    fastboot flash fastboot l-loader.bin
    fastboot flash fip fip.bin
    fastboot flash nvme nvme_bs4096_js_raw.img
    fastboot flash boot boot.img
    fastboot flash system system.img
    fastboot flash vendor vendor.img
    fastboot flash userdata userdata.img

@doitright As mentioned previously in Disk encryption in android - #10 by vchong, the OP-TEE AOSP build scripts make changes to the bootloader sources, so users need to flash some of the other related partitions as well.