Merge branches 'tiny/bloat-o-meter-no-SyS', 'tiny/more-procless', 'tiny/no-advice...
authorJosh Triplett <josh@joshtriplett.org>
Tue, 23 Sep 2014 06:14:40 +0000 (23:14 -0700)
committerJosh Triplett <josh@joshtriplett.org>
Tue, 23 Sep 2014 06:14:40 +0000 (23:14 -0700)
arch/x86/Makefile
arch/x86/boot/compressed/Makefile
arch/x86/boot/compressed/aslr.c
arch/x86/boot/compressed/early_serial_console.c
arch/x86/configs/tiny.config [new file with mode: 0644]
init/Kconfig
kernel/configs/tiny.config [new file with mode: 0644]
kernel/sys_ni.c
mm/Makefile
scripts/bloat-o-meter
scripts/kconfig/Makefile

index c1aa368..7705b6f 100644 (file)
@@ -255,12 +255,6 @@ archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
        $(Q)$(MAKE) $(clean)=arch/x86/tools
 
-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'
@@ -274,5 +268,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
index 7a801a3..20db5b3 100644 (file)
@@ -26,18 +26,19 @@ 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 \
-                               $(objtree)/drivers/firmware/efi/libstub/lib.a
-endif
+vmlinux-objs-$(CONFIG_EFI_STUB) += $(obj)/eboot.o $(obj)/efi_stub_$(BITS).o \
+       $(objtree)/drivers/firmware/efi/libstub/lib.a
 
-$(obj)/vmlinux: $(VMLINUX_OBJS) FORCE
+$(obj)/vmlinux: $(vmlinux-objs-y) FORCE
        $(call if_changed,ld)
        @:
 
@@ -45,7 +46,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  $@
index fc6091a..913c999 100644 (file)
@@ -1,6 +1,5 @@
 #include "misc.h"
 
-#ifdef CONFIG_RANDOMIZE_BASE
 #include <asm/msr.h>
 #include <asm/archrandom.h>
 #include <asm/e820.h>
@@ -320,5 +319,3 @@ unsigned char *choose_kernel_location(unsigned char *input,
 out:
        return (unsigned char *)choice;
 }
-
-#endif /* CONFIG_RANDOMIZE_BASE */
index d3d003c..261e81f 100644 (file)
@@ -1,9 +1,5 @@
 #include "misc.h"
 
-#ifdef CONFIG_EARLY_PRINTK
-
 int early_serial_base;
 
 #include "../early_serial_console.c"
-
-#endif
diff --git a/arch/x86/configs/tiny.config b/arch/x86/configs/tiny.config
new file mode 100644 (file)
index 0000000..4e2ecfa
--- /dev/null
@@ -0,0 +1 @@
+CONFIG_NOHIGHMEM=y
index e84c642..782a65b 100644 (file)
@@ -1537,6 +1537,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
diff --git a/kernel/configs/tiny.config b/kernel/configs/tiny.config
new file mode 100644 (file)
index 0000000..c2de56a
--- /dev/null
@@ -0,0 +1,4 @@
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_KERNEL_XZ=y
+CONFIG_OPTIMIZE_INLINING=y
+CONFIG_SLOB=y
index 391d4dd..d4709d4 100644 (file)
@@ -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);
index 632ae77..fe7a053 100644 (file)
@@ -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
index 549d0ab..23e78dc 100755 (executable)
@@ -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)
index 9c4d241..ebf40f6 100644 (file)
@@ -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