Tinification for 3.18
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJUL0J0AAoJEA7Zo9+K/4c9w40P/iMFPfCethdBtPz5rI88CVr2 7yU99TdbEPoRJm+rU4ohvHdB73p2KWINIKvpSThvegvjXbEcKxQkdpVWHsFJZeHS bZiYmhjxdCBvJGLrYo5IwqH0PrSjokTPzMUekUCk7BkUKNJRaDjfUBHvUmKsinUR dQL+3KE3edy6W3DL+FOd0QZwSOgmOfEibTWpfmg+n16kFNa75Kg/QLwjYRvtQplP eElywDZN07IhAeBFqKhKvlKmDSAeqMd8RfoPPo9Ts+reeIrWYjVNbl9ISOqXqy2x JoLeZQmwSXj/C9Ehr5e+aId2eO8In5xueQfXP8SS8dCC7VLwRbnNgyAQQZEslEBk QH0GhT6GqTamBdiNI3I+usfs65cEaialXh2afcoLwGS/iGD8MhZ8Dt+m4iyXNxEZ kT9VA4974mPjJ1g0mDDnYIxNjxF43m+SD5K1sR/XGpMcA8NdqMUmvKNcbePCobVa WTutIemQqGipNeWE94XwZEbc0B+aWwH7eiZOBMVGhWsHInd7QeTBTbfZlctyBkzf AswgsFjC5FW05CWK6J1Lf/UI1FD9PmHMKpmQUPED1+7okDTfqGjKjdREWgZSixUt LIRfWqWEaNpRRBFbDyt0C+F4pBRPLiRDaOyNhwEdtXuVGKRXb1G3qX7nFOJAZo6G GDTZo9iIRNSfm/M4tJ+n =2VyW -----END PGP SIGNATURE----- Merge tag 'tiny/for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/josh/linux Pull "tinification" patches from Josh Triplett. Work on making smaller kernels. * tag 'tiny/for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/josh/linux: bloat-o-meter: Ignore syscall aliases SyS_ and compat_SyS_ mm: Support compiling out madvise and fadvise x86: Support compiling out human-friendly processor feature names x86: Drop support for /proc files when !CONFIG_PROC_FS x86, boot: Don't compile early_serial_console.c when !CONFIG_EARLY_PRINTK x86, boot: Don't compile aslr.c when !CONFIG_RANDOMIZE_BASE x86, boot: Use the usual -y -n mechanism for objects in vmlinux x86: Add "make tinyconfig" to configure the tiniest possible kernel x86, platform, kconfig: move kvmconfig functionality to a helper
This commit is contained in:
Коммит
74da38631a
|
@ -137,6 +137,7 @@ config X86
|
|||
select HAVE_ACPI_APEI if ACPI
|
||||
select HAVE_ACPI_APEI_NMI if ACPI
|
||||
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
|
||||
select X86_FEATURE_NAMES if PROC_FS
|
||||
|
||||
config INSTRUCTION_DECODER
|
||||
def_bool y
|
||||
|
@ -314,6 +315,17 @@ config SMP
|
|||
|
||||
If you don't know what to do here, say N.
|
||||
|
||||
config X86_FEATURE_NAMES
|
||||
bool "Processor feature human-readable names" if EMBEDDED
|
||||
default y
|
||||
---help---
|
||||
This option compiles in a table of x86 feature bits and corresponding
|
||||
names. This is required to support /proc/cpuinfo and a few kernel
|
||||
messages. You can disable this to save space, at the expense of
|
||||
making those few kernel messages show numeric feature bits instead.
|
||||
|
||||
If in doubt, say Y.
|
||||
|
||||
config X86_X2APIC
|
||||
bool "Support x2apic"
|
||||
depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
|
||||
|
|
|
@ -253,12 +253,6 @@ archclean:
|
|||
$(Q)$(MAKE) $(clean)=arch/x86/tools
|
||||
$(Q)$(MAKE) $(clean)=arch/x86/purgatory
|
||||
|
||||
PHONY += kvmconfig
|
||||
kvmconfig:
|
||||
$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(srctree)/arch/x86/configs/kvm_guest.config
|
||||
$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
|
||||
|
||||
define archhelp
|
||||
echo '* bzImage - Compressed kernel image (arch/x86/boot/bzImage)'
|
||||
echo ' install - Install kernel using'
|
||||
|
@ -272,5 +266,4 @@ define archhelp
|
|||
echo ' bzdisk/fdimage*/isoimage also accept:'
|
||||
echo ' FDARGS="..." arguments for the booted kernel'
|
||||
echo ' FDINITRD=file initrd for the booted kernel'
|
||||
echo ' kvmconfig - Enable additional options for guest kernel support'
|
||||
endef
|
||||
|
|
|
@ -35,19 +35,22 @@ setup-y += video-vesa.o
|
|||
setup-y += video-bios.o
|
||||
|
||||
targets += $(setup-y)
|
||||
hostprogs-y := mkcpustr tools/build
|
||||
hostprogs-y := tools/build
|
||||
hostprogs-$(CONFIG_X86_FEATURE_NAMES) += mkcpustr
|
||||
|
||||
HOST_EXTRACFLAGS += -I$(srctree)/tools/include \
|
||||
-include include/generated/autoconf.h \
|
||||
-D__EXPORTED_HEADERS__
|
||||
|
||||
ifdef CONFIG_X86_FEATURE_NAMES
|
||||
$(obj)/cpu.o: $(obj)/cpustr.h
|
||||
|
||||
quiet_cmd_cpustr = CPUSTR $@
|
||||
cmd_cpustr = $(obj)/mkcpustr > $@
|
||||
targets += cpustr.h
|
||||
targets += cpustr.h
|
||||
$(obj)/cpustr.h: $(obj)/mkcpustr FORCE
|
||||
$(call if_changed,cpustr)
|
||||
endif
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -26,17 +26,18 @@ LDFLAGS_vmlinux := -T
|
|||
hostprogs-y := mkpiggy
|
||||
HOST_EXTRACFLAGS += -I$(srctree)/tools/include
|
||||
|
||||
VMLINUX_OBJS = $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
|
||||
$(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o \
|
||||
$(obj)/piggy.o $(obj)/cpuflags.o $(obj)/aslr.o
|
||||
vmlinux-objs-y := $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o \
|
||||
$(obj)/string.o $(obj)/cmdline.o \
|
||||
$(obj)/piggy.o $(obj)/cpuflags.o
|
||||
|
||||
vmlinux-objs-$(CONFIG_EARLY_PRINTK) += $(obj)/early_serial_console.o
|
||||
vmlinux-objs-$(CONFIG_RANDOMIZE_BASE) += $(obj)/aslr.o
|
||||
|
||||
$(obj)/eboot.o: KBUILD_CFLAGS += -fshort-wchar -mno-red-zone
|
||||
|
||||
ifeq ($(CONFIG_EFI_STUB), y)
|
||||
VMLINUX_OBJS += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
|
||||
endif
|
||||
vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o
|
||||
|
||||
$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
|
||||
$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
|
||||
$(call if_changed,ld)
|
||||
@:
|
||||
|
||||
|
@ -44,7 +45,7 @@ OBJCOPYFLAGS_vmlinux.bin := -R .comment -S
|
|||
$(obj)/vmlinux.bin: vmlinux FORCE
|
||||
$(call if_changed,objcopy)
|
||||
|
||||
targets += $(patsubst $(obj)/%,%,$(VMLINUX_OBJS)) vmlinux.bin.all vmlinux.relocs
|
||||
targets += $(patsubst $(obj)/%,%,$(vmlinux-objs-y)) vmlinux.bin.all vmlinux.relocs
|
||||
|
||||
CMD_RELOCS = arch/x86/tools/relocs
|
||||
quiet_cmd_relocs = RELOCS $@
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "misc.h"
|
||||
|
||||
#ifdef CONFIG_RANDOMIZE_BASE
|
||||
#include <asm/msr.h>
|
||||
#include <asm/archrandom.h>
|
||||
#include <asm/e820.h>
|
||||
|
@ -335,5 +334,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
|
|||
out:
|
||||
return (unsigned char *)choice;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_RANDOMIZE_BASE */
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
#include "misc.h"
|
||||
|
||||
#ifdef CONFIG_EARLY_PRINTK
|
||||
|
||||
int early_serial_base;
|
||||
|
||||
#include "../early_serial_console.c"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
*/
|
||||
|
||||
#include "boot.h"
|
||||
#ifdef CONFIG_X86_FEATURE_NAMES
|
||||
#include "cpustr.h"
|
||||
#endif
|
||||
|
||||
static char *cpu_name(int level)
|
||||
{
|
||||
|
@ -32,11 +34,48 @@ static char *cpu_name(int level)
|
|||
}
|
||||
}
|
||||
|
||||
static void show_cap_strs(u32 *err_flags)
|
||||
{
|
||||
int i, j;
|
||||
#ifdef CONFIG_X86_FEATURE_NAMES
|
||||
const unsigned char *msg_strs = (const unsigned char *)x86_cap_strs;
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (msg_strs[0] < i ||
|
||||
(msg_strs[0] == i && msg_strs[1] < j)) {
|
||||
/* Skip to the next string */
|
||||
msg_strs += 2;
|
||||
while (*msg_strs++)
|
||||
;
|
||||
}
|
||||
if (e & 1) {
|
||||
if (msg_strs[0] == i &&
|
||||
msg_strs[1] == j &&
|
||||
msg_strs[2])
|
||||
printf("%s ", msg_strs+2);
|
||||
else
|
||||
printf("%d:%d ", i, j);
|
||||
}
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (e & 1)
|
||||
printf("%d:%d ", i, j);
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int validate_cpu(void)
|
||||
{
|
||||
u32 *err_flags;
|
||||
int cpu_level, req_level;
|
||||
const unsigned char *msg_strs;
|
||||
|
||||
check_cpu(&cpu_level, &req_level, &err_flags);
|
||||
|
||||
|
@ -49,34 +88,9 @@ int validate_cpu(void)
|
|||
}
|
||||
|
||||
if (err_flags) {
|
||||
int i, j;
|
||||
puts("This kernel requires the following features "
|
||||
"not present on the CPU:\n");
|
||||
|
||||
msg_strs = (const unsigned char *)x86_cap_strs;
|
||||
|
||||
for (i = 0; i < NCAPINTS; i++) {
|
||||
u32 e = err_flags[i];
|
||||
|
||||
for (j = 0; j < 32; j++) {
|
||||
if (msg_strs[0] < i ||
|
||||
(msg_strs[0] == i && msg_strs[1] < j)) {
|
||||
/* Skip to the next string */
|
||||
msg_strs += 2;
|
||||
while (*msg_strs++)
|
||||
;
|
||||
}
|
||||
if (e & 1) {
|
||||
if (msg_strs[0] == i &&
|
||||
msg_strs[1] == j &&
|
||||
msg_strs[2])
|
||||
printf("%s ", msg_strs+2);
|
||||
else
|
||||
printf("%d:%d ", i, j);
|
||||
}
|
||||
e >>= 1;
|
||||
}
|
||||
}
|
||||
show_cap_strs(err_flags);
|
||||
putchar('\n');
|
||||
return -1;
|
||||
} else {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_NOHIGHMEM=y
|
|
@ -250,8 +250,15 @@
|
|||
#include <asm/asm.h>
|
||||
#include <linux/bitops.h>
|
||||
|
||||
#ifdef CONFIG_X86_FEATURE_NAMES
|
||||
extern const char * const x86_cap_flags[NCAPINTS*32];
|
||||
extern const char * const x86_power_flags[32];
|
||||
#define X86_CAP_FMT "%s"
|
||||
#define x86_cap_flag(flag) x86_cap_flags[flag]
|
||||
#else
|
||||
#define X86_CAP_FMT "%d:%d"
|
||||
#define x86_cap_flag(flag) ((flag) >> 5), ((flag) & 31)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In order to save room, we index into this array by doing
|
||||
|
|
|
@ -13,10 +13,13 @@ nostackp := $(call cc-option, -fno-stack-protector)
|
|||
CFLAGS_common.o := $(nostackp)
|
||||
|
||||
obj-y := intel_cacheinfo.o scattered.o topology.o
|
||||
obj-y += proc.o capflags.o powerflags.o common.o
|
||||
obj-y += common.o
|
||||
obj-y += rdrand.o
|
||||
obj-y += match.o
|
||||
|
||||
obj-$(CONFIG_PROC_FS) += proc.o
|
||||
obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
|
||||
|
||||
obj-$(CONFIG_X86_32) += bugs.o
|
||||
obj-$(CONFIG_X86_64) += bugs_64.o
|
||||
|
||||
|
@ -48,6 +51,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
|
|||
|
||||
obj-$(CONFIG_HYPERVISOR_GUEST) += vmware.o hypervisor.o mshyperv.o
|
||||
|
||||
ifdef CONFIG_X86_FEATURE_NAMES
|
||||
quiet_cmd_mkcapflags = MKCAP $@
|
||||
cmd_mkcapflags = $(CONFIG_SHELL) $(srctree)/$(src)/mkcapflags.sh $< $@
|
||||
|
||||
|
@ -56,3 +60,4 @@ cpufeature = $(src)/../../include/asm/cpufeature.h
|
|||
targets += capflags.c
|
||||
$(obj)/capflags.c: $(cpufeature) $(src)/mkcapflags.sh FORCE
|
||||
$(call if_changed,mkcapflags)
|
||||
endif
|
||||
|
|
|
@ -346,8 +346,8 @@ static void filter_cpuid_features(struct cpuinfo_x86 *c, bool warn)
|
|||
continue;
|
||||
|
||||
printk(KERN_WARNING
|
||||
"CPU: CPU feature %s disabled, no CPUID level 0x%x\n",
|
||||
x86_cap_flags[df->feature], df->level);
|
||||
"CPU: CPU feature " X86_CAP_FMT " disabled, no CPUID level 0x%x\n",
|
||||
x86_cap_flag(df->feature), df->level);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
init/Kconfig
10
init/Kconfig
|
@ -1540,6 +1540,16 @@ config AIO
|
|||
by some high performance threaded applications. Disabling
|
||||
this option saves about 7k.
|
||||
|
||||
config ADVISE_SYSCALLS
|
||||
bool "Enable madvise/fadvise syscalls" if EXPERT
|
||||
default y
|
||||
help
|
||||
This option enables the madvise and fadvise syscalls, used by
|
||||
applications to advise the kernel about their future memory or file
|
||||
usage, improving performance. If building an embedded system where no
|
||||
applications use these syscalls, you can disable this option to save
|
||||
space.
|
||||
|
||||
config PCI_QUIRKS
|
||||
default y
|
||||
bool "Enable PCI quirk workarounds" if EXPERT
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
|
||||
CONFIG_KERNEL_XZ=y
|
||||
CONFIG_OPTIMIZE_INLINING=y
|
||||
CONFIG_SLOB=y
|
|
@ -156,6 +156,9 @@ cond_syscall(sys_process_vm_writev);
|
|||
cond_syscall(compat_sys_process_vm_readv);
|
||||
cond_syscall(compat_sys_process_vm_writev);
|
||||
cond_syscall(sys_uselib);
|
||||
cond_syscall(sys_fadvise64);
|
||||
cond_syscall(sys_fadvise64_64);
|
||||
cond_syscall(sys_madvise);
|
||||
|
||||
/* arch-specific weak syscall entries */
|
||||
cond_syscall(sys_pciconfig_read);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#
|
||||
|
||||
mmu-y := nommu.o
|
||||
mmu-$(CONFIG_MMU) := fremap.o gup.o highmem.o madvise.o memory.o mincore.o \
|
||||
mmu-$(CONFIG_MMU) := fremap.o gup.o highmem.o memory.o mincore.o \
|
||||
mlock.o mmap.o mprotect.o mremap.o msync.o rmap.o \
|
||||
vmalloc.o pagewalk.o pgtable-generic.o
|
||||
|
||||
|
@ -11,7 +11,7 @@ ifdef CONFIG_CROSS_MEMORY_ATTACH
|
|||
mmu-$(CONFIG_MMU) += process_vm_access.o
|
||||
endif
|
||||
|
||||
obj-y := filemap.o mempool.o oom_kill.o fadvise.o \
|
||||
obj-y := filemap.o mempool.o oom_kill.o \
|
||||
maccess.o page_alloc.o page-writeback.o \
|
||||
readahead.o swap.o truncate.o vmscan.o shmem.o \
|
||||
util.o mmzone.o vmstat.o backing-dev.o \
|
||||
|
@ -28,6 +28,9 @@ else
|
|||
obj-y += bootmem.o
|
||||
endif
|
||||
|
||||
ifdef CONFIG_MMU
|
||||
obj-$(CONFIG_ADVISE_SYSCALLS) += fadvise.o madvise.o
|
||||
endif
|
||||
obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
|
||||
|
||||
obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o
|
||||
|
|
|
@ -20,6 +20,8 @@ def getsizes(file):
|
|||
if type in "tTdDbBrR":
|
||||
# strip generated symbols
|
||||
if name.startswith("__mod_"): continue
|
||||
if name.startswith("SyS_"): continue
|
||||
if name.startswith("compat_SyS_"): continue
|
||||
if name == "linux_banner": continue
|
||||
# statics and some other optimizations adds random .NUMBER
|
||||
name = re.sub(r'\.[0-9]+', '', name)
|
||||
|
|
|
@ -104,6 +104,23 @@ endif
|
|||
%_defconfig: $(obj)/conf
|
||||
$(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
|
||||
|
||||
configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config $(srctree)/arch/$(SRCARCH)/configs/$(1).config)
|
||||
|
||||
define mergeconfig
|
||||
$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for this target))
|
||||
$(if $(call configfiles,$(1)),, $(error No configuration exists for this target on this architecture))
|
||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O $(objtree) $(objtree)/.config $(call configfiles,$(1))
|
||||
$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig
|
||||
endef
|
||||
|
||||
PHONY += kvmconfig
|
||||
kvmconfig:
|
||||
$(call mergeconfig,kvm_guest)
|
||||
|
||||
PHONY += tinyconfig
|
||||
tinyconfig: allnoconfig
|
||||
$(call mergeconfig,tiny)
|
||||
|
||||
# Help text used by make help
|
||||
help:
|
||||
@echo ' config - Update current config utilising a line-oriented program'
|
||||
|
@ -124,6 +141,8 @@ help:
|
|||
@echo ' randconfig - New config with random answer to all options'
|
||||
@echo ' listnewconfig - List new options'
|
||||
@echo ' olddefconfig - Same as silentoldconfig but sets new symbols to their default value'
|
||||
@echo ' kvmconfig - Enable additional options for guest kernel support'
|
||||
@echo ' tinyconfig - Configure the tiniest possible kernel'
|
||||
|
||||
# lxdialog stuff
|
||||
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
|
||||
|
|
Загрузка…
Ссылка в новой задаче