Makefile 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. JFFS2_BLOCKSIZE = 128k
  8. include $(TOPDIR)/rules.mk
  9. include $(INCLUDE_DIR)/image.mk
  10. TARGET_DTBS := rbt-832 dlan-usb-extender
  11. DTBS_DIR:=dts/
  12. LOADADDR:=0x00008000
  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))