Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #
  2. # Copyright (C) 2008 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. IMGNAME:=$(BIN_DIR)/openwrt-$(BOARD)
  10. define imgname
  11. $(IMGNAME)-$(2)-$(patsubst jffs2-%,jffs2,$(1))
  12. endef
  13. VMLINUX:=$(IMGNAME)-vmlinux
  14. UIMAGE:=$(IMGNAME)-uImage
  15. ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
  16. VMLINUX:=$(IMGNAME)-vmlinux-initramfs
  17. UIMAGE:=$(IMGNAME)-uImage-initramfs
  18. endif
  19. ifeq ($(CONFIG_RALINK_RT305X),y)
  20. define kernel_entry
  21. -a 0x80000000 -e 0x80000000
  22. endef
  23. else
  24. define kernel_entry
  25. -a 0x88000000 -e 0x88000000
  26. endef
  27. endif
  28. define Image/BuildKernel
  29. cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
  30. cp $(KDIR)/vmlinux $(VMLINUX).bin
  31. $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux -lc1 -lp2 -pb2 $(KDIR)/vmlinux.lzma
  32. mkimage -A mips -O linux -T kernel -C lzma $(call kernel_entry) \
  33. -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \
  34. -d $(KDIR)/vmlinux.lzma $(KDIR)/uImage.lzma
  35. cp $(KDIR)/uImage.lzma $(UIMAGE).bin
  36. endef
  37. define Image/Build/squashfs
  38. $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
  39. endef
  40. define Image/Build
  41. $(call Image/Build/$(1))
  42. ( \
  43. dd if=$(KDIR)/uImage.lzma bs=1024k conv=sync; \
  44. dd if=$(KDIR)/root.$(1) bs=65536 conv=sync; \
  45. ) > $(BIN_DIR)/openwrt-$(BOARD)-$(1).img
  46. endef
  47. $(eval $(call BuildImage))