diff options
author | Helmut Grohne <helmut@subdivi.de> | 2023-01-15 21:11:07 +0100 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2023-01-15 21:11:07 +0100 |
commit | e0b948d626e744c9b8a53cacbd09167b61e5da47 (patch) | |
tree | 7c45e189552f3d67a5486ba484317b3c9f6c1d8f /bin | |
parent | 2e8532c6af5a144c891d6f72743bd9873941acde (diff) | |
parent | 4f085d1e4bad9990671fb5d953c9aba2c9b51902 (diff) | |
download | debvm-e0b948d626e744c9b8a53cacbd09167b61e5da47.tar.gz |
Merge support_boot into main
Closes: !23
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/debvm-run | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/bin/debvm-run b/bin/debvm-run index 6ed47c4..e36ea60 100755 --- a/bin/debvm-run +++ b/bin/debvm-run @@ -16,7 +16,7 @@ B<debvm-run> [B<-g>] [B<-i> F<image>] [B<-s> I<sshport>] [B<--> I<qemu options>] B<debvm-run> is essentially a thin wrapper around B<qemu> for running a virtual machine image created by B<debvm-create> or something compatible. The virtual machine image is expected to be a raw ext4 image with file system label B<debvm>. The architecture of the machine is detected from the contained F</bin/true>. -It must contain a symbolic link pointing to a kernel image at F</vmlinuz> or F</vmlinux> depending on the architecture and a symbolic link pointing to an initrd image at F</initrd.img>. +It must contain a symbolic link pointing to a kernel image at one of F<(|/boot)/vmlinu[xz]> a symbolic link pointing to an initrd image at F<initrd.img> in the same directory as the kernel image. Both are extracted and passed to B<qemu>. A net interface configured for user mode is added automatically. @@ -186,20 +186,22 @@ if command -v elf-arch >/dev/null 2>&1; then /sbin/debugfs "$IMAGE" -R "cat /bin/true" > "$KERNELTMP" VMARCH=$(elf-arch "$KERNELTMP") fi -case "$VMARCH" in - mips*|ppc64el) - KERNELLINK=vmlinux - ;; - *) - KERNELLINK=vmlinuz - ;; -esac - -KERNELNAME=$(/sbin/debugfs "$IMAGE" -R "stat $KERNELLINK" | sed 's/Fast link dest: "\(.*\)"/\1/;t;d') -INITRDNAME=$(/sbin/debugfs "$IMAGE" -R "stat initrd.img" | sed 's/Fast link dest: "\(.*\)"/\1/;t;d') +for KERNELLINK in vmlinuz vmlinux boot/vmlinuz boot/vmlinux; do + KERNELNAME=$(/sbin/debugfs "$IMAGE" -R "stat $KERNELLINK" | sed 's/Fast link dest: "\(.*\)"/\1/;t;d') + test -n "$KERNELNAME" && break +done +if test "${KERNELLINK%/*}" = "$KERNELLINK"; then + BOOTDIR= +else + BOOTDIR="${KERNELLINK%/*}/" +fi test -n "$KERNELNAME" || die "failed to discover kernel image" +test "${KERNELNAME#/}" = "$KERNELNAME" && KERNELNAME="$BOOTDIR$KERNELNAME" + +INITRDNAME=$(/sbin/debugfs "$IMAGE" -R "stat ${BOOTDIR}initrd.img" | sed 's/Fast link dest: "\(.*\)"/\1/;t;d') test -n "$INITRDNAME" || die "failed to discover initrd image" +test "${INITRDNAME#/}" = "$INITRDNAME" && INITRDNAME="$BOOTDIR$INITRDNAME" KERNEL_CMDLINE="root=LABEL=debvm rw" NETDEV="user,id=net0" |