77 lines
2.0 KiB
Diff
77 lines
2.0 KiB
Diff
|
|
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
|
|||
|
|
|