赞
踩
作者 | 将狼才鲸 |
---|---|
日期 | 2024-03-01 |
准备一台Windows电脑
安装VMware或者VMware Player虚拟机
从华为镜像下载Ubuntu系统,用国内源下载速度更快
下载开源鸿蒙系统源码
在VMware虚拟机中安装Ubuntu系统
安装完之后进入系统,使用命令行将官方源换成华为源,这样下载软件时更快
在Ubuntu系统中解压上面已经下载的openHarmony源码
在Ubuntu系统中安装Docker
将你下载好的鸿蒙源码在Ubuntu下解压,进入已经解压的源码根目录
执行 sudo docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/docker_oh_mini:3.2 将源码路径导入到Docker中
编译
编译成功后是这样的打印:
[OHOS INFO] [1614/1615] STAMP obj/build/ohos/images/make_images.stamp [OHOS INFO] [1615/1615] STAMP obj/build/core/gn/images.stamp [OHOS INFO] ccache_dir = /root/.ccache, ccache_exec = /usr/bin/ccache [OHOS INFO] -------------------------------------------- [OHOS INFO] ccache summary: [OHOS INFO] ccache version: 3.7.7 [OHOS INFO] cache hit (direct): 0 [OHOS INFO] cache hit (preprocessed): 0 [OHOS INFO] cache miss: 0 [OHOS INFO] hit rate: 0.00% [OHOS INFO] miss rate: 0.00% [OHOS INFO] Cache size (GB): [OHOS INFO] --------------------------------------------- [OHOS INFO] c targets overlap rate statistics [OHOS INFO] subsystem files NO. percentage builds NO. percentage overlap rate [OHOS INFO] hiviewdfx 12 0.8% 12 0.8% 1.00 [OHOS INFO] kernel 902 63.5% 902 63.5% 1.00 [OHOS INFO] security 61 4.3% 61 4.3% 1.00 [OHOS INFO] startup 26 1.8% 26 1.8% 1.00 [OHOS INFO] systemabilitymgr 15 1.1% 15 1.1% 1.00 [OHOS INFO] thirdparty 393 27.7% 393 27.7% 1.00 [OHOS INFO] [OHOS INFO] c overall build overlap rate: 1.00 [OHOS INFO] [OHOS INFO] [OHOS INFO] qemu_mini_system_demo@ohemu build success [OHOS INFO] Cost time: 0:05:47 root@ff38bf1e3e75:/home/openharmony# jim@ubuntu:~/openHarmony/out/arm_mps2_an386/qemu_mini_system_demo$ ls all_parts_host.json build_configs config.h kconfig_files.txt OHOS_Image.bin src_installed_parts.json all_parts_info.json build.log error.log libs OHOS_Image.map src_sa_infos_tmp.json args.gn build.ninja etc NOTICE_FILES OHOS_Image.sym.sorted startup binary_installed_parts.json build.ninja.d gen obj packages thirdparty build.1709259296.3884952.log build.trace.gz hiviewdfx OHOS_Image security toolchain.ninja build.1709259767.6772568.log config.gni kconfig_env.txt OHOS_Image.asm sorted_action_duration.txt jim@ubuntu:~/openHarmony/out/arm_mps2_an386/qemu_mini_system_demo$
生成的系统镜像image是这里面的OHOS_Image文件
如需退出Docker,执行exit命令即可。这个命令会停止当前的Docker容器,并返回到您的操作系统。
下一步就可以把编译好的操作系统在QEMU模拟器中运行起来了。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。