From 4687e3a9eaeafb761fe79444a628bd56dd0d4c47 Mon Sep 17 00:00:00 2001 From: Jinguang Dong Date: Wed, 28 Oct 2020 11:43:04 +0800 Subject: [PATCH 1/2] Add docker image for OpenHarmony platform build --- docker/Dockerfile | 63 ++++++++++++++ docker/LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++ docker/README.md | 27 ++++++ docker/build.sh | 16 ++++ docker/sources.list | 14 +++ 5 files changed, 321 insertions(+) create mode 100644 docker/Dockerfile create mode 100644 docker/LICENSE create mode 100644 docker/README.md create mode 100755 docker/build.sh create mode 100644 docker/sources.list diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000000..de4a46cee34 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,63 @@ +# 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. + + +FROM ubuntu:20.04 +MAINTAINER dongjinguang@huawei.com +WORKDIR /home/openharmony + +RUN apt-get update -y \ + && apt-get install curl wget -y \ + && apt-get install python3.8 -y \ + && apt-get install python3-pip -y \ + && apt-get install dosfstools -y \ + && apt-get install mtools -y \ + && apt-get install scons -y \ + && apt-get install make -y \ + && apt-get install libffi-dev -y \ + && apt-get install zip -y \ + && apt-get install python3-distutils -y \ + && apt-get install binutils -y \ + && apt-get install mtd-utils -y \ + && apt-get install libc6-dev-x32 -y \ + && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 \ + && ln -s /bin/bash /bin/sh \ + && ln -s /usr/bin/python3.8 /usr/bin/python3 \ + && ln -s /usr/bin/python3.8 /usr/bin/python \ + && pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple setuptools \ + && pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple kconfiglib \ + && pip3 install --trusted-host mirrors.aliyun.com -i http://mirrors.aliyun.com/pypi/simple pycryptodome \ + && pip3 install --trusted-host mirrors.aliyun.com -i https://mirrors.aliyun.com/pypi/simple ecdsa \ + && mkdir -p /home/tools \ + && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar \ + && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar \ + && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz \ + && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar \ + && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar \ + && tar xvf /home/tools/llvm-linux-9.0.0-34042.tar -C /home/tools \ + && tar xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \ + && tar xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \ + && tar xvf /home/tools/ninja.1.9.0.tar -C /home/tools \ + && tar xvf /home/tools/gn.1523.tar -C /home/tools \ + && sed -i '$aexport PATH=/home/tools/llvm/bin:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/home/tools/hc-gen:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/home/tools/gcc_riscv32/bin:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/home/tools/ninja:$PATH' /root/.bashrc \ + && sed -i '$aexport PATH=/home/tools/gn:$PATH' /root/.bashrc \ + && export PATH=/home/tools/llvm/bin:$PATH \ + && export PATH=/home/tools/hc-gen:$PATH \ + && export PATH=/home/tools/gcc_riscv32/bin:$PATH \ + && export PATH=/home/tools/ninja:$PATH \ + && export PATH=/home/tools/gn:$PATH \ + && rm -rf /home/tools/*.tar \ + && rm -rf /home/tools/*.gz diff --git a/docker/LICENSE b/docker/LICENSE new file mode 100644 index 00000000000..261eeb9e9f8 --- /dev/null +++ b/docker/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000000..f10bb644c8b --- /dev/null +++ b/docker/README.md @@ -0,0 +1,27 @@ +# Openharmony docerimage + +### Docker镜像 + +Openharmony的Docker镜像托管在[HuaweiCloud SWR](https://console.huaweicloud.com/swr/?region=cn-south-1#/app/warehouse/warehouseMangeDetail/goldensir/openharmony-docker/openharmony-docker?type=ownImage)上。 +目前容器化构建选项支持情况如下: + +| 硬件平台 | Docker镜像仓库 | 标签 | 说明 | +| :----- | :------------------------ | :----------------------- | :--------------------------------------- | +| 3861/3516/3518 | `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `0.0.1` | 已经预安装Openharmony `0.0.1` 版本的编译环境。 | + + +* Ubuntu/Windows 平台使用说明 + + 对于`Ubuntu/Windows`平台,可以直接使用以下命令获取并运行最新的稳定镜像: + ``` + docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.1 + docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.1 + python build.py wifiiot/ipcamera_hi3516dv300/ipcamera_hi3518ev300 + ``` + +#### 通过Dockerfile 构建本地Docker image + ``` + git clone https://gitee.com/openharmony/docs.git + cd docs/docker + ./build.sh + ``` diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 00000000000..de9e060e981 --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,16 @@ +# 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. + + +#!/bin/sh +docker build -t openharmony-docker:0.0.1 . diff --git a/docker/sources.list b/docker/sources.list new file mode 100644 index 00000000000..7214e41b134 --- /dev/null +++ b/docker/sources.list @@ -0,0 +1,14 @@ +# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释 +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse + +# 预发布软件源,不建议启用 +deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse +# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse + -- Gitee From b4a2abdb1013ad95f5a825d5d2fde737ba5eed92 Mon Sep 17 00:00:00 2001 From: Jinguang Dong Date: Wed, 28 Oct 2020 11:54:40 +0800 Subject: [PATCH 2/2] Add quick linker for Docker image build and format the file to unix --- Readme-CN.md | 61 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/Readme-CN.md b/Readme-CN.md index 3a4879a7ba6..791d8dd8f72 100755 --- a/Readme-CN.md +++ b/Readme-CN.md @@ -1,30 +1,31 @@ -# OpenHarmony开发者文档 - -此工程存放OpenHarmony提供的快速入门、开发指南、API参考等开发者文档,欢迎参与OpenHarmony开发者文档开源项目,与我们一起完善开发者文档。 - -[View English](docs-en/Readme-EN.md) - -## 文档目录结构 - -- quick-start:[快速入门](quick-start/Readme-CN.md) -- get-code:[获取源码/获取工具](get-code/Readme-CN.md) -- driver:[驱动](driver/Readme-CN.md) -- kernel:[内核](kernel/Readme-CN.md) -- subsystems:[子系统](subsystems/Readme-CN.md) -- bundles:[组件开发](bundles/Readme-CN.md) -- guide:[设备开发](guide/Readme-CN.md) -- security:[安全](security/Readme-CN.md) -- api-LinkIoT:[联接类模组API](api/api-LinkIoT/Readme-CN.md) -- api-SmartVision-Devices:[智慧视觉设备API](api/api-SmartVision-Devices/Readme-CN.md) -- contribute:[贡献](contribute/参与贡献.md) -- term:[术语](term/术语.md) -- 3rd-Party-License:[第三方开源软件及许可证说明](quick-start/第三方开源软件及许可证说明.md) - -## 贡献 - -非常欢迎您贡献文档,我们鼓励开发者以各种方式参与文档反馈和贡献。 - -您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](contribute/贡献文档.md)。 - -卓越贡献者将会在开发者社区文档贡献专栏表彰公示。 - +# OpenHarmony开发者文档 + +此工程存放OpenHarmony提供的快速入门、开发指南、API参考等开发者文档,欢迎参与OpenHarmony开发者文档开源项目,与我们一起完善开发者文档。 + +[View English](docs-en/Readme-EN.md) + +## 文档目录结构 + +- quick-start:[快速入门](quick-start/Readme-CN.md) +- get-code:[获取源码/获取工具](get-code/Readme-CN.md) +- docker:[Docker镜像构建](docker/README.md) +- driver:[驱动](driver/Readme-CN.md) +- kernel:[内核](kernel/Readme-CN.md) +- subsystems:[子系统](subsystems/Readme-CN.md) +- bundles:[组件开发](bundles/Readme-CN.md) +- guide:[设备开发](guide/Readme-CN.md) +- security:[安全](security/Readme-CN.md) +- api-LinkIoT:[联接类模组API](api/api-LinkIoT/Readme-CN.md) +- api-SmartVision-Devices:[智慧视觉设备API](api/api-SmartVision-Devices/Readme-CN.md) +- contribute:[贡献](contribute/参与贡献.md) +- term:[术语](term/术语.md) +- 3rd-Party-License:[第三方开源软件及许可证说明](quick-start/第三方开源软件及许可证说明.md) + +## 贡献 + +非常欢迎您贡献文档,我们鼓励开发者以各种方式参与文档反馈和贡献。 + +您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容,详细请参考[贡献文档](contribute/贡献文档.md)。 + +卓越贡献者将会在开发者社区文档贡献专栏表彰公示。 + -- Gitee