Commit 01a224b4 authored by Kai Germaschewski's avatar Kai Germaschewski

kbuild: Put flags for objcopy into OBJCOPYFLAGS

Again, don't just add flags into $(OBJCOPY), but use the
variable $(OBJCOPYFLAGS) instead.
parent 0be6838a
......@@ -8,6 +8,7 @@
# Copyright (C) 1995-2001 by Russell King
LDFLAGS_vmlinux :=-p -X -T arch/arm/vmlinux.lds
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9
CFLAGS +=-pipe
......
......@@ -115,15 +115,15 @@ endif
export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
Image: $(SYSTEM)
$(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) $@
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
bzImage: zImage
zImage: compressed/vmlinux
$(OBJCOPY) -O binary -R .note -R .comment -S compressed/vmlinux $@
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
bootpImage: bootp/bootp
$(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
compressed/vmlinux: $(TOPDIR)/vmlinux
@$(MAKE) -C compressed vmlinux
......
......@@ -78,7 +78,7 @@ $(HEAD): $(HEAD:.o=.S)
$(CC) $(AFLAGS) -traditional -c $(HEAD:.o=.S)
piggy.o: $(SYSTEM)
$(OBJCOPY) -O binary -R .note -R .comment -S $(SYSTEM) piggy
$(OBJCOPY) $(OBJCOPYFLAGS) $(SYSTEM) piggy
gzip $(GZFLAGS) < piggy > piggy.gz
$(LD) -r -o $@ -b binary piggy.gz
rm -f piggy piggy.gz
......
......@@ -35,7 +35,7 @@ LDFLAGS_vmlinux = -T $(LD_SCRIPT).tmp
# objcopy is used to make binary images from the resulting linked file
OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
# -mlinux enables -march=v10, -fno-underscores, -D__linux__ among others
......@@ -64,7 +64,7 @@ LIBS := $(TOPDIR)/arch/cris/lib/lib.a $(LIBS) $(TOPDIR)/arch/cris/lib/lib.a $(LI
MAKEBOOT = $(MAKE) -C arch/$(ARCH)/boot
vmlinux.bin: vmlinux
$(OBJCOPY) vmlinux vmlinux.bin
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
timage: vmlinux.bin
cat vmlinux.bin cramfs.img >timage
......
......@@ -8,7 +8,7 @@ CC = gcc-cris -melf -I $(TOPDIR)/include
CFLAGS = -O2
LD = ld-cris
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
OBJECTS = head.o misc.o
# files to compress
......@@ -18,7 +18,7 @@ all: vmlinuz
decompress.bin: $(OBJECTS)
$(LD) -T decompress.ld -o decompress.o $(OBJECTS)
$(OBJCOPY) -O binary --remove-section=.bss decompress.o decompress.bin
$(OBJCOPY) $(OBJCOPYFLAGS) decompress.o decompress.bin
# save it for mkprod in the topdir.
cp decompress.bin $(TOPDIR)
......
......@@ -8,6 +8,7 @@ CC = gcc-cris -mlinux -I $(TOPDIR)/include
CFLAGS = -O2
LD = gcc-cris -mlinux -nostdlib
OBJCOPY = objcopy-cris
OBJCOPYFLAGS = -O binary --remove-section=.bss
all: rescue.bin testrescue.bin kimagerescue.bin
......@@ -16,11 +17,11 @@ rescue: rescue.bin
rescue.bin: head.o
$(LD) -T rescue.ld -o rescue.o head.o
$(OBJCOPY) -O binary --remove-section=.bss rescue.o rescue.bin
$(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin
cp rescue.bin $(TOPDIR)
testrescue.bin: testrescue.o
$(OBJCOPY) -O binary --remove-section=.bss testrescue.o tr.bin
$(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin
# Pad it to 784 bytes
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat tr.bin tmp2423 >testrescue_tmp.bin
......@@ -28,7 +29,7 @@ testrescue.bin: testrescue.o
rm tr.bin tmp2423 testrescue_tmp.bin
kimagerescue.bin: kimagerescue.o
$(OBJCOPY) -O binary --remove-section=.bss kimagerescue.o ktr.bin
$(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin
# Pad it to 784 bytes, that's what the rescue loader expects
dd if=/dev/zero of=tmp2423 bs=1 count=784
cat ktr.bin tmp2423 >kimagerescue_tmp.bin
......
......@@ -17,8 +17,8 @@
#
LDFLAGS := -m elf_i386
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
LDFLAGS_vmlinux :=-T arch/i386/vmlinux.lds -e stext
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/i386/vmlinux.lds -e stext
CFLAGS += -pipe
......
......@@ -32,11 +32,11 @@ BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build
$(OBJCOPY) compressed/vmlinux compressed/vmlinux.out
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
bzImage: bbootsect bsetup compressed/bvmlinux tools/build
$(OBJCOPY) compressed/bvmlinux compressed/bvmlinux.out
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
compressed/vmlinux: $(TOPDIR)/vmlinux
......
......@@ -40,7 +40,7 @@ misc.o: misc.c
piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(SYSTEM) $$tmppiggy; \
$(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
......
......@@ -13,6 +13,7 @@ AWK := awk
export AWK
OBJCOPYFLAGS := --strip-all
LDFLAGS_vmlinux := -static -T arch/$(ARCH)/vmlinux.lds
AFLAGS_KERNEL := -mconstant-gp
EXTRA =
......@@ -100,7 +101,7 @@ arch/$(ARCH)/vmlinux.lds: arch/$(ARCH)/vmlinux.lds.S FORCE
-traditional arch/$(ARCH)/vmlinux.lds.S > $@
compressed: vmlinux
$(OBJCOPY) --strip-all vmlinux vmlinux-tmp
$(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux-tmp
gzip vmlinux-tmp
mv vmlinux-tmp.gz vmlinux.gz
......
......@@ -20,7 +20,7 @@
FINAL_LD=$(CROSS_COMPILE)ld --warn-common --warn-section-align
CPP=$(CC) -E
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
OBJCOPY_FLAGS =-O binary -R .note -R .comment -S
LDFLAGS_vmlinux =-T arch/parisc/vmlinux.lds
CFLAGS_PIPE := -pipe
......
......@@ -36,6 +36,7 @@ BOOTAFLAGS = -D__ASSEMBLY__ $(HOSTCFLAGS)
CFLAGS = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
LD_ARGS = -Ttext 0x00400000 -e _start
OBJCOPYFLAGS := -S -O binary
OBJS = crt0.o start.o main.o zlib.o image.o imagesize.o
#LIBS = $(TOPDIR)/lib/lib.a
......@@ -109,9 +110,8 @@ zImage.initrd: $(OBJS) initrd.o addnote
$(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) initrd.o $(LIBS)
./addnote $@
vmlinux.gz: $(TOPDIR)/vmlinux
$(OBJCOPY) -S -O binary $(TOPDIR)/vmlinux vmlinux
$(OBJCOPY) $(OBJCOPYFLAGS) $(TOPDIR)/vmlinux vmlinux
ls -l vmlinux | awk '{printf "/* generated -- do not edit! */\nint uncompressed_size = %d;\n", $$5}' > imagesize.c
$(CROSS_COMPILE)nm -n $(TOPDIR)/vmlinux | tail -1 | awk '{printf "long vmlinux_end = 0x%s;\n", substr($$1,8)}' >> imagesize.c
gzip -vf9 vmlinux
......
......@@ -14,7 +14,7 @@
#
LDFLAGS := -m elf_s390
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
OBJCOPYFLAGS := -O binary
ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390/vmlinux-shared.lds
else
......
......@@ -2,8 +2,6 @@
# arch/s390/boot/Makefile
#
OBJCOPY = $(CROSS_COMPILE)objcopy
EXTRA_AFLAGS := -traditional
include $(TOPDIR)/Rules.make
......@@ -12,11 +10,11 @@ include $(TOPDIR)/Rules.make
$(LD) $(LDFLAGS) -Ttext 0x0 -o $@ $<
%.boot: %.lnk
$(OBJCOPY) -O binary $< $@
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
image: $(TOPDIR)/vmlinux \
iplfba.boot ipleckd.boot ipldump.boot
$(OBJCOPY) -O binary $(TOPDIR)/vmlinux image
$(OBJCOPY) $(OBJCOPYFLAGS) $(TOPDIR)/vmlinux image
$(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map
listing: ../../../vmlinux
......
......@@ -15,7 +15,7 @@
LDFLAGS := -m elf64_s390
CPP=$(CC) -E
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
OBJCOPYFLAGS := -O binary
ifeq ($(CONFIG_SHARED_KERNEL),y)
LINKSCRIPT := arch/s390x/vmlinux-shared.lds
else
......
......@@ -2,8 +2,6 @@
# Makefile for the linux s390-specific parts of the memory manager.
#
OBJCOPY = $(CROSS_COMPILE)objcopy
O_TARGET :=
EXTRA_AFLAGS := -traditional
......@@ -14,11 +12,11 @@ include $(TOPDIR)/Rules.make
$(LD) -Ttext 0x0 -o $@ $<
%.boot: %.lnk
$(OBJCOPY) -O binary $< $@
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
image: $(TOPDIR)/vmlinux \
iplfba.boot ipleckd.boot ipldump.boot
$(OBJCOPY) -O binary $(TOPDIR)/vmlinux image
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
$(NM) $(TOPDIR)/vmlinux | grep -v '\(compiled\)\|\( [aUw] \)\|\(\.\)\|\(LASH[RL]DI\)' | sort > $(TOPDIR)/System.map
listing: ../../../vmlinux
......
......@@ -24,7 +24,7 @@ AFLAGS += -mb
LDFLAGS := -EB
endif
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -R .stab -R .stabstr -S
OBJCOPYFLAGS := -O binary -R .note -R .comment -R .stab -R .stabstr -S
MODFLAGS +=
......
......@@ -11,10 +11,10 @@
SYSTEM =$(TOPDIR)/vmlinux
Image: $(SYSTEM)
$(OBJCOPY) $(SYSTEM) Image
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
zImage: compressed/vmlinux
$(OBJCOPY) compressed/vmlinux zImage
$(OBJCOPY) $(OBJCOPYFLAGS) $< $@
compressed/vmlinux: $(TOPDIR)/vmlinux
$(MAKE) -C compressed vmlinux
......
......@@ -33,7 +33,7 @@ head.o: head.S
piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
$(OBJCOPY) $(OBJCOPYFLAGS) -R .empty_zero_page $(SYSTEM) $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(LD) $(LDFLAGS) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-sh-linux -T $$tmppiggy.lnk; \
......
......@@ -34,7 +34,7 @@ export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
LD=$(CROSS_COMPILE)ld -m elf_x86_64
OBJCOPY=$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S
OBJCOPYFLAGS := -O binary -R .note -R .comment -S
LDFLAGS_vmlinux := -T arch/x86_64/vmlinux.lds -e stext
CFLAGS += -mno-red-zone
......
......@@ -28,11 +28,11 @@ BOOT_INCL = $(TOPDIR)/include/linux/config.h \
$(TOPDIR)/include/asm/boot.h
zImage: bootsect setup compressed/vmlinux tools/build
$(OBJCOPY) compressed/vmlinux compressed/vmlinux.out
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/vmlinux compressed/vmlinux.out
tools/build bootsect setup compressed/vmlinux.out $(ROOT_DEV) > zImage
bzImage: bbootsect bsetup compressed/bvmlinux tools/build
$(OBJCOPY) compressed/bvmlinux compressed/bvmlinux.out
$(OBJCOPY) $(OBJCOPYFLAGS) compressed/bvmlinux compressed/bvmlinux.out
tools/build -b bbootsect bsetup compressed/bvmlinux.out $(ROOT_DEV) > bzImage
bzImage-padded: bzImage
......
......@@ -33,7 +33,7 @@ misc.o: misc.c
piggy.o: $(SYSTEM)
tmppiggy=_tmp_$$$$piggy; \
rm -f $$tmppiggy $$tmppiggy.gz $$tmppiggy.lnk; \
$(OBJCOPY) $(SYSTEM) $$tmppiggy; \
$(OBJCOPY) $(OBJCOPYFLAGS) $< $$tmppiggy; \
gzip -f -9 < $$tmppiggy > $$tmppiggy.gz; \
echo "SECTIONS { .data : { input_len = .; LONG(input_data_end - input_data) input_data = .; *(.data) input_data_end = .; }}" > $$tmppiggy.lnk; \
$(IA32_LD) -r -o piggy.o -b binary $$tmppiggy.gz -b elf32-i386 -T $$tmppiggy.lnk; \
......
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