#
# Copyright (c) 2006 Ondrej Palkovsky
# Copyright (c) 2009 Martin Decky
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
#   notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
#   notice, this list of conditions and the following disclaimer in the
#   documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
#   derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

## General platform options

% Platform
@ "abs32le" abstract 32-bit little endian
@ "amd64" AMD64/Intel EM64T (PC)
@ "arm32" ARM 32-bit
@ "ia32" Intel IA-32 (PC)
@ "ia64" Intel IA-64
@ "mips32" MIPS 32-bit
@ "mips64" MIPS 64-bit
@ "ppc32" PowerPC 32-bit (iMac G4)
@ "sparc64" Sun UltraSPARC 64-bit
! PLATFORM (choice)

% Machine type
@ "msim" MSIM
@ "bgxemul" GXEmul big endian
@ "lgxemul" GXEmul little endian
! [PLATFORM=mips32] MACHINE (choice)

% Machine type
@ "msim" MSIM
! [PLATFORM=mips64] MACHINE (choice)

% Machine type
@ "i460GX" i460GX chipset machine
@ "ski" Ski ia64 simulator
! [PLATFORM=ia64] MACHINE (choice)

% Machine type
@ "generic" Generic Sun workstation or server
! [PLATFORM=sparc64] MACHINE (choice)

% Machine type
@ "gta02" GTA02 / Neo FreeRunner
@ "testarm" GXEmul Testarm
@ "integratorcp" Integratorcp
! [PLATFORM=arm32] MACHINE (choice)

% CPU type
@ "pentium4" Pentium 4
@ "pentium3" Pentium 3
@ "core" Core Solo/Duo
@ "athlon_xp" Athlon XP
@ "athlon_mp" Athlon MP
@ "i486" i486
! [PLATFORM=ia32] PROCESSOR (choice)

% CPU type
@ "opteron" Opteron
! [PLATFORM=amd64] PROCESSOR (choice)

% CPU type
@ "us" UltraSPARC I-II subarchitecture
@ "us3" UltraSPARC III-IV subarchitecture
@ "sun4v" Niagara (sun4v)
! [PLATFORM=sparc64&MACHINE=generic] PROCESSOR (choice)

% RAM disk format
@ "tmpfs" TMPFS image
@ "fat" FAT16 image
@ "ext2fs" EXT2 image
! RDFMT (choice)


## Mapping between platform and kernel architecture

% Kernel architecture
@ "abs32le"
! [PLATFORM=abs32le] KARCH (choice)

% Kernel architecture
@ "amd64"
! [PLATFORM=amd64] KARCH (choice)

% Kernel architecture
@ "arm32"
! [PLATFORM=arm32] KARCH (choice)

% Kernel architecture
@ "ia32"
! [PLATFORM=ia32] KARCH (choice)

% Kernel architecture
@ "ia32xen"
! [PLATFORM=ia32xen] KARCH (choice)

% Kernel architecture
@ "ia64"
! [PLATFORM=ia64] KARCH (choice)

% Kernel architecture
@ "mips32"
! [PLATFORM=mips32] KARCH (choice)

% Kernel architecture
@ "mips64"
! [PLATFORM=mips64] KARCH (choice)

% Kernel architecture
@ "ppc32"
! [PLATFORM=ppc32] KARCH (choice)

% Kernel architecture
@ "ppc64"
! [PLATFORM=ppc64] KARCH (choice)

% Kernel architecture
@ "sparc64"
! [PLATFORM=sparc64] KARCH (choice)


## Mapping between platform and user space architecture

% User space architecture
@ "abs32le"
! [PLATFORM=abs32le] UARCH (choice)

% User space architecture
@ "amd64"
! [PLATFORM=amd64] UARCH (choice)

% User space architecture
@ "arm32"
! [PLATFORM=arm32] UARCH (choice)

% User space architecture
@ "ia32"
! [PLATFORM=ia32|PLATFORM=ia32xen] UARCH (choice)

% User space architecture
@ "ia64"
! [PLATFORM=ia64] UARCH (choice)

% User space architecture
@ "mips32"
! [PLATFORM=mips32&(MACHINE=msim|MACHINE=lgxemul)] UARCH (choice)

% User space architecture
@ "mips32eb"
! [PLATFORM=mips32&MACHINE=bgxemul] UARCH (choice)

% User space architecture
@ "mips64"
! [PLATFORM=mips64] UARCH (choice)

% User space architecture
@ "ppc32"
! [PLATFORM=ppc32] UARCH (choice)

% User space architecture
@ "ppc64"
! [PLATFORM=ppc64] UARCH (choice)

% User space architecture
@ "sparc64"
! [PLATFORM=sparc64] UARCH (choice)


