patch-2.0.11 linux/arch/alpha/boot/Makefile

Next file: linux/arch/alpha/boot/main.c
Previous file: linux/arch/alpha/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.10/linux/arch/alpha/boot/Makefile linux/arch/alpha/boot/Makefile
@@ -12,8 +12,12 @@
 # enable this for linking under OSF/1:
 LINKFLAGS = -non_shared -T 0x20000000 -N
 else
-# enable this for linking under Linux:
-LINKFLAGS = -static -T bootloader.lds -N 
+ elf=$(shell if $(LD) --help | grep elf64alpha >/dev/null; then echo yes; fi)
+ ifeq ($(elf),yes)
+  LINKFLAGS = -static -Ttext 0x20000000 -N
+ else
+  LINKFLAGS = -static -T bootloader.lds -N
+ endif
 endif
 
 .S.s:
@@ -22,13 +26,15 @@
 	$(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
 
 OBJECTS = head.o main.o
-TARGETS = vmlinux.gz
+TARGETS = vmlinux.gz tools/objstrip # also needed by aboot & milo
+VMLINUX = $(TOPDIR)/vmlinux
+OBJSTRIP = tools/objstrip
 
 all:	$(TARGETS)
 	@echo Ready to install kernel in $(shell pwd)/vmlinux.gz
 
 # normally no need to build these:
-rawboot: vmlinux.nh tools/lxboot tools/bootlx vmlinux
+rawboot: vmlinux.nh tools/lxboot tools/bootlx
 
 msb:	tools/lxboot tools/bootlx vmlinux.nh
 	( cat tools/lxboot tools/bootlx vmlinux.nh ) > /dev/rz0a
@@ -51,21 +57,33 @@
 #
 # A raw binary without header.  Used by raw boot.
 #
-vmlinux.nh: tools/build
-	tools/build -v $(TOPDIR)/vmlinux > vmlinux.nh
+main.o: ksize.h
+
+ksize.h: $(OBJSTRIP) vmlinux.nh
+	echo "#define KERNEL_SIZE `$(OBJSTRIP) -p vmlinux.nh /dev/null`" > $@
+
+vmlinux.nh: $(VMLINUX) $(OBJSTRIP)
+ifeq ($(elf),yes)
+	cp $(VMLINUX) vmlinux.stripped
+	strip vmlinux.stripped		# work around ELF binutils bug...
+	$(OBJSTRIP) -v vmlinux.stripped vmlinux.nh
+	rm -f vmlinux.stripped
+else
+	$(OBJSTRIP) -v $(VMLINUX) vmlinux.nh
+endif
 
 vmlinux: $(TOPDIR)/vmlinux
 	cp $(TOPDIR)/vmlinux vmlinux
 	strip vmlinux
 
-tools/lxboot: tools/build
-	tools/build > tools/lxboot
+tools/lxboot: $(OBJSTRIP) bootloader
+	$(OBJSTRIP) -p bootloader tools/lxboot
 
-tools/bootlx: bootloader tools/build
-	tools/build -vb bootloader > tools/bootlx
+tools/bootlx: bootloader $(OBJSTRIP)
+	$(OBJSTRIP) -vb bootloader tools/bootlx
 
-tools/build: tools/build.c
-	$(HOSTCC) tools/build.c -o tools/build
+$(OBJSTRIP): $(OBJSTRIP).c
+	$(HOSTCC) $(OBJSTRIP).c -o $(OBJSTRIP)
 
 tools/mkbb: tools/mkbb.c
 	$(HOSTCC) tools/mkbb.c -o tools/mkbb
@@ -74,11 +92,11 @@
 	$(LD) $(LINKFLAGS) \
 		$(OBJECTS) \
 		$(LIBS) \
-		-o bootloader || \
+		-o bootloader && strip bootloader || \
 		(rm -f bootloader && exit 1)
 
 clean:
-	rm -f $(TARGETS) bootloader bootimage vmlinux.nh tools/build \
+	rm -f $(TARGETS) bootloader bootimage vmlinux.nh \
 		tools/mkbb tools/bootlx tools/lxboot
 
 dep:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov