patch-2.1.79 linux/arch/ppc/boot/Makefile

Next file: linux/arch/ppc/boot/crypt.h
Previous file: linux/arch/ppc/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.78/linux/arch/ppc/boot/Makefile linux/arch/ppc/boot/Makefile
@@ -9,94 +9,118 @@
 # Adapted for PowerPC by Gary Thomas
 # modified by Cort (cort@cs.nmt.edu)
 #
-
 .c.s:
 	$(CC) $(CFLAGS) -S -o $*.s $<
 .s.o:
 	$(AS) -o $*.o $<
 .c.o:
-	$(CC) $(CFLAGS) -c -o $*.o $<
+	$(CC) $(CFLAGS)  -DINITRD_OFFSET=$(IOFF) -DINITRD_SIZE=$(ISZ) -DZIMAGE_OFFSET=$(ZOFF) -DZIMAGE_SIZE=$(ZSZ) -DKERNELBASE=$(KERNELBASE) -c -o $*.o $<
 .S.s:
 	$(CC) -D__ASSEMBLY__ -traditional -E -o $*.o $<
 .S.o:
 	$(CC) -D__ASSEMBLY__ -traditional -c -o $*.o $<
 
 
-ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00800000
+ZOFF = 0
+ZSZ = 0
+IOFF = 0
+ISZ = 0
+#ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00800000
+ZLINKFLAGS = -T ../vmlinux.lds -Ttext 0x00600000
 GZIP_FLAGS = -v9
 
-SYSTEM = $(TOPDIR)/vmlinux
-OBJECTS := head.o inflate.o unzip.o misc.o vreset.o kbd.o
-CFLAGS = -O2 -DSTDC_HEADERS -I$(TOPDIR)/include
+OBJECTS := head.o misc.o vreset.o kbd.o ../coffboot/zlib.o # inflate.o unzip.o
+#OBJECTS := crt0.o start.o vreset.o
+CFLAGS = -O2 -DSTDC_HEADERS -fno-builtin -I$(TOPDIR)/include
 OBJCOPY = $(CROSS_COMPILE)objcopy
 OBJCOPY_ARGS = -O elf32-powerpc
 
+all:	zImage
 
-all:	$(TOPDIR)/zImage
 
+ifeq ($(CONFIG_PREP),y)
 mkprep : mkprep.c
-	$(HOSTCC) $(CFLAGSINC) -o mkprep mkprep.c
-
-piggyback : piggyback.c
-	$(HOSTCC) $(CFLAGSINC) -o piggyback piggyback.c
-
-find_name : find_name.c
-	$(HOSTCC) $(CFLAGSINC) -o find_name find_name.c
-
-floppy: $(TOPDIR)/vmlinux zImage 
-	dd if=$(TOPDIR)/zImage of=/dev/fd0H1440 bs=64b
+	$(HOSTCC) -DKERNELBASE=$(KERNELBASE) -o mkprep mkprep.c
 
-floppy.initrd: $(TOPDIR)/vmlinux zImage 
-	dd if=$(TOPDIR)/zImage.initrd of=/dev/fd0H1440 bs=64b
+floppy: $(TOPDIR)/vmlinux zImage
+	dd if=zImage of=/dev/fd0H1440 bs=64b
 
-znetboot : zImage mkprep
-	cp $(TOPDIR)/zImage /usr/local/tftpboot/vmlinux
+znetboot : zImage
+	cp zImage /tftpboot/zImage.prep
 
-znetboot.initrd : zImage.initrd mkprep
-	cp $(TOPDIR)/zImage.initrd /usr/local/tftpboot/vmlinux
+znetboot.initrd : zImage.initrd
+	cp zImage.initrd /tftpboot/zImage.prep
 
+zvmlinux: $(OBJECTS) ../coffboot/vmlinux.gz
 #
-# This really needs to go away.  Perhaps a 
-# zImage.prep and zImage.chrp might be better.
-# Once we're able to get a lilo-ish program 
-# on prep systems this won't be a problem.
-#   -- Cort
+# build the boot loader image and then compute the offset into it
+# for the kernel image
 #