## Mapping between platform and boot architecture

% Boot architecture
@ "abs32le"
! [PLATFORM=abs32le] BARCH (choice)

% Boot architecture
@ "amd64"
! [PLATFORM=amd64] BARCH (choice)

% Boot architecture
@ "arm32"
! [PLATFORM=arm32] BARCH (choice)

% Boot architecture
@ "ia32"
! [PLATFORM=ia32] BARCH (choice)

% Boot architecture
@ "ia32xen"
! [PLATFORM=ia32xen] BARCH (choice)

% Boot architecture
@ "ia64"
! [PLATFORM=ia64] BARCH (choice)

% Boot architecture
@ "mips32"
! [PLATFORM=mips32] BARCH (choice)

% Boot architecture
@ "mips64"
! [PLATFORM=mips64] BARCH (choice)

% Boot architecture
@ "ppc32"
! [PLATFORM=ppc32] BARCH (choice)

% Boot architecture
@ "ppc64"
! [PLATFORM=ppc64] BARCH (choice)

% Boot architecture
@ "sparc64"
! [PLATFORM=sparc64] BARCH (choice)


## Mapping between platform and image format

% Image format
@ "binary"
! [PLATFORM=mips32&MACHINE=msim] IMAGE (choice)

% Image format
@ "ecoff"
! [PLATFORM=mips32&(MACHINE=bgxemul|MACHINE=lgxemul)] IMAGE (choice)

% Image format
@ "binary"
! [PLATFORM=mips64] IMAGE (choice)


## Compiler options

% Compiler
@ "gcc_cross" GNU C Compiler (cross-compiler)
@ "gcc_native" GNU C Compiler (native)
@ "icc" Intel C Compiler
@ "suncc" Sun Studio C Compiler
@ "clang" Clang
! [PLATFORM=amd64|PLATFORM=ia32] COMPILER (choice)

% Compiler
@ "gcc_cross" GNU C Compiler (cross-compiler)
@ "gcc_native" GNU C Compiler (native)
@ "icc" Intel C Compiler
! [PLATFORM=ia64] COMPILER (choice)

% Compiler
@ "gcc_cross" GNU C Compiler (cross-compiler)
@ "gcc_native" GNU C Compiler (native)
@ "suncc" Sun Studio C Compiler
! [PLATFORM=sparc64] COMPILER (choice)

% Compiler
@ "gcc_cross" GNU C Compiler (cross-compiler)
@ "gcc_native" GNU C Compiler (native)
! [PLATFORM=arm32|PLATFORM=mips32|PLATFORM=mips64|PLATFORM=ppc32] COMPILER (choice)

% Compiler
@ "gcc_cross" GNU C Compiler (cross-compiler)
@ "gcc_native" GNU C Compiler (native)
@ "clang" Clang
! [PLATFORM=abs32le] COMPILER (choice)


## Cross-compiler target for abstract architecture

% Cross-compiler target
@ "arm32" ARM 32-bit
@ "ia32" Intel IA-32
@ "mips32" MIPS 32-bit
! [PLATFORM=abs32le&COMPILER=gcc_cross] CROSS_TARGET (choice)


## Kernel configuration

% Fences
! [PLATFORM=ia32&(PROCESSOR=athlon_xp|PROCESSOR=athlon_mp|PROCESSOR=pentium3)] CONFIG_FENCES_P3 (y)

% Fences
! [PLATFORM=ia32&(PROCESSOR=pentium4|PROCESSOR=core)] CONFIG_FENCES_P4 (y)

% Fences
! [PLATFORM=amd64] CONFIG_FENCES_P4 (y)

% ACPI support
! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_ACPI (y)

% Hierarchical page tables support
! [PLATFORM=abs32le|PLATFORM=ia32|PLATFORM=amd64|PLATFORM=arm32|PLATFORM=mips32|PLATFORM=ppc32] CONFIG_PAGE_PT (y)

% Page hash table support
! [PLATFORM=ia64|PLATFORM=mips64|PLATFORM=sparc64] CONFIG_PAGE_HT (y)

% Software integer division support
! [PLATFORM=abs32le|PLATFORM=ia32|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=mips64|PLATFORM=ppc32] CONFIG_SOFTINT (y)

% ASID support
! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=mips64|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID (y)

% ASID FIFO support
! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=mips64|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID_FIFO (y)

% OpenFirmware tree support
! [PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_OFW_TREE (y)

% OpenFirmware PCI bus support
! [PLATFORM=sparc64] CONFIG_OFW_PCI (y)

% Multiboot standard support
! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_MULTIBOOT (y)

% FPU support
! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ia64|PLATFORM=sparc64] CONFIG_FPU (y)

