How can I build HIkey960 with 32-bit build as by default it is 64 bit build system


#1

Hi, I am download the Android SDK - Oreo and done the build for the HiKey960 platform with 64-bit , But I want to build the same for 32-bit, than what are changes I have to made and is there any option for the 32 bit build.

Could you please suggest the steps or procedure for 32-bit build on Android Oreo for HiKey960.


#2

May I ask you why ?

I’m not sure you can have a full 32-bit system, It’s possible that kernel must be 64-bit (because of the bootloader), but if kernel is built with CONFIG_COMPAT, you can run a 32-bit userspace. You can look at Boardconfig file in /aosp/device/linaro/hikey/hikey32 to have an example of 32-bit build config.


#3

Thanks Loic,

I have seen the file aosp/device/linaro/hikey/BoardConfigCommon.mk , but there is not hikey32 path in the aosp.

below is the configuration:

Primary Arch

TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_ABI := arm64-v8a

Secondary Arch

TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi

TARGET_USES_64_BIT_BINDER := true
TARGET_SUPPORTS_32_BIT_APPS := true
TARGET_SUPPORTS_64_BIT_APPS := true

Can I make primary architecture as 32-bit ? it is possible?
if not possible , please let me know how to build 32bit application on 64-bit hikey960 platform? where and all I have to change/modify the code?


#4

So am I to understand that your reason for wanting to build a 32bit OS for the hikey960 is so that you can run 32bit userspace applications? If that is the reason, then you don’t need to do anything at all – IT ALREADY CAN. That is what “secondary arch” means.

If you are building a native library or application (Java applications run in ART, which is host architecture agnostic from a user application standpoint), you can target 32bit ARMv7 by specifying it in your application.mk or build.gradle


#5

Like @doitright said, you can run your 32-bit ARMv7 app on a 64-bit ARMv8, CPU is capable to switch between aarch64 and aarch32. However if your app use libraries (e.g. libc/bionic) you will need a 32-bit version of these libraries as well.


#6

Just to add minimally to that, most of those 32bit libraries are present, in fact, everything that the NDK would rely on.


#7

Thanks doitright and Loic.

But I have an third party application code (C and C++ Code) which is of 32 bit and I need to integrate it with Android Oreo(Hikey960) which is of 64 bit as a main architecture.

when I want to build my 32 bit application than, I have to use 32bit tool chain from the hiKey960 platform code.

is the 32 bit tool chain available for 32 bit application build ? if yes where I have to refer as am example?

also let me know the folder to check for 32 bit tool chain.


#8

I don’t understand the question. Whether you are building as ndk or part of the platform doesn’t matter, just tell the compiler to build it the way you want and it will sort out the libraries.

But if it’s c/c++ code, why don’t you build it 64 bit?


#9

No, I can not build my application as 64-bit , there are some dependencies.
if I have to include my application in system.img file as a 32-bit build application ? is it possible and how?


#10

I didn’t ask you if you did. I asked you if you COULD. What are the dependencies?
You would include a 32 bit in the system image in the exact same way as a 64 bit.