Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. ifeq ($(ADK_TARGET_KERNEL_ZIMAGE),y)
  9. KERNEL:=$(LINUX_DIR)/arch/arm/boot/zImage
  10. else
  11. KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
  12. endif
  13. LOADADDR:=0x20008000
  14. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
  15. MACH:=spitz
  16. endif
  17. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB),y)
  18. MACH:=versatilepb
  19. NET:=-net user -net nic,model=smc91c111
  20. endif
  21. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
  22. MACH:=vexpress-a9
  23. NET:=-cpu cortex-a9 -net user -net nic,model=lan9118
  24. endif
  25. kernel-install:
  26. gzip -9 < $(LINUX_DIR)/arch/arm/boot/Image > ${BUILD_DIR}/Image.gz
  27. PATH='${TARGET_PATH}' mkimage -A arm -O linux -T kernel -C gzip \
  28. -a ${LOADADDR} -e ${LOADADDR} -d ${BUILD_DIR}/Image.gz \
  29. -n foxg20 $(KERNEL) $(MAKE_TRACE)
  30. ifeq ($(ADK_TARGET_FS),nfsroot)
  31. imageinstall: kernel-install ${FW_DIR}/${ROOTFSUSERTARBALL}
  32. @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  33. @echo 'Type dhcp via u-boot prompt to load kernel'
  34. @echo 'After that type bootm to load the kernel'
  35. endif
  36. ifeq ($(ADK_TARGET_FS),mmc)
  37. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSTARBALL)
  38. @echo "The RootFS tarball is:"
  39. @echo "$(FW_DIR)/$(ROOTFSTARBALL)"
  40. @echo 'Before booting from MicroSD card you need to set following u-boot environment variable:'
  41. @echo "setenv bootcmd 'mmc init; sleep 1; fatload mmc 0 0x22000000 kernel; bootm 0x22000000'"
  42. @echo "saveenv"
  43. @echo
  44. @echo "Boot the board via network and use adkinstall."
  45. @echo "If you just want to update, use adkupdate."
  46. endif
  47. ifeq ($(ADK_TARGET_FS),archive)
  48. ifeq ($(ADK_TARGET_SYSTEM_ACMESYSTEMS_FOXG20),y)
  49. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSTARBALL)
  50. else
  51. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL)
  52. endif
  53. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  54. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  55. @echo "Use following command to install it on SD card:"
  56. @echo "sudo ./scripts/install-rpi.sh /dev/sdb $(FW_DIR)/$(ROOTFSTARBALL)"
  57. endif
  58. ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM)$(ADK_TARGET_SYSTEM_QEMU_ARMHF),y)
  59. @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  60. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  61. @echo "Use following command to create a QEMU Image:"
  62. @echo "./scripts/create.sh +g qemu-${CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  63. @echo "Start qemu with following options:"
  64. @echo 'qemu-system-arm -M $(MACH) -nographic $(NET) -kernel $(FW_DIR)/$(TARGET_KERNEL) -hda qemu-${CPU_ARCH}.img'
  65. endif
  66. endif
  67. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  68. imageinstall: $(FW_DIR)/$(ROOTFSUSERTARBALL)
  69. @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  70. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  71. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  72. endif
  73. ifeq ($(ADK_TARGET_FS),initramfs)
  74. imageinstall: $(FW_DIR)/$(INITRAMFS)
  75. @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  76. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  77. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  78. ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM)$(ADK_TARGET_SYSTEM_QEMU_ARMHF),y)
  79. ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
  80. @echo 'qemu-system-arm -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -drive file=qemu-${CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user'
  81. else
  82. @echo "Start qemu with following command line:"
  83. @echo 'qemu-system-arm -M $(MACH) -nographic $(NET) -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  84. endif
  85. endif
  86. endif
  87. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  88. imageinstall: createinitramfs
  89. @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  90. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  91. ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM)$(ADK_TARGET_SYSTEM_QEMU_ARMHF),y)
  92. @echo "Start qemu with following command line:"
  93. @echo 'qemu-system-arm -M $(MACH) -nographic $(NET) -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  94. endif
  95. endif