Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
adapter/hals/utils/file/ | 12-May-2024 | - | 100 | 58 | ||
liteos_m/ | 12-May-2024 | - | 12,585 | 5,670 | ||
BUILD.gn | D | 12-May-2024 | 615 | 16 | 14 | |
README.md | D | 12-May-2024 | 3.8 KiB | 115 | 73 | |
README_zh.md | D | 12-May-2024 | 3.4 KiB | 115 | 73 | |
ohos.build | D | 12-May-2024 | 170 | 10 | 10 |
README.md
1# QEMU(Tutorials of C-SKY ) 2 3## 1.Introduction 4 5QEMU can simulate the kernel to run on different boards, freeing the dependence on the physical development board.The `SmartL_E802/` subdirectory contains part of the OpenHarmony kernel\_liteos\_m code verified by the Qemu C-SKY virtualization platform,you can simulate a single board based on the C-SKY architecture. 6 7## 2.Setup Environment 8 9 1. Set up the Compilation tool chain 10 11 Note: [Downloadable directly](https://repo.huaweicloud.com/openharmony/compiler/gcc_csky/v3.10.29/linux/csky-v3.10.29.tar.gz) 12 13 Optional compiler installation process: 14 15 a) Create the `csky_toolchain` folder and enter it 16 17 ```shell 18 mkdir csky_toolchain && cd csky_toolchain 19 ``` 20 21 b) Download csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz to `csky_toolchain`folder and unzip,download link: https://occ.t-head.cn/community/download?id=3885366095506644992 22 23 ```shell 24 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1619529111421/csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 25 tar -xf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 26 ``` 27 28 c) Add the csky-elfabiv2 compilation tool chain to the environment variable (modify user_toolchain_xxx_path to your own installation path): 29 30 ```shell 31 vim ~/.bashrc 32 export PATH=$PATH:user_toolchain_xxx_path/csky_toolchain/bin 33 source ~/.bashrc 34 ``` 35 36 2. Install qemu 37 38 a) create `csky_qemu` folder and enter it 39 40 ```shell 41 mkdir csky_qemu && cd csky_qemu 42 ``` 43 44 b) download csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz to `csky_qemu`folder and unzip,download link: https://occ.t-head.cn/community/download?id=636946310057951232 45 46 ```shell 47 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1612269502091/csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 48 tar -xf csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 49 ``` 50 51 c) Add qemu to the environment variable (modify user_qemu_xxx_path to your own installation path): 52 53 ```shell 54 vim ~/.bashrc 55 export PATH=$PATH:user_qemu_xxx_path/csky-qemu/bin 56 source ~/.bashrc 57 ``` 58 59 d) Installation dependencies 60 61 ```shell 62 ldd qemu_installation_path/bin/qemu-system-cskyv2 63 ``` 64 65 According to the execution result of ldd, install the missing dependent libraries 66 67 (Annotation: For more installation instructions, please refer to the following link: https://occ.t-head.cn/community/download?id=636946310057951232) 68 69## 3.Get source code 70 71[code acquisition ](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md) 72 73Hint : You can use the `repo` command to get the source code. 74 75## 4.Source building 76 77 1. Execute the hb set command and select the project`qemu_csky_mini_system_demo`. 78 79 2. Execute the hb clean && hb build command to build the executable file that produces `OHOS_Image`. 80 81 ```shell 82 hb set 83 hb clean && hb build 84 ``` 85 86 3. After the building is complete,the corresponding executable file is in the home directory: 87 88 ``` 89 out/SmartL_E802/qemu_csky_mini_system_demo/ 90 ``` 91 92## 5.Run the image in Qemu 93 94 1. Run qemu(Don't cooperate with GDB) 95 96 ```shell 97 ./qemu-run 98 ``` 99 100 2. Run qemu(Cooperate with GDB) 101 102 a) Start the GDB server and wait for the connection 103 104 ```shell 105 ./qemu-run -g 106 ``` 107 108 b) Create a new terminal and use GDB to connect to qemu 109 110 ```shell 111 csky-abiv2-elf-gdb out/SmartL_E802/qemu_csky_mini_system_demo/OHOS_Image -ex "target remote localhost:1234" 112 ``` 113 114 Annotation: The way to exit qemu : press ctrl and a,then release and press x. 115
README_zh.md
1# QEMU(C-SKY 教程) 2 3## 1.简介 4 5QEMU可以模拟内核运行在不同的单板,解除对物理开发板的依赖。`SmartL_E802/`子目录包含部分Qemu C-SKY虚拟化平台验证的OpenHarmony kernel\_liteos\_m的代码,通过它来模拟一个基于C-SKY架构的单板。 6 7## 2.环境搭建 8 9 1. 编译工具链安装 10 11 提示: [可直接下载](https://repo.huaweicloud.com/openharmony/compiler/gcc_csky/v3.10.29/linux/csky-v3.10.29.tar.gz) 12 13 可选的编译器安装流程: 14 15 a) 创建`csky_toolchain`文件夹并进入 16 17 ```shell 18 mkdir csky_toolchain && cd csky_toolchain 19 ``` 20 21 b) 下载csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 到`csky_toolchain`文件夹并解压,下载地址:https://occ.t-head.cn/community/download?id=3885366095506644992 22 23 ```shell 24 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1619529111421/csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 25 tar -xf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 26 ``` 27 28 c) 将csky-elfabiv2编译工具链加入环境变量(将user_toolchain_xxx_path修改为自己的安装路径): 29 30 ```shell 31 vim ~/.bashrc 32 export PATH=$PATH:user_toolchain_xxx_path/csky_toolchain/bin 33 source ~/.bashrc 34 ``` 35 36 2. qemu安装 37 38 a) 创建`csky_qemu`文件夹并进入 39 40 ```shell 41 mkdir csky_qemu && cd csky_qemu 42 ``` 43 44 b) 下载csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz到`csky_qemu`文件夹下并解压,下载地址:https://occ.t-head.cn/community/download?id=636946310057951232 45 46 ```shell 47 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1612269502091/csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 48 tar -xf csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 49 ``` 50 51 c) 将qemu加入环境变量(将user_qemu_xxx_path修改为自己的安装路径): 52 53 ```shell 54 vim ~/.bashrc 55 export PATH=$PATH:user_qemu_xxx_path/csky-qemu/bin 56 source ~/.bashrc 57 ``` 58 59 d) 安装依赖 60 61 ```shell 62 ldd qemu_installation_path/bin/qemu-system-cskyv2 63 ``` 64 65 根据ldd执行结果,安装缺少的依赖库 66 67 (注:更多使用安装指导,请参考官方指南:https://occ.t-head.cn/community/download?id=636946310057951232) 68 69## 3.获取源码 70 71[代码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) 72 73提示: 可以使用 `repo` 命令来获取源码。 74 75## 4.源码构建 76 77 1. 执行hb set命令并选择项目`qemu_csky_mini_system_demo`。 78 79 2. 执行hb clean && hb build命令构建产生 `OHOS_Image` 的可执行文件。 80 81 ```shell 82 hb set 83 hb clean && hb build 84 ``` 85 86 3. 在构建完成之后,对应的可执行文件在主目录下: 87 88 ``` 89 out/SmartL_E802/qemu_csky_mini_system_demo/ 90 ``` 91 92## 5.在Qemu中运行镜像 93 94 1. 启动qemu(不配合GDB) 95 96 ```shell 97 ./qemu-run 98 ``` 99 100 2. 启动qemu(配合GDB) 101 102 a) 启动GDB服务器,等待连接 103 104 ```shell 105 ./qemu-run -g 106 ``` 107 108 b) 新建终端并使用GDB连接qemu 109 110 ```shell 111 csky-abiv2-elf-gdb out/SmartL_E802/qemu_csky_mini_system_demo/OHOS_Image -ex "target remote localhost:1234" 112 ``` 113 114 注:qemu退出方式为:按下ctrl加a键,然后松开再按下x键。 115