Makefile 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/mk/kernel.mk
  5. include $(TOPDIR)/mk/modules.mk
  6. include $(TOPDIR)/mk/kernel-build.mk
  7. include $(TOPDIR)/mk/image.mk
  8. KERNEL:=$(LINUX_DIR)/vmlinux
  9. OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
  10. $(TOOLS_BUILD_DIR):
  11. mkdir -p $(TOOLS_BUILD_DIR)
  12. tools-compile: $(TOOLS_BUILD_DIR)
  13. $(MAKE) -C ../tools/trx
  14. $(MAKE) -C ../tools/addpattern
  15. $(MAKE) -C ../tools/srec2bin
  16. $(MAKE) -C ../tools/squashfs prepare compile install
  17. ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_WRT54G),y)
  18. kernel-install: tools-compile
  19. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(LINUX_DIR)/vmlinux \
  20. $(LINUX_DIR)/vmlinuz
  21. @gzip -c9 $(LINUX_DIR)/vmlinuz > $(TARGET_KERNEL)
  22. endif
  23. ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_AG241),y)
  24. kernel-install: tools-compile
  25. ${TARGET_CROSS}objcopy -S -O srec $(KERNEL) \
  26. $(LINUX_DIR)/vmlinux.srec
  27. PATH='${TARGET_PATH}' srec2bin $(LINUX_DIR)/vmlinux.srec $(LINUX_DIR)/vmlinux.bin
  28. (dd if=/dev/zero bs=16 count=1; cat $(LINUX_DIR)/vmlinux.bin) > $(LINUX_DIR)/vmlinux.tmp
  29. PATH='${TARGET_PATH}' addpattern -p AG3B -b -r 2.0 -i $(LINUX_DIR)/vmlinux.tmp \
  30. -o $(TARGET_KERNEL) 2>/dev/null
  31. endif
  32. ifeq ($(ADK_TARGET_SYSTEM_MIKROTIK_RB532),y)
  33. kernel-install:
  34. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) \
  35. $(TARGET_DIR)/boot/kernel
  36. endif
  37. ifeq ($(ADK_TARGET_FS),cf)
  38. imageinstall: kernel-install $(BIN_DIR)/$(ROOTFSUSERTARBALL)
  39. @cp $(TARGET_DIR)/boot/kernel $(TARGET_KERNEL)
  40. @echo 'The kernel file is: ${TARGET_KERNEL}'
  41. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSUSERTARBALL)"
  42. @echo "Boot the board via network (tftp+nfsroot) and use adkinstall."
  43. @echo "If you just want to update, use adkupdate."
  44. endif
  45. ifeq ($(ADK_TARGET_FS),squashfs)
  46. imageinstall: kernel-install $(BIN_DIR)/$(ROOTFSSQUASHFS)
  47. @if [ $$(stat -f %z ${BUILD_DIR}/${ROOTFSSQUASHFS}) -gt 3801088 ];then \
  48. echo 'Image is too big!'; \
  49. else \
  50. ${CP} ${BUILD_DIR}/${ROOTFSSQUASHFS} ${BIN_DIR}/${ROOTFSSQUASHFS}; \
  51. echo The image file is $(ROOTFSSQUASHFS); \
  52. echo 'You can flash the image via tftp:'; \
  53. echo 'tftp 192.168.1.1'; \
  54. echo 'tftp> binary'; \
  55. echo "tftp> put $(ROOTFSSQUASHFS) upgrade_code.bin"; \
  56. fi
  57. endif
  58. ifeq ($(ADK_TARGET_FS),nfsroot)
  59. imageinstall: kernel-install $(BIN_DIR)/$(ROOTFSUSERTARBALL)
  60. @echo 'The kernel file is: ${TARGET_KERNEL}'
  61. @echo 'The nfs root tarball is: ${BIN_DIR}/${ROOTFSUSERTARBALL}'
  62. ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_AG241),y)
  63. @echo 'You can flash the kernel via tftp:'
  64. @echo 'tftp 192.168.1.1'
  65. @echo 'tftp> binary'
  66. @echo 'tftp> put ${TARGET_KERNEL} upgrade_code.bin'
  67. endif
  68. ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_WRT54G),y)
  69. @echo 'Type following on the CFE prompt to boot the kernel:'
  70. @echo 'CFE> boot -z -elf -tftp 192.168.1.254:${TARGET_KERNEL}'
  71. endif
  72. endif
  73. ifeq ($(ADK_TARGET_FS),archive)
  74. imageinstall: $(BIN_DIR)/$(ROOTFSTARBALL)
  75. @cp $(KERNEL) $(TARGET_KERNEL)
  76. @echo 'The kernel file is: ${TARGET_KERNEL}'
  77. @echo "The RootFS tarball is: $(BIN_DIR)/$(ROOTFSTARBALL)"
  78. @echo "Use following command to create a QEMU Image:"
  79. @echo "sudo ./scripts/create-image.sh -f $(ADK_TARGET_ROOTFS) qemu-${CPU_ARCH}.img $(BIN_DIR)/$(ROOTFSTARBALL)"
  80. @echo "Be sure to change permissions after image creation."
  81. @echo "Start qemu with following options:"
  82. @echo 'qemu-system-mipsel -nographic -M malta -kernel $(TARGET_KERNEL) -hda qemu-${CPU_ARCH}.img -append "root=/dev/hda1"'
  83. endif
  84. ifeq ($(ADK_TARGET_FS),initramfs)
  85. imageinstall: $(BIN_DIR)/$(INITRAMFS)
  86. @cp $(KERNEL) $(TARGET_KERNEL)
  87. @echo 'The kernel file is: ${TARGET_KERNEL}'
  88. @echo 'The initramfs image is: ${BIN_DIR}/${INITRAMFS}'
  89. @echo 'qemu-system-mipsel -nographic -M malta -kernel $(TARGET_KERNEL) -initrd ${BIN_DIR}/${INITRAMFS}'
  90. endif
  91. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  92. imageinstall: ${BUILD_DIR}/${INITRAMFS_PIGGYBACK} createinitramfs
  93. @cp $(KERNEL) $(TARGET_KERNEL)
  94. @echo 'The kernel+initramfs file is: ${TARGET_KERNEL}'
  95. @echo "Start qemu with following command line:"
  96. @echo 'qemu-system-mipsel -nographic -M malta -kernel $(TARGET_KERNEL)'
  97. endif
  98. ifeq ($(ADK_TARGET_FS),yaffs)
  99. imageinstall: kernel-install $(BIN_DIR)/$(ROOTFSTARBALL)
  100. @echo "The RootFS tarball is:"
  101. @echo "$(BIN_DIR)/$(ROOTFSTARBALL)"
  102. @echo "Boot the board via network (tftp/nfsroot) and use adkinstall."
  103. @echo "If you just want to update, use adkupdate."
  104. endif