Qemu compatible kernel configuration

http://www.gnuwakes.org/documentation/0.1/html/ch12s07.html


First, create the allno.config file. This file will be used to compile a Qemu compatible kernel.

cat << EOF > allno.config
# allno.config

CONFIG_BINFMT_ELF=y
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y
CONFIG_HAVE_IDE=y
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_IDE_GENERIC=y
CONFIG_VIDEO_SELECT=y
CONFIG_EXT3_FS=y
CONFIG_MPENTIUMII=y
CONFIG_SYSVIPC=y
CONFIG_TMPFS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_NET=y
CONFIG_UNIX=y
CONFIG_INET=y
CONFIG_PACKET=y
CONFIG_NETDEVICES=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_MROUTE=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
EOF
          

Then compile the kernel.

make mrproper
make allnoconfig
make 
          

Explanation:

        "make config"      Plain text interface.
        "make menuconfig"  Text based color menus, radiolists & dialogs.
        "make xconfig"     X windows (Qt) based configuration tool.
        "make gconfig"     X windows (Gtk) based configuration tool.
        "make oldconfig"   Default all questions based on the contents of
                           your existing ./.config file and asking about
                           new config symbols.
        "make silentoldconfig"
                           Like above, but avoids cluttering the screen
                           with questions already answered.
        "make defconfig"   Create a ./.config file by using the default
                           symbol values from arch/$ARCH/defconfig.
        "make allyesconfig"
                           Create a ./.config file by setting symbol
                           values to 'y' as much as possible.
        "make allmodconfig"
                           Create a ./.config file by setting symbol
                           values to 'm' as much as possible.
        "make allnoconfig" Create a ./.config file by setting symbol
                           values to 'n' as much as possible.
        "make randconfig"  Create a ./.config file by setting symbol
                           values to random values.

   The allyesconfig/allmodconfig/allnoconfig/randconfig variants can
   also use the environment variable KCONFIG_ALLCONFIG to specify a
   filename that contains config options that the user requires to be
   set to a specific value.  If KCONFIG_ALLCONFIG=filename is not used,
   "make *config" checks for a file named "all{yes/mod/no/random}.config"
   for symbol values that are to be forced.  If this file is not found,
   it checks for a file named "all.config" to contain forced values.
          

In our case, the make allnoconfig variants will check for the file allno.config for symbol values that are to be forced (if the environment variable KCONFIG_ALLCONFIG is not used).

kernel allno.config with sda disk support:

########################################
# Executable file formats / Emulations #
########################################

# Kernel support for ELF binaries
CONFIG_BINFMT_ELF=y

################
# File systems #
################

# Ext3 journalling file system support
CONFIG_EXT3_FS=y

# /proc file system support
CONFIG_PROC_FS=y

# Virtual memory file system support (former shm fs)
CONFIG_TMPFS=y

# Inotify file change notification support
CONFIG_INOTIFY=y

# Inotify support for userspace
CONFIG_INOTIFY_USER=y

# ISO 9660 CDROM file system support
CONFIG_ISO9660_FS=y

###############################
# Processor type and features #
###############################

# Pentium-II/Celeron(pre-Coppermine)
CONFIG_MPENTIUMII=y

# Paravirtualized guest support
CONFIG_PARAVIRT_GUEST=y
# KVM Guest support
CONFIG_KVM_GUEST=y
# KVM paravirtualized clock
CONFIG_KVM_CLOCK=y

#################
# General setup #
#################

# Prompt for development and/or incomplete code/drivers
CONFIG_EXPERIMENTAL=y

# System V IPC
CONFIG_SYSVIPC=y

# Initial RAM filesystem and RAM disk (initramfs/initrd) support
CONFIG_BLK_DEV_INITRD=y

# Optimize for size
CONFIG_CC_OPTIMIZE_FOR_SIZE=y

# Kernel .config support
CONFIG_IKCONFIG=y

# Enable access to .config through /proc/config.gz
CONFIG_IKCONFIG_PROC=y

##########################
# Enable the block layer #
##########################

# Enable the block layer
CONFIG_BLOCK=y

# Deadline I/O scheduler
CONFIG_IOSCHED_DEADLINE=y

######################
# Networking support #
######################

# Networking support
CONFIG_NET=y
# Packet socket
#CONFIG_PACKET=y
# Unix domain sockets
CONFIG_UNIX=y
# TCP/IP networking
CONFIG_INET=y

##########################
# Bus options (PCI etc.) #
##########################

# PCI support
CONFIG_PCI=y

##################
# Device Drivers #
##################

# Block devices
CONFIG_BLK_DEV=y
# Virtio block driver (EXPERIMENTAL)
CONFIG_VIRTIO_BLK=y

