# yocto-bsp-filename {{=machine}}.conf
#@TYPE: Machine
#@NAME: {{=machine}}

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

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

{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": preferred_kernel = kernel_choice.split('_')[0] }}
{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": preferred_kernel_version = kernel_choice.split('_')[1] }}
{{ if kernel_choice != "custom" and kernel_choice != "linux-yocto-dev": }}
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"
PREFERRED_PROVIDER_virtual/libgles1 ?= "mesa"
PREFERRED_PROVIDER_virtual/libgles2 ?= "mesa"

{{ 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)" }}
{{ input type:"choice" val:"mips64" msg:"MIPS64  (64-bit)" }}
{{ if qemuarch == "i386": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-i586.inc
{{ if qemuarch == "x86_64": }}
require conf/machine/include/qemu.inc
DEFAULTTUNE ?= "core2-64"
require conf/machine/include/tune-core2.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-ppc7400.inc
{{ if qemuarch == "mips": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-mips32.inc
{{ if qemuarch == "mips64": }}
require conf/machine/include/qemu.inc
require conf/machine/include/tune-mips64.inc

{{ if qemuarch == "i386" or qemuarch == "x86_64": }}
MACHINE_FEATURES += "x86"
KERNEL_IMAGETYPE = "bzImage"
SERIAL_CONSOLE = "115200 ttyS0"
XSERVER = "xserver-xorg \
           ${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'mesa-driver-swrast', '', d)} \
           xf86-input-vmmouse \
           xf86-input-keyboard \
           xf86-input-evdev \
           xf86-video-vmware"

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

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

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