Commit 85e161f7 authored by Sam Ravnborg's avatar Sam Ravnborg

usr: Create objectfile for usr filesystem using .incbin

Patch originally by HJ Lu.

The filesystem was previously embedded in a .o file using ld.
Embedding the filesystem using ld broke as a result ia64 and maybe more
architectures.

The better way to do this is to use the .incbin feature, as already
used for vsyscall for i386. .incbin has the advantage that ELH header
is correct, as required by ia64 - and maybe other archs.
This change will break architectures relying on binutils older than
2.11.90.0.23 released on 2001-07-14.
Most notably arm will break in some configurations due to this.
The rationale behing introducing .incbin is that ia64 needs this change
and the .incbin feature has been present in binutils for a number
of years now.
arm will thus have to catch up with binutils - or patch usr/Makefile
to stay compatible with the 2.5 kernel.

The definition of LDFLAGS_BLOB removed for all architectures - it was 
obsoleted by this change.
Except for arm - that may require it due to the tool compatibility issue.
parent 015744f5
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
NM := $(NM) -B NM := $(NM) -B
LDFLAGS_vmlinux := -static -N #-relax LDFLAGS_vmlinux := -static -N #-relax
LDFLAGS_BLOB := --format binary --oformat elf64-alpha
cflags-y := -pipe -mno-fp-regs -ffixed-8 cflags-y := -pipe -mno-fp-regs -ffixed-8
# Determine if we can use the BWX instructions with GAS. # Determine if we can use the BWX instructions with GAS.
......
...@@ -34,7 +34,6 @@ CFLAGS += -D__linux__ ...@@ -34,7 +34,6 @@ CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD) CFLAGS += -DUTS_SYSNAME=\"uClinux\" -DTARGET=$(BOARD)
AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) $(cflags-y) AFLAGS += -DPLATFORM=$(PLATFORM) -DTARGET=$(BOARD) -DMODEL=$(MODEL) $(cflags-y)
LDFLAGS += $(ldflags-y) LDFLAGS += $(ldflags-y)
LDFLAGS_BLOB := --format binary --oformat elf32-h8300
CROSS_COMPILE = h8300-elf- CROSS_COMPILE = h8300-elf-
#HEAD := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o #HEAD := arch/$(ARCH)/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
LDFLAGS := -m elf_i386 LDFLAGS := -m elf_i386
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := LDFLAGS_vmlinux :=
LDFLAGS_BLOB := --format binary --oformat elf32-i386
CFLAGS += -pipe CFLAGS += -pipe
......
...@@ -19,7 +19,6 @@ COMPILE_ARCH = $(shell uname -m) ...@@ -19,7 +19,6 @@ COMPILE_ARCH = $(shell uname -m)
# override top level makefile # override top level makefile
AS += -m68020 AS += -m68020
LDFLAGS := -m m68kelf LDFLAGS := -m m68kelf
LDFLAGS_BLOB := --format binary --oformat elf32-m68k
ifneq ($(COMPILE_ARCH),$(ARCH)) ifneq ($(COMPILE_ARCH),$(ARCH))
# prefix for cross-compiling binaries # prefix for cross-compiling binaries
CROSS_COMPILE = m68k-linux- CROSS_COMPILE = m68k-linux-
......
...@@ -85,8 +85,6 @@ CFLAGS += -O2 -g ...@@ -85,8 +85,6 @@ CFLAGS += -O2 -g
CFLAGS += -D__linux__ CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\" CFLAGS += -DUTS_SYSNAME=\"uClinux\"
LDFLAGS_BLOB := --format binary --oformat elf32-m68k
head-y := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o head-y := arch/m68knommu/platform/$(platform-y)/$(board-y)/crt0_$(model-y).o
CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h \ CLEAN_FILES := include/asm-$(ARCH)/asm-offsets.h \
......
...@@ -20,13 +20,11 @@ ...@@ -20,13 +20,11 @@
ifdef CONFIG_PARISC64 ifdef CONFIG_PARISC64
CROSS_COMPILE := hppa64-linux- CROSS_COMPILE := hppa64-linux-
UTS_MACHINE := parisc64 UTS_MACHINE := parisc64
LDFLAGS_BLOB := --format binary --oformat elf64-hppa-linux
else else
MACHINE := $(subst 64,,$(shell uname -m)) MACHINE := $(subst 64,,$(shell uname -m))
ifneq ($(MACHINE),parisc) ifneq ($(MACHINE),parisc)
CROSS_COMPILE := hppa-linux- CROSS_COMPILE := hppa-linux-
endif endif
LDFLAGS_BLOB := --format binary --oformat elf32-hppa-linux
endif endif
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
# This must match PAGE_OFFSET in include/asm-ppc/page.h. # This must match PAGE_OFFSET in include/asm-ppc/page.h.
KERNELLOAD := $(CONFIG_KERNEL_START) KERNELLOAD := $(CONFIG_KERNEL_START)
LDFLAGS_BLOB := --format binary --oformat elf32-powerpc
LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic LDFLAGS_vmlinux := -Ttext $(KERNELLOAD) -Bstatic
CPPFLAGS += -Iarch/$(ARCH) CPPFLAGS += -Iarch/$(ARCH)
AFLAGS += -Iarch/$(ARCH) AFLAGS += -Iarch/$(ARCH)
......
...@@ -17,7 +17,6 @@ KERNELLOAD := 0xc000000000000000 ...@@ -17,7 +17,6 @@ KERNELLOAD := 0xc000000000000000
LDFLAGS := -m elf64ppc LDFLAGS := -m elf64ppc
LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD) LDFLAGS_vmlinux := -Bstatic -e $(KERNELLOAD) -Ttext $(KERNELLOAD)
LDFLAGS_BLOB := --format binary --oformat elf64-powerpc
CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \ CFLAGS += -msoft-float -pipe -Wno-uninitialized -mminimal-toc \
-mtraceback=full -mcpu=power4 -mtraceback=full -mcpu=power4
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
ifdef CONFIG_ARCH_S390_31 ifdef CONFIG_ARCH_S390_31
LDFLAGS := -m elf_s390 LDFLAGS := -m elf_s390
LDFLAGS_BLOB := --format binary --oformat elf32-s390
CFLAGS += -m31 CFLAGS += -m31
UTS_MACHINE := s390 UTS_MACHINE := s390
endif endif
...@@ -23,7 +22,6 @@ endif ...@@ -23,7 +22,6 @@ endif
ifdef CONFIG_ARCH_S390X ifdef CONFIG_ARCH_S390X
LDFLAGS := -m elf64_s390 LDFLAGS := -m elf64_s390
MODFLAGS += -fpic -D__PIC__ MODFLAGS += -fpic -D__PIC__
LDFLAGS_BLOB := --format binary --oformat elf64-s390
CFLAGS += -m64 CFLAGS += -m64
UTS_MACHINE := s390x UTS_MACHINE := s390x
endif endif
......
...@@ -50,10 +50,8 @@ LDFLAGS_vmlinux += -e _stext ...@@ -50,10 +50,8 @@ LDFLAGS_vmlinux += -e _stext
ifdef CONFIG_CPU_LITTLE_ENDIAN ifdef CONFIG_CPU_LITTLE_ENDIAN
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' -EL LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64' -EL
LDFLAGS_BLOB :=--format binary --oformat elf32-sh-linux
else else
LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' -EB LDFLAGS_vmlinux += --defsym 'jiffies=jiffies_64+4' -EB
LDFLAGS_BLOB :=--format binary --oformat elf32-shbig-linux
endif endif
CFLAGS += -pipe $(cpu-y) CFLAGS += -pipe $(cpu-y)
......
...@@ -23,8 +23,6 @@ AS := $(AS) -32 ...@@ -23,8 +23,6 @@ AS := $(AS) -32
LDFLAGS := -m elf32_sparc LDFLAGS := -m elf32_sparc
endif endif
LDFLAGS_BLOB := --format binary --oformat elf32-sparc
#CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7 #CFLAGS := $(CFLAGS) -g -pipe -fcall-used-g5 -fcall-used-g7
ifneq ($(IS_EGCS),y) ifneq ($(IS_EGCS),y)
CFLAGS := $(CFLAGS) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 CFLAGS := $(CFLAGS) -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
......
...@@ -32,7 +32,6 @@ RANLIB = sparc64-linux-ranlib ...@@ -32,7 +32,6 @@ RANLIB = sparc64-linux-ranlib
else else
AS := $(AS) -64 AS := $(AS) -64
LDFLAGS := -m elf64_sparc LDFLAGS := -m elf64_sparc
LDFLAGS_BLOB := --format binary --oformat elf64-sparc
endif endif
ifneq ($(UNDECLARED_REGS),y) ifneq ($(UNDECLARED_REGS),y)
......
...@@ -27,7 +27,6 @@ CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" ...@@ -27,7 +27,6 @@ CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
# some reason) # some reason)
LDFLAGS_MODULE += --unique=.gnu.linkonce.this_module LDFLAGS_MODULE += --unique=.gnu.linkonce.this_module
LDFLAGS_BLOB := -b binary --oformat elf32-little
OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e OBJCOPY_FLAGS_BLOB := -I binary -O elf32-little -B v850e
......
...@@ -36,7 +36,6 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP ...@@ -36,7 +36,6 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
LDFLAGS := -m elf_x86_64 LDFLAGS := -m elf_x86_64
OBJCOPYFLAGS := -O binary -R .note -R .comment -S OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -e stext LDFLAGS_vmlinux := -e stext
LDFLAGS_BLOB := --format binary --oformat elf64-x86-64
CFLAGS += -mno-red-zone CFLAGS += -mno-red-zone
CFLAGS += -mcmodel=kernel CFLAGS += -mcmodel=kernel
......
...@@ -5,11 +5,10 @@ host-progs := gen_init_cpio ...@@ -5,11 +5,10 @@ host-progs := gen_init_cpio
clean-files := initramfs_data.cpio.gz clean-files := initramfs_data.cpio.gz
LDFLAGS_initramfs_data.o := $(LDFLAGS_BLOB) -r -T # initramfs_data.o contains the initramfs_data.cpio.gz image.
# The image is included using .incbin, a dependency which is not
$(obj)/initramfs_data.o: $(src)/initramfs_data.scr \ # tracked automatically.
$(obj)/initramfs_data.cpio.gz FORCE $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE
$(call if_changed,ld)
# initramfs-y are the programs which will be copied into the CPIO # initramfs-y are the programs which will be copied into the CPIO
# archive. Currently, the filenames are hardcoded in gen_init_cpio, # archive. Currently, the filenames are hardcoded in gen_init_cpio,
......
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.gz"
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