OpenHarmony 4.0 Release 编译及报错

news/2024/2/29 2:40:16

1、环境准备

安装下面这三东西,是为了下载 Harmony 源码

sudo apt install curl
sudo apt install python3-pip
sudo apt install git-lfs

安装下面这五个东西,是为了解决编译到最后报错(头铁不信的,你可以试试,等最后再安装)

sudo apt install default-jdk
sudo apt install mtd-utils
sudo apt install scons
sudo apt install gcc-arm-none-eabi
sudo apt install gcc-arm-linux-gnueabi

sudo apt-get install libxt-dev

sudo apt-get install libx11-dev

sudo apt install xorg-dev

sudo apt-get install liblz4-tool

sudo apt install dwarves

2、安装 repo


务必按照此步骤安装repo。ubuntu默认提供的repo每次启动都会访问googlge服务器,会被墙。
此外20.04下需要root身份执行–否则提示没权限。
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo
chmod a+x /usr/local/bin/repo
pip3 install -i Simple index requests

3、下载源码


[官网版本更新说明}(docs: OpenHarmony documentation | OpenHarmony开发者文档 - Gitee.com)

目前最新为 4.0 版本,内核基于 5.10,老版本 2.x 1.x 已经停止维护,内核基于 4.19

参考官网下载方式

repo init -u OpenHarmony/manifest -b OpenHarmony-4.0-Release --no-repo-verify
repo sync -c
repo forall -c ‘git lfs pull’

注意那个 4.0 之前没有 v,以前的版本是有这个 v 的,不然会初始化失败,还有就是注意检查电脑是否断网了

4、下载编译依赖工具包


源码下载完成后,进入根目录执行 bash build/prebuilts_download.sh

看你网速快慢,我这大概10分钟,下载完成后会多出 openharmony_prebuilts 文件夹

5、编译源码


./build.sh --product-name rk3568 --ccache

第一次编译前面阶段 2W 多个文件,后面阶段 6W 多个文件,整体时间看你电脑性能。

编译中间要是出错看提示就行,少啥就自行安装,比如这种

default-jdk is not installed. please install it.
mtd-utils is not installed. please install it.
scons is not installed. please install it.
gcc-arm-none-eabi is not installed. please install it.
gcc-arm-linux-gnueabi is not installed. please install it.
Missing dependencies, please check!
[OHOS INFO] Set cache size limit to 100.0 GB
[OHOS INFO] generated build prop info to /hom

nce:sync_fence
All rules passed
Do NO-Config-Cmds-In-Init rule checking now:
[WARNING]: local_code_sign is not in start cmd list.  path:/system/etc/init/local_code_sign.cfg
[WARNING]: intell_voice_service is not in start cmd list.  path:/system/etc/init/intell_voice_service.cfg
  Please refer to: https://gitee.com/openharmony/developtools_integration_verification/tree/master/tools/startup_guard/rules/NO-Config-Cmds-In-Init/README.md
Do NO-Config-SystemParameter-In-INIT rule checking now:
Please modify according to README.md
[OHOS INFO] rk3568 build success
[OHOS INFO] Cost time:  1:58:23
=====build  successful=====
2023-11-29 11:47:19
++++++++++++++++++++++++++++++++++++++++
 

---------------------------------------------------------------------------------------------------------------------------------

6、编译错误

1、fatal error: X11/XXXX.h: No such file or directory

