Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # grab image
- wget https://dl.fedoraproject.org/pub/alt/risc-v/disk_images/Fedora-Developer-37-20221130.n.0.SiFive.Unmatched/Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz
- # unpack
- xz -d Fedora-Developer-37-20221130.n.0-nvme.raw.img.xz
- # create resized image (128G):
- modprobe nbd max_part=8
- dd if=/dev/zero of=fed64gc_37.raw.img bs=1 count=0 seek=128G
- qemu-nbd -f raw --connect=/dev/nbd1 ./Fedora-Developer-37-20221130.n.0-nvme.raw.img
- qemu-nbd -f raw --connect=/dev/nbd2 ./fed64gc_37.raw.img
- echo -e "p\nq" | fdisk /dev/nbd1 # list partitions
- fdisk /dev/nbd2 # create partitions similar to nbd1
- # g (create empty gpt disk label)
- # n <cr> <cr> +700M (create first partition)
- # n <cr> <cr> <cr> (create second partition)
- # w (save and exit)
- mkfs.ext4 /dev/nbd2p1
- mkfs.ext4 /dev/nbd2p2
- mkdir foo bar
- mount /dev/nbd1p1 foo
- mount /dev/nbd2p1 bar
- cp foo/initramfs* . # grab initrd
- cp foo/vmlinuz* . # grab kernel (appears gzip compressed Image, a.k.a. Image.gz)
- rsync -a foo/ bar/
- umount foo
- umount bar
- blkid /dev/nbd2p* # grab UUID of "/boot" and "/" partitions (*not* PARTUUID!)
- mount /dev/nbd1p2 foo
- mount /dev/nbd2p2 bar
- rsync -a foo/ bar/
- umount foo
- vi bar/etc/fstab # replace UUIDs of "/boot" and "/" with above
- umount bar
- rmdir foo bar
- qemu-nbd --disconnect /dev/nbd1
- qemu-nbd --disconnect /dev/nbd2
- modprobe -r nbd
- # create virtual machine:
- mv vmlinuz-6.0.10-300.0.riscv64.fc37.riscv64 Image-6.0.10-300.0.riscv64.fc37.riscv64.gz
- gunzip Image-6.0.10-300.0.riscv64.fc37.riscv64.gz
- mv initramfs-* /var/lib/libvirt/images/fv64gc/
- mv Image-* /var/lib/libvirt/images/fv64gc/
- mv fed64gc_37.raw.img /var/lib/libvirt/images/fv64gc/
- # edit fv64gc.xml to update initramfs, Image, and the root partition UUID on cmdline
- virsh define fv64gc.xml
- # add "systemd.unit=multi-user.target enforcing=0" to cmdline on first boot;
- # run `systemctl set-default multi-user.target; restorecon -Rp /` on first login!!!
- # then restore cmdline to its original form...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement