patch-2.4.19 linux-2.4.19/arch/ppc/boot/chrp/Makefile

Next file: linux-2.4.19/arch/ppc/boot/chrp/main.c
Previous file: linux-2.4.19/arch/ppc/boot/Makefile
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/arch/ppc/boot/chrp/Makefile linux-2.4.19/arch/ppc/boot/chrp/Makefile
@@ -1,4 +1,4 @@
-# BK Id: SCCS/s.Makefile 1.13 07/27/01 20:24:17 trini
+# BK Id: SCCS/s.Makefile 1.15 01/11/02 10:46:06 trini
 #
 # Makefile for making ELF bootable images for booting on CHRP
 # using Open Firmware.
@@ -7,19 +7,9 @@
 #
 # Based on coffboot by Paul Mackerras
 
-ifeq ($(CONFIG_PPC64BRIDGE),y)
-MSIZE=.64
-AFLAGS += -Wa,-mppc64bridge
-else
-MSIZE=
-endif
-
-.c.o:
-	$(CC) $(CFLAGS) -DKERNELBASE=$(KERNELBASE) -c -o $*.o $<
-.S.o:
-	$(CC) $(AFLAGS) -traditional -c -o $*.o $<
+USE_STANDARD_AS_RULE := true
 
-LD_ARGS = -Ttext 0x00400000
+LD_ARGS = -T ../ld.script -Ttext 0x00400000
 
 OBJS = ../common/crt0.o start.o main.o misc.o ../common/string.o image.o \
 	../common/ofcommon.o
@@ -27,23 +17,22 @@
 ADDNOTE = ../utils/addnote
 PIGGYBACK = ../utils/piggyback
 
+ifeq ($(CONFIG_PPC64BRIDGE),y)
+END += .64
+AFLAGS += -Wa,-mppc64bridge
+endif
 ifeq ($(CONFIG_SMP),y)
-TFTPIMAGE=/tftpboot/zImage.chrp.smp$(MSIZE)
-else
-TFTPIMAGE=/tftpboot/zImage.chrp$(MSIZE)
+END += .smp
 endif
 
+TFTPIMAGE=/tftpboot/zImage.chrp$(END)
+
+AFLAGS_../common/crt0.o		+= -I$(TOPDIR)/arch/$(ARCH)/kernel
+
 all: zImage
 
 znetboot: zImage
-ifdef CONFIG_SMP
-	cp -f $(TOPDIR)/vmlinux /tftpboot/vmlinux.smp
-else
-	cp -f $(TOPDIR)/vmlinux /tftpboot/vmlinux
-endif
-ifdef CONFIG_PPC64BRIDGE
-	cp -f $(TOPDIR)/vmlinux /tftpboot/vmlinux.64
-endif
+	cp -f $(TOPDIR)/vmlinux /tftpboot/vmlinux$(END)
 	cp ../images/zImage.chrp $(TFTPIMAGE)
 
 znetboot.initrd: zImage.initrd
@@ -52,22 +41,28 @@
 floppy: zImage
 	mcopy zImage a:zImage
 
-image.o: $(PIGGYBACK) ../images/vmlinux.gz
-	$(PIGGYBACK) image < ../images/vmlinux.gz | $(AS) -o $@
-
-sysmap.o: $(PIGGYBACK) $(TOPDIR)/System.map
-	$(PIGGYBACK) sysmap < $(TOPDIR)/System.map | $(AS) -o $@
-
-initrd.o: ../images/ramdisk.image.gz $(PIGGYBACK)
-	$(PIGGYBACK) initrd < ../images/ramdisk.image.gz | $(AS) -o $@
+image.o: ../images/vmlinux.gz ../common/dummy.o
+	$(OBJCOPY) ../common/dummy.o $@ \
+		--add-section=.image=../images/vmlinux.gz \
+		--set-section-flags=.image=contents,alloc,load,readonly,data
+ifdef CONFIG_XMON
+	$(OBJCOPY) $@ $@ \
+		--add-section=.sysmap=$(TOPDIR)/System.map \
+		--set-section-flags=.sysmap=contents,alloc,load,readonly,data
+endif
 
-zImage: $(OBJS) $(LIBS) ../common/no_initrd.o $(ADDNOTE) ../images/vmlinux.gz
-	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) ../common/no_initrd.o $(LIBS)
+zImage: $(OBJS) $(LIBS) $(ADDNOTE)
+	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) $(LIBS)
+	$(OBJCOPY) ../images/$@.chrp ../images/$@.chrp -R .comment -R .ramdisk
 	cp ../images/$@.chrp ../images/$@.chrp-rs6k
 	$(ADDNOTE) ../images/$@.chrp-rs6k
 
-zImage.initrd: $(OBJS) $(LIBS) initrd.o $(ADDNOTE) ../images/vmlinux.gz
-	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) initrd.o $(LIBS)
+zImage.initrd: $(OBJS) $(LIBS) $(ADDNOTE) ../images/ramdisk.image.gz
+	$(OBJCOPY) image.o image.o \
+		--add-section=.ramdisk=../images/ramdisk.image.gz \
+		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+	$(LD) $(LD_ARGS) -o ../images/$@.chrp $(OBJS) $(LIBS)
+	$(OBJCOPY) ../images/$@.chrp ../images/$@.chrp -R .comment
 	cp ../images/$@.chrp ../images/$@.chrp-rs6k
 	$(ADDNOTE) ../images/$@.chrp-rs6k
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)