天天看点

减小linux内核大小的配置选项

linux内核现在是越来越大,以前kernel+rootfs一张软盘都能放下,现在光放内核都不行了,

要减小linux内核的大小,可以通过Linux-tiny patches 补丁来实现,当然还有一些其他的配置选项,

CONFIG option Description Default Small
CONFIG_CORE_SMALL tune some kernel data sizes N Y
CONFIG_NET_SMALL tune some net-related data sizes N Y
CONFIG_KMALLOC_ACCOUNTING turn on kmalloc accounting N Y *
CONFIG_AUDIT_BOOTMEM print out all bootmem allocations N Y *
CONFIG_DEPRECATE_INLINES cause compiler to emit info about inlines N Y *
CONFIG_PRINTK allow disable of printk code and message data Y N
CONFIG_BUG allow elimination of BUG (and BUG_ON??) code Y N
CONFIG_ELF_CORE allow disabling of ELF core dumps Y N
CONFIG_PROC_KCORE allow disabling of /proc/kcore Y N
CONFIG_AIO allow disabling of async IO syscalls Y N
CONFIG_XATTR allow disabling of xattr syscalls Y N
CONFIG_FILE_LOCKING allow disabling of file locking syscalls Y N
CONFIG_DIRECTIO allow disabling of direct IO support Y N
CONFIG_MAX_SWAPFILES_SHIFT number of swapfiles 5
CONFIG_NR_LDISCS number of tty line disciplines 16 2
CONFIG_MAX_USER_RT_PRIO number of RT priority levels (schedule slots) 100 5
Other config options These are not in Linux-tiny, but help with size default small
CONFIG_KALLSYMS load all symbols for debugging/kksymoops Y N
CONFIG_SHMEM allow disabling of shmem filesystem Y N +
CONFIG_SWAP allow disabling of support for a swap segment (virtual memory) Y N
CONFIG_SYSV_IPC allow disabling of support for System V IPC Y N +
CONFIG_POSIX_MQUEUE allow disabling of POSIX message queue support Y N +
CONFIG_SYSCTL allow disabling of sysctl support Y N +
CONFIG_LOG_BUF_SHIFT control size of kernel printk buffer 14 11
CONFIG_UID16 allow support for 16-bit uids Y ??
CONFIG_CC_OPTIMIZE_FOR_SIZE Use gcc -os to optimize for size Y Y
CONFIG_MODULES allow support for kernel loadable modules Y N +
CONFIG_KMOD allow support for automatic kernel module loading Y N
CONFIG_PCI allow support for PCI bus and devices Y Y -
CONFIG_XIP_KERNEL allow support for kernel Execute-in-Place N N
CONFIG_MAX_RESERVE_AREA ?? ?? ??
CONFIG_BLK_DEV_LOOP support for loopback block device Y Y -
CONFIG_BLK_DEV_RAM support for block devices for RAM filesystems Y Y -
CONFIG_BLK_DEV_RAM_COUNT Number of block devices for RAM filesystems 16 2?
CONFIG_BLK_DEV_RAM_SIZE Size of block device struct for RAM filesystems 4096 ??
CONFIG_IOSCHED_AS Include Anticipatory IO scheduler Y Y
CONFIG_IOSCHED_DEADLINE Include Deadline IO scheduler Y N +
CONFIG_IOSCHED_CFQ Include CFQ IO scheduler Y N +
CONFIG_IP_PNP support for IP autoconfiguration Y N +
CONFIG_IP_PNP_DHCP support for IP autoconfiguration via DHCP Y N +
CONFIG_IDE support for IDE devices Y N +
CONFIG_SCSI support for SCSI devices Y N +

Legend:

  • "Y *" - Set to 'Y' for measurement during development, and set to 'N' for deployment.
  • "N +" - Whether you can set this to 'N' depends on whether this feaure is needed by your applications.
  • "Y -" - You probably need this, but it might we worth checking to see if you don't.

继续阅读