# Network device support
CONFIG_NETDEVICES=y
# Ethernet (10 or 100Mbit)
CONFIG_NET_ETHERNET=y
# EISA, VLB, PCI and on board controllers
CONFIG_NET_PCI=y
# RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support
CONFIG_8139CP=y
# PCI NE2000 and clones support (This driver also works for RealTek RTL-8029)
CONFIG_NE2K_PCI=y
# Virtio network driver (EXPERIMENTAL)
CONFIG_VIRTIO_NET=y

# Serial ATA (prod) and Parallel ATA (experimental)
CONFIG_ATA=y
# ATA SFF support (SFF is the legacy IDE interface)
CONFIG_ATA_SFF=y
# Intel PATA MPIIX support
CONFIG_ATA_PIIX=y

# SCSI device support
CONFIG_SCSI=y
# SCSI disk support
CONFIG_BLK_DEV_SD=y
# SCSI CDROM support
CONFIG_BLK_DEV_SR=y

# Multiple devices driver support (RAID and LVM)
CONFIG_MD=y
# Device mapper support
CONFIG_BLK_DEV_DM=y

##################
# Virtualization #
##################

# Virtualization
CONFIG_VIRTUALIZATION=y

# PCI driver for virtio devices (EXPERIMENTAL)
CONFIG_VIRTIO_PCI=y

With modules support:

# Enable loadable module support
CONFIG_MODULES=y

# Module unloading
CONFIG_MODULE_UNLOAD=y

########################################
# Executable file formats / Emulations #
########################################

# Kernel support for ELF binaries
CONFIG_BINFMT_ELF=y

################
# File systems #
################

# Ext3 journalling file system support
CONFIG_EXT3_FS=m

# /proc file system support
CONFIG_PROC_FS=y

# Virtual memory file system support (former shm fs)
CONFIG_TMPFS=y

# Inotify file change notification support
CONFIG_INOTIFY=y

# Inotify support for userspace
CONFIG_INOTIFY_USER=y

# ISO 9660 CDROM file system support
CONFIG_ISO9660_FS=m

###############################
# Processor type and features #
###############################

# Pentium-II/Celeron(pre-Coppermine)
CONFIG_MPENTIUMII=y

# Paravirtualized guest support
CONFIG_PARAVIRT_GUEST=y
# KVM Guest support
CONFIG_KVM_GUEST=y
# KVM paravirtualized clock
CONFIG_KVM_CLOCK=y

#################
# General setup #
#################

# Prompt for development and/or incomplete code/drivers
CONFIG_EXPERIMENTAL=y

# System V IPC
CONFIG_SYSVIPC=y

# Initial RAM filesystem and RAM disk (initramfs/initrd) support
CONFIG_BLK_DEV_INITRD=y

# Optimize for size
CONFIG_CC_OPTIMIZE_FOR_SIZE=y

# Kernel .config support
CONFIG_IKCONFIG=y

# Enable access to .config through /proc/config.gz
CONFIG_IKCONFIG_PROC=y

##########################
# Enable the block layer #
##########################

# Enable the block layer
CONFIG_BLOCK=y

# Deadline I/O scheduler
CONFIG_IOSCHED_DEADLINE=y

######################
# Networking support #
######################

# Networking support
CONFIG_NET=y
# Packet socket
#CONFIG_PACKET=y
# Unix domain sockets
CONFIG_UNIX=m
# TCP/IP networking
CONFIG_INET=y

##########################
# Bus options (PCI etc.) #
##########################

# PCI support
CONFIG_PCI=y

##################
# Device Drivers #
##################

# Block devices
CONFIG_BLK_DEV=y
# Virtio block driver (EXPERIMENTAL)
CONFIG_VIRTIO_BLK=m

# Network device support
CONFIG_NETDEVICES=y
# Ethernet (10 or 100Mbit)
CONFIG_NET_ETHERNET=y
# EISA, VLB, PCI and on board controllers
CONFIG_NET_PCI=y
# RealTek RTL-8139 C+ PCI Fast Ethernet Adapter support
CONFIG_8139CP=m
# PCI NE2000 and clones support (This driver also works for RealTek RTL-8029)
CONFIG_NE2K_PCI=m
# Virtio network driver (EXPERIMENTAL)
CONFIG_VIRTIO_NET=m

# Serial ATA (prod) and Parallel ATA (experimental)
CONFIG_ATA=m
# ATA SFF support (SFF is the legacy IDE interface)
CONFIG_ATA_SFF=y
# Intel PATA MPIIX support
CONFIG_ATA_PIIX=m

# SCSI device support
CONFIG_SCSI=m
# SCSI disk support
CONFIG_BLK_DEV_SD=m
# SCSI CDROM support
CONFIG_BLK_DEV_SR=m

# Multiple devices driver support (RAID and LVM)
CONFIG_MD=y
# Device mapper support
CONFIG_BLK_DEV_DM=m
##################
# Virtualization #
##################

# Virtualization
CONFIG_VIRTUALIZATION=y

# PCI driver for virtio devices (EXPERIMENTAL)
CONFIG_VIRTIO_PCI=m

你可能感兴趣的:(Qemu compatible kernel configuration)