...
 
Commits (4)
......@@ -20,7 +20,8 @@ if [ -z "$MIRROR" ] ; then
MIRROR="http://deb.debian.org/debian"
fi
DISK="image.qcow2"
DIR=`mktemp -d /tmp/$SYSTEM-XXXXXXX`
DISK="$DIR/image.qcow2"
FOUND="no"
......@@ -151,6 +152,23 @@ if [ "$SYSTEM" == "s390x-virt" ] ; then
FOUND="yes"
fi
# FIXME I could not find how to show the Linux boot-up log, to give
# feedback to the user; it seems the console hangs after a few bytes,
# until the login prompt
if [ "$SYSTEM" == "ppc64el-pseries" ] ; then
ARCH="ppc64el"
LINUX="linux-image-powerpc64le"
QEMU_ARCH="ppc64le"
QEMU_MACHINE="pseries"
QEMU_CPU="power9"
QEMU_DISK="-drive file=$DISK"
QEMU_NET_DRIVER="e1000"
LINUX_FILENAME="vmlinux"
INITRD_FILENAME="initrd.img"
CONSOLE="tty0"
FOUND="yes"
fi
if [ "$FOUND" != "yes" ] ; then
echo "Could not find system type: $SYSTEM"
exit 1
......@@ -159,35 +177,34 @@ fi
QEMU_NET="-device $QEMU_NET_DRIVER,netdev=net -netdev user,id=net,hostfwd=tcp::2222-:22"
# Create the filesystem
eatmydata qemu-debootstrap --arch="$ARCH" --include="$LINUX",systemd --verbose "$SUITE" /tmp/chroot "$MIRROR"
eatmydata qemu-debootstrap --arch="$ARCH" --include="$LINUX",systemd,openssh-server --verbose "$SUITE" "$DIR"/chroot "$MIRROR"
# Install a simple fstab and set hostname
cp fstab /tmp/chroot/etc/fstab
echo "debian" > /tmp/chroot/etc/hostname
cp fstab "$DIR"/chroot/etc/fstab
echo "debian" > "$DIR"/chroot/etc/hostname
# Create and set passwords for root and user debian
chroot /tmp/chroot adduser --gecos "Debian user,,," --disabled-password debian
echo "root:root" | chroot /tmp/chroot chpasswd
echo "debian:debian" | chroot /tmp/chroot chpasswd
chroot "$DIR"/chroot adduser --gecos "Debian user,,," --disabled-password debian
echo "root:root" | chroot "$DIR"/chroot chpasswd
echo "debian:debian" | chroot "$DIR"/chroot chpasswd
# Disable predictable interface naming and configure dhcp by default
ln -s /dev/null /tmp/chroot/etc/systemd/network/99-default.link
cp interfaces /tmp/chroot/etc/network/interfaces
ln -s /dev/null "$DIR"/chroot/etc/systemd/network/99-default.link
cp interfaces "$DIR"/chroot/etc/network/interfaces
# Recreate initrd
chroot /tmp/chroot update-initramfs -k all -c
chroot "$DIR"/chroot update-initramfs -k all -c
# Create the qcow2 image
eatmydata virt-make-fs --format=qcow2 --size="$DISK_SIZE" --partition=gpt --type=ext4 --label=rootfs /tmp/chroot /tmp/"$DISK"
eatmydata virt-make-fs --format=qcow2 --size="$DISK_SIZE" --partition=gpt --type=ext4 --label=rootfs "$DIR"/chroot "$DISK"
# Extract kernel and initrd
ln -L /tmp/chroot/"$LINUX_FILENAME" /tmp/kernel
ln -L /tmp/chroot/"$INITRD_FILENAME" /tmp/initrd
ln -L "$DIR"/chroot/"$LINUX_FILENAME" "$DIR"/kernel
ln -L "$DIR"/chroot/"$INITRD_FILENAME" "$DIR"/initrd
# Propose a boot command line
echo "(Try to) boot with:"
echo cd /tmp
echo qemu-system-"$QEMU_ARCH" -machine "$QEMU_MACHINE" -cpu "$QEMU_CPU" -m "$MEM" $QEMU_DISK $QEMU_NET -kernel kernel -initrd initrd -nographic -append '"'root=LABEL=rootfs console="$CONSOLE"'"'
echo qemu-system-"$QEMU_ARCH" -machine "$QEMU_MACHINE" -cpu "$QEMU_CPU" -m "$MEM" $QEMU_DISK $QEMU_NET -kernel "$DIR"/kernel -initrd "$DIR"/initrd -nographic -append '"'root=LABEL=rootfs console="$CONSOLE"'"'
echo "You can use Ctrl-a x to exit from QEMU"
#rm -fr /tmp/chroot
#rm -fr "$DIR"/chroot