From 4b7a075453479e183a02e34bf1177ef5538f026a Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Tue, 31 Jul 2012 09:13:26 +0200 Subject: add support for virtualbox emulator --- package/cfgfs/Makefile | 4 ++-- scripts/create-image-with-grub.sh | 17 ++++++++++++----- scripts/create-sys | 2 +- scripts/update-sys | 2 +- target/config/Config.in | 8 +++++++- target/linux/config/Config.in.block | 2 +- target/linux/config/Config.in.graphics | 23 +++++++++++++++++++++-- target/linux/config/Config.in.input | 5 +++++ target/linux/config/Config.in.netdevice | 1 + target/x86/Makefile | 5 +++++ 10 files changed, 56 insertions(+), 13 deletions(-) diff --git a/package/cfgfs/Makefile b/package/cfgfs/Makefile index 9d8acf78a..fdf13aa33 100644 --- a/package/cfgfs/Makefile +++ b/package/cfgfs/Makefile @@ -5,7 +5,7 @@ include ${TOPDIR}/rules.mk PKG_NAME:= cfgfs PKG_VERSION:= 1.0.9 -PKG_RELEASE:= 2 +PKG_RELEASE:= 3 PKG_DESCR:= compressed config filesystem PKG_SECTION:= base PKG_URL:= http://openadk.org/ @@ -15,7 +15,7 @@ PKG_CFLINE_CFGFS+= select BUSYBOX_MD5SUM@ PKG_CFLINE_CFGFS+= select BUSYBOX_XARGS@ PKG_CFLINE_CFGFS+= select BUSYBOX_FEATURE_SORT_BIG@ PKG_CFLINE_CFGFS+= depends on !ADK_TARGET_ROOTFS_NFSROOT && !ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK && !ADK_TARGET_ROOTFS_INITRAMFS -PKG_DFLT_CFGFS:= y if !(ADK_TOOLCHAIN_ONLY || ADK_TOOLCHAIN_ARCHIVE || ADK_HARDWARE_QEMU) +PKG_DFLT_CFGFS:= y if !(ADK_TOOLCHAIN_ONLY || ADK_TOOLCHAIN_ARCHIVE) WRKDIST= ${WRKDIR}/${PKG_NAME}-${PKG_VERSION} NO_DISTFILES:= 1 diff --git a/scripts/create-image-with-grub.sh b/scripts/create-image-with-grub.sh index 43770f5ba..dbf073b07 100755 --- a/scripts/create-image-with-grub.sh +++ b/scripts/create-image-with-grub.sh @@ -67,14 +67,14 @@ type=qemu function usage { cat >&2 < 5 )); then print -u2 "$me: -c $OPTARG out of bounds" @@ -87,6 +87,8 @@ while getopts "c:hp:qs:ntf:" ch; do fi ;; (q) quiet=1 ;; (+q) quiet=0 ;; + (g) grub=1 ;; + (+g) grub=0 ;; (s) if [[ $OPTARG != @(96|192|384|576|1152)00 ]]; then print -u2 "$me: serial speed $OPTARG invalid" exit 1 @@ -310,13 +312,18 @@ done cp "${grubfiles[@]}" boot/grub/ cd "$TOPDIR" -dd if=qemu.img of=mbr bs=64k count=1 -bs=$((524288-64-1)) +dd if=$tgt of=mbr bs=64k count=1 2>/dev/null +bs=$((524288)) (( quiet )) || print Generating ext2 image with size $bs... -dd if=/dev/zero of=cfgfs bs=1024k count=$cfgfs +dd if=/dev/zero of=cfgfs bs=1024k count=$cfgfs 2>/dev/null genext2fs -q -b $bs -d $T ${tgt}.new (( quiet )) || print Finishing up... cat mbr ${tgt}.new cfgfs > $tgt +if [[ $type = vbox ]]; then + rm -f $tgt.vdi + VBoxManage convertdd $tgt $tgt.vdi +fi + rm -rf "$T" mbr ${tgt}.new cfgfs exit 0 diff --git a/scripts/create-sys b/scripts/create-sys index ffa0ed70f..c34a6ac3a 100755 --- a/scripts/create-sys +++ b/scripts/create-sys @@ -32,7 +32,7 @@ for i in $systems;do systemu=$(echo $system|tr '[:upper:]' '[:lower:]') system=$(echo $system|tr '[:upper:]_' '[:lower:]-') system=$(echo $system|sed 's#x86-64#x86_64#') - if [ "${system%-*}" = "toolchain" -o "${system%-*}" = "qemu" ];then + if [ "${system%-*}" = "toolchain" -o "${system%-*}" = "qemu" -o "${system%-*}" = "vbox" ];then printf "\tdefault \"${system%-*}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default else printf "\tdefault \"${system}\" if ADK_$systemu\n" >> $topdir/target/config/Config.in.system.default diff --git a/scripts/update-sys b/scripts/update-sys index bcfbfa84e..64b56a7dd 100755 --- a/scripts/update-sys +++ b/scripts/update-sys @@ -49,7 +49,7 @@ config $archsym boolean EOF -if [ "${system}" = "toolchain" -o "${system}" = "qemu" ];then +if [ "${system}" = "toolchain" -o "${system}" = "qemu" -o "${system}" = "vbox" ];then sys=${system}-$cpuarch else sys=$system diff --git a/target/config/Config.in b/target/config/Config.in index d4d5f193e..9a296b32b 100644 --- a/target/config/Config.in +++ b/target/config/Config.in @@ -223,6 +223,9 @@ config ADK_LINUX_64 config ADK_HARDWARE_QEMU boolean +config ADK_HARDWARE_VBOX + boolean + config ADK_NATIVE boolean @@ -400,6 +403,7 @@ config ADK_TARGET_CMDLINE default "console=ttyS0,115200 console=tty0" if ADK_TARGET_SYSTEM_IBM_X40 default "console=ttyS0,115200 console=tty0" if ADK_TARGET_SYSTEM_INTEL_ATOM default "console=ttyS0,115200 console=tty0" if ADK_TARGET_SYSTEM_QEMU_I686 + default "console=ttyS0,115200 console=tty0 vga=791" if ADK_TARGET_SYSTEM_VBOX_I686 default "console=ttyS0,115200 console=tty0" if ADK_TARGET_QEMU_ARM_MODEL_SPITZ default "console=ttyAMA0 console=tty0" if ADK_TARGET_QEMU_ARM_MODEL_VERSATILE default "console=ttyS0,115200 console=tty0 fbcon=rotate:1" if ADK_TARGET_SYSTEM_SHARP_ZAURUS @@ -517,6 +521,7 @@ config ADK_TARGET_ROOTFS_INITRAMFS ADK_LINUX_X86 || \ ADK_LINUX_X86_64 || \ ADK_LINUX_NATIVE + depends on !ADK_HARDWARE_VBOX select ADK_KERNEL_BLK_DEV_INITRD select ADK_KERNEL_RD_XZ help @@ -534,6 +539,7 @@ config ADK_TARGET_ROOTFS_INITRAMFS_PIGGYBACK ADK_LINUX_X86 || \ ADK_LINUX_X86_64 || \ ADK_LINUX_NATIVE + depends on !ADK_HARDWARE_VBOX select ADK_KERNEL_EXT2_FS help create an read-only initramfs system. @@ -565,7 +571,7 @@ config ADK_TARGET_ROOTFS_NFSROOT select ADK_KERNEL_NFS_COMMON select ADK_KERNEL_IP_PNP select ADK_KERNEL_IP_PNP_DHCP - depends on !ADK_HARDWARE_QEMU + depends on !ADK_HARDWARE_QEMU && !ADK_HARDWARE_VBOX help Root filesystem mounted via NFS. (DHCP) diff --git a/target/linux/config/Config.in.block b/target/linux/config/Config.in.block index 87fce5e8e..a71982b76 100644 --- a/target/linux/config/Config.in.block +++ b/target/linux/config/Config.in.block @@ -4,7 +4,6 @@ config ADK_KERNEL_BLOCK config ADK_KERNEL_MD boolean - config ADK_KERNEL_LBD boolean @@ -159,6 +158,7 @@ config ADK_KERNEL_SATA_AHCI select ADK_KERNEL_BLK_DEV_SD depends on ADK_TARGET_WITH_SATA default y if ADK_TARGET_SYSTEM_SHUTTLE_SA76 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default n menu "Block devices support" diff --git a/target/linux/config/Config.in.graphics b/target/linux/config/Config.in.graphics index f6f97dfa8..4a6cb4dec 100644 --- a/target/linux/config/Config.in.graphics +++ b/target/linux/config/Config.in.graphics @@ -1,6 +1,7 @@ config ADK_KERNEL_VT boolean default y if ADK_HARDWARE_QEMU + default y if ADK_HARDWARE_VBOX default y if ADK_TARGET_WITH_VGA default y if ADK_NATIVE_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_INTEL_ATOM @@ -9,11 +10,18 @@ config ADK_KERNEL_VT config ADK_KERNEL_VT_CONSOLE boolean default y if ADK_HARDWARE_QEMU + default y if ADK_HARDWARE_VBOX default y if ADK_TARGET_WITH_VGA default y if ADK_NATIVE_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_INTEL_ATOM default n +config ADK_KERNEL_VGA_CONSOLE + boolean + default y if ADK_HARDWARE_VBOX + default y if ADK_TARGET_WITH_VGA + default n + config ADK_KERNEL_FONTS boolean @@ -48,9 +56,20 @@ config ADK_KERNEL_AGP_INTEL menu "Graphic devices support" depends on ADK_TARGET_WITH_VGA +config ADK_KERNEL_FB_VESA + prompt "................................ Framebuffer support for VirtualBox Emulator (VESA)" + boolean + select ADK_KERNEL_FB + select ADK_KERNEL_FRAMEBUFFER_CONSOLE + default y if ADK_TARGET_SYSTEM_VBOX_I686 + default n + depends on ADK_TARGET_SYSTEM_VBOX_I686 + help + Framebuffer support for VirtualBox Emulator. + config ADK_KERNEL_FB_CIRRUS - prompt "................................ Framebuffer support for QEMU Emulator" - tristate + prompt "................................ Framebuffer support for QEMU Emulator (Cirrus)" + boolean select ADK_KERNEL_FB select ADK_KERNEL_FRAMEBUFFER_CONSOLE default y if ADK_TARGET_SYSTEM_QEMU_I686 diff --git a/target/linux/config/Config.in.input b/target/linux/config/Config.in.input index 27966d80b..4f29471da 100644 --- a/target/linux/config/Config.in.input +++ b/target/linux/config/Config.in.input @@ -4,6 +4,7 @@ depends on ADK_TARGET_WITH_USB || ADK_TARGET_WITH_INPUT || ADK_TARGET_WITH_TOUCH config ADK_KERNEL_INPUT boolean default y if ADK_TARGET_SYSTEM_QEMU_I686 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 @@ -42,6 +43,7 @@ config ADK_KERNEL_INPUT_EVDEV config ADK_KERNEL_INPUT_KEYBOARD boolean default y if ADK_TARGET_SYSTEM_QEMU_I686 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 @@ -55,6 +57,7 @@ config ADK_KERNEL_INPUT_KEYBOARD config ADK_KERNEL_KEYBOARD_ATKBD boolean default y if ADK_TARGET_SYSTEM_QEMU_I686 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 @@ -67,6 +70,7 @@ config ADK_KERNEL_KEYBOARD_ATKBD config ADK_KERNEL_INPUT_MOUSE boolean default y if ADK_TARGET_SYSTEM_QEMU_I686 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 @@ -80,6 +84,7 @@ config ADK_KERNEL_INPUT_MOUSE config ADK_KERNEL_INPUT_MOUSEDEV boolean default y if ADK_TARGET_SYSTEM_QEMU_I686 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_PCENGINES_ALIX1C default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 diff --git a/target/linux/config/Config.in.netdevice b/target/linux/config/Config.in.netdevice index f601c0764..9aade47ab 100644 --- a/target/linux/config/Config.in.netdevice +++ b/target/linux/config/Config.in.netdevice @@ -155,6 +155,7 @@ config ADK_KERNEL_E1000 select ADK_KERNEL_NETDEVICES select ADK_KERNEL_NET_ETHERNET select ADK_KERNEL_NETDEV_1000 + default y if ADK_TARGET_SYSTEM_VBOX_I686 default y if ADK_TARGET_SYSTEM_IBM_X40 default y if ADK_NATIVE_SYSTEM_IBM_X40 default y if ADK_TARGET_SYSTEM_QEMU_I686 diff --git a/target/x86/Makefile b/target/x86/Makefile index 40fe4ded6..f81eb101c 100644 --- a/target/x86/Makefile +++ b/target/x86/Makefile @@ -36,6 +36,11 @@ ifeq ($(ADK_HARDWARE_QEMU),y) @echo "Start qemu with following command line:" @echo 'qemu -nographic -net user,hostfwd=tcp::2222-:22 -net nic,model=e1000 -kernel $(BIN_DIR)/$(TARGET_KERNEL) qemu-${CPU_ARCH}.img' endif +ifeq ($(ADK_HARDWARE_VBOX),y) + @cp $(KERNEL) $(BIN_DIR)/$(TARGET_KERNEL) + @echo "Use following command to create a VirtualBox Image:" + @echo "./scripts/create-image-with-grub.sh -f vbox vbox-${CPU_ARCH}.img $(BIN_DIR)/$(ROOTFSTARBALL)" +endif endif ifeq ($(ADK_TARGET_FS),usb) imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL) -- cgit v1.2.3