Commit 25bb11a4 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: initramfs updates

Use ld to link the cpio archive into the image, build was broken
due to requiring a recent version of objcopy before, plus assorted
cleanups:

o Don't include arch/$(ARCH)/Makefile, export the needed arch-specific
  flags instead.
o Name the generated section consistently .init.ramfs everywhere.
parent 9589f34f
...@@ -175,7 +175,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS) ...@@ -175,7 +175,7 @@ AFLAGS := -D__ASSEMBLY__ $(CPPFLAGS)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \ export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \ CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \ CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE \
HOSTCXX HOSTCXXFLAGS HOSTCXX HOSTCXXFLAGS LDFLAGS_BLOB
export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS export CPPFLAGS NOSTDINC_FLAGS OBJCOPYFLAGS LDFLAGS
export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
......
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
LDFLAGS := -m elf_i386 LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
ARCHBLOBLFLAGS := -I binary -O elf32-i386 -B i386
LDFLAGS_vmlinux := -e stext LDFLAGS_vmlinux := -e stext
LDFLAGS_BLOB := --format binary --oformat elf32-i386
CFLAGS += -pipe CFLAGS += -pipe
......
...@@ -79,7 +79,7 @@ SECTIONS ...@@ -79,7 +79,7 @@ SECTIONS
__initcall_end = .; __initcall_end = .;
. = ALIGN(4096); . = ALIGN(4096);
__initramfs_start = .; __initramfs_start = .;
.init.ramfs : { *(.init.initramfs) } .init.ramfs : { *(.init.ramfs) }
__initramfs_end = .; __initramfs_end = .;
. = ALIGN(32); . = ALIGN(32);
__per_cpu_start = .; __per_cpu_start = .;
......
include arch/$(ARCH)/Makefile
obj-y := initramfs_data.o obj-y := initramfs_data.o
host-progs := gen_init_cpio host-progs := gen_init_cpio
clean-files := initramfs_data.cpio.gz clean-files := initramfs_data.cpio.gz
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T
$(OBJCOPY) $(ARCHBLOBLFLAGS) \
--rename-section .data=.init.initramfs \ $(obj)/initramfs_data.o: $(src)/initramfs_data.scr $(obj)/initramfs_data.cpio.gz FORCE
$(obj)/initramfs_data.cpio.gz $(obj)/initramfs_data.o $(call if_changed,ld)
$(STRIP) -s $(obj)/initramfs_data.o
$(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio
( cd $(obj) ; ./gen_init_cpio | gzip -9c > initramfs_data.cpio.gz ) ( cd $(obj) ; ./$< | gzip -9c > $@ )
SECTIONS
{
.init.ramfs : { *(.data) }
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment