Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 $(ADK_TOPDIR)/rules.mk
  4. include $(ADK_TOPDIR)/mk/kernel-build.mk
  5. include $(ADK_TOPDIR)/mk/image.mk
  6. KERNEL:=$(LINUX_DIR)/arch/x86/boot/bzImage
  7. QEMU_ARCH:=x86_64
  8. QEMU_ARGS:=-M pc -m 256
  9. ifeq ($(ADK_PACKAGE_GRUB_EFI_X86_64),y)
  10. QEMU_ARGS+=-L . -bios bios-x86_64.bin
  11. endif
  12. QEMU_ARGS+=${ADK_QEMU_ARGS}
  13. QEMU_ARGS+=-net user -net nic,model=e1000
  14. ifeq ($(ADK_TARGET_QEMU_WITH_AUDIO),y)
  15. QEMU_ARGS+=-device AC97
  16. endif
  17. ifeq ($(ADK_TARGET_QEMU_WITH_BOOTLOADER),y)
  18. ifeq ($(ADK_TARGET_QEMU_WITHOUT_GRAPHIC),y)
  19. CREATE:=./scripts/create.sh -g -t
  20. else
  21. CREATE:=./scripts/create.sh -g
  22. endif
  23. else
  24. CREATE:=./scripts/create.sh
  25. endif
  26. # target helper text
  27. ifeq ($(ADK_TARGET_FS),archive)
  28. targethelp:
  29. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  30. ifeq ($(ADK_TARGET_QEMU),y)
  31. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  32. @echo "Use following command to create a QEMU Image:"
  33. @echo "$(CREATE) qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  34. @echo "Start qemu with following options:"
  35. ifeq ($(ADK_TARGET_QEMU_WITH_BOOTLOADER),y)
  36. @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} qemu-${ADK_TARGET_CPU_ARCH}.img'
  37. else
  38. @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  39. endif
  40. endif
  41. endif
  42. ifeq ($(ADK_TARGET_FS),initramfs)
  43. targethelp:
  44. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  45. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  46. ifeq ($(ADK_TARGET_QEMU),y)
  47. @echo "Start qemu with following command line:"
  48. @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  49. endif
  50. endif
  51. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  52. targethelp:
  53. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  54. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  55. endif
  56. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  57. targethelp:
  58. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  59. ifeq ($(ADK_TARGET_QEMU),y)
  60. @echo "Start qemu with following command line:"
  61. @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  62. endif
  63. endif
  64. ifeq ($(ADK_TARGET_FS),nfsroot)
  65. targethelp:
  66. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  67. @echo 'The nfs root tarball is: ${FW_DIR}/${ROOTFSUSERTARBALL}'
  68. endif
  69. ifeq ($(ADK_TARGET_FS),usb)
  70. targethelp:
  71. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  72. @echo "To install everything to USB disk use:"
  73. @echo "sudo ./scripts/install.sh -g -t default /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  74. endif
  75. ifeq ($(ADK_TARGET_FS),iso)
  76. targethelp:
  77. @echo 'ISO image is at $<'
  78. endif
  79. ifeq ($(ADK_TARGET_FS),genimage)
  80. targethelp:
  81. @echo "The disk image is: $(FW_DIR)/disk.img"
  82. ifeq ($(ADK_TARGET_QEMU),y)
  83. @echo "Start qemu with following command line:"
  84. @echo 'qemu-system-${QEMU_ARCH} ${QEMU_ARGS} $(FW_DIR)/disk.img'
  85. else
  86. @echo "Use following command to install it on SD card:"
  87. @echo 'sudo dd if=$(FW_DIR)/disk.img of=/dev/sdX bs=2048k'
  88. endif
  89. endif
  90. # image creation and kernel install
  91. kernel-strip:
  92. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  93. kernel-install: kernel-strip
  94. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
  95. # filesystem specific targets
  96. ifeq ($(ADK_TARGET_FS),archive)
  97. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  98. endif
  99. ifeq ($(ADK_TARGET_FS),initramfs)
  100. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  101. endif
  102. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  103. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  104. endif
  105. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  106. imageinstall: createinitramfs targethelp
  107. endif
  108. ifeq (${ADK_TARGET_FS},iso)
  109. imageinstall: ${FW_DIR}/${ROOTFSISO} targethelp
  110. endif
  111. ifeq (${ADK_TARGET_FS},genimage)
  112. imageinstall: ${FW_DIR}/${GENIMAGE} targethelp
  113. endif
  114. ifeq ($(ADK_TARGET_FS),nfsroot)
  115. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  116. endif
  117. ifeq ($(ADK_TARGET_FS),usb)
  118. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  119. endif