xref: /DragonOS/tools/create_hdd_image.sh (revision 4316306c607e2786d6ad0aa791c5fe198cc6a1a0)
1echo "Creating virtual disk image..."
2
3# 创建一至少为16MB磁盘镜像(类型选择raw)
4qemu-img create -f raw disk.img 16M
5
6# 使用fdisk把disk.img的分区表设置为MBR格式(下方的空行请勿删除)
7fdisk disk.img << EOF
8o
9n
10
11
12
13
14w
15EOF
16
17LOOP_DEVICE=$(sudo losetup -f --show -P disk.img) \
18    || exit 1
19echo ${LOOP_DEVICE}p1
20sudo mkfs.vfat -F 32 ${LOOP_DEVICE}p1
21sudo losetup -d ${LOOP_DEVICE}
22
23echo "Successfully created disk image."
24mkdir -p ../bin
25mv ./disk.img ../bin/
26