% FPU support
! [PLATFORM=mips32&(MACHINE=lgxemul|MACHINE=bgxemul)] CONFIG_FPU (y)


## Kernel features options

% Support for SMP
! [(PLATFORM=ia32&PROCESSOR!=athlon_xp)|PLATFORM=amd64|PLATFORM=sparc64|PLATFORM=ia64|(PLATFORM=mips32&MACHINE=msim)|(PLATFORM=mips64&MACHINE=msim)|PLATFORM=abs32le] CONFIG_SMP (y/n)

% Debug build
! CONFIG_DEBUG (y/n)

% Deadlock detection support for spinlocks
! [CONFIG_DEBUG=y&CONFIG_SMP=y] CONFIG_DEBUG_SPINLOCK (y/n)

% Lazy FPU context switching
! [CONFIG_FPU=y] CONFIG_FPU_LAZY (y/n)

% Use VHPT
! [PLATFORM=ia64] CONFIG_VHPT (n/y)

% Use TSB
! [PLATFORM=sparc64] CONFIG_TSB (y/n)

% IO SAPIC on default address support
! [PLATFORM=ia64&MACHINE!=ski] CONFIG_IOSAPIC (y/n)

% Virtually indexed D-cache support
! [PLATFORM=sparc64] CONFIG_VIRT_IDX_DCACHE (y/n)

% Simics SMP Hack
! [PROCESSOR=sun4v&CONFIG_SMP=y] CONFIG_SIMICS_SMP_HACK (n/y)

% Support for userspace debuggers
! CONFIG_UDEBUG (y/n)

% Kernel console support
! CONFIG_KCONSOLE (y/n)

% Kernel symbol information
! CONFIG_SYMTAB (y/n)

% Detailed kernel logging
! CONFIG_LOG (n/y)

% Kernel function tracing
! CONFIG_TRACE (n/y)

% Compile kernel tests
! CONFIG_TEST (y/n)

% Use link-time optimization
! [COMPILER=gcc_cross|COMPILER=gcc_native] CONFIG_LTO (n/y)


## Hardware support

% Input device class
@ "generic" Keyboard or serial line
! [PLATFORM=arm32&MACHINE=integratorcp] CONFIG_HID_IN (choice)

% Input device class
@ "generic" Keyboard or serial line
@ "none" No input device
! [PLATFORM=ia32|(PLATFORM=arm32&MACHINE=testarm)|PLATFORM=amd64|PLATFORM=mips32|PLATFORM=mips64|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_HID_IN (choice)

% Input device class
@ "generic" Keyboard or serial line
@ "keyboard" Keyboard
@ "serial" Serial line
@ "none" No input device
! [PLATFORM=ia64&MACHINE=i460GX] CONFIG_HID_IN (choice)

% Output device class
@ "generic" Monitor or serial line
! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp)] CONFIG_HID_OUT (choice)

% Output device class
@ "generic" Monitor or serial line
@ "none" No output device
! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=sparc64|PLATFORM=ppc32|(PLATFORM=ia64&MACHINE=i460GX)|(PLATFORM=mips32&MACHINE=msim)|(PLATFORM=mips64&MACHINE=msim)] CONFIG_HID_OUT (choice)

% Output device class
@ "generic" Monitor or serial line
@ "monitor" Monitor
@ "serial" Serial line
@ "none" No output device
! [PLATFORM=mips32&(MACHINE=bgxemul|MACHINE=lgxemul)] CONFIG_HID_OUT (choice)

% Output device class
@ "generic" Monitor or serial line
@ "monitor" Monitor
@ "serial" Serial line
@ "none" No output device
! [PLATFORM=arm32&MACHINE=testarm] CONFIG_HID_OUT (choice)

% PC keyboard support
! [CONFIG_HID_IN=generic&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_PC_KBD (y/n)

% PC keyboard support
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_PC_KBD (y/n)

% PC keyboard support
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_PC_KBD (y/n)

% Support for msim/GXemul keyboard
! [CONFIG_HID_IN=generic&(PLATFORM=mips32|PLATFORM=mips64)] CONFIG_MIPS_KBD (y/n)

% Support for msim/GXemul printer
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=mips32|PLATFORM=mips64)] CONFIG_MIPS_PRN (y/n)

% Support for GXemul keyboard
! [CONFIG_HID_IN=generic&PLATFORM=arm32&MACHINE=testarm] CONFIG_ARM_KBD (y/n)

% Support for GXemul printer
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=testarm] CONFIG_ARM_PRN (y/n)

% Support for VIA CUDA controller
! [CONFIG_HID_IN=generic&PLATFORM=ppc32] CONFIG_VIA_CUDA (y/n)

