diff --git "a/docs/zh/docs/TailorCustom/isocut\344\275\277\347\224\250\346\214\207\345\215\227.md" "b/docs/zh/docs/TailorCustom/isocut\344\275\277\347\224\250\346\214\207\345\215\227.md" index 19790dae0f02539e6a3dd2faf173f487e76c02ea..bc5af8666cdd205c66caa4a87de3da08b51a97d5 100644 --- "a/docs/zh/docs/TailorCustom/isocut\344\275\277\347\224\250\346\214\207\345\215\227.md" +++ "b/docs/zh/docs/TailorCustom/isocut\344\275\277\347\224\250\346\214\207\345\215\227.md" @@ -7,6 +7,7 @@ - [命令介绍](#命令介绍) - [软件包来源](#软件包来源) - [操作指导](#操作指导) + - [新镜像的自动安装(在riscv64环境下)](#新镜像的自动安装在riscv64环境下) - [FAQ](#FAQ) - [默认 rpm 包列表安装系统失败](#默认-rpm-包列表安装系统失败) @@ -22,7 +23,7 @@ openEuler 光盘镜像较大,下载、传输镜像很耗时。另外,使用 使用 openEuler 裁剪定制工具制作 ISO 所使用的机器需要满足如下软硬件要求: -- CPU 架构为 AArch64 或者 x86_64 +- CPU 架构为 AArch64 / x86_64 / riscv64 - 建议预留 30 GB 以上的磁盘空间(用于运行裁剪定制工具和存放 ISO 镜像) ## 安装工具 @@ -36,6 +37,8 @@ openEuler 光盘镜像较大,下载、传输镜像很耗时。另外,使用 2. 下载对应架构的 ISO 镜像(必须是 everything 版本),并存放在任一目录(建议该目录磁盘空间大于 20 GB),此处假设存放在 /home/isocut_iso 目录。 AArch64 架构的镜像下载链接为:https://repo.openeuler.org/openEuler-{version}/ISO/aarch64/openEuler-{version}-everything-aarch64-dvd.iso + x86_64 架构的镜像下载链接为:https://repo.openeuler.org/openEuler-{version}/ISO/x86_64/openEuler-{version}-everything-x86_64-dvd.iso + riscv64 架构的镜像下载链接为:https://repo.openeuler.org/openEuler-{version}/ISO/riscv64/openEuler-{version}-everything-riscv64-dvd.iso 3. 创建文件 /etc/yum.repos.d/local.repo,配置对应 yum 源。配置内容参考如下,其中 baseurl 是用于挂载 ISO 镜像的目录。 @@ -198,27 +201,18 @@ rootpw --iscrypted ${pwd} > - 配置 grub 初始密码需要使用 root 权限。 > - grub 密码对应的默认用户为 root 。 > -> - 系统中需有 grub2-set-password 命令,若不存在,请提前安装该命令。 +> - 系统中需有 grub2-mkpasswd-pbkdf2 命令,若不存在,请提前安装该命令。 1. 执行如下命令,根据提示设置 grub2 密码。 ```shell - $ sudo grub2-set-password -o ./ + $ sudo grub2-mkpasswd-pbkdf2 -o ./ Enter password: Confirm password: - grep: .//grub.cfg: No such file or directory - WARNING: The current configuration lacks password support! - Update your configuration with grub2-mkconfig to support this feature. + PBKDF2 hash of your password is grub.pbkdf2.sha512.*** ``` -2. 命令执行完成后,会在当前目录生成 user.cfg 文件,grub.pbkdf2.sha512 开头的内容即 grub2 加密密码。 - - ```shell - $ sudo cat user.cfg - GRUB2_PASSWORD=grub.pbkdf2.sha512.*** - ``` - -3. 复制上述密文,并在 /etc/isocut/anaconda-ks.cfg 文件中增加如下配置。 +2. 复制上述密文,并在 /etc/isocut/anaconda-ks.cfg 文件中增加如下配置。 ```shell %addon com_huawei_grub_safe --iscrypted --password='grub.pbkdf2.sha512.***' @@ -256,6 +250,10 @@ kernel.aarch64 %end ``` +##### (在使用 QEMU 启动的 riscv64 中需要)修改 kickstart 文件中的设备名 + +将 `/etc/isocut/anaconda-ks.cfg` 中所有 `sda` 改为 `vda`(共 3 处),使其与 QEMU 虚拟机使用的 VirtIO 设备名称一致,确保自动化安装识别磁盘。 + ### 操作指导 @@ -324,6 +322,57 @@ kernel.aarch64 sudo isocut -t /home/temp -k /etc/isocut/anaconda-ks.cfg /home/isocut_iso/openEuler-24.03-LTS-aarch64-dvd.iso /home/result/new.iso ``` +### 新镜像的自动安装(在riscv64环境下) + +1. 使用 UEFI 启动,下载 `RISCV_VIRT_CODE.fd` 和 `RISCV_VIRT_VARS.fd` + 可在 [openEuler 官方镜像站](https://dl-cdn.openeuler.openatom.cn/openEuler-24.03-LTS/virtual_machine_img/riscv64/) 获取。 + +2. 创建虚拟硬盘,例如: + ``` + qemu-img create -f qcow2 riscv\_disk.qcow2 10G + ``` + +3. 使用如下脚本完成自动安装: + ``` + \#!/usr/bin/env bash + + # Variables + + vcpu=8 + memory=8 + drive="\$(ls \*.qcow2)" + fw1="RISCV\_VIRT\_CODE.fd" + fw2="RISCV\_VIRT\_VARS.fd" + ssh\_port=12055 + cdrom="new\.iso" + + cmd="qemu-system-riscv64 + -nographic + -machine virt,pflash0=pflash0,pflash1=pflash1,acpi=off + -smp \$vcpu -m \${memory}G + -blockdev node-name=pflash0,driver=file,read-only=on,filename=\$fw1 + -blockdev node-name=pflash1,driver=file,filename=\$fw2 + -drive file=\$drive,format=qcow2,id=hd0 + -device virtio-blk-device,drive=hd0,bootindex=1 + -device virtio-scsi-device,id=scsi0 + -drive if=none,file=\$cdrom,id=cdrom,media=cdrom,readonly=on + -device scsi-cd,drive=cdrom,bootindex=2 + -object rng-random,filename=/dev/urandom,id=rng0 + -device virtio-rng-device,rng=rng0 + -device virtio-net-device,netdev=net0 + -netdev user,id=net0,hostfwd=tcp::\$ssh\_port-:22" + + echo ":: Starting RISC-V VM with kickstart ISO..." + echo "vCPU: \$vcpu" + echo "Memory: \${memory}G" + echo "Disk: \$drive" + echo "ISO: \$cdrom" + echo "SSH Port: \$ssh\_port" + sleep 1 + + eval \$cmd + ``` + ## FAQ