Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Makefile for rescue code
  3. #
  4. target = $(target_rescue_dir)
  5. src = $(src_rescue_dir)
  6. CC = gcc-cris -mlinux $(LINUXINCLUDE)
  7. CFLAGS = -O2
  8. LD = gcc-cris -mlinux -nostdlib
  9. OBJCOPY = objcopy-cris
  10. OBJCOPYFLAGS = -O binary --remove-section=.bss
  11. all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
  12. $(target)/rescue.bin: $(target) $(target)/head.o
  13. $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
  14. $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
  15. # Place a copy in top-level build directory
  16. cp -p $(target)/rescue.bin $(objtree)
  17. $(target)/testrescue.bin: $(target) $(target)/testrescue.o
  18. $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
  19. # Pad it to 784 bytes
  20. dd if=/dev/zero of=tmp2423 bs=1 count=784
  21. cat tr.bin tmp2423 >testrescue_tmp.bin
  22. dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
  23. rm tr.bin tmp2423 testrescue_tmp.bin
  24. $(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
  25. $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
  26. # Pad it to 784 bytes, that's what the rescue loader expects
  27. dd if=/dev/zero of=tmp2423 bs=1 count=784
  28. cat ktr.bin tmp2423 >kimagerescue_tmp.bin
  29. dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
  30. rm ktr.bin tmp2423 kimagerescue_tmp.bin
  31. $(target):
  32. mkdir -p $(target)
  33. $(target)/head.o: $(src)/head.S
  34. $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
  35. $(target)/testrescue.o: $(src)/testrescue.S
  36. $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
  37. $(target)/kimagerescue.o: $(src)/kimagerescue.S
  38. $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
  39. clean:
  40. rm -f $(target)/*.o $(target)/*.bin
  41. fastdep:
  42. modules:
  43. modules-install: