From 3b5b679166df95ba2ce2e507e008da04d5efd4da Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Tue, 19 Apr 2016 09:35:26 -0400 Subject: rebuild initrd as necessary before qemu --- initrd.sh | 20 +++++++++++++++++--- qemu.sh | 6 +++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/initrd.sh b/initrd.sh index 5e7ed90..675dcc8 100755 --- a/initrd.sh +++ b/initrd.sh @@ -1,4 +1,18 @@ #!/bin/sh -set -ex -cp -f /boot/vmlinuz-$(uname -r) isolinux/live/vmlinuz -/usr/sbin/mkinitramfs -d initramfs-tools -o isolinux/live/initrd.img $(uname -r) + +initrd=isolinux/live/initrd.img +vmlinuz=isolinux/live/vmlinuz + +conf_dir=initramfs-tools + +if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then + need_update=1 +elif [ "$(find "$conf_dir" -newer "$initrd" -print -quit)" ]; then + need_update=1 +fi + +if [ "$need_update" ]; then + set -ex + cp -f /boot/vmlinuz-$(uname -r) "$vmlinuz" + /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" $(uname -r) +fi diff --git a/qemu.sh b/qemu.sh index 2955c20..5c0abd2 100755 --- a/qemu.sh +++ b/qemu.sh @@ -1,7 +1,11 @@ #!/bin/sh # img=debian-live-8.4.0-amd64-gnome-desktop.iso -img=debian-live-8.4.0-amd64-standard.iso +# img=debian-live-8.4.0-amd64-standard.iso +img=debian-live-8.4.0-amd64-standard.btrfs.iso + +./initrd.sh + sudo qemu-system-x86_64 -enable-kvm -smp 2 -m 640 -k en-us \ -vga qxl \ -net nic,vlan=0,model=virtio \ -- cgit v1.2.3