dracut/test/make-test-root
Victor Lowther 4957ab92f2 Create test image on an md array and improve cryptroot handling
If we purport to test booting to an md raid, we may as well test it.

We do not need the plymouth module and the normal crypt module to include
duplicate functionality.
2009-05-25 11:36:32 +02:00

37 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# This script creates a root filesystem on an encrypted LVM PV
dd if=/dev/zero of=test/root.ext2 bs=1M count=20
initdir=test/mnt
kernel=$(uname -r)
(
. ./dracut-functions
dracut_install sh df free ls shutdown poweroff stty cat ps ln ip route \
/lib/terminfo/l/linux mount dmesg ifconfig dhclient mkdir cp ping dhclient
inst "modules.d/40network/dhclient-script" "/sbin/dhclient-script"
inst "modules.d/40network/ifup" "/sbin/ifup"
dracut_install grep
inst test/test-init /sbin/init
find_binary plymouth >/dev/null && dracut_install plymouth
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
)
targetfs="$initdir"
unset initdir
# create an initramfs that will create the target root filesystem.
# We do it this way because creating it directly in the host OS
# results in cryptsetup not being able to unlock the LVM PV.
# Probably a bug in cryptsetup, but...
./dracut -l -i "$targetfs" /source \
-m "dash kernel-modules test crypt lvm mdraid udev-rules base rootfs-block" \
-d "ata_piix ext2 sd_mod" \
-f test/initramfs.makeroot
# Invoke KVM and/or QEMU to actually create the target filesystem.
test/run-qemu -hda test/root.ext2 -m 512M -nographic -net none \
-kernel "/boot/vmlinuz-$kernel" \
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81" \
-initrd test/initramfs.makeroot