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

Next file: linux-2.4.19/arch/ppc/boot/pmac/chrpmain.c
Previous file: linux-2.4.19/arch/ppc/boot/mbx/rdimage.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/arch/ppc/boot/pmac/Makefile linux-2.4.19/arch/ppc/boot/pmac/Makefile
@@ -1,4 +1,4 @@
-# BK Id: SCCS/s.Makefile 1.16 09/28/01 07:39:37 trini
+# BK Id: SCCS/s.Makefile 1.19 01/16/02 11:08:07 trini
 #
 # Makefile for making XCOFF bootable images for booting on PowerMacs
 # using Open Firmware.
@@ -9,10 +9,10 @@
 # Tom Rini		January 2001
 
 OBJCOPY_ARGS = -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
-COFF_LD_ARGS = -e _start -T ld.script -Ttext 500000 -Tdata 510000 -Bstatic
-CHRP_LD_ARGS = -Ttext 0x01000000
+COFF_LD_ARGS = -T ../ld.script -e _start -Ttext 0x00500000 -Bstatic
+CHRP_LD_ARGS = -T ../ld.script -Ttext 0x01000000
 
-COMMONOBJS = start.o misc.o ../common/string.o image.o ../common/ofcommon.o
+COMMONOBJS = start.o misc.o ../common/string.o ../common/ofcommon.o
 COFFOBJS = ../common/coffcrt0.o $(COMMONOBJS) coffmain.o
 CHRPOBJS = ../common/crt0.o $(COMMONOBJS) chrpmain.o
 LIBS = $(TOPDIR)/lib/lib.a ../lib/zlib.a
@@ -20,29 +20,31 @@
 MKNOTE := ../utils/mknote
 SIZE := ../utils/size
 OFFSET := ../utils/offset
-PIGGYBACK := ../utils/piggyback
 HACKCOFF := ../utils/hack-coff
 
-ifeq ($(CONFIG_PPC64BRIDGE),y)
-MSIZE=.64
-else
-MSIZE=
+ifdef CONFIG_SMP
+END := .smp
 endif
-
-ifeq ($(CONFIG_SMP),y)
-TFTPIMAGE=/tftpboot/zImage.pmac.smp$(MSIZE)
-else
-TFTPIMAGE=/tftpboot/zImage.pmac$(MSIZE)
+ifdef CONFIG_PPC64BRIDGE
+END += .64
 endif
 
-../common/crt0.o:
-	$(MAKE) -C ../common crt0.o
+TFTPIMAGE=/tftpboot/zImage.pmac$(END)
+
+AFLAGS_../common/crt0.o		+= -I$(TOPDIR)/arch/$(ARCH)/kernel
 
 ../common/coffcrt0.o:
 	$(MAKE) -C ../common coffcrt0.o
 
-chrpmain.o: chrpmain.c
-	$(CC) $(CFLAGS) -DSYSMAP_OFFSET=0 -DSYSMAP_SIZE=0 -c chrpmain.c
+image.o: ../images/vmlinux.gz ../common/dummy.o
+	$(OBJCOPY) ../common/dummy.o $@ -R .comment \
+		--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
 
 znetboot: vmlinux.coff vmlinux.elf-pmac zImage
 	cp ../images/vmlinux.coff $(TFTPIMAGE)
@@ -52,30 +54,26 @@
 	cp ../images/vmlinux.initrd.coff $(TFTPIMAGE)
 	cp ../images/vmlinux.initrd.elf-pmac $(TFTPIMAGE).elf
 
-#floppy: zImage
-#	mount -t hfs /dev/fd0 /mnt
-#	cp vmlinux.coff /mnt
-#	umount /mnt
-
-miboot.image: dummy.o ../images/vmlinux.gz
+miboot.image: ../common/dummy.o ../images/vmlinux.gz
 	$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=../images/vmlinux.gz \
-		dummy.o ../images/$@
+		../common/dummy.o ../images/$@
 
 miboot.initrd.image: miboot.image ../images/ramdisk.image.gz
 	$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=../images/ramdisk.image.gz \
 		../images/miboot.image ../images/$@
 
