type
status
slug
summary
tags
category
icon
password
new update day
Property
Oct 22, 2023 01:31 PM
created days
Last edited time
Oct 22, 2023 01:31 PM
构建 rootfs
要生成 QEMU 能够使用的 rootfs,需要创建一个磁盘镜像文件并在其中安装一个操作系统。
这可以通过多种方式完成,例如使用
debootstrap
工具来安装 Debian 系统,或者使用 Buildroot
来创建一个定制的嵌入式 Linux 系统。下面是一个简单的示例,演示如何使用
debootstrap
来创建一个 Debian 系统的磁盘镜像:- 安装
debootstrap
和qemu-utils
工具:
- 创建一个空的磁盘镜像文件:
- 格式化磁盘镜像并挂载它:
- 使用
debootstrap
安装 Debian 系统:
- 卸载磁盘镜像:
现在您就可以在 QEMU 中使用这个磁盘镜像作为 rootfs 了。
设置用户名密码
使用
debootstrap
安装的 Debian 系统默认没有设置用户名和密码。您需要在安装过程中手动设置它们。在安装完成后,您可以使用
chroot
命令进入安装的系统并使用 passwd
命令来设置 root 用户的密码。例如:此外,您还可以使用
adduser
命令来创建新用户并设置密码。例如:- Author:tangcuyu
- URL:https://expoli.tech/articles/2023/07/08/When-compiling-and-debugging-the-kernel-on-Ubuntu-22.04%2C-manually-generate-rootfs-that-can-be-used-by-qemu
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts