buildroot: build a second pass kernel if initramfs is enabled
If initramfs is enabled, build a second pass kernel containing the CPIO rootfs, preliminary work to get non exclusive enabling of initramfs. Signed-off-by: Florian Fainelli <florian@openwrt.org> SVN-Revision: 37047
This commit is contained in:
parent
b729d41d64
commit
a890ccd6e0
@ -32,6 +32,7 @@ endef
|
|||||||
|
|
||||||
define Kernel/CompileImage
|
define Kernel/CompileImage
|
||||||
$(call Kernel/CompileImage/Default)
|
$(call Kernel/CompileImage/Default)
|
||||||
|
$(call Kernel/CompileImage/Initramfs)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Kernel/Clean
|
define Kernel/Clean
|
||||||
|
@ -83,12 +83,13 @@ ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
|
|||||||
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_DIR)/.config
|
echo -e "$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),CONFIG_INITRAMFS_COMPRESSION_XZ=y\nCONFIG_RD_XZ=y,# CONFIG_INITRAMFS_COMPRESSION_XZ is not set\n# CONFIG_RD_XZ is not set)" >> $(LINUX_DIR)/.config
|
||||||
endef
|
endef
|
||||||
else
|
else
|
||||||
define Kernel/SetInitramfs
|
endif
|
||||||
|
|
||||||
|
define Kernel/SetNoInitramfs
|
||||||
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
mv $(LINUX_DIR)/.config $(LINUX_DIR)/.config.old
|
||||||
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
grep -v INITRAMFS $(LINUX_DIR)/.config.old > $(LINUX_DIR)/.config
|
||||||
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
|
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
|
||||||
endef
|
endef
|
||||||
endif
|
|
||||||
|
|
||||||
define Kernel/Configure/Default
|
define Kernel/Configure/Default
|
||||||
$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
|
$(LINUX_CONF_CMD) > $(LINUX_DIR)/.config.target
|
||||||
@ -100,12 +101,16 @@ define Kernel/Configure/Default
|
|||||||
echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target
|
echo "# CONFIG_KPROBES is not set" >> $(LINUX_DIR)/.config.target
|
||||||
$(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
|
$(SCRIPT_DIR)/metadata.pl kconfig $(TMP_DIR)/.packageinfo $(TOPDIR)/.config > $(LINUX_DIR)/.config.override
|
||||||
$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
|
$(SCRIPT_DIR)/kconfig.pl 'm+' '+' $(LINUX_DIR)/.config.target /dev/null $(LINUX_DIR)/.config.override > $(LINUX_DIR)/.config
|
||||||
$(call Kernel/SetInitramfs)
|
$(call Kernel/SetNoInitramfs)
|
||||||
rm -rf $(KERNEL_BUILD_DIR)/modules
|
rm -rf $(KERNEL_BUILD_DIR)/modules
|
||||||
[ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
|
[ -d $(LINUX_DIR)/user_headers ] || $(MAKE) $(KERNEL_MAKEOPTS) INSTALL_HDR_PATH=$(LINUX_DIR)/user_headers headers_install
|
||||||
$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
|
$(SH_FUNC) grep '=[ym]' $(LINUX_DIR)/.config | LC_ALL=C sort | md5s > $(LINUX_DIR)/.vermagic
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Kernel/Configure/Initramfs
|
||||||
|
$(call Kernel/SetInitramfs)
|
||||||
|
endef
|
||||||
|
|
||||||
define Kernel/CompileModules/Default
|
define Kernel/CompileModules/Default
|
||||||
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
|
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
|
||||||
+$(MAKE) $(KERNEL_MAKEOPTS) modules
|
+$(MAKE) $(KERNEL_MAKEOPTS) modules
|
||||||
@ -113,14 +118,32 @@ endef
|
|||||||
|
|
||||||
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
|
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
|
||||||
|
|
||||||
|
define Kernel/CopyImage
|
||||||
|
$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)$(1)
|
||||||
|
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux$(1).elf
|
||||||
|
endef
|
||||||
|
|
||||||
define Kernel/CompileImage/Default
|
define Kernel/CompileImage/Default
|
||||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
|
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
|
||||||
+$(MAKE) $(KERNEL_MAKEOPTS) $(subst ",,$(KERNELNAME))
|
+$(MAKE) $(KERNEL_MAKEOPTS) $(subst ",,$(KERNELNAME))
|
||||||
#")
|
#")
|
||||||
$(KERNEL_CROSS)objcopy -O binary $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
|
$(call Kernel/CopyImage)
|
||||||
$(KERNEL_CROSS)objcopy $(OBJCOPY_STRIP) -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
||||||
|
define Kernel/CompileImage/Initramfs
|
||||||
|
$(call Kernel/Configure/Initramfs)
|
||||||
|
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
|
||||||
|
+$(MAKE) $(KERNEL_MAKEOPTS) $(subst ",,$(KERNELNAME))
|
||||||
|
#")
|
||||||
|
#")
|
||||||
|
$(call Kernel/CopyImage,-initramfs)
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define Kernel/CompileImage/Initramfs
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
define Kernel/Clean/Default
|
define Kernel/Clean/Default
|
||||||
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
|
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
|
||||||
rm -f $(LINUX_KERNEL)
|
rm -f $(LINUX_KERNEL)
|
||||||
|
Loading…
Reference in New Issue
Block a user