type
status
date
slug
summary
tags
category
icon
password

一:实验目的

本实验考察同学们对操作系统框架的整体理解以及实操能力,要求同学们能够对OpenHarmony操作系统有基本的理解,并且可以编译OpenHarmony系统源码,最后在QEMU硬件模拟器中模拟OpenHarmony操作系统的运行。

二:实验内容

使用QEMU硬件模拟器运行开源鸿蒙OpenHarmony4.X操作系统。

三.实验环境

虚拟机系统:ubuntu 20.04
QEMU版本:QEMU6.2.0
所编译的系统版本:轻型(mini)

四.实验步骤

(1)VMware WorkStation的安装

访问WMware的官方网站,根据网站提示进行下载和安装。

(2)在WMware中安装ubuntu 20.04系统

下载iso文件后在WMware中配置虚拟机并启动。
首先,终端默认使用bash。
notion image
notion image
因此,需要修改dash为bash。接下来配置相关环境。
notion image
安装DevEco Device Tool
notion image
解压后给予执行权限,然后运行,同意用户协议后等待自动安装
notion image
python-venv报错,无法安装。清华源只有python-venv没有3.8的,默认都是3.10.执行如下命令
notion image
notion image
notion image
随后手动安装python3.8-venv
notion image
notion image
notion image
安装完成。

(3)下载编译鸿蒙系统源码,生成镜像

1. 安装git
notion image
 
2.安装gitee repo工具
手动编辑环境变量,创建python软链接,使python命令直接能启动python3,然后运行repo init,运行正常
notion image
3. 生成公钥、添加公钥
notion image
复制终端内容粘贴即可
notion image
Ssh -T命令 查看是否绑定成功。如下图成功
notion image
4. 选择QEMU:MINI 后来发现缺东西又补成了全量仓库。初始化仓库,安装完git-lfs后使用repo sync -c开始下载
notion image
notion image
5. 运行prebuildsh 从而安装必要包
notion image
缺大量的包,不知道为什么没有一起clone下来。这里手动补上,运行的时候报错什么,就补什么
notion image
6.编译标准系统
先装一个标准系统的docker
notion image
notion image
7.编译完成
notion image
8.生成了OHOS_Image
notion image

(4)安装并使用QEMU运行生成的镜像

1.QEMU安装
2. 下载源码
编译之前得装一个ninja
notion image
进行一个configure
notion image
4.make一下
notion image
耐心等待make完成
notion image
5.Make install安装
notion image
notion image
6. 添加环境变量 安装QEMU的文件夹
notion image
7.因为不需要GDB调试,这里直接apt install这个工具链
notion image
8.需要用hb -set选择一次版型。但是hb set会报错。按照OpenHarmony在issues里面给出的解释,应该执行如下命令python3 -m pip install --user build/hb。必须在docker环境中进行,如果不在docker那么hbset没输出。但是不知道原因,已经有issue了官方没给出回复。选mini即可
notion image
9.再安装qemu system arm模拟我们的arm镜像
notion image
10.不能使用自带的qemu脚本,会报错找不到/dev/vda和ttyS0
自己写一条命令就行了qemu-system-arm -M mps2-an386  -m 16M -kernel /home/zhangkaiyang2022211661/out/arm_mps2_an386/qemu_mini_system_demo/OHOS_Image -nographic -append "root=/dev/vda or console=ttyAMA0"
notion image
notion image
多附上几张运行截图
notion image
notion image
TEST START全部成功,进入命令行
notion image
ls命令,没有挂在文件系统,找不到/目录,正常
notion image
date命令,默认时间戳为0,1970年1月1日,正常
notion image
 

五:遇到的问题及解决方案

问题一:

镜像文件编译过程中,在运行prebuildsh后,系统报错缺少大量的文件包,并没有通过git clone下来。
解决方案:通过分析缺少的文件,手动进行补充,在实验过程中,报什么错误就补充什么包。

问题二:

安装QUMU的过程中,需要用hb -set选择一次版型。但是hb set会报错。按照OpenHarmony在issues里面给出的解释,应该执行如下命令python3 -m pip install --user build/hb。必须在docker环境中进行,如果不在docker那么hbset没输出。但是不知道原因,已经有issue了官方没给出回复。
解决方案:选mini即可。

问题三:

在模拟ARM镜像过程中,不能使用自带的qemu脚本,会报错找不到/dev/vda和ttyS0
解决方案:自己写一条命令就行了:qemu-system-arm -M mps2-an386  -m 16M -kernel /home/zhangkaiyang2022211661/out/arm_mps2_an386/qemu_mini_system_demo/OHOS_Image -nographic -append "root=/dev/vda or console=ttyAMA0"
树莓派常用指令/源计算机网络实验——Socket文件传输
Loading...
Lynnette177
Lynnette177
建议开着梯子访问站点。图片是直接从Notion获取的,不开梯子容易看不见图片。
Latest posts
iOS免越狱hook与patch框架和免越狱dylib注入打包
2025-2-19
iOS liapp bypass+Unity逆向+tweak开发
2025-2-7
手动实现的seh
2025-1-25
iOS逆向——某跑步软件的文件上传
2024-11-30
支付宝小程序逆向
2024-10-24
iOS下的Unity逆向:地铁跑酷
2024-10-1
Announcement
🎉2024.6.9 上线🎉