Makefile.svn-base 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #
  2. # Makefile for Broadcom BCM947XX boards
  3. #
  4. # Copyright 2001-2003, Broadcom Corporation
  5. # All Rights Reserved.
  6. #
  7. # THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
  8. # KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
  9. # SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
  10. # FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
  11. #
  12. # Copyright 2004 Manuel Novoa III <mjn3@codepoet.org>
  13. # Modified to support bzip'd kernels.
  14. # Of course, it would be better to integrate bunzip capability into CFE.
  15. #
  16. # Copyright 2005 Oleg I. Vdovikin <oleg@cs.msu.su>
  17. # Cleaned up, modified for lzma support, removed from kernel
  18. #
  19. TEXT_START := 0x80001000
  20. BZ_TEXT_START := 0x80400000
  21. OBJCOPY := $(CROSS_COMPILE)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S
  22. CFLAGS = -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
  23. -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
  24. -ffunction-sections -pipe -mlong-calls -fno-common \
  25. -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap
  26. CFLAGS += -DLOADADDR=$(TEXT_START) -D_LZMA_IN_CB
  27. ASFLAGS = $(CFLAGS) -D__ASSEMBLY__ -DBZ_TEXT_START=$(BZ_TEXT_START)
  28. SEDFLAGS := s/BZ_TEXT_START/$(BZ_TEXT_START)/;s/TEXT_START/$(TEXT_START)/
  29. OBJECTS := head.o data.o
  30. all: loader.gz loader.elf
  31. # Don't build dependencies, this may die if $(CC) isn't gcc
  32. dep:
  33. install:
  34. loader.gz: loader
  35. gzip -nc9 $< > $@
  36. loader.elf: loader.o
  37. cp $< $@
  38. loader: loader.o
  39. $(OBJCOPY) $< $@
  40. loader.o: loader.lds $(OBJECTS)
  41. $(LD) -static --gc-sections -no-warn-mismatch -T loader.lds -o $@ $(OBJECTS)
  42. loader.lds: loader.lds.in Makefile
  43. @sed "$(SEDFLAGS)" < $< > $@
  44. data.o: data.lds decompress.image
  45. $(LD) -no-warn-mismatch -T data.lds -r -o $@ -b binary decompress.image -b elf32-tradlittlemips
  46. data.lds:
  47. @echo "SECTIONS { .data : { code_start = .; *(.data) code_stop = .; }}" > $@
  48. decompress.image: decompress
  49. $(OBJCOPY) $< $@
  50. decompress: decompress.lds decompress.o LzmaDecode.o
  51. $(LD) -static --gc-sections -no-warn-mismatch -T decompress.lds -o $@ decompress.o LzmaDecode.o
  52. decompress.lds: decompress.lds.in Makefile
  53. @sed "$(SEDFLAGS)" < $< > $@
  54. mrproper: clean
  55. clean:
  56. rm -f loader.gz loader decompress *.lds *.o *.image