当前位置:   article > 正文

OpenHarmony4.1的操作系统模拟器运行环境_openharmony模拟环境

openharmony模拟环境
  • 先下载源码和编译程序:

    • 查看 OpenHarmony4.1源码下载、编译,生成OHOS_Image可执行文件的最简易流程
  • 我准备在QEMU模拟器中运行ARM Cortex-M4的轻型开源鸿蒙系统

  • 在电脑上安装QEMU模拟器软件,可以在Windows下安装,也可以在Linux发行版下安装

    • Qemu安装-QEMU Quick Emulator QEMU在Ubuntu下的安装流程;是下载源码后再编译,编译速度很慢,可以make只编译ARM部分的,这样编译速度会快很多
      • …/configure --target-list=arm-softmmu,arm-linux-user
      • make -j4
      • sudo make install
    • 在Windows下的安装流程更简单
    • Windows的所有安装包 安装6.2.0及以上的版本都可以
    • 官网下载很慢,可以用国内网站下载 https://www.mydown.com/soft/172/726002172.shtml
    • Windows下安装后手动配置好QEMU的环境变量,或者进入到D:\Program Files\qemu的目录下打开CMD命令行界面
  • Ubuntu回到OpenHarmony源码根目录下,使用命令行用QEMU模拟器运行开源鸿蒙系统

    • ./qemu-run --help
    • ./qemu-run -e out/arm_mps2_an386/qemu_mini_system_demo/OHOS_Image
    • qemu-run是个脚本,可以用文本文件打开,它里面也是调用的qemu-system-arm,并且传入了需要的参数
  • 这是开源鸿蒙在QEMU硬件模拟器中运行的结果,在网口时程序跑飞了,可能源码中对QEMU Cortex-M4的适配有点问题,你也可以再尝试一下别的QEMU开发板,步骤和上述流程一样的:

jim@ubuntu:~/openHarmony$ ./qemu-run -e out/arm_mps2_an386/qemu_mini_system_demo/OHOS_Image
board: arm_mps2_an386

Enter to start qemu[y/n]:entering kernel init...
LfsLowLevelInit: DiskPartition succeed
LfsLowLevelInit: PartitionFormat succeed
LfsLowLevelInit: mount fs on '/littlefs' succeed
LfsLowLevelInit: mkdir '/littlefs' succeed
tcpip_init start
*************Exception Information**************
Type      = 11
ThrdPid   = 25
Phase     = exc in task
FaultAddr = 0xabababab
Current task info:
Task name = (null)
Task ID   = 25
Task SP   = (nil)
Task ST   = 0x0
Task SS   = 0x0
Exception reg dump:
PC        = 0x2100e62a
LR        = 0x2101b045
SP        = 0x210b18e0
R0        = 0x210a725c
R1        = 0x200
R2        = 0x210a725c
R3        = 0x2108a9b3
R4        = 0x0
R5        = 0x0
R6        = 0x0
R7        = 0x210b18e8
R8        = 0x0
R9        = 0x0
R10       = 0x0
R11       = 0x0
R12       = 0xc8000000
PriMask   = 0x0
xPSR      = 0x610f0000
----- backtrace start -----
backtrace 0 -- lr = 0x21015178
backtrace 1 -- lr = 0x2101b044
backtrace 2 -- lr = 0x210235da
backtrace 3 -- lr = 0x210235e2
backtrace 4 -- lr = 0x2102379a
----- backtrace end -----
qemu: fatal: Lockup: can't escalate 3 to HardFault (current priority -1)

R00=210b2ad0 R01=2109fa3f R02=210a18f8 R03=6c0da998
R04=00000000 R05=00000060 R06=00000018 R07=210b1708
R08=00000019 R09=000003e8 R10=218ba1e8 R11=00000000
R12=00000000 R13=210b1708 R14=210011db R15=21000fcc
XPSR=21030006 --C- T handler
s00=00000000 s01=00000000 d00=0000000000000000
s02=00000000 s03=00000000 d01=0000000000000000
s04=00000000 s05=00000000 d02=0000000000000000
s06=00000000 s07=00000000 d03=0000000000000000
s08=00000000 s09=00000000 d04=0000000000000000
s10=00000000 s11=00000000 d05=0000000000000000
s12=00000000 s13=00000000 d06=0000000000000000
s14=00000000 s15=00000000 d07=0000000000000000
s16=00000000 s17=00000000 d08=0000000000000000
s18=00000000 s19=00000000 d09=0000000000000000
s20=00000000 s21=00000000 d10=0000000000000000
s22=00000000 s23=00000000 d11=0000000000000000
s24=00000000 s25=00000000 d12=0000000000000000
s26=00000000 s27=00000000 d13=0000000000000000
s28=00000000 s29=00000000 d14=0000000000000000
s30=00000000 s31=00000000 d15=0000000000000000
FPSCR: 00000000
/home/jim/openHarmony/vendor/ohemu/qemu_mini_system_demo/qemu_run.sh: line 95: 50440 Aborted                 (core dumped) qemu-system-arm -M mps2-an386 -m 16M -kernel $elf_file $qemu_option -append "root=dev/vda or console=ttyS0" -nographic
jim@ubuntu:~/openHarmony$ 

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 在Windows的QEMU下可以用这个命令
    • qemu-system-arm -M mps2-an386 -cpu cortex-m4 -kernel OHOS_Image -serial stdio -nodefaults -nographic
    • 另外一个可供你参考的命令 qemu-system-arm -machine versatileab -cpu cortex-a9 -nographic -monitor null -semihosting -append ‘some program arguments’ -kernel program.axf
