Added Multiboot support
Added support for passing kernel and modules directly to qemu using multiboot.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
DISK_IMAGE=minix.postinst.8g.img
|
||||
DISK_IMAGE=minix.dev-postinst.8g.img
|
||||
INSTANCE_NUMBER=1
|
||||
|
||||
MULTIBOOT_SOURCE_DIR=""
|
||||
|
||||
if [ -f .settings ]
|
||||
then
|
||||
@@ -21,7 +21,6 @@ then
|
||||
|
||||
fi
|
||||
USB_DISK_PARAMS="-drive id=my_usb_disk,file=usbdisk.img,if=none -device usb-storage,drive=my_usb_disk "
|
||||
|
||||
QEMU_PARAMS="-usb $USB_DISK_PARAMS"
|
||||
|
||||
|
||||
@@ -46,34 +45,44 @@ then
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# For multiboot (not functional yet) missing mfs? and qemu not properly starting
|
||||
#
|
||||
MULTIBOOT_KERNEL_CMD_LINE="rootdevname=c0d0p0s0"
|
||||
MULTIBOOT_MODULE_NAMES="
|
||||
mod01_ds \
|
||||
mod02_rs \
|
||||
mod03_pm \
|
||||
mod04_sched \
|
||||
mod05_vfs \
|
||||
mod06_memory \
|
||||
mod07_log \
|
||||
mod08_tty \
|
||||
mod09_ext2 \
|
||||
mod10_vm \
|
||||
mod11_pfs \
|
||||
mod12_init \
|
||||
"
|
||||
MULTIBOOT_MODULES=""
|
||||
for i in ${MULTIBOOT_MODULE_NAMES}
|
||||
do
|
||||
MULTIBOOT_MODULES="$MULTIBOOT_MODULES,${i} arg=$MULTIBOOT_KERNEL_CMD_LINE"
|
||||
done
|
||||
MULTIBOOT_MODULES=${MULTIBOOT_MODULES:1}
|
||||
MULTIBOOT_PARAMS="-kernel kernel -initrd \"$MULTIBOOT_MODULES\""
|
||||
if [ -n "$MULTIBOOT_SOURCE_DIR" -a -d "$MULTIBOOT_SOURCE_DIR" ]
|
||||
then
|
||||
echo "Using multiboot (found directory)"
|
||||
#
|
||||
# For multiboot in qemu we need to give the modules as parameter to qemu in the
|
||||
# initrd argument. We need a comma separated list of items but also need to pass
|
||||
# the kernel command line arguments to the modules.
|
||||
MULTIBOOT_DEST_DIR=multiboot
|
||||
rm -rf $MULTIBOOT_DEST_DIR
|
||||
mkdir -p $MULTIBOOT_DEST_DIR
|
||||
cp $MULTIBOOT_SOURCE_DIR/* $MULTIBOOT_DEST_DIR
|
||||
for i in $MULTIBOOT_DEST_DIR/mod*.gz ; do gunzip $i ; done
|
||||
MULTIBOOT_KERNEL_CMD_LINE="rootdevname=c0d0p0s0"
|
||||
MULTIBOOT_MODULE_NAMES="
|
||||
mod01_ds \
|
||||
mod02_rs \
|
||||
mod03_pm \
|
||||
mod04_sched \
|
||||
mod05_vfs \
|
||||
mod06_memory \
|
||||
mod07_log \
|
||||
mod08_tty \
|
||||
mod09_mfs \
|
||||
mod10_vm \
|
||||
mod11_pfs \
|
||||
mod12_init \
|
||||
"
|
||||
MULTIBOOT_MODULES=""
|
||||
for i in ${MULTIBOOT_MODULE_NAMES}
|
||||
do
|
||||
MULTIBOOT_MODULES="$MULTIBOOT_MODULES,$MULTIBOOT_DEST_DIR/${i} arg=$MULTIBOOT_KERNEL_CMD_LINE"
|
||||
done
|
||||
MULTIBOOT_MODULES=${MULTIBOOT_MODULES:1}
|
||||
MULTIBOOT_PARAMS="-kernel $MULTIBOOT_DEST_DIR/kernel -initrd \"$MULTIBOOT_MODULES\""
|
||||
|
||||
#QEMU_PARAMS="$QEMU_PARAMS -append \"$MULTIBOOT_KERNEL_CMD_LINE\""
|
||||
#QEMU_PARAMS="$QEMU_PARAMS $MULTIBOOT_PARAMS"
|
||||
QEMU_PARAMS="$QEMU_PARAMS -append \"$MULTIBOOT_KERNEL_CMD_LINE\""
|
||||
QEMU_PARAMS="$QEMU_PARAMS $MULTIBOOT_PARAMS"
|
||||
fi
|
||||
|
||||
|
||||
SSH_PORT=$((2222 + $INSTANCE_NUMBER))
|
||||
@@ -86,7 +95,9 @@ MONITOR_PORT=$((4444 + $INSTANCE_NUMBER))
|
||||
# also start the monitor on port 4444 so we can telnet to it.
|
||||
echo "starting ${DISK_IMAGE} qemu instance ${INSTANCE_NUMBER} with ssh port ${SSH_PORT} and monitor on port ${MONITOR_PORT}"
|
||||
sleep 2
|
||||
qemu-system-i386 -localtime -redir tcp:$SSH_PORT::22 -m 2024 -hda $DISK_IMAGE -curses \
|
||||
-monitor telnet::$MONITOR_PORT,server,nowait \
|
||||
-enable-kvm $QEMU_PARAMS
|
||||
|
||||
cmd="qemu-system-i386 -curses -localtime -redir tcp:$SSH_PORT::22 -m 2024 $QEMU_PARAMS -monitor telnet::$MONITOR_PORT,server,nowait -enable-kvm -hda $DISK_IMAGE"
|
||||
#
|
||||
# I don't actually know why I need the eval here ..
|
||||
echo $cmd
|
||||
eval $cmd
|
||||
|
||||
Reference in New Issue
Block a user