linux-old/arch/ppc64/boot/Makefile
<<
>>
Prefs
   1# Makefile for making ELF bootable images for booting on CHRP
   2# using Open Firmware.
   3#
   4# Geert Uytterhoeven    September 1997
   5#
   6# Based on coffboot by Paul Mackerras
   7# Simplified for ppc64 by Todd Inglett
   8#
   9# NOTE: this code is built for 32 bit in ELF32 format even though
  10#       it packages a 64 bit kernel.  We do this to simplify the
  11#       bootloader and increase compatibility with OpenFirmware.
  12#
  13#       To this end we need to define BOOTCC, etc, as the tools
  14#       needed to build the 32 bit image.  These are normally HOSTCC,
  15#       but may be a third compiler if, for example, you are cross
  16#       compiling from an intel box.  Once the 64bit ppc gcc is
  17#       stable it will probably simply be a compiler switch to
  18#       compile for 32bit mode.
  19#       To make it easier to setup a cross compiler,
  20#       CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
  21#       in the toplevel makefile.
  22
  23CROSS32_COMPILE =
  24#CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux-
  25
  26BOOTCC = $(CROSS32_COMPILE)gcc
  27BOOTCFLAGS = $(HOSTCFLAGS) -fno-builtin -I$(HPATH)
  28BOOTLD = $(CROSS32_COMPILE)ld
  29BOOTAS = $(CROSS32_COMPILE)as
  30BOOTAFLAGS = -D__ASSEMBLY__ $(HOSTCFLAGS) -I$(HPATH)
  31
  32OBJCOPYFLAGS = contents,alloc,load,readonly,data
  33
  34LDVARS= \
  35        --defsym _vmlinux_memsize=0x`$(CROSS_COMPILE)nm -n $(TOPDIR)/vmlinux | sed '$$s/^........\([^ ]*\).*/\1/p;d'` \
  36        --defsym _vmlinux_filesize=0x`ls -l $(TOPDIR)/vmlinux | awk '{ printf "%x\n", $$5 }'`
  37
  38.c.o:
  39        $(BOOTCC) $(BOOTCFLAGS) -c -o $*.o $<
  40.S.o:
  41        $(BOOTCC) $(BOOTAFLAGS) -traditional -c -o $*.o $<
  42
  43CFLAGS  = $(CPPFLAGS) -O -fno-builtin -DSTDC_HEADERS
  44LD_ARGS = -Ttext 0x00400000 -e _start
  45
  46OBJS = crt0.o string.o prom.o zImage.o zlib.o
  47LIBS =
  48
  49ifeq ($(CONFIG_SMP),y)
  50TFTPIMAGE=/tftpboot/zImage.chrp.smp
  51else
  52TFTPIMAGE=/tftpboot/zImage.chrp
  53endif
  54
  55
  56ifeq ($(CONFIG_PPC_ISERIES),y)
  57all:    vmlinux.sm
  58else
  59all:    zImage
  60endif
  61
  62
  63znetboot: zImage
  64        cp zImage $(TFTPIMAGE)
  65
  66
  67ifeq ($(CONFIG_PPC_ISERIES),y)
  68
  69addSystemMap: addSystemMap.c
  70        $(HOSTCC) $(HOSTCFLAGS) -o addSystemMap addSystemMap.c
  71
  72vmlinux.sm: $(TOPDIR)/vmlinux addSystemMap
  73        ./addSystemMap $(TOPDIR)/System.map $(TOPDIR)/vmlinux vmlinux.sm
  74
  75
  76addRamDisk: addRamDisk.c
  77        $(HOSTCC) $(HOSTCFLAGS) -o addRamDisk addRamDisk.c
  78
  79vmlinux.initrd: $(TOPDIR)/vmlinux addRamDisk ramdisk.image.gz $(TOPDIR)/System.map
  80        ./addRamDisk ramdisk.image.gz $(TOPDIR)/System.map $(TOPDIR)/vmlinux vmlinux.initrd
  81
  82vmlinux.sminitrd: vmlinux.sm addRamDisk ramdisk.image.gz $(TOPDIR)/System.map
  83        ./addRamDisk ramdisk.image.gz $(TOPDIR)/System.map vmlinux.sm vmlinux.sminitrd
  84
  85endif
  86
  87
  88znetboot.initrd: zImage.initrd
  89        cp zImage.initrd $(TFTPIMAGE)
  90
  91addnote: addnote.c
  92        $(HOSTCC) $(HOSTCFLAGS) -o addnote addnote.c
  93
  94
  95zImage.o: $(TOPDIR)/vmlinux
  96
  97uts_string: uts_string.txt
  98        $(OBJCOPY) zImage.o \
  99                --add-section=.kernel:$@=$@.txt \
 100                --set-section-flags=.kernel:$@=$(OBJCOPYFLAGS)
 101
 102vmlinux .config System.map: % : $(TOPDIR)/% zImage.o
 103        gzip -cvf9 $(TOPDIR)/$@ > kernel-$@.gz
 104        $(OBJCOPY) zImage.o \
 105                --add-section=.kernel:$@=kernel-$@.gz \
 106                --set-section-flags=.kernel:$@=$(OBJCOPYFLAGS)
 107
 108initrd: ramdisk.image.gz
 109        $(OBJCOPY) zImage.o \
 110                --add-section=.kernel:$@=ramdisk.image.gz \
 111                --set-section-flags=.kernel:$@=$(OBJCOPYFLAGS)
 112
 113uts_string.txt: $(TOPDIR)/vmlinux
 114        strings $(TOPDIR)/vmlinux | \
 115        grep -E 'Linux version .* .gcc version' > $@
 116
 117zImage: $(OBJS) addnote uts_string vmlinux .config System.map
 118        $(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) $(LIBS) \
 119        $(LDVARS)
 120        ./addnote $@
 121
 122zImage.initrd: $(OBJS) addnote uts_string vmlinux .config System.map initrd
 123        $(BOOTLD) $(LD_ARGS) -T zImage.lds -o $@ $(OBJS) $(LIBS) \
 124        $(LDVARS)
 125        ./addnote $@
 126
 127clean:
 128        rm -f add{note,RamDisk,SystemMap} $(OBJS) initrd.o \
 129                vmlinux.{sm,initrd} zImage{,.initrd} uts_string.txt \
 130                kernel-{vmlinux,.config,System.map}.gz
 131
 132fastdep:
 133        $(TOPDIR)/scripts/mkdep *.[Sch] > .depend
 134
 135dep:
 136        $(CPP) $(CPPFLAGS) -M *.S *.c > .depend
 137
 138
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.