Makefile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #
  2. # Copyright (C) 2012 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/image.mk
  9. TARGET_DTBS := rbt-832 dlan-usb-extender
  10. DTBS_DIR:=dts/
  11. LOADADDR:=0x00008000
  12. JFFS2_BLOCKSIZE = 128k
  13. UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
  14. define Image/Build/MkuImage
  15. mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
  16. -n 'ARM OpenWrt Linux-$(LINUX_VERSION)' -d $(1) $(2);
  17. endef
  18. define Image/Build/DTB
  19. cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1);
  20. cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
  21. $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
  22. cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
  23. endef
  24. define Image/Build/Profile/dLAN_USB_Extender
  25. dd if=$(KDIR)/uImage-dlan-usb-extender bs=64k conv=sync of=$(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
  26. cat $(KDIR)/root.$(1) >> $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
  27. cp $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin $(BIN_DIR)/
  28. endef
  29. define Image/BuildKernel
  30. $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
  31. endef
  32. define Image/Build/Initramfs
  33. $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
  34. endef
  35. define Image/Build/squashfs
  36. $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128
  37. endef
  38. define Image/Build
  39. $(call Image/Build/$(1))
  40. dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
  41. $(call Image/Build/Profile/$(PROFILE),$(1))
  42. ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
  43. $(call Image/Build/Initramfs)
  44. endif
  45. endef
  46. $(eval $(call BuildImage))