% Support for NS16550 controller
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic] CONFIG_NS16550 (y/n)

% Support for NS16550 controller
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&PLATFORM=ia64&MACHINE=i460GX] CONFIG_NS16550 (y/n)

% Support for Samsung S3C24XX on-chip UART
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)

% Support for Samsung S3C24XX on-chip interrupt controller
! [PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_IRQC (y)

% Support for i8042 controller
! [CONFIG_PC_KBD=y] CONFIG_I8042 (y)

% Support for pl050 controller
! [CONFIG_HID_IN=generic&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_PL050 (y)

% Sun keyboard support
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic&CONFIG_NS16550=y] CONFIG_SUN_KBD (y)

% Macintosh ADB keyboard support
! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=ppc32&(CONFIG_VIA_CUDA=y)] CONFIG_MAC_KBD (y)

% Dummy serial line input
! [CONFIG_MIPS_KBD=y|CONFIG_ARM_KBD=y] CONFIG_DSRLNIN (y)

% Dummy serial line output
! [CONFIG_MIPS_PRN=y|CONFIG_ARM_PRN=y] CONFIG_DSRLNOUT (y)

% Serial line input module
! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)

% EGA support
! [CONFIG_HID_OUT=generic&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_EGA (y/n)

% EGA support
! [CONFIG_HID_OUT=generic&PLATFORM=ia64&MACHINE=i460GX] CONFIG_EGA (y/n)

% Framebuffer support
! [CONFIG_HID_OUT=generic&(PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ppc32)] CONFIG_FB (y/n)

% Framebuffer support
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=monitor)&PLATFORM=mips32&(MACHINE=lgxemul|MACHINE=bgxemul)] CONFIG_FB (y/n)

% Framebuffer support
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=monitor)&PLATFORM=arm32] CONFIG_FB (y/n)

% Framebuffer support
! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=monitor)&PLATFORM=sparc64&MACHINE=generic] CONFIG_FB (y/n)

% Default framebuffer mode
@ "640x480"
@ "800x600"
@ "1024x768"
@ "1152x720"
@ "1152x864"
@ "1280x720"
@ "1280x800"
@ "1280x960"
@ "1280x1024"
@ "1400x1050"
@ "1440x900"
@ "1440x1050"
@ "1600x1200"
@ "1920x1080"
@ "1920x1200"
! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_VESA_MODE (choice)

% Default framebuffer depth
@ "8"
@ "16"
@ "24"
! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_VESA_BPP (choice)

% Start AP processors by the loader
! [PLATFORM=sparc64&CONFIG_SMP=y] CONFIG_AP (y/n)

% Dynamic linking support
! [PLATFORM=ia32] CONFIG_RTLD (n/y)
! [PLATFORM=abs32le|PLATFORM=amd64|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_RTLD (n)

% Build shared libraries
! [CONFIG_RTLD=y] CONFIG_BUILD_SHARED_LIBS (n/y)
! [CONFIG_RTLD=n] CONFIG_BUILD_SHARED_LIBS (n)

% Link against shared libraries
! [CONFIG_BUILD_SHARED_LIBS=y] CONFIG_USE_SHARED_LIBS (n/y)
! [CONFIG_BUILD_SHARED_LIBS=n] CONFIG_USE_SHARED_LIBS (n)

% Launch (devman) test drivers
! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)

% Load disk drivers on startup
! CONFIG_START_BD (n/y)

% Mount /data on startup
! [CONFIG_START_BD=y] CONFIG_MOUNT_DATA (n/y)

% Write core files
! CONFIG_WRITE_CORE_FILES (n/y)

% Include development files (headers, libraries)
! [RDFMT=tmpfs|RDFMT=ext2fs] CONFIG_DEVEL_FILES (n/y)

% Strip binaries
! CONFIG_STRIP_BINARIES (n/y)

% Optimize for size
! CONFIG_OPTIMIZE_FOR_SIZE (n/y)

% Barebone build with essential binaries only 
! CONFIG_BAREBONE (n/y)

% Build pcc binaries 
! CONFIG_PCC (n/y)

% Build binutils binaries 
! CONFIG_BINUTILS (n/y)

% Line debugging information
! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y)

# USB settings 

% USB release build (less logging)
! CONFIG_USB_RELEASE_BUILD (y/n)

% Start virtual USB host controller
! CONFIG_RUN_VIRTUAL_USB_HC (n/y)

% OHCI root hub port power switching
@ "no" All root hub ports are always powered.
@ "ganged" Root hub ports are all powered or all off.
@ "per_port" Powered status of every root hub port is independent.
![PLATFORM=ia32|PLATFORM=amd64] OHCI_POWER_SWITCH (choice)