-ifdef CONFIG_CHRP
-zImage: zvmlinux
-	cp zvmlinux $(TOPDIR)/zImage
-
-zImage.initrd: zvmlinux.initrd
-	cp zvmlinux.initrd $(TOPDIR)/zImage.initrd
-
-zvmlinux: $(OBJECTS) $(SYSTEM) find_name vmlinux.gz piggyback
-	./piggyback < vmlinux.gz | $(AS) -o piggy.o
-	$(LD) $(ZLINKFLAGS) -o $@ $(OBJECTS) piggy.o
-	rm -f piggy.o
-else
+	$(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
+	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment --add-section=image=../coffboot/vmlinux.gz \
+		zvmlinux.tmp $@
+#
+# then with the offset rebuild the bootloader so we know where the kernel is
+#
+	$(CC) $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0 \
+		-DZIMAGE_OFFSET=`./offset zvmlinux image` \
+		-DZIMAGE_SIZE=`./size zvmlinux image` -DKERNELBASE=$(KERNELBASE) \
+		-c -o misc.o misc.c
+	$(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
+	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment --add-section=image=../coffboot/vmlinux.gz \
+		zvmlinux.tmp $@
+	rm zvmlinux.tmp
+
+zvmlinux.initrd: zvmlinux
+	$(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
+	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
+		--add-section=initrd=ramdisk.image.gz \
+		--add-section=image=../coffboot/vmlinux.gz \
+		zvmlinux.initrd.tmp zvmlinux.initrd
+	$(CC) $(CFLAGS) -DINITRD_OFFSET=`./offset zvmlinux.initrd initrd` \
+		-DINITRD_SIZE=`./size zvmlinux.initrd initrd` \
+		-DZIMAGE_OFFSET=`./offset zvmlinux.initrd image` \
+		-DZIMAGE_SIZE=`./size zvmlinux.initrd image` \
+		-DKERNELBASE=$(KERNELBASE) -c -o misc.o misc.c
+	$(LD) $(ZLINKFLAGS) -o zvmlinux.initrd.tmp $(OBJECTS)
+	$(OBJCOPY) $(OBJCOPY_ARGS) -R .comment \
+		--add-section=initrd=ramdisk.image.gz \
+		--add-section=image=../coffboot/vmlinux.gz \
+		zvmlinux.initrd.tmp $@
+	rm zvmlinux.initrd.tmp
+
 zImage: zvmlinux mkprep
-	mkprep -pbp zvmlinux $(TOPDIR)/zImage
+	./mkprep -pbp zvmlinux zImage
 
 zImage.initrd: zvmlinux.initrd mkprep
-	mkprep -pbp zvmlinux.initrd $(TOPDIR)/zImage.initrd
+	./mkprep -pbp zvmlinux.initrd zImage.initrd
+else
+mkprep:
 
-zvmlinux: $(OBJECTS) $(SYSTEM) mkprep  find_name vmlinux.gz
-	$(LD) $(ZLINKFLAGS) -o zvmlinux.tmp $(OBJECTS)
-	$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=image=vmlinux.gz \
-		zvmlinux.tmp $@
-	rm zvmlinux.tmp
+floppy:
+
+znetboot:
+
+znetboot.initrd:
+
+zvmlinux:
+
+zvmlinux.initrd:
+
+zImage:
+
+zImage.initrd:
 endif
 
-vmlinux.gz: $(TOPDIR)/vmlinux
-	dd bs=64k skip=1 if=$(TOPDIR)/vmlinux | gzip -vf9 - > vmlinux.gz
 
-zvmlinux.initrd: zvmlinux
-	$(OBJCOPY) $(OBJCOPY_ARGS) --add-section=initrd=ramdisk.image.gz \
-		zvmlinux $@
+
+# just here to match coffboot/Makefile
+vmlinux.coff:
+
+vmlinux.coff.initrd:
 
 clean:
-	rm -f vmlinux* znetboot* zImage* zvmlinux* mkprep find_name
-	rm -f $(TOPDIR)/{zImage*,znetboot*,zvmlinux*,vmlinux*}
+	rm -f vmlinux* zvmlinux* mkprep zImage*
 
 fastdep:
 	$(TOPDIR)/scripts/mkdep *.[Sch] > .depend

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