This is a cache of https://discuss.96boards.org/t/cross-compilation-tools/1431. It is a snapshot of the page at 2024-10-31T05:19:06.274+0000.
Cross compilation tools - MediaTek-X20 - 96Boards Forum

Cross compilation tools

It is important for the build what the Embedded device code that the cross compilation tools.For the android devices, we are interested in the device’s cross-compilation tool.
In the $(project)/kernel-3.18/Android.mk file, the information about the build command as follow:
KERNEL_MAKE_OPTION := O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) ROOTDIR=$(KERNEL_ROOT_DIR) $(if $(strip $(SHOW_COMMANDS)),V=1)

$(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPTION) $(KERNEL_DEFCONFIG)

Due to the makefile can print the command that perform compilation, we can find the information for the build log. In the log, there is information about the cross compilation tools:
make -C kernel-3.18 O=/work/dongyong/MT6797_Android_Marshmallow_6.0/out/target/product/amt6797_evb_m/obj/KERNEL_OBJ ARCH=arm64 CROSS_COMPILE=/work/dongyong/MT6797_Android_Marshmallow_6.0/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android- ROOTDIR=/work/dongyong/MT6797_Android_Marshmallow_6.0 amt6797_evb_m_debug_defconfig
There is the gcc tool what is name to aarch64-linux-android-gcc-4.9 in the $(project)/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin directory’s information :
So the cross-compilation tool is $(project)/prebuilts/gcc/linux-x86/aarch64/-
-aarch64-linux-android-4.9/bin/aarch64-linux-android-gcc
2.For example we can build a executable file by using the tool.
The Sample code as follow:
#include <stdio.h>
struct a{
int i;
};
int main()
{
struct a aa;
aa.i = 10;
printf("====dyong====aa.i=%d\n",aa.i);
return 0;
}
The makefile:
MY_OUT=/work/dongyong/MT6797_Android_Marshmallow_6.0/out/target/product/a mt6797_evb_m
MY_ANDROID_TOOLCHAIN=/work/dongyong/MT6797_Android_Marshmallow_6.0/pre builts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin
MY_ANDROID_BUILD_TOP=/work/dongyong/MT6797_Android_Marshmallow_6.0

CC=$(MY_ANDROID_TOOLCHAIN)/aarch64-linux-android-gcc
INCLUDE= -I$(MY_ANDROID_BUILD_TOP)/bionic/libc/arch-arm64/include -I$(MY_ANDROID_BUILD_TOP)/bionic/libc/kernel/uapi/asm-arm64 -I$(MY_ANDROID_BUILD_TOP)/bionic/libm/include -I$(MY_ANDROID_BUILD_TOP)/bionic/libm/include/arm64
LDFLAGS= -nostdlib -Bdynamic -fPIE -pie -Wl,-dynamic-linker,/system/bin/linker64 -Wl,–gc-sections -Wl,-z,nocopyreloc -L$(MY_OUT)/obj/lib -Wl,-rpath-link=$(MY_OUT)/obj/lib $(MY_OUT)/obj/lib/crtbegin_dynamic.o -Wl,–whole-archive -Wl,–no-whole-archive -lc -lstdc++ -lgcc -lm -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,–warn-shared-textrel -Wl,–fatal-warnings -Wl,–no-undefined -ldl

main:
$(CC) $(INCLUDE) $(LDFLAGS) amt_example.c -o amt_example
Running the follow command to generate executable files amt_example.
$make
Pushing the executable file to android devices by the adb tool.
Using the adb tool connect the android devices, execute the amt_example and get the results as follow:

Your post doesn’t include that actual output but… third-party code for Android is normally compiled using the Android NDK rather than grabbing the compiler used to build the system image.

I’m new to 96boards and have some basic questions.
I’ve used DS-5 and a Panda board+Linux to do NEON developments for ARMv7+Neon. Remote GDB via Ethernet for full register level debug. I could obtain real time processor loading via the PMU.
I’m looking for a set-up to allow the same for ARMv8 + AArch64. The MediaTek-X20 looks good in that it has both A72 and A53 so I’m hoping to be able to profile option on both platforms. My questions are:

  1. Is there AArch64 Linux for this board?
  2. Can I use DS-5 for IDE? Any other suggestions?
  3. How do I get my code to run on A72/A53 specifically?

Thanks for your help

I’m so sorry to tell you that the device only support the Android system.

Thanks for you review. I want to tell some information about the device, I guess that worker who work on the embedded device should care of the information. Of course, I am to post a message that include that actual output.

Thanks

There is a community project forming to try and bring GNU/Linux to X20 but its very early days (getting the basics working will probably come together fairly quickly but I suspect it will be a very long time before we get GFX working on GNU/Linux):