大家好,


我最近在尝试在飞腾d2000(arm64)上运行 鸿蒙OS。目前鸿蒙OS的驱动(hi_osal.ko, hi3516cv500_hdmi.ko, hifb.ko等, hdf.patch, hi3516dv300.patch)是否支持arm64?


Docker 编译rootfs: root@653b7eb4d81d:/home/openharmony# ./build.sh --product-name Hi3516DV300


编译 鸿蒙 rootfs时候,默认会编译 linux-5.10-stable最新的版本(当前为5.10.57)。编译时候使用ARCH=arm.

但是飞腾的ARCH为arm64. 所以在飞腾(ft-d2000 4核)上运行鸿蒙系统时, rootfs 里 vendor目录下得.ko模块无法插入到arm64的内核当中。


amos@osv:~/linux-5.10.57$ file arch/arm/boot/compressed/vmlinux

arch/arm/boot/compressed/vmlinux: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

amos@osv:~/linux-5.10.57$ file arch/arm/boot/zImage

arch/arm/boot/zImage: Linux kernel ARM boot executable zImage (little-endian)

amos@osv:~/linux-5.10.57$ file arch/arm/boot/Image

arch/arm/boot/Image: data

amos@osv:~/linux-5.10.57$ file arch/arm64/boot/Image

arch/arm64/boot/Image: MS-DOS executable PE32+ executable (EFI application) Aarch64 (stripped to external PDB) Mono/.Net assembly, for MS Windows

amos@osv:~/linux-5.10.57$ file arch/arm64/boot/Image.gz

arch/arm64/boot/Image.gz: gzip compressed data, max compression, from Unix, original size modulo 2^32 39156224

amos@osv:~/linux-5.10.57$


root@osv:/mnt/3h/oh3lts# file out/ohos-arm-release/sdk_linux/src_tmp/ko/hi_osal.ko out/ohos-arm-release/packages/phone/vendor/modules/hi_osal.ko

out/ohos-arm-release/sdk_linux/src_tmp/ko/hi_osal.ko:          ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=6b4bb478094f11d3844b4142b24b92fbd04848a8, not stripped

out/ohos-arm-release/packages/phone/vendor/modules/hi_osal.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=6b4bb478094f11d3844b4142b24b92fbd04848a8, not stripped

root@osv:/mnt/3h/oh3lts#


输入图片说明

输入图片说明

我尝试使用ARCH=arm64编译鸿蒙系统,错误很多。目测把鸿蒙编译链和hdf等patch移植到arm64的工作量不小。

root@653b7eb4d81d:/home/openharmony# ./build.sh --product-name Hi3516DV300
++++++++++++++++++++++++++++++++++++++++
2022-03-24 12:19:33
--product-name Hi3516DV300
build standard system...
---------------------------------------
--product-name Hi3516DV300 --device-name hi3516dv300 --target-os ohos --target-cpu arm64
build_ohos_cmd: build/build_scripts/build_ohos.sh product_name=Hi3516DV300 target_os=ohos target_cpu=arm64 gn_args=is_standard_system=true build_target=images
++++++++++++++++++++++++++++++++++++++++
2022-03-24 12:19:33
product_name=Hi3516DV300 target_os=ohos target_cpu=arm64 gn_args=is_standard_system=true build_target=images
pre_process
Python 3.8.5
OPTIONS=product_name
PARAM=Hi3516DV300
-------------------
OPTIONS=target_os
PARAM=ohos
-------------------
OPTIONS=target_cpu
PARAM=arm64
-------------------
OPTIONS=gn_args
PARAM=is_standard_system=true
-------------------
OPTIONS=build_target
PARAM=images
-------------------
product_name=Hi3516DV300 target_os=ohos target_cpu=arm64 gn_args=is_standard_system=true build_target=images
root_out_dir=//out/ohos-arm64-release
root_build_dir=//out/ohos-arm64-release
root_gen_dir=//out/ohos-arm64-release/gen
current_toolchain=//build/toolchain/ohos:ohos_clang_arm64
host_toolchain=//build/toolchain/linux:clang_x64
args: Namespace(build_platform_name='phone', build_xts=False, example_subsystem_file=None, gn_root_out_dir='/home/openharmony/out/ohos-arm64-release', ignore_api_check=['xts', 'common', 'subsystem_examples'], platforms_config_file='/home/openharmony/out/build_configs/standard_system/platforms.build', scalable_build=False, source_root_dir='/home/openharmony/', subsystem_config_file='/home/openharmony/out/build_configs/subsystem_config.json', target_cpu='arm64', target_os='ohos')
build configs generation is complete.
build_l2 = false
OHOS_PROFILER_DIR =  //developtools/profiler/
OHOS_PROFILER_3RDPARTY_DIR =  //third_party/
OHOS_PROFILER_3RDPARTY_GRPC_DIR =  //third_party//grpc
OHOS_PROFILER_3RDPARTY_PROTOBUF_DIR =  //third_party//protobuf
OHOS_PROFILER_3RDPARTY_GOOGLETEST_DIR //third_party//googletest
build_tests =  false
enable_debuginfo = false
enable_coverage = false
product_name : , Hi3516DV300
hi3516dv300_group in
arm64
buffer manager use target:
platform: ohos
platform: ohos
....
....
---- MPP_CFLAGS=-Wall -fsigned-char -DHI_RELEASE -DVER_X=1 -DVER_Y=0 -DVER_Z=0 -DVER_P=1 -DVER_B=10 -DUSER_BIT_32 -DKERNEL_BIT_32 -I/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/mpp/./../osal/include -I/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/mpp/./../mpp/include -I/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/mpp/./../mpp/include/adapt -I/home/openharmony//third_party/bounds_checking_function/include -Wno-date-time
make[4]: Entering directory '/home/openharmony/out/KERNEL_OBJ/kernel/src_tmp/linux-5.10'
---- SDK_PATH=/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/mpp/./.. , PARAM_FILE=./Makefile.param
---- KERNEL_ROOT=/home/openharmony//out/KERNEL_OBJ/kernel/src_tmp/linux-5.10
make[4]: Entering directory '/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/interdrv/common/cipher/src'
make[5]: Entering directory '/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/interdrv/common/cipher/mbedtls_prepare'
make[4]: Entering directory '/home/openharmony/out/KERNEL_OBJ/kernel/src_tmp/linux-5.10'
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_vmalloc.o
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_fileops.o
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_debug.o
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mno-sched-prolog'
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_atomic.o
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_init.o
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_addr.o
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mno-sched-prolog'
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mno-sched-prolog'
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_barrier.o
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mno-sched-prolog'
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mapcs'
clang-10: error: unknown argument: '-mno-sched-prolog'
scripts/Makefile.build:280: recipe for target '/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_atomic.o' failed
make[3]: *** [/home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_atomic.o] Error 1
make[3]: *** Waiting for unfinished jobs....
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_proc.o
clang-10: error: unknown argument: '-mno-sched-prolog'
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_wait.o
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_semaphore.o
clang-10: error: unknown argument: '-mapcs'
  CC [M]  /home/openharmony/out/ohos-arm64-release/sdk_linux/src_tmp/src/osal/linux/osal_schedule.

Thanks, Amos