-coffboot: $(COFFOBJS) $(LIBS) ../common/no_initrd.o ld.script ../images/vmlinux.gz
-	$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) ../common/no_initrd.o $(LIBS)
-
-coffboot.initrd: $(COFFOBJS) $(LIBS) initrd.o ld.script ../images/vmlinux.gz
-	$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) initrd.o $(LIBS)
-
-image.o: $(PIGGYBACK) ../images/vmlinux.gz
-	$(PIGGYBACK) image < ../images/vmlinux.gz | $(AS) -o $@
-
-initrd.o: ../images/ramdisk.image.gz $(PIGGYBACK)
-	$(PIGGYBACK) initrd < ../images/ramdisk.image.gz | $(AS) -o $@
+coffboot: $(COFFOBJS) image.o $(LIBS) ../ld.script
+	$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) image.o $(LIBS)
+	$(OBJCOPY) $@ $@ -R .comment
+
+coffboot.initrd: $(COFFOBJS) image.o $(LIBS) ../ld.script \
+		../images/ramdisk.image.gz
+	$(OBJCOPY) image.o image-coff.o \
+		--add-section=.ramdisk=../images/ramdisk.image.gz \
+		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+	$(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) image-coff.o $(LIBS)
+	$(OBJCOPY) $@ $@ -R .comment
+	rm -f image-coff.o
 
 vmlinux.coff: coffboot $(HACKCOFF)
 	$(OBJCOPY) $(OBJCOPY_ARGS) coffboot ../images/$@
@@ -89,24 +87,23 @@
 	rm -f coffboot.initrd
 	ln -sf vmlinux.initrd.coff ../images/zImage.initrd.pmac
 
-vmlinux.elf-pmac: $(CHRPOBJS) $(LIBS) ../common/no_initrd.o $(MKNOTE) ../images/vmlinux.gz
-	$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $(CHRPOBJS) ../common/no_initrd.o $(LIBS)
+vmlinux.elf-pmac: $(CHRPOBJS) $(LIBS) $(MKNOTE) image.o
+	$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $(CHRPOBJS) $(LIBS) image.o
 	$(MKNOTE) > note
 	$(OBJCOPY) ../images/$@ ../images/$@ --add-section=.note=note \
-		--add-section=sysmap=$(TOPDIR)/System.map -R .comment
-	$(CC) $(CFLAGS) chrpmain.c -c -o chrpmain.o \
-		-DSYSMAP_OFFSET=`sh $(OFFSET) $(OBJDUMP) ../images/$@ sysmap` \
-		-DSYSMAP_SIZE=`sh $(SIZE) $(OBJDUMP) ../images/$@ sysmap`
-	$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $(CHRPOBJS) ../common/no_initrd.o $(LIBS)
-	$(OBJCOPY) ../images/$@ ../images/$@ --add-section=.note=note \
-		--add-section=sysmap=$(TOPDIR)/System.map -R .comment
+		-R .comment -R .ramdisk
 	rm -f note
 
-vmlinux.initrd.elf-pmac: $(CHRPOBJS) $(LIBS) initrd.o $(MKNOTE) ../images/vmlinux.gz
-	$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $(CHRPOBJS) initrd.o $(LIBS)
+vmlinux.initrd.elf-pmac: $(CHRPOBJS) $(LIBS) $(MKNOTE) image.o \
+		../images/ramdisk.image.gz
+	$(OBJCOPY) image.o image-elf.o \
+		--add-section=.ramdisk=../images/ramdisk.image.gz \
+		--set-section-flags=.ramdisk=contents,alloc,load,readonly,data
+	$(LD) $(CHRP_LD_ARGS) -o ../images/$@ $(CHRPOBJS) $(LIBS) image-elf.o
 	$(MKNOTE) > note
-	$(OBJCOPY) ../images/$@ ../images/$@ --add-section=.note=note -R .comment
-	rm -f note
+	$(OBJCOPY) ../images/$@ ../images/$@ --add-section=.note=note \
+		-R .comment
+	rm -f note image-elf.o
 
 zImage: vmlinux.coff vmlinux.elf-pmac miboot.image
 

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