-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-qemu-syslinux
executable file
·29 lines (25 loc) · 1.01 KB
/
run-qemu-syslinux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
set -euox pipefail
cd "$(dirname "$0")"
# Skipping Kernel re-build (so this is different from run-qemu, which still does that)
# Prepare InitRD (from container image named e.g. "hello" which was created in `./build`)
./image2initrd $1
KERNEL="$(dirname "$0")"/$1.kernel
INITRD="$(dirname "$0")"/$1.initrd
# Create boot disk image
# inspired by https://wiki.syslinux.org/wiki/index.php?title=Development/Testing
# TODO use guestfish (guestmount) here, like in archlinux/*.sh?
IMG=$1.img
rm -f $IMG
qemu-img create -f raw $IMG 20M
mkfs.ext4 -v -L LinuxRootFS $IMG
udisksctl loop-setup --no-user-interaction -f $IMG
sudo extlinux --install /run/media/$USER/LinuxRootFS
sudo cp syslinux/* /run/media/$USER/LinuxRootFS
sudo mkdir /run/media/$USER/LinuxRootFS/boot/
sudo cp $KERNEL /run/media/$USER/LinuxRootFS/boot/bzImage
sudo cp $INITRD /run/media/$USER/LinuxRootFS/boot/initrd.gz
sudo ls -alR /run/media/$USER/LinuxRootFS/
umount /run/media/$USER/LinuxRootFS/
# Actually run image in VM
./run-gtk-bios "$IMG"