[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/init.c:28:
[OHOS ERROR] In file included from ../../third_party/flutter/glfw/src/internal.h:169:
[OHOS ERROR] ../../third_party/flutter/glfw/src/x11_platform.h:39:10: fatal error: 'X11/Xcursor/Xcursor.h' file not found
[OHOS ERROR] #include <X11/Xcursor/Xcursor.h>
[OHOS ERROR]          ^~~~~~~~~~~~~~~~~~~~~~~
[OHOS ERROR] 1 error generated.
[OHOS ERROR] [7497/20650] CC clang_x64/obj/third_party/flutter/glfw/src/glfw/input.o
[OHOS ERROR] FAILED: clang_x64/obj/third_party/flutter/glfw/src/glfw/input.o

sudo apt-get install libxt-dev

sudo apt-get install libx11-dev

sudo apt install xorg-dev

2、error: use of undeclared identifier 'strlen'

[OHOS ERROR]     idxVal = (idxVal >= projectModels.size()) ? 0 : idxVal;
[OHOS ERROR]               ~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
[OHOS ERROR] ../../ide/tools/previewer/util/CommandParser.cpp:785:36: warning: comparison of integers of different signs: 'int' and 'std::vector::size_type' (aka 'unsigned long') [-Wsign-compare]
[OHOS ERROR]     if (enumValue < 0 || enumValue >= projectModels.size()) {
[OHOS ERROR]                          ~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~
[OHOS ERROR] ../../ide/tools/previewer/util/CommandParser.cpp:855:24: error: use of undeclared identifier 'strlen'
[OHOS ERROR]     size_t argLength = strlen(str);
[OHOS ERROR]                        ^
[OHOS ERROR] 2 warnings and 1 error generated.

CommandParser.cpp 添加

#include <string.h>

3、kernel编译报错|/bin/sh: 1: lz4c: not found

  SORTTAB vmlinux
  SYSMAP  System.map
  OBJCOPY arch/arm64/boot/Image
  LZ4     arch/arm64/boot/Image.lz4
/bin/sh: 1: lz4c: not found
make[3]: *** [/home/kevin/disk/code/OpenHarmony4.0/out/kernel/src_tmp/linux-5.10/arch/arm64/boot/Makefile:31: arch/arm64/boot/Image.lz4] Error 127
make[3]: *** Deleting file 'arch/arm64/boot/Image.lz4'
make[2]: *** [arch/arm64/Makefile:162: Image.lz4] Error 2
make[1]: *** [arch/arm64/Makefile:208: rk3568-toybrick-x0-linux.img] Error 2
make[1]: Leaving directory '/home/kevin/disk/code/OpenHarmony4.0/out/kernel/OBJ/linux-5.10'
make: *** [Makefile:185: __sub-make] Error 2

sudo apt-get install liblz4-tool

4、 error: Cannot resolve BTF IDs for CONFIG_DEBUG_INFO_BTF, please install libelf-dev, libelf-devel or elfutils-libelf-devel

[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/dma.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/emergency-restart.h
[OHOS ERROR] error: Cannot resolve BTF IDs for CONFIG_DEBUG_INFO_BTF, please install libelf-dev, libelf-devel or elfutils-libelf-devel
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/hw_irq.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/irq_regs.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/kdebug.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/kmap_types.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/local.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/local64.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/mm-arch-hooks.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/mmiowb.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/msi.h
[OHOS ERROR] make[2]: *** [/home/kevin/disk/code/OpenHarmony4.0/out/kernel/src_tmp/linux-5.10/Makefile:1295: prepare-resolve_btfids] Error 1
[OHOS ERROR] make[2]: *** Waiting for unfinished jobs....
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/serial.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/switch_to.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/trace_clock.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/unaligned.h
[OHOS ERROR]   WRAP    arch/arm64/include/generated/asm/vga.h
[OHOS ERROR] make[1]: *** [arch/arm64/Makefile:208: rk3568-toybrick-x0-linux.img] Error 2
[OHOS ERROR] make[1]: Leaving directory '/home/kevin/disk/code/OpenHarmony4.0/out/kernel/OBJ/linux-5.10'
[OHOS ERROR] make: *** [Makefile:185: __sub-make] Error 2
[OHOS ERROR] Traceback (most recent call last):

sudo apt install dwarves

修改文件路径:

/OpenHarmony4.0/kernel/linux/config/linux-5.10/arch/arm64/configs/

k3568_standard_defconfig6608 CONFIG_DEBUG_INFO_BTF=y

修改为 : 

rk3568_standard_defconfig6608 CONFIG_DEBUG_INFO_BTF is not set

5、 genext2fs: command not found


[OHOS ERROR] E/write_index_tbl(1498): try to write index entry(./arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0-linux.dtb)...
[OHOS ERROR] E/write_index_tbl(1515): mod fdt path:./arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0-linux.dtb -> rk-kernel.dtb...
[OHOS ERROR] E/write_index_tbl(1498): try to write index entry(logo.bmp)...
[OHOS ERROR] E/write_index_tbl(1498): try to write index entry(logo_kernel.bmp)...
[OHOS ERROR]   Image:  resource.img (with rk3568-toybrick-x0-linux.dtb logo.bmp logo_kernel.bmp) is ready
[OHOS ERROR] make[1]: Leaving directory '/home/kevin/disk/code/OpenHarmony4.0/out/kernel/OBJ/linux-5.10'
[OHOS ERROR] ~/disk/code/OpenHarmony4.0/out/rk3568
[OHOS ERROR] blocks = 4096  block_size 16384
[OHOS ERROR] ../kernel/src_tmp/linux-5.10/make-boot.sh: line 22: genext2fs: command not found
[OHOS ERROR] Traceback (most recent call last):

sudo apt install genext2fs


https://www.xjx100.cn/news/3118980.html

相关文章

Web实现悬浮球-可点击拖拽禁止区域

这次要实现的是这种效果&#xff0c;能够在页面上推拽和点击的&#xff0c;拖拽的话&#xff0c;就跟随鼠标移动&#xff0c;点击的话&#xff0c;就触发新的行为&#xff0c;当然也有指定某些区域不能拖拽&#xff0c;接下来就一起来看看有什么难点吧~ 需要监听的鼠标事件 既…

docker基础操作及部署springboot项目流程

一、安装docker及基础命令 1.centos系统安装https://www.runoob.com/docker/ubuntu-docker-install.html curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun2.启动docker服务 systemctl start docker3.查看docker服务是否启动成功 docker info4.设置开机…

Leetcode2336 无限集中的最小数字

题目&#xff1a; 现有一个包含所有正整数的集合 [1, 2, 3, 4, 5, ...] 。 实现 SmallestInfiniteSet 类&#xff1a; SmallestInfiniteSet() 初始化 SmallestInfiniteSet 对象以包含 所有 正整数。int popSmallest() 移除 并返回该无限集中的最小整数。void addBack(int nu…

【STM32】OLED显示屏

1 调试方式 1. 串口调试&#xff1a;通过串口通信&#xff0c;将调试信息发送到电脑端&#xff0c;电脑使用串口助手显示调试信息 2. 显示屏调试&#xff1a;直接将显示屏连接到单片机&#xff0c;将调试信息打印在显示屏上 3. Keil调试模式&#xff1a;借助Keil软件的调试模…

一文秒懂|Linux字符设备驱动

我的圈子&#xff1a; 高级工程师聚集地 我是董哥&#xff0c;高级嵌入式软件开发工程师&#xff0c;从事嵌入式Linux驱动开发和系统开发&#xff0c;曾就职于世界500强公司&#xff01; 创作理念&#xff1a;专注分享高质量嵌入式文章&#xff0c;让大家读有所得&#xff01; …

制作心理咨询小程序的详细指南

随着科技的的发展&#xff0c;小程序已经成为了人们日常生活中不可或缺的一部分。特别是在心理咨询这个领域&#xff0c;小程序可以提供一个更为便捷、高效的服务平台。本文将通过乔拓云平台为例&#xff0c;详细介绍如何制作一个心理咨询小程序。 首先&#xff0c;我们需要注册…

c 语言常见的易错题分析

在C语言中&#xff0c;有一些常见的易错题需要特别注意。以下是一些例子&#xff1a; 1&#xff0c;数组越界&#xff1a;在C语言中&#xff0c;数组的索引是从0开始的。因此&#xff0c;一个长度为n的数组的索引范围应该是0到n-1。如果尝试访问超出这个范围的索引&#xff0c…

代码随想录 435. 无重叠区间

题目 给定一个区间的集合 intervals &#xff0c;其中 intervals[i] [starti, endi] 。返回 需要移除区间的最小数量&#xff0c;使剩余区间互不重叠 。 示例 1: 输入: intervals [[1,2],[2,3],[3,4],[1,3]] 输出: 1 解释: 移除 [1,3] 后&#xff0c;剩下的区间没有重叠。 示…