D:\Program Files\qemu>qemu-system-arm -M mps2-an386 -cpu cortex-m4 -kernel OHOS_Image -serial stdio -nodefaults -nographic
qemu-system-arm: warning: nic lan9118.0 has no peer
entering kernel init...
LfsLowLevelInit: DiskPartition succeed
LfsLowLevelInit: PartitionFormat succeed
LfsLowLevelInit: mount fs on '/littlefs' succeed
LfsLowLevelInit: mkdir '/littlefs' succeed
tcpip_init start
*************Exception Information**************
Type      = 11
ThrdPid   = 25
Phase     = exc in task
FaultAddr = 0xabababab
Current task info:
Task name = (null)
Task ID   = 25
Task SP   = (nil)
Task ST   = 0x0
Task SS   = 0x0
Exception reg dump:
PC        = 0x2100e62a
LR        = 0x2101b045
SP        = 0x210b18e0
R0        = 0x210a725c
R1        = 0x200
R2        = 0x210a725c
R3        = 0x2108a9b3
R4        = 0x0
R5        = 0x0
R6        = 0x0
R7        = 0x210b18e8
R8        = 0x0
R9        = 0x0
R10       = 0x0
R11       = 0x0
R12       = 0xc8000000
PriMask   = 0x0
xPSR      = 0x610f0000
----- backtrace start -----
backtrace 0 -- lr = 0x21015178
backtrace 1 -- lr = 0x2101b044
backtrace 2 -- lr = 0x210235da
backtrace 3 -- lr = 0x210235e2
backtrace 4 -- lr = 0x2102379a
----- backtrace end -----
qemu: fatal: Lockup: can't escalate 3 to HardFault (current priority -1)

R00=210b2ad0 R01=2109fa3f R02=210a18f8 R03=6c0da998
R04=00000000 R05=00000060 R06=00000018 R07=210b1708
R08=00000019 R09=000003e8 R10=218ba1e8 R11=00000000
R12=00000000 R13=210b1708 R14=210011db R15=21000fcc
XPSR=21030006 --C- T handler
s00=00000000 s01=00000000 d00=0000000000000000
s02=00000000 s03=00000000 d01=0000000000000000
s04=00000000 s05=00000000 d02=0000000000000000
s06=00000000 s07=00000000 d03=0000000000000000
s08=00000000 s09=00000000 d04=0000000000000000
s10=00000000 s11=00000000 d05=0000000000000000
s12=00000000 s13=00000000 d06=0000000000000000
s14=00000000 s15=00000000 d07=0000000000000000
s16=00000000 s17=00000000 d08=0000000000000000
s18=00000000 s19=00000000 d09=0000000000000000
s20=00000000 s21=00000000 d10=0000000000000000
s22=00000000 s23=00000000 d11=0000000000000000
s24=00000000 s25=00000000 d12=0000000000000000
s26=00000000 s27=00000000 d13=0000000000000000
s28=00000000 s29=00000000 d14=0000000000000000
s30=00000000 s31=00000000 d15=0000000000000000
FPSCR: 00000000

D:\Program Files\qemu>

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72

如果想更深入的学习 OpenHarmony 开发的内容,可以参考以下学习文档:

OpenHarmony 开发环境搭建:https://qr18.cn/CgxrRy

《OpenHarmony源码解析》:https://qr18.cn/CgxrRy

  • 搭建开发环境
  • Windows 开发环境的搭建
  • Ubuntu 开发环境搭建
  • Linux 与 Windows 之间的文件共享
  • ……

系统架构分析:https://qr18.cn/CgxrRy

  • 构建子系统
  • 启动流程
  • 子系统
  • 分布式任务调度子系统
  • 分布式通信子系统
  • 驱动子系统
  • ……

OpenHarmony 设备开发学习手册:https://qr18.cn/CgxrRy

OpenHarmony面试题(内含参考答案):https://qr18.cn/CgxrRy

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/870504
推荐阅读
相关标签
  

闽ICP备14008679号