Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #
  2. # Copyright (C) 2009-2010 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. DEVICE_VARS += KERNEL_PREFIX FILESYSTEMS
  10. define Device/Default
  11. PROFILES = Default $$(DEVICE_NAME)
  12. KERNEL_NAME := vmlinux.elf
  13. KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf
  14. KERNEL := kernel-bin | strip-kernel | patch-cmdline
  15. IMAGES := sysupgrade.tar
  16. FILESYSTEMS := squashfs
  17. IMAGE/sysupgrade.tar := tar-file $$$$(FILESYSTEMS)
  18. endef
  19. define Build/tar-file
  20. mkdir -p $(KDIR)/sysupgrade-$(DEVICE_NAME)/
  21. echo "BOARD=$(BOARD)" > $(KDIR)/sysupgrade-$(DEVICE_NAME)/CONTROL
  22. $(CP) $(KDIR)/$(KERNEL_IMAGE) $(KDIR)/sysupgrade-$(DEVICE_NAME)/kernel
  23. $(CP) $(KDIR)/root.$(1) $(KDIR)/sysupgrade-$(DEVICE_NAME)/root
  24. (cd $(KDIR); $(TAR) cvf \
  25. $@ sysupgrade-$(DEVICE_NAME))
  26. endef
  27. define Build/strip-kernel
  28. # Workaround pre-SDK-1.9.0 u-boot versions not handling the .notes section
  29. $(TARGET_CROSS)strip -R .notes $@ -o $@.stripped && mv $@.stripped $@
  30. endef
  31. define Device/generic
  32. FILESYSTEMS := ext4
  33. DEVICE_TITLE := Generic
  34. endef
  35. TARGET_DEVICES += generic
  36. ER_CMDLINE:=-mtdparts=phys_mapped_flash:640k(boot0)ro,640k(boot1)ro,64k(eeprom)ro block2mtd.block2mtd=/dev/mmcblk0p2,65536,rootfs,5 root=/dev/mtdblock3 rootfstype=squashfs rootwait
  37. define Device/er
  38. CMDLINE := $(ER_CMDLINE)
  39. DEVICE_TITLE := Ubiquiti EdgeRouter
  40. endef
  41. TARGET_DEVICES += er
  42. ERLITE_CMDLINE:=-mtdparts=phys_mapped_flash:512k(boot0),512k(boot1),64k@1024k(eeprom) block2mtd.block2mtd=/dev/sda2,65536,rootfs,5 root=/dev/mtdblock3 rootfstype=squashfs rootwait
  43. define Device/erlite
  44. CMDLINE := $(ERLITE_CMDLINE)
  45. DEVICE_TITLE := Ubiquiti EdgeRouter Lite
  46. endef
  47. TARGET_DEVICES += erlite
  48. $(eval $(call BuildImage))