Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #
  2. # Copyright (C) 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. VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
  10. UIMAGE:=$(IMG_PREFIX)-uImage
  11. define kernel_entry
  12. -a 0x80002000 -e 0x80002000
  13. endef
  14. define CompressGzip
  15. gzip -9n -c $(1) > $(2)
  16. endef
  17. define MkImage
  18. mkimage -A mips -O linux -T kernel $(call kernel_entry) -C $(1) $(2) \
  19. -n "ADM8668 Linux Kernel(2.4.31)" \
  20. -d $(3) $(4)
  21. endef
  22. define Build/Clean
  23. $(MAKE) -C lzma-loader clean
  24. endef
  25. define Image/Prepare
  26. cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
  27. $(MAKE) -C lzma-loader \
  28. KDIR="$(KDIR)" \
  29. clean compile
  30. rm -f $(KDIR)/fs_mark
  31. touch $(KDIR)/fs_mark
  32. $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
  33. endef
  34. define Image/Build
  35. ./my-mkimage $(KDIR)/loader.bin $(KDIR)/root.squashfs \
  36. $(KDIR)/fs_mark $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
  37. endef
  38. define Image/BuildKernel
  39. cp $(KDIR)/vmlinux.elf $(VMLINUX).elf
  40. cp $(KDIR)/vmlinux $(VMLINUX).bin
  41. $(call CompressGzip,$(KDIR)/vmlinux,$(KDIR)/vmlinux.bin.gz)
  42. $(call MkImage,gzip,,$(KDIR)/vmlinux.bin.gz,$(BIN_DIR)/$(UIMAGE)-gzip.bin)
  43. ifeq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
  44. cp $(KDIR)/vmlinux-initramfs.elf $(VMLINUX)-initramfs.elf
  45. cp $(KDIR)/vmlinux $(VMLINUX)-initramfs.bin
  46. $(call CompressGzip,$(KDIR)/vmlinux-initramfs,$(KDIR)/vmlinux-initramfs.bin.gz)
  47. $(call MkImage,gzip,,$(KDIR)/vmlinux-initramfs.bin.gz,$(BIN_DIR)/$(UIMAGE)-initramfs-gzip.bin)
  48. endif
  49. endef
  50. $(eval $(call BuildImage))