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)
export VERSION PATCHLEVEL SUBLEVEL EXTRAVERSION KERNELRELEASE ARCH \
CONFIG_SHELL TOPDIR HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC \
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 CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
......
......@@ -18,8 +18,8 @@
LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
ARCHBLOBLFLAGS := -I binary -O elf32-i386 -B i386
LDFLAGS_vmlinux := -e stext
LDFLAGS_BLOB := --format binary --oformat elf32-i386
CFLAGS += -pipe
......
......@@ -79,7 +79,7 @@ SECTIONS
__initcall_end = .;
. = ALIGN(4096);
__initramfs_start = .;
.init.ramfs : { *(.init.initramfs) }
.init.ramfs : { *(.init.ramfs) }
__initramfs_end = .;
. = ALIGN(32);
__per_cpu_start = .;
......
include arch/$(ARCH)/Makefile
obj-y := initramfs_data.o
host-progs := gen_init_cpio
clean-files := initramfs_data.cpio.gz
$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz
$(OBJCOPY) $(ARCHBLOBLFLAGS) \
--rename-section .data=.init.initramfs \
$(obj)/initramfs_data.cpio.gz $(obj)/initramfs_data.o
$(STRIP) -s $(obj)/initramfs_data.o
LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T
$(obj)/initramfs_data.o: $(src)/initramfs_data.scr $(obj)/initramfs_data.cpio.gz FORCE
$(call if_changed,ld)
$(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