一、代码下载

 代码下载5.0.3命令:

    repo init -u https://gitee.com/cooperation-teams-tv/manifest -b OpenHarmony-5.0.3-Release

    repo sync -c -j8

    repo forall -c git lfs pull

 编译v900:

         bash build/prebuilts_download.sh --skip-ssl 

        ./build.sh --product-name mp_ohos --ccache --patch  (第二次编译不用带--patch参数)

二、常见编译问题

2.1 编译kernel时,clang工具找不到-mno-outline-atomics参数,导致失败。

解决办法卸载系统clang工程,让走工程里面clang编译工具链。

查看系统是否安装
clang --version
卸载系统默认clang工具链
sudo apt remove clang
sudo apt purge --autoremove clang

FAILED: build_kernel 
/usr/bin/env ../../device/soc/hisilicon/honghu/sdk_linux/kernel/build_kernel.sh /home/mattli/wrokcode/07.TV_5.0.3-Release/ tv shaolingun shaolingun root arm64 linux-5.10
build kernel start
/home/mattli/wrokcode/07.TV_5.0.3-Release/out/shaolingun/linux-5.10/Makefile:507: "Makefile comm-feature-dir=../comm_feature/, CFG_CHIP_NAME=hi3751v900, pwd=/home/mattli/wrokcode/out/shaolingun/sdk_obj/KERNEL_OBJ_D"
  GEN     Makefile
scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead
  CC      scripts/mod/empty.o
  CC      scripts/mod/devicetable-offsets.s
clang: error: unknown argument: '-mno-outline-atomics'
make[3]: *** [/home/mattli/wrokcode/07.TV_5.0.3-Release/out/shaolingun/linux-5.10/scripts/Makefile.build:117: scripts/mod/devicetable-offsets.s] Error 1
make[3]: *** Waiting for unfinished jobs....
clang: error: unknown argument: '-mno-outline-atomics'

2.2 编译kernel时,ld.lld工具无法正常链接,导致编译失败。

解决办法卸载系统lld工程,让走工程里面lld编译工具链。

查看系统是否安装
ld.lld --version
卸载系统默认lld工具链
sudo apt remove lld
sudo apt purge --autoremove lld

[6937/51691] ACTION //device/soc/hisilicon/honghu/sdk_linux:build_kernel(//build/toolchain/ohos:ohos_clang_arm64)
FAILED: build_kernel 
/usr/bin/env ../../device/soc/hisilicon/honghu/sdk_linux/kernel/build_kernel.sh /home/mattli/wrokcode/07.TV_5.0.3-Release/ tv shaolingun shaolingun root arm64 linux-5.10
build kernel start
ld.lld: error: incompatible section flags for .init.data
>>> kernel/built-in.a(panic.o):(.init.rodata): 0x2
>>> output section .init.data: 0x83

ld.lld: error: incompatible section flags for .init.data
>>> kernel/built-in.a(cpu.o):(.init.rodata): 0x2
>>> output section .init.data: 0x83

ld.lld: error: incompatible section flags for .init.data
>>> kernel/built-in.a(resource.o):(.init.rodata): 0x2
>>> output section .init.data: 0x83

ld.lld: error: incompatible section flags for .init.data
>>> kernel/built-in.a(capability.o):(.init.rodata): 0x2
>>> output section .init.data: 0x83

ld.lld: error: incompatible section flags for .init.data
>>> kernel/built-in.a(signal.o):(.init.rodata): 0x2
>>> output section .init.data: 0x83

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
Logo

社区规范:仅讨论OpenHarmony相关问题。

更多推荐