[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

qemu installs of FC4 via serial console



I've finished my first installation of Fedora Core 4 with qemu.
This took about 75 minutes for 820 rpm packages on a P4 2.4GHz
with qemu configured to have 384MB of RAM.
Using "-kernel/-initrd" did not work for me, so I put together
a new ISO image which is setting all syslinux options correctly.

Configuring qemu to only use a serial console, I can now
automatically install and start it e.g. within "screen"
and keep it running there. Then I only login via ssh to get some
work done.

Let me know if you run the below script also for ppc/x86_64
and/or for other releases and how those work.

regards,

Florian La Roche




#!/bin/sh
#
# Install and run Fedora Core 4 with qemu.
#

# kickstart file to use
KS="ks=http://192.168.123.128/mirror/ks.cfg";
# image file to use as harddisk
IMAGE=fc4.vmdk
# network MAC address to use
#MAC="-macaddr d0:0f:af:fe:10:00   52:54:00:12:34:56"
# directory where to find Fedora Core
FEDORA=/var/www/html/mirror/fedora/4/i386/os
test -d $FEDORA || FEDORA=/home/mirror/fedora/4/i386/os
PXE=$FEDORA/images/pxeboot

# install params for a serial console
APPEND="initrd=initrd.img ramdisk_size=8192 text console=ttyS0,9600n8"
APPEND="$APPEND utf8 selinux=0 $KS clock=pit"

# Do we want to start a new installation?
if test "$1" = "install" ; then
    # Sanity check.
    test -d $FEDORA || exit 1
    test -d $PXE || exit 1
    # Create an empty harddisk image:
    test -f $IMAGE || qemu-img create $IMAGE 6G
    # The following is not working for me, not sure why:
    #qemu $MAC -m 384 -nographic -kernel $PXE/vmlinuz \
    #     -initrd $PXE/initrd.img -append "$APPEND" -hda $IMAGE
    # Use this for normall install options with a real console:
    #qemu $MAC -m 384 -serial stdio -cdrom $FEDORA/images/boot.iso \
    #     -hda $IMAGE -boot d
    # Copy boot data into a new directory:
    BOOTDIR=`mktemp -d bootdirXXXXXX`
    BOOTISO=`mktemp bootXXXXXX.iso`
    cp -r $FEDORA/isolinux $BOOTDIR/
    chmod 644 $BOOTDIR/isolinux/*
    sed -i -e "s/^timeout .*/timeout 5/" $BOOTDIR/isolinux/isolinux.cfg
    sed -i -e "s#^  append .*#  append $APPEND#" $BOOTDIR/isolinux/isolinux.cfg
    #cat $BOOTDIR/isolinux/isolinux.cfg
    mkisofs -quiet -o $BOOTISO -b isolinux/isolinux.bin -c isolinux/boot.cat \
        -no-emul-boot -boot-load-size 4 -boot-info-table -R -J \
        -V "serial console install" -T $BOOTDIR
    rm -rf $BOOTDIR
    time qemu $MAC -m 384 -nographic -cdrom $BOOTISO -hda $IMAGE -boot d
    rm -rf $BOOTISO
    exit 0
fi

qemu $MAC -m 256 -nographic -hda $IMAGE
exit 0

# Things todo within the installed system:
# - Modify /etc/inittab to start a serial getty:
#   s0:12345:respawn:/sbin/agetty 9600 ttyS0 linux
#   s0:12345:respawn:/sbin/mgetty -r -s 9600 /dev/ttyS0 linux
# - Modify /boot/grub/grub.conf:
#   #splashimage=(hd0,0)/grub/splash.xpm.gz
#   serial –unit=0 –speed=9600
#   terminal –timeout=10 --dump --lines=24 --silent serial console
# - Modify grub.conf to have "console=tty0 console=ttyS0,9600n8"
#   to output kernel messages on both consoles, last entry is
#   also used for keyboard input.
# - Modify /etc/securetty to include your serial device.

# TODO:
# - Try 38400 or 115200 as speed of the serial port?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]