stratovirt/0010-docs-add-IMAGE_BUILD.md.patch
Fei Xu 5118a146a4 StratoVirt: synchronize 20.03 LTS SP2 branch to master
Signed-off-by: Fei Xu <xufei30@huawei.com>
2021-06-16 17:33:15 +08:00

77 lines
2.0 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 74a0d73ae3658e075bf946e2e90e0d6a9785ac3c Mon Sep 17 00:00:00 2001
From: Zhu Huankai <zhuhuankai1@huawei.com>
Date: Tue, 18 May 2021 10:27:52 +0800
Subject: [PATCH] docs: add IMAGE_BUILD.md
This markdown tells users how to build a test image.
Signed-off-by: Zhu Huankai <zhuhuankai1@huawei.com>
---
tests/hydropper/docs/IMAGE_BUILD.md | 54 +++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
create mode 100644 tests/hydropper/docs/IMAGE_BUILD.md
diff --git a/tests/hydropper/docs/IMAGE_BUILD.md b/tests/hydropper/docs/IMAGE_BUILD.md
new file mode 100644
index 0000000..1e29fb2
--- /dev/null
+++ b/tests/hydropper/docs/IMAGE_BUILD.md
@@ -0,0 +1,54 @@
+# 构建测试镜像
+
+1. 请于openEuler官网下载所需版本的stratovirt_img和vmlinux.bin。(以下以openEuler-21.03-stratovirt-x86_64.img为例)
+
+- 地址https://openeuler.org/zh/download/
+
+2. 扩容镜像
+
+- 创建一个2G大小的空镜像文件extend.img
+
+ ```shell
+ dd if=/dev/zero of=extend.img bs=50M count=40
+ ```
+
+- 扩容stratovirt_img
+
+ ```shell
+ cat extend.img >> openEuler-21.03-stratovirt-x86_64.img
+ ```
+
+- 调整文件系统大小
+
+ ```shell
+ e2fsck -f openEuler-21.03-stratovirt-x86_64.img && resize2fs openEuler-21.03-stratovirt-x86_64.img
+ ```
+
+3. 添加依赖包
+
+- 挂载镜像
+
+ ```shell
+ mount openEuler-21.03-stratovirt-x86_64.img /mnt
+ ```
+
+- 配置在线yum源请参考 [开发环境准备.md](https://gitee.com/openeuler/docs/blob/stable2-21.03/docs/zh/docs/ApplicationDev/开发环境准备.md)。由于stratovirt_img内没有vi等编辑工具建议先在主机上创建文件openEuler.repo并配置好yum源完成后将openEuler.repo拷贝到镜像内。
+
+ ```shell
+ cp ./openEuler.repo /mnt/etc/yum.repos.d
+ ```
+
+- 进入镜像挂载目录通过yum命令安装依赖包。
+
+ ```shell
+ cd /mnt
+ chroot .
+ yum -y install openSSH
+ ```
+
+- 离开当前目录后使用umount命令卸载镜像。
+
+ ```shell
+ exit
+ umount /mnt
+ ```
--
2.25.1