| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| adapter/hals/utils/file/ | 12-May-2024 | - | 100 | 58 | ||
| liteos_m/ | 12-May-2024 | - | 12,592 | 5,674 | ||
| BUILD.gn | D | 12-May-2024 | 615 | 16 | 14 | |
| README.md | D | 12-May-2024 | 4.3 KiB | 135 | 86 | |
| README_zh.md | D | 12-May-2024 | 3.9 KiB | 135 | 86 | |
| 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 Tip: Users can also skip this step by using the following instructions directly to use the compiler configured in the default environment. 12 13 To use the default environment, execute '3.Get source code' and then install the default compiler in the root directory by executing the following instructions. 14 15 ```shell 16 sh build/prebuilts_download.sh 17 ``` 18 19 Optional compiler installation process: 20 21 a) Create the `csky_toolchain` folder and enter it 22 23 ```shell 24 mkdir csky_toolchain && cd csky_toolchain 25 ``` 26 27 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 28 29 ```shell 30 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1619529111421/csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 31 tar -xf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 32 ``` 33 34 c) Add the csky-elfabiv2 compilation tool chain to the environment variable (modify user_toolchain_xxx_path to your own installation path): 35 36 ```shell 37 vim ~/.bashrc 38 export PATH=$PATH:user_toolchain_xxx_path/csky_toolchain/bin 39 source ~/.bashrc 40 ``` 41 42 d) Delete the default compiler path: 43 44 change SmartL_E802\liteos_m\config.gni: 45 46 ```c 47 board_toolchain_path = "$ohos_root_path/prebuilts/gcc/linux-x86/csky/csky/bin" 48 ``` 49 50 to 51 52 ```c 53 board_toolchain_path = "" 54 ``` 55 56 2. Install qemu 57 58 a) create `csky_qemu` folder and enter it 59 60 ```shell 61 mkdir csky_qemu && cd csky_qemu 62 ``` 63 64 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 65 66 ```shell 67 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1612269502091/csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 68 tar -xf csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 69 ``` 70 71 c) Add qemu to the environment variable (modify user_qemu_xxx_path to your own installation path): 72 73 ```shell 74 vim ~/.bashrc 75 export PATH=$PATH:user_qemu_xxx_path/csky-qemu/bin 76 source ~/.bashrc 77 ``` 78 79 d) Installation dependencies 80 81 ```shell 82 ldd qemu_installation_path/bin/qemu-system-cskyv2 83 ``` 84 85 According to the execution result of ldd, install the missing dependent libraries 86 87 (Annotation: For more installation instructions, please refer to the following link: https://occ.t-head.cn/community/download?id=636946310057951232) 88 89## 3.Get source code 90 91[code acquisition ](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md) 92 93Hint : You can use the `repo` command to get the source code. 94 95## 4.Source buildding 96 97 1. Execute the hb set command and select the project`qemu_csky_mini_system_demo`. 98 99 2. Execute the hb clean && hb build command to build the executable file that produces `OHOS_Image`. 100 101 ```shell 102 hb set 103 hb clean && hb build 104 ``` 105 106 3. After the buildding is complete,the corresponding executable file is in the home directory: 107 108 ``` 109 out/SmartL_E802/qemu_csky_mini_system_demo/ 110 ``` 111 112## 5.Run the image in Qemu 113 114 1. Run qemu(Don't cooperate with GDB) 115 116 ```shell 117 ./qemu-run 118 ``` 119 120 2. Run qemu(Cooperate with GDB) 121 122 a) Start the GDB server and wait for the connection 123 124 ```shell 125 ./qemu-run -g 126 ``` 127 128 b) Create a new terminal and use GDB to connect to qemu 129 130 ```shell 131 csky-abiv2-elf-gdb out/SmartL_E802/qemu_csky_mini_system_demo/OHOS_Image -ex "target remote localhost:1234" 132 ``` 133 134 Annotation: The way to exit qemu : press ctrl and a,then release and press x. 135
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 提示:用户也可以直接使用下列指令来使用默认环境中配置好的编译器,跳过该步骤。 12 13 若要使用默认环境请先执行 '3.获取源码' ,然后在根目录下执行下列指令安装默认编译器。 14 15 ```shell 16 sh build/prebuilts_download.sh 17 ``` 18 19 可选的编译器安装流程: 20 21 a) 创建`csky_toolchain`文件夹并进入 22 23 ```shell 24 mkdir csky_toolchain && cd csky_toolchain 25 ``` 26 27 b) 下载csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 到`csky_toolchain`文件夹并解压,下载地址:https://occ.t-head.cn/community/download?id=3885366095506644992 28 29 ```shell 30 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1619529111421/csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 31 tar -xf csky-elfabiv2-tools-x86_64-minilibc-20210423.tar.gz 32 ``` 33 34 c) 将csky-elfabiv2编译工具链加入环境变量(将user_toolchain_xxx_path修改为自己的安装路径): 35 36 ```shell 37 vim ~/.bashrc 38 export PATH=$PATH:user_toolchain_xxx_path/csky_toolchain/bin 39 source ~/.bashrc 40 ``` 41 42 d) 删除默认的编译器路径: 43 44 修改SmartL_E802\liteos_m\config.gni: 45 46 ```c 47 board_toolchain_path = "$ohos_root_path/prebuilts/gcc/linux-x86/csky/csky/bin" 48 ``` 49 50 改为 51 52 ```c 53 board_toolchain_path = "" 54 ``` 55 56 2. qemu安装 57 58 a) 创建`csky_qemu`文件夹并进入 59 60 ```shell 61 mkdir csky_qemu && cd csky_qemu 62 ``` 63 64 b) 下载csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz到`csky_qemu`文件夹下并解压,下载地址:https://occ.t-head.cn/community/download?id=636946310057951232 65 66 ```shell 67 wget https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource/1356021/1612269502091/csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 68 tar -xf csky-qemu-x86_64-Ubuntu-16.04-20210202-1445.tar.gz 69 ``` 70 71 c) 将qemu加入环境变量(将user_qemu_xxx_path修改为自己的安装路径): 72 73 ```shell 74 vim ~/.bashrc 75 export PATH=$PATH:user_qemu_xxx_path/csky-qemu/bin 76 source ~/.bashrc 77 ``` 78 79 d) 安装依赖 80 81 ```shell 82 ldd qemu_installation_path/bin/qemu-system-cskyv2 83 ``` 84 85 根据ldd执行结果,安装缺少的依赖库 86 87 (注:更多使用安装指导,请参考官方指南:https://occ.t-head.cn/community/download?id=636946310057951232) 88 89## 3.获取源码 90 91[代码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md) 92 93提示: 可以使用 `repo` 命令来获取源码。 94 95## 4.源码构建 96 97 1. 执行hb set命令并选择项目`qemu_csky_mini_system_demo`。 98 99 2. 执行hb clean && hb build命令构建产生 `OHOS_Image` 的可执行文件。 100 101 ```shell 102 hb set 103 hb clean && hb build 104 ``` 105 106 3. 在构建完成之后,对应的可执行文件在主目录下: 107 108 ``` 109 out/SmartL_E802/qemu_csky_mini_system_demo/ 110 ``` 111 112## 5.在Qemu中运行镜像 113 114 1. 启动qemu(不配合GDB) 115 116 ```shell 117 ./qemu-run 118 ``` 119 120 2. 启动qemu(配合GDB) 121 122 a) 启动GDB服务器,等待连接 123 124 ```shell 125 ./qemu-run -g 126 ``` 127 128 b) 新建终端并使用GDB连接qemu 129 130 ```shell 131 csky-abiv2-elf-gdb out/SmartL_E802/qemu_csky_mini_system_demo/OHOS_Image -ex "target remote localhost:1234" 132 ``` 133 134 注:qemu退出方式为:按下ctrl加a键,然后松开再按下x键。 135