linaro-swg/optee_android_manifest

How to build AOSP + OP-TEE (Not working)

emanuelfc opened this issue · 17 comments

Hello,

I'm currently attempting to build AOSP+OPTEE following the official AOSP+OPTEE guide from https://optee.readthedocs.io/building/aosp/aosp.html but to no avail.

Board = HiKey960

Steps:

  1. Download AOSP
    repo init -u https://android.googlesource.com/platform/manifest -b master
    Base Directory = optee-hikey960
  2. Clone optee_android_manifest
    git clone https://github.com/linaro-swg/optee_android_manifest
    cd optee_android_manifest

Now i copied all the contents of the optee_android_manifest inside the Base Directory, that is all the scripts and folders inside optee_android_manifest will be inside Base Directory.

  1. Sync and Build using scripts
    ./sync-p-hikey960.sh
    ./build-p-hikey960.sh

Now this went along with no issues whatsoever including flashing (using the instructions), however when i turned on the HiKey960 board and attempt to run xtest, it failed because it did not exist... neither were any optee logging in dmesg.

Am i correctly following the instructions? At first they did not seem clear as i attempted to simply sync and build using the scripts but it was simply not working. Is there anything else?

Kind regards.

I think you're mixing up the regular build steps (https://source.android.com/source/devices.html), which uses manual build instructions, with our build steps (https://optee.readthedocs.io/building/aosp/aosp.html) which uses build scripts.

Just run steps 2 and 3 you mentioned above. No need to do step 1. No need to copy or move anything anywhere. Probably best if you start from scratch so prevent any mix ups from breaking the build.

I think you're mixing up the regular build steps (https://source.android.com/source/devices.html), which uses manual build instructions, with our build steps (https://optee.readthedocs.io/building/aosp/aosp.html) which uses build scripts.

Just run steps 2 and 3 you mentioned above. No need to do step 1. No need to copy or move anything anywhere. Probably best if you start from scratch so prevent any mix ups from breaking the build.

Thanks! I did exactly as you said before posting this, but there were no folders (such as build) in the base directory, which made me believe there was more to it. However i figured it out that ./sync-p-hikey960.sh was stopping because error: Exited sync due to fetch errors. It seems that arm-trusted-firmware is not correctly fetching and remains empty after many attempts at running the script. However i can safely execute git clone https://github.com/ARM-software/arm-trusted-firmware. I have attempted at cloning it and putting it into the required folder, but to no success. Any ideas on how i could solve this?

Good catch. Looks like the integration branch of https://github.com/ARM-software/arm-trusted-firmware was deleted! :( I'm checking with ARM to see if the branch can be pushed back.

As a workaround, for all the .xml files under archive/, look for a line that contains name="ARM-software/arm-trusted-firmware.git" path="optee/arm-trusted-firmware" upstream="integration", and replace integration with master. Then run sync again.

TF on GitHub is a read-only mirror. Maybe better change the manifest to use git.trustedfirmware.org which is the official upstream tree since a while back?

Ok, will change to the new url moving forward, but what about previous releases? Should I overwrite those?

Let's wait until there is someone out here actually asking for an old OP-TEE/AOSP build. When that happens we can just add an additional commit on top of previous releases, i.e., change the "patch-version" (see semver).

Btw, what's the reason for having used the integration branch? Would it be possible to switch to the master branch instead?

Ok. I guess I can add a patch release.

Btw, what's the reason for having used the integration branch? Would it be possible to switch to the master branch instead?

To save having to wait a few days for the latest, especially when patches are submitted, which was more frequent back then, but a lot less nowadays. Guess it's not such a good decision anymore. Yes, we'll switch to the new url and the master branch from now on.

Pushed fix to master and updated all manifests to use master branch of git.trustedfirmware.org/TF-A/trusted-firmware-a.git.

@emanuelfc please confirm fix and close issue. Thanks.

Changing all .xml files in archive/ and changing upstream="integration" to upstream="master" seems to have worked, thanks!

Don't know if this issue is related to this but i have a similar issue to issue #51 - Error when open file device/linaro/hikey/installer/hikey960/hisi-sec_usb_xloader.img ./flash-all.sh: line 57: 2364 Segmentation fault sudo "${INSTALLER_DIR}"/hikey_idt -c "${INSTALLER_DIR}"/config -p "${DEVICE_PORT}"

@emanuelfc Please run the flash all script from root of your source tree, i.e.

sudo ./device/linaro/hikey/installer/hikey960/flash-all.sh /dev/ttyUSBn
replace n with the proper number

@emanuelfc Please run the flash all script from root of your source tree, i.e.

sudo ./device/linaro/hikey/installer/hikey960/flash-all.sh /dev/ttyUSBn
replace n with the proper number

It seems to have corrected the problem, however after flashing the recovery images, the board does not change to fastboot mode, even when done manually... It seems the recovery process of the script messed up fastboot.

Please provide logs from both your pc and the board.

Sorry but I'm not able to debug this now. Please try the prebuilt recovery.bin here (and fip.bin here too, but only if necessary) to see if it helps.

Been having a constant battle with the board, has it halts in sending sparse 'system'. The only thing that seems to be working is using the recovery provided by 96boards for HiKey960, as suggested by @tesmnorth (was doing this for a few days now):

@emanuelfc Did you try this: https://github.com/96boards-hikey/tools-images-hikey960

Sorry i have no logs aside from output of the scripts because i have no UART at the moment.

I was finally able to fully complete executing the flash script with no errors, unfortunately it did not boot. (No HDMI output, no LEDs flashing in the board)

@emanuelfc Sorry, not sure if this is still useful to you, but if required please try https://github.com/linaro-swg/optee_android_manifest/tree/master-dirty#build-guide. Note that this is a temporary out-of-tree build for testing only.