#@TYPE: Machine
#@NAME: {{=machine}}

#@DESCRIPTION: Machine configuration for {{=machine}} systems

{{ if kernel_choice == "custom": preferred_kernel = "linux-yocto-custom" }}
{{ if kernel_choice == "custom": }}
PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}"

{{ if kernel_choice != "custom": preferred_kernel = kernel_choice.split('_')[0] }}
{{ if kernel_choice != "custom": preferred_kernel_version = kernel_choice.split('_')[1] }}
{{ if kernel_choice != "custom": }}
PREFERRED_PROVIDER_virtual/kernel ?= "{{=preferred_kernel}}"
PREFERRED_VERSION_{{=preferred_kernel}} ?= "{{=preferred_kernel_version}}%"

{{ if qemuarch == "i386" or qemuarch == "x86_64": }}
PREFERRED_PROVIDER_virtual/xserver ?= "xserver-xorg"
PREFERRED_PROVIDER_virtual/libgl ?= "mesa-dri"
PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa-dri"
PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa-dri"

{{ input type:"choicelist" name:"qemuarch" prio:"5" msg:"Which qemu architecture would you like to use?" default:"i386" }}
{{ input type:"choice" val:"i386" msg:"i386    (32-bit)" }}
{{ input type:"choice" val:"x86_64" msg:"x86_64  (64-bit)" }}
{{ input type:"choice" val:"arm" msg:"ARM     (32-bit)" }}
{{ input type:"choice" val:"powerpc" msg:"PowerPC (32-bit)" }}
{{ input type:"choice" val:"mips" msg:"MIPS    (32-bit)" }}
{{ if qemuarch == "i386": }}
require conf/machine/include/tune-i586.inc
{{ if qemuarch == "x86_64": }}
require conf/machine/include/tune-x86_64.inc
{{ if qemuarch == "arm": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-arm926ejs.inc
{{ if qemuarch == "powerpc": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-ppc603e.inc
{{ if qemuarch == "mips": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-mips32.inc

{{ if qemuarch == "i386" or qemuarch == "x86_64": }}
MACHINE_FEATURES += "x86"
KERNEL_IMAGETYPE = "bzImage"
SERIAL_CONSOLE = "115200 ttyS0"
# We bypass swrast but we need it to be present for X to load correctly
XSERVER ?= "xserver-xorg \
           mesa-dri-driver-swrast \
           xf86-input-vmmouse \
           xf86-input-keyboard \
           xf86-input-evdev \
           xf86-video-vmware"
require conf/machine/include/qemu.inc

{{ if qemuarch == "arm": }}
KERNEL_IMAGETYPE = "zImage"
SERIAL_CONSOLE = "115200 ttyAMA0"

{{ if qemuarch == "powerpc": }}
KERNEL_IMAGETYPE = "vmlinux"
SERIAL_CONSOLE = "115200 ttyS0"

{{ if qemuarch == "mips": }}
KERNEL_IMAGETYPE = "vmlinux"
KERNEL_ALT_IMAGETYPE = "vmlinux.bin"
SERIAL_CONSOLE = "115200 ttyS0"
MACHINE_EXTRA_RRECOMMENDS = " kernel-modules"
