- # BK Id: SCCS/s.Makefile 1.9 10/15/01 10:53:29 trini
- #
- #
- # arch/ppc/mbxboot/Makefile
- #
- # This file is subject to the terms and conditions of the GNU General Public
- # License. See the file "COPYING" in the main directory of this archive
- # for more details.
- #
- # Copyright (C) 1994 by Linus Torvalds
- # 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 $<
- .S.s:
- $(CPP) $(AFLAGS) -traditional -o $*.o $<
- .S.o:
- $(CC) $(AFLAGS) -traditional -c -o $*.o $<
- TFTPIMAGE := /tftpboot/zImage.embedded
- OFFSET := ../utils/offset
- SIZE := ../utils/size
- LIBS := ../lib/zlib.a
- OBJCOPY_ARGS := -O elf32-powerpc
- ifdef CONFIG_8xx
- ZLINKFLAGS := -T $(TOPDIR)/arch/$(ARCH)/vmlinux.lds -Ttext 0x00180000
- OBJECTS := head.o m8xx_tty.o
- CFLAGS += -DCONFIG_8xx
- endif
- ifdef CONFIG_8260
- ZLINKFLAGS := -T $(TOPDIR)/arch/$(ARCH)/vmlinux.lds -Ttext 0x00400000
- OBJECTS := head_8260.o m8260_tty.o embed_config.o
- CFLAGS += -DCONFIG_8260
- endif
- OBJECTS += ../common/misc-common.o misc.o ../common/string.o
- OBJCOPY_ARGS = -O elf32-powerpc
- ifeq ($(CONFIG_MBX),y)
- OBJECTS += iic.o embed_config.o pci.o qspan_pci.o
- CFLAGS += -DCONFIG_MBX
- endif
- ifeq ($(CONFIG_RPXLITE),y)
- CFLAGS += -DCONFIG_RPXLITE
- OBJECTS += iic.o embed_config.o
- endif
- ifeq ($(CONFIG_RPXCLASSIC),y)
- CFLAGS += -DCONFIG_RPXCLASSIC
- OBJECTS += iic.o embed_config.o pci.o qspan_pci.o
- endif
- ifeq ($(CONFIG_BSEIP),y)
- CFLAGS += -DCONFIG_BSEIP
- OBJECTS += iic.o embed_config.o
- endif
- ifeq ($(CONFIG_FADS),y)
- CFLAGS += -DCONFIG_FADS
- OBJECTS += embed_config.o
- endif
- all: zImage
- misc.o: misc.c
- $(CC) $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0 -DZIMAGE_OFFSET=0
- -DZIMAGE_SIZE=0 -c -o $@ $*.c
- zvmlinux.initrd: $(OBJECTS) $(LIBS) ../images/vmlinux.gz
- #
- # Recompile misc.o again with more 'correct' bogus offsets
- #
- $(CC) $(CFLAGS) -DINITRD_OFFSET=0x0008c8e3 -DINITRD_SIZE=0x0000111a
- -DZIMAGE_OFFSET=0x00018000 -DZIMAGE_SIZE=0x000748e2
- -c -o misc.o misc.c
- $(LD) $(ZLINKFLAGS) -o $@.tmp $(OBJECTS) $(LIBS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment
- --add-section=initrd=../images/ramdisk.image.gz
- --add-section=image=../images/vmlinux.gz
- $@.tmp $@
- $(CC) $(CFLAGS) -DINITRD_OFFSET=`sh $(OFFSET) $(OBJDUMP) $@ initrd`
- -DINITRD_SIZE=`sh $(SIZE) $(OBJDUMP) $@ initrd`
- -DZIMAGE_OFFSET=`sh $(OFFSET) $(OBJDUMP) $@ image`
- -DZIMAGE_SIZE=`sh $(SIZE) $(OBJDUMP) $@ image`
- -c -o misc.o misc.c
- $(LD) $(ZLINKFLAGS) -o $@.tmp $(OBJECTS) $(LIBS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment
- --add-section=initrd=../images/ramdisk.image.gz
- --add-section=image=../images/vmlinux.gz
- $@.tmp ../images/$@.embedded
- # Remove zvmlinux and zvmlinux.temp, we have ../images/zvmlinux.embedded
- rm -f $@.tmp $@
- zImage: zvmlinux
- ifeq ($(CONFIG_RPXCLASSIC),y)
- dd if=../images/zvmlinux.embedded of=../images/zImage.embedded bs=65536 skip=1
- else
- ln -sf ../images/zvmlinux.embedded ../images/zImage.embedded
- endif
- zImage.initrd: zvmlinux.initrd
- ifeq ($(CONFIG_RPXCLASSIC),y)
- dd if=../images/zvmlinux.initrd.embedded of=../images/zImage.initrd.embedded bs=65536 skip=1
- else
- ln -sf ../images/zvmlinux.initrd.embedded ../images/zImage.initrd.embedded
- endif
- zvmlinux: $(OBJECTS) $(LIBS) ../images/vmlinux.gz
- #
- # Recompile misc.o again with more 'correct' bogus offsets
- #
- $(CC) $(CFLAGS) -DINITRD_OFFSET=0 -DINITRD_SIZE=0
- -DZIMAGE_OFFSET=0x00018000 -DZIMAGE_SIZE=0x000748e2
- -c -o misc.o misc.c
- #
- # build the boot loader image and then compute the offset into it
- # for the kernel image
- #
- $(LD) $(ZLINKFLAGS) -o $@.tmp $(OBJECTS) $(LIBS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment
- --add-section=image=../images/vmlinux.gz
- $@.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=`sh $(OFFSET) $(OBJDUMP) $@ image`
- -DZIMAGE_SIZE=`sh $(SIZE) $(OBJDUMP) $@ image`
- -c -o misc.o misc.c
- $(LD) $(ZLINKFLAGS) -o $@.tmp $(OBJECTS) $(LIBS)
- $(OBJCOPY) $(OBJCOPY_ARGS) -R .comment
- --add-section=image=../images/vmlinux.gz
- $@.tmp ../images/$@.embedded
- # Remove zvmlinux and zvmlinux.temp, we have ../images/zvmlinux.embedded
- rm -f $@.tmp $@
- znetboot : zImage
- cp ../images/zImage.embedded $(TFTPIMAGE)
- znetboot.initrd : zImage.initrd
- cp ../images/zImage.initrd.embedded $(TFTPIMAGE)
- include $(TOPDIR)/Rules.make