[HIKEY620] boot.img not generated and other img generated in out/target/product/generic
DamienLieupart opened this issue · 28 comments
Hi all,
I got a Hikey 620 board. I managed to put optee + debian without any problem with this link: https://github.com/OP-TEE/build
I then tried to put optee + aosp on my hikey 620 board. I followed the link https://github.com/linaro-swg/optee_android_manifest
In the part "4. Flashing the image" the img files are not present in out/target/product/hikey/ but in out/target/product/generic/.
In addition, the boot.img is not generated.
Do you have any idea ?
Thanks for your help.
Which branch are you using? Please use https://github.com/linaro-swg/optee_android_manifest/tree/lcr-ref-hikey-o or https://github.com/linaro-swg/optee_android_manifest/tree/hikey-n-4.9-master if you're using something else.
It looks like you're not building for hikey620. Did you run source ./build/envsetup.sh; lunch hikey-userdebug
first?
Note: Edited for context/accuracy.
Hi vchong,
Thanks for your quick answer, i have followed tutorial step by step.
Branch is :repo init -u https://android-git.linaro.org/git/platform/manifest.git -b android-7.1.2_r33 -g "default,-non-default,-device,hikey,fugu"
So yes i run source ./build/envsetup.sh; lunch hikey-userdebug first.
I will try your branch and I will come back to you.
So you're using the hikey-n-4.9-master
(default) branch which should be fine as well. This is the N
version while the one given above is the O
version. Not sure what happened to your build. Suggest you try again, or check the build logs for errors.
Hi vchong,
Exactly same problem :( Folder out/target/product/hikey doesn't exist and boot.img
is not generated
./build/envsetup.sh; lunch hikey-userdebug :
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=hikey
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPR1
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a15
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-104-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPR6.170623.023
OUT_DIR=out
AUX_OS_VARIANT_LIST=
No error had been detected in log :+1:
Creating filesystem with parameters:
Size: 2147483648
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 8192
Label: system
Blocks: 524288
Block groups: 16
Reserved block group size: 127
Created filesystem with 5031/131072 inodes and 177564/524288 blocks
[100% 62349/62349] Install system fs image: out/target/product/generic/system.img
Please read and follow the instructions instructions carefully! It's source ./build/envsetup.sh; lunch hikey-userdebug
, NOT ./build/envsetup.sh; lunch hikey-userdebug
. They're not the same. ./build/envsetup.sh
will not setup the environment properly (actually, not at all). On my system (Ubuntu-14.04), ./build/envsetup.sh
doesn't even run and generates a Permission denied
error. Not sure why Ubuntu 16.04 lets you do it.
In any case, the output should be something like below:
> source ./build/envsetup.sh; lunch hikey-userdebug
including device/generic/car/car-arm64/vendorsetup.sh
including device/generic/car/car-armv7-a-neon/vendorsetup.sh
including device/generic/car/car-x86_64/vendorsetup.sh
including device/generic/car/car-x86/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=hikey
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPR1
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a15
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-97-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPR6.170623.023
OUT_DIR=out
AUX_OS_VARIANT_LIST=
============================================
You don't have to run both commands at the same time. The README runs them one at a time. You can do that too to make sure the first command runs ok before the second one.
yes, i have followed exactly step by step the tutorial.
i worked on ubuntu 16.04. It is the only one difference between us.
1@ESF-Station:~/devel/opteeHikeyAOSPV8$ source ./build/envsetup.sh
including device/generic/car/car-arm64/vendorsetup.sh
including device/generic/car/car-armv7-a-neon/vendorsetup.sh
including device/generic/car/car-x86_64/vendorsetup.sh
including device/generic/car/car-x86/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
1@ESF-Station:~/devel/opteeHikeyAOSPV8$ lunch hikey-userdebug
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=hikey
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_PLATFORM_VERSION=OPR1
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a15
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-104-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPR6.170623.023
OUT_DIR=out
AUX_OS_VARIANT_LIST=
Ok. Let me try a build to see if I can reproduce. Note that the build has just been upgrade to 8.1.0_r7
.
my following make command :
1@ESF-Station:~/devel/opteeHikeyAOSPV8$ sudo make -j12 TARGET_BUILD_KERNEL=true TARGET_BOOTIMAGE_USE_FAT=true CFG_SECURE_DATA_PATH=y CFG_SECSTOR_TA_MGMT_PTA=y TARGET_TEE_IS_OPTEE=true TARGET_BUILD_UEFI=true
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=8.0.0
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-4.4.0-104-generic-x86_64-with-Ubuntu-16.04-xenial
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=OPR6.170623.023
OUT_DIR=out
That's the problem. Why sudo
?
Thanks a lot for your support again.
Same problem with android-7.1.2_r33
.
For right access. I can try without.
Do you have problems building without sudo
? If not, just build without sudo
. The build environment is setup for the current user but you're building as a different user (root
).
Please delete the out
folder first, i.e. rm -rf out
, before rebuilding without sudo
.
Okay thanks, i removed out folder and rebuild without sudo. I let you inform.
i got en error without sudo :
15:25:38 ninja failed with: exit status 1
build/core/main.mk:21 : la recette pour la cible « run_soong_ui » a échouée
Sorry but I don't read French. In any case, this is not an op-tee related error. Suggest you make sure you can build just android (i.e. regular android with op-tee) first without any issues.
https://source.android.com/setup/devices (see HiKey boards section)
See https://discuss.96boards.org/t/couple-of-videos-to-get-you-started-on-the-hikey960-aosp/1825/5 for someone with the same error (but different board). Did you install all the dependencies first?
Hi vchong,
I try to build just android with your link (https://source.android.com/setup/devices (see HiKey boards section)). It works fine. I can build and load board without any problem.
I try to begin from scratch with this tuto to get optee with AOSP.
There is problem in build :
CAT arch/arm64/boot/Image-dtb
ninja: build stopped: subcommand failed.
18:15:04 ninja failed with: exit status 1
failed to build some targets (09:48 (mm:ss))
In log i can see error :
LD out/arm-plat-hikey/core/tee.elf
out/arm-plat-hikey/core/arch/arm/kernel/thread_a64.o: In function `el0_sync_abort':
/home/X/devel/opteeAOSP/optee/optee_os/core/arch/arm/kernel/thread_a64.S:800:(.text.el0_sync_abort+0xf4): relocation truncated to fit: R_AARCH64_TSTBR14 against `.text.thread_vect_table'
out/arm-plat-hikey/core/arch/arm/kernel/thread_a64.o: In function `elx_fiq':
/home/X/devel/opteeAOSP/optee/optee_os/core/arch/arm/kernel/thread_a64.S:971:(.text.elx_fiq+0x9c): relocation truncated to fit: R_AARCH64_TSTBR14 against `.text.thread_vect_table'
core/arch/arm/kernel/link.mk:150 : make for target « out/arm-plat-hikey/core/tee.elf » failed
make[1]: *** [out/arm-plat-hikey/core/tee.elf] Error 1
make[1] : leave directory « /home/X/devel/opteeAOSP/optee/optee_os »
CircuitCo HiKey RELEASE fail
pass 0
fail 1
Makefile:26 : make for target « /home/X/devel/opteeAOSP/out/dist/fip.bin »failed
make: *** [/home/X/devel/opteeAOSP/out/dist/fip.bin] Error 1
make : leave directory « /home/X/devel/opteeAOSP/device/linaro/hikey/bootloader »
Part : 3.6. Build the booloader firmware (fip.bin) [OPTIONAL] failed with same error
Did you try to build with Ubuntu 16.04
?
Thanks for your help.
Hi vchong,
Could you please send me your manifest to rebuilt a stable version AOSP+OPTEE on Hikey620, so that I could check my build environment setup.
Thanks in advance.
@DamienLieupart I can reproduce. Will investigate and update.
Hi vchong,
Okay and thanks for your support.
@DamienLieupart Fixed by op-tee team. Please run repo sync optee/optee_os
and rebuild (i.e. Section 3.7).
Thanks, i will try asap
Hi vchong,
I managed to build and load AOSP + optee with the last fix of op-tee team :)
I can know try to develop CA and TA.
Thanks again for your support.
You're welcome and good luck.
You might want to try reading below threads for references on developing your own CA/TA. Note that some info might already be outdated.
OP-TEE/optee_os#903
OP-TEE/optee_os#1809
linaro-swg/hello_world#14
Thanks, i managed to developing CA/TA on optee on qemu and hikey.
I thinks toolchains is different for optee + AOSP.
I will try and check your links.
Thanks.
Hi vchong,
I managed to compile CA/TA using full environment with make command find in subject linaro-swg/hello_world#14.
Now, I want to extract toolchains and library to compile CA/TA in smaller environment.
I already make this job for Qemu and optee on Hikey.
I have set exports in makefile of optee_examples :
export TA_DEV_KIT_DIR =optee_os/out/arm/export-ta_arm32
export TEEC_EXPORT =optee_client/out/export
export HOST_CROSS_COMPILE =aarch64/bin/aarch64-linux-gnu-
export TA_CROSS_COMPILE = aarch32/bin/arm-linux-gnueabihf-
For optee aosp :
for TA_DEV_KIT_DIR : optee/optee_os/out/arm-plat-hikey/export-ta_arm32(64)
for TEEC_EXPORT : out/target/product/hikey/system/lib(64)/libteec.so and external/optee_client/out/export/include
for HOST_CROSS_COMPILE : prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux-
for TA_CROSS_COMPILE :
32bits --> prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/arm-linux-androideabi-
64bits --> prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
When i compiled CA i have error :
32bits -> cannot find -lteec
64bits -> libteec.so : unsupported ELF mechine number 183
Maybe i wrong with HOST_CROSS_COMPILE ?
Other question linked, for Qemu and optee on hikey, CA are compiled in 64bits and TA in 32 bits.
For optee + AOSP on hikey, TA seems to be compiled in 64 bits ?
Thanks for your help.
Please create a new issue next time since the original issue has been resolved and unrelated to the latest question.
For the Android build, Android makefiles are used, not the regular Makefile
s. Additionally, the CA/TA Android makefiles were written to build in the full environment only. If you want to build them separately or in a smaller environment, you'll have to rewrite the Android makefiles yourself, but I've never tried that so not sure if it'll work. There might be a lot of dependencies required from the full build and we don't have a list of what all of them are. At minimum you'll need at least ndk and bionic.
In any case, yes, your HOST_CROSS_COMPILE is wrong. Regardless of Linux or Android, it has to be a cross compiler as well. HOST_CROSS_COMPILE is the cross compiler for the CA located in the host
dir, which runs on the target system, not the host system.
TAs are compiled in 64 bits for AOSP. No special reason other than the Makefiles were written like that from the beginning. TA_DEV_KIT_DIR
needs to specify export-ta_arm64
in this case.
Hi vchong,
I'm sorry, you are right, I will create new issue next time.
Thanks for clarifications it's clearer now.