mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
c33df4eaaf
The file init/initramfs.c is always compiled and linked in the kernel vmlinux even when BLK_DEV_RAM and BLK_DEV_INITRD are disabled and the system isn't using any form of an initramfs or initrd. In this situation the code is only used to unpack a (static) default initial rootfilesystem. The current init/initramfs.c code. usr/initramfs_data.o compiles to a size of ~15 kbytes. Disabling BLK_DEV_RAM and BLK_DEV_INTRD shrinks the kernel code size with ~60 Kbytes. This patch avoids compiling in the code and data for initramfs support if CONFIG_BLK_DEV_INITRD is not defined. Instead of the initramfs code and data it uses a small routine in init/noinitramfs.c to setup an initial static default environment for mounting a rootfilesystem later on in the kernel initialisation process. The new code is: 164 bytes of size. The patch is separated in two parts: 1) doesn't compile initramfs code when CONFIG_BLK_DEV_INITRD is not set 2) changing all plaforms vmlinux.lds.S files to not reserve an area of PAGE_SIZE when CONFIG_BLK_DEV_INITRD is not set. [deweerdt@free.fr: warning fix] Signed-off-by: Jean-Paul Saman <jean-paul.saman@nxp.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Frederik Deweerdt <frederik.deweerdt@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
34 lines
1.0 KiB
Makefile
34 lines
1.0 KiB
Makefile
#
|
|
# Makefile for the linux kernel.
|
|
#
|
|
|
|
obj-y := main.o version.o mounts.o
|
|
ifneq ($(CONFIG_BLK_DEV_INITRD),y)
|
|
obj-y += noinitramfs.o
|
|
else
|
|
obj-$(CONFIG_BLK_DEV_INITRD) += initramfs.o
|
|
endif
|
|
obj-$(CONFIG_GENERIC_CALIBRATE_DELAY) += calibrate.o
|
|
|
|
mounts-y := do_mounts.o
|
|
mounts-$(CONFIG_BLK_DEV_RAM) += do_mounts_rd.o
|
|
mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o
|
|
mounts-$(CONFIG_BLK_DEV_MD) += do_mounts_md.o
|
|
|
|
# files to be removed upon make clean
|
|
clean-files := ../include/linux/compile.h
|
|
|
|
# dependencies on generated files need to be listed explicitly
|
|
|
|
$(obj)/version.o: include/linux/compile.h
|
|
|
|
# compile.h changes depending on hostname, generation number, etc,
|
|
# so we regenerate it always.
|
|
# mkcompile_h will make sure to only update the
|
|
# actual file if its content has changed.
|
|
|
|
include/linux/compile.h: FORCE
|
|
@echo ' CHK $@'
|
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \
|
|
"$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)"
|