#!/bin/sh # Start up an mld system on a ARM system under QEMU color_black="\\033[1;38m" color_reset="\\033[0;39m" color_red="\\033[1;31m" help() { echo "Usage: $0 [MLD_ARCHIVE]" echo " [MLD_ARCHIVE] Create MLD image from the given MLD archive file" } if [ "$1" = "-h" -o "$1" = "--help" ]; then help exit fi if ! qemu --version > /dev/null; then echo "${color_red}QEMU not installed${color_reset}" exit 1 fi cpu=$(qemu-system-arm -M versatilepb -cpu ? | grep arm1176 || qemu-system-arm -M versatilepb -cpu ? | grep arm1136-r2) archive=${1} if [ -n "$archive" ]; then echo "${color_black}Create MLD image${color_reset}" mkdir mld qemu-img create -f raw mld.img 100M mkfs.vfat mld.img sudo mount mld.img mld -o loop,uid=$(id -u),gid=$(id -g) tar -xzf $archive -C mld cp mld/kernel.img kernel cp mld/boot/initramfs . sudo umount mld rmdir mld echo fi if [ ! -e mld.img ]; then echo "${color_red}No MLD image exists${color_reset}" help exit 2 fi echo -n $color_black cat <<-EOF Start MLD for ARM processors on QEMU ==================================== EOF echo -n $color_reset echo "CPU: $cpu" qemu-system-arm -m 256 -M versatilepb -cpu $cpu -ctrl-grab -hda mld.img -kernel kernel -initrd initramfs -append "panic=5 QUIET=1 quiet splash=silent" -daemonize -usbdevice tablet #-vnc :0 #sudo qemu-system-arm -m 256 -M versatilepb -cpu $cpu -ctrl-grab -hda mld.img -kernel kernel -initrd initramfs -append "panic=5 QUIET=1 quiet splash=silent" -net tap -net nic,macaddr=52:54:00:12:34:58 -daemonize -usbdevice tablet #-vnc :0