From 5584d8edd2994880880be271a78e73252f95878d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Polyos=20Project=20=28=E9=9F=A9=E6=98=8C=E5=88=9A=29?= Date: Mon, 18 Dec 2023 16:34:34 +0800 Subject: [PATCH] add riscv64 config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Polyos Project (韩昌刚) --- OAT.xml | 5 ++ riscv64_virt/BUILD.gn | 31 ++++++++++ riscv64_virt/README_zh.md | 36 ++++++++++++ riscv64_virt/linux/BUILD.gn | 36 ++++++++++++ riscv64_virt/linux/chipset/BUILD.gn | 27 +++++++++ .../chipset/etc/fstab.qemu.riscv64.linux | 6 ++ riscv64_virt/linux/chipset/etc/fstab.updater | 6 ++ riscv64_virt/linux/images/BUILD.gn | 23 ++++++++ .../linux/images/system_image_conf.txt | 32 +++++++++++ .../linux/images/updater_image_conf.txt | 5 ++ .../linux/images/userdata_image_conf.txt | 33 +++++++++++ .../linux/images/vendor_image_conf.txt | 33 +++++++++++ riscv64_virt/linux/ohos.build | 10 ++++ riscv64_virt/linux/rootfs/BUILD.gn | 56 +++++++++++++++++++ riscv64_virt/linux/rootfs/default.para | 16 ++++++ .../linux/rootfs/init.qemu.riscv64.linux.cfg | 28 ++++++++++ .../rootfs/init.qemu.riscv64.linux.usb.cfg | 51 +++++++++++++++++ .../rootfs/qemu.riscv64.linux.updater.cfg | 10 ++++ riscv64_virt/ohos.build | 10 ++++ 19 files changed, 454 insertions(+) create mode 100755 riscv64_virt/BUILD.gn create mode 100755 riscv64_virt/README_zh.md create mode 100755 riscv64_virt/linux/BUILD.gn create mode 100755 riscv64_virt/linux/chipset/BUILD.gn create mode 100755 riscv64_virt/linux/chipset/etc/fstab.qemu.riscv64.linux create mode 100755 riscv64_virt/linux/chipset/etc/fstab.updater create mode 100755 riscv64_virt/linux/images/BUILD.gn create mode 100755 riscv64_virt/linux/images/system_image_conf.txt create mode 100755 riscv64_virt/linux/images/updater_image_conf.txt create mode 100755 riscv64_virt/linux/images/userdata_image_conf.txt create mode 100755 riscv64_virt/linux/images/vendor_image_conf.txt create mode 100755 riscv64_virt/linux/ohos.build create mode 100755 riscv64_virt/linux/rootfs/BUILD.gn create mode 100755 riscv64_virt/linux/rootfs/default.para create mode 100755 riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.cfg create mode 100755 riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.usb.cfg create mode 100755 riscv64_virt/linux/rootfs/qemu.riscv64.linux.updater.cfg create mode 100755 riscv64_virt/ohos.build diff --git a/OAT.xml b/OAT.xml index 5fb9254..c1182cf 100644 --- a/OAT.xml +++ b/OAT.xml @@ -59,6 +59,11 @@ + + + + + diff --git a/riscv64_virt/BUILD.gn b/riscv64_virt/BUILD.gn new file mode 100755 index 0000000..8ec701b --- /dev/null +++ b/riscv64_virt/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +group("riscv64_virt") { +} diff --git a/riscv64_virt/README_zh.md b/riscv64_virt/README_zh.md new file mode 100755 index 0000000..74ec639 --- /dev/null +++ b/riscv64_virt/README_zh.md @@ -0,0 +1,36 @@ +# Qemu RISCV-64 Virt 标准系统教程 + +## 简介 + +`riscv64_virt/linux` 子目录包含部分Qemu RISCV-64虚拟化平台验证的Linux kernel的适配代码,含驱动配置、板端配置等。 + +RISCV-64 虚拟化平台是一个 `qemu-system-riscv64` 的目标设备,通过它来模拟一个通用的、基于RISCV-64架构的单板。 + + +提示: 系统内存硬编码为2048MB。 + +## 环境搭建 + +参考链接: [环境搭建](https://gitee.com/openharmony/docs/blob/HEAD/zh-cn/device-dev/quick-start/quickstart-standard.md) + +## 源码构建 + +在已经获取的源码根目录,请输入: + +``` +./build.sh --product-name qemu-riscv64-linux-min +``` + +在构建完成之后,对应的镜像文件在out/qemu-riscv64-linux/packages/phone/images/目录下。 +qemu-riscv64-linux-min表示部件最小集合的产品。 + +## 运行镜像 + +如果没有安装 `qemu-system-riscv64` ,安装请参考链接 [Qemu installation](https://gitee.com/openharmony/device_qemu/blob/HEAD/README_zh.md) + +提示:当前引入的功能在virt-5.1的目标machine已经完成测试,不保证所有的Qemu版本都能够运行成功,因此需要保证你的qemu-system-riscv64 +版本尽可能在5.1及以上。 + +## 退出qemu环境 + +先按组合键`Ctrl+a` 再单按`x`键,可退出qemu虚拟环境。 diff --git a/riscv64_virt/linux/BUILD.gn b/riscv64_virt/linux/BUILD.gn new file mode 100755 index 0000000..c13bcd1 --- /dev/null +++ b/riscv64_virt/linux/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without modification, +# are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, this list of +# conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, this list +# of conditions and the following disclaimer in the documentation and/or other materials +# provided with the distribution. +# +# 3. Neither the name of the copyright holder nor the names of its contributors may be used +# to endorse or promote products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +group("qemu-riscv64-linux-group") { + deps = [ + "//device/qemu/riscv64_virt/linux/chipset:chipset_files", + "//device/qemu/riscv64_virt/linux/images:all_image_conf", + "//device/qemu/riscv64_virt/linux/rootfs:rootfs_files", + ] +} diff --git a/riscv64_virt/linux/chipset/BUILD.gn b/riscv64_virt/linux/chipset/BUILD.gn new file mode 100755 index 0000000..ca2b1a4 --- /dev/null +++ b/riscv64_virt/linux/chipset/BUILD.gn @@ -0,0 +1,27 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/ohos.gni") + +ohos_prebuilt_etc("fstab.qemu.riscv64.linux") { + source = "etc/fstab.qemu.riscv64.linux" + module_install_dir = "etc" + part_name = "qemu_riscv64_linux_chipset" + install_images = [ chipset_base_dir ] +} + +group("chipset_files") { + deps = [ + ":fstab.qemu.riscv64.linux", + "//kernel/linux/build:linux_kernel", + ] +} diff --git a/riscv64_virt/linux/chipset/etc/fstab.qemu.riscv64.linux b/riscv64_virt/linux/chipset/etc/fstab.qemu.riscv64.linux new file mode 100755 index 0000000..f0743f1 --- /dev/null +++ b/riscv64_virt/linux/chipset/etc/fstab.qemu.riscv64.linux @@ -0,0 +1,6 @@ +# fstab file. +# +/dev/block/vdb /usr ext4 ro,barrier=1 wait,required +/dev/block/vdc /vendor ext4 ro,barrier=1 wait,required +/dev/block/vdd /data ext4 nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc wait,reservedsize=104857600 +/dev/block/vda /misc none none wait diff --git a/riscv64_virt/linux/chipset/etc/fstab.updater b/riscv64_virt/linux/chipset/etc/fstab.updater new file mode 100755 index 0000000..24386a1 --- /dev/null +++ b/riscv64_virt/linux/chipset/etc/fstab.updater @@ -0,0 +1,6 @@ +# +/dev/block/platform/soc/10100000.himci.eMMC/by-name/system /system ext4 ro,barrier=1 wait +/dev/block/platform/soc/10100000.himci.eMMC/by-name/vendor /vendor ext4 ro,barrier=1 wait +/dev/block/platform/soc/10100000.himci.eMMC/by-name/userdata /data ext4 nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc wait,reservedsize=104857600 +/dev/block/platform/soc/10100000.himci.eMMC/by-name/misc /misc none none wait +/dev/block/platform/soc/100f0000.himci.SD/mmcblk1p1 /sdcard ext4 rw wait diff --git a/riscv64_virt/linux/images/BUILD.gn b/riscv64_virt/linux/images/BUILD.gn new file mode 100755 index 0000000..0653db5 --- /dev/null +++ b/riscv64_virt/linux/images/BUILD.gn @@ -0,0 +1,23 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//build/ohos.gni") + +ohos_copy("all_image_conf") { + sources = [ + "system_image_conf.txt", + "updater_image_conf.txt", + "userdata_image_conf.txt", + "vendor_image_conf.txt", + ] + outputs = [ "${product_output_dir}/imagesconf/{{source_file_part}}" ] +} diff --git a/riscv64_virt/linux/images/system_image_conf.txt b/riscv64_virt/linux/images/system_image_conf.txt new file mode 100755 index 0000000..b92a489 --- /dev/null +++ b/riscv64_virt/linux/images/system_image_conf.txt @@ -0,0 +1,32 @@ + # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + # Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # 1. Redistributions of source code must retain the above copyright notice, this list of + # conditions and the following disclaimer. + # + # 2. Redistributions in binary form must reproduce the above copyright notice, this list + # of conditions and the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # 3. Neither the name of the copyright holder nor the names of its contributors may be used + # to endorse or promote products derived from this software without specific prior written + # permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/ +1572864000 +--fs_type=ext4 +--dac_config ../../build/ohos/images/mkimage/dac.txt diff --git a/riscv64_virt/linux/images/updater_image_conf.txt b/riscv64_virt/linux/images/updater_image_conf.txt new file mode 100755 index 0000000..3c4ff5f --- /dev/null +++ b/riscv64_virt/linux/images/updater_image_conf.txt @@ -0,0 +1,5 @@ +/updater +67108864 +--fs_type=ext4 +--dac_config ../../build/ohos/images/mkimage/dac.txt +--file_context obj/base/security/selinux_adapter/file_contexts.bin diff --git a/riscv64_virt/linux/images/userdata_image_conf.txt b/riscv64_virt/linux/images/userdata_image_conf.txt new file mode 100755 index 0000000..9aa0d45 --- /dev/null +++ b/riscv64_virt/linux/images/userdata_image_conf.txt @@ -0,0 +1,33 @@ + # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + # Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # 1. Redistributions of source code must retain the above copyright notice, this list of + # conditions and the following disclaimer. + # + # 2. Redistributions in binary form must reproduce the above copyright notice, this list + # of conditions and the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # 3. Neither the name of the copyright holder nor the names of its contributors may be used + # to endorse or promote products derived from this software without specific prior written + # permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/data +1572864000 +--fs_type=ext4 +--dac_config ../../build/ohos/images/mkimage/dac.txt diff --git a/riscv64_virt/linux/images/vendor_image_conf.txt b/riscv64_virt/linux/images/vendor_image_conf.txt new file mode 100755 index 0000000..832e813 --- /dev/null +++ b/riscv64_virt/linux/images/vendor_image_conf.txt @@ -0,0 +1,33 @@ + # Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + # Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved. + # + # Redistribution and use in source and binary forms, with or without modification, + # are permitted provided that the following conditions are met: + # + # 1. Redistributions of source code must retain the above copyright notice, this list of + # conditions and the following disclaimer. + # + # 2. Redistributions in binary form must reproduce the above copyright notice, this list + # of conditions and the following disclaimer in the documentation and/or other materials + # provided with the distribution. + # + # 3. Neither the name of the copyright holder nor the names of its contributors may be used + # to endorse or promote products derived from this software without specific prior written + # permission. + # + # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/vendor +536870912 +--fs_type=ext4 +--dac_config ../../build/ohos/images/mkimage/dac.txt diff --git a/riscv64_virt/linux/ohos.build b/riscv64_virt/linux/ohos.build new file mode 100755 index 0000000..cd1a616 --- /dev/null +++ b/riscv64_virt/linux/ohos.build @@ -0,0 +1,10 @@ +{ + "subsystem": "device_riscv64_virt", + "parts": { + "qemu_riscv64_linux_chipset": { + "module_list": [ + "//device/qemu/riscv64_virt/linux:qemu-riscv64-linux-group" + ] + } + } +} diff --git a/riscv64_virt/linux/rootfs/BUILD.gn b/riscv64_virt/linux/rootfs/BUILD.gn new file mode 100755 index 0000000..de99f6b --- /dev/null +++ b/riscv64_virt/linux/rootfs/BUILD.gn @@ -0,0 +1,56 @@ +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//base/startup/init/services/etc/param/param_fixer.gni") +import("//build/ohos.gni") + +ohos_prebuilt_etc("qemu.riscv64.linux.init.cfg") { + source = "init.qemu.riscv64.linux.cfg" + if (!enable_ramdisk) { + install_images = [ "system" ] + } else { + install_images = [ chipset_base_dir ] + } + part_name = "qemu_riscv64_linux_chipset" +} + +ohos_prebuilt_etc("qemu.riscv64.linux.usb.cfg") { + source = "init.qemu.riscv64.linux.usb.cfg" + if (!enable_ramdisk) { + install_images = [ "system" ] + } else { + install_images = [ chipset_base_dir ] + } + part_name = "qemu_riscv64_linux_chipset" +} + +ohos_prebuilt_etc("qemu.riscv64.linux.updater.cfg") { + source = "qemu.riscv64.linux.updater.cfg" + install_images = [ "updater" ] + part_name = "qemu_riscv64_linux_chipset" +} + +ohos_prebuilt_para("default_param") { + source = "default.para" + install_images = [ chipset_base_dir ] + module_install_dir = "etc/param" + part_name = "qemu_riscv64_linux_chipset" +} + +group("rootfs_files") { + deps = [ + ":default_param", + ":qemu.riscv64.linux.init.cfg", + ":qemu.riscv64.linux.updater.cfg", + ":qemu.riscv64.linux.usb.cfg", + ] +} diff --git a/riscv64_virt/linux/rootfs/default.para b/riscv64_virt/linux/rootfs/default.para new file mode 100755 index 0000000..cb7544f --- /dev/null +++ b/riscv64_virt/linux/rootfs/default.para @@ -0,0 +1,16 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +persist.hdc.mode=tcp +persist.hdc.port=5555 + diff --git a/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.cfg b/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.cfg new file mode 100755 index 0000000..e4bbe9a --- /dev/null +++ b/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.cfg @@ -0,0 +1,28 @@ +{ + "import" : [ + "init.qemu.riscv64.linux.usb.cfg" + ], + "jobs" : [{ + "name" : "pre-init", + "cmds" : [ + "write /proc/sys/vm/min_free_kbytes 10240" + ] + }, { + "name" : "init", + "cmds" : [ + "mount debugfs /sys/kernel/debug /sys/kernel/debug mode=755" + ] + }, { + "name" : "fs", + "cmds" : [ + ] + }, { + "name" : "boot", + "cmds" : [ + "chmod 777 /dev/ttyAMA2", + "chmod 0440 /proc/interrupts", + "chmod 0440 /proc/stat" + ] + } + ] +} diff --git a/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.usb.cfg b/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.usb.cfg new file mode 100755 index 0000000..a6df325 --- /dev/null +++ b/riscv64_virt/linux/rootfs/init.qemu.riscv64.linux.usb.cfg @@ -0,0 +1,51 @@ +{ + "jobs" : [{ + "name" : "boot", + "cmds" : [ + "mkdir /dev/usb-ffs 0770 shell shell", + "mkdir /dev/usb-ffs/hdc 0770 shell shell", + "mount configfs none /config", + "mkdir /config/usb_gadget/g1 0770 shell shell", + "write /config/usb_gadget/g1/idVendor 0x12D1", + "write /config/usb_gadget/g1/idProduct 0x5000", + "write /config/usb_gadget/g1/os_desc/use 1", + "write /config/usb_gadget/g1/bcdDevice 0x0223", + "write /config/usb_gadget/g1/bcdUSB 0x0200", + "mkdir /config/usb_gadget/g1/strings/0x409 0770", + "copy /sys/block/mmcblk0/device/cid /config/usb_gadget/g1/strings/0x409/serialnumber", + "write /config/usb_gadget/g1/strings/0x409/manufacturer HISILICON", + "write /config/usb_gadget/g1/strings/0x409/product \"HDC Device\"", + "mkdir /config/usb_gadget/g1/functions/ffs.hdc", + "mkdir /config/usb_gadget/g1/configs/b.1 0770 shell shell", + "mkdir /config/usb_gadget/g1/configs/b.1/strings/0x409 0770 shell shell", + "write /config/usb_gadget/g1/os_desc/b_vendor_code 0x1", + "write /config/usb_gadget/g1/os_desc/qw_sign MSFT100", + "write /config/usb_gadget/g1/configs/b.1/MaxPower 500", + "symlink /config/usb_gadget/g1/configs/b.1 /config/usb_gadget/g1/os_desc/b.1", + "mount functionfs hdc /dev/usb-ffs/hdc uid=2000,gid=2000", + "setparam sys.usb.configfs 1", + "setparam sys.usb.controller 100e0000.hidwc3_0" + ] + }, { + "name" : "param:sys.usb.config=none && param:sys.usb.configfs=1", + "condition" : "sys.usb.config=none && sys.usb.configfs=1", + "cmds" : [ + "write /config/usb_gadget/g1/os_desc/use 0", + "setparam sys.usb.ffs.ready 0" + ] + }, { + "name" : "param:init.svc.hdcd=stopped", + "condition" : "init.svc.hdcd=stopped", + "cmds" : [ + "setparam sys.usb.ffs.ready 0" + ] + }, { + "name" : "param:sys.usb.config=hdc && param:sys.usb.configfs=1", + "condition" : "sys.usb.config=hdc && sys.usb.configfs=1", + "cmds" : [ + "write /config/usb_gadget/g1/idProduct 0x5000", + "write /config/usb_gadget/g1/os_desc/use 1" + ] + } + ] +} diff --git a/riscv64_virt/linux/rootfs/qemu.riscv64.linux.updater.cfg b/riscv64_virt/linux/rootfs/qemu.riscv64.linux.updater.cfg new file mode 100755 index 0000000..746be03 --- /dev/null +++ b/riscv64_virt/linux/rootfs/qemu.riscv64.linux.updater.cfg @@ -0,0 +1,10 @@ +{ + "jobs" : [ + { + "name" : "init", + "cmds" : [ + + ] + } + ] +} diff --git a/riscv64_virt/ohos.build b/riscv64_virt/ohos.build new file mode 100755 index 0000000..8e0acad --- /dev/null +++ b/riscv64_virt/ohos.build @@ -0,0 +1,10 @@ +{ + "parts": { + "device_riscv64_virt": { + "module_list": [ + "//device/qemu/riscv64_virt:riscv64_virt" + ] + } + }, + "subsystem": "device_riscv64_virt" +} -- Gitee