| 1 | # |
| 2 | # Copyright (C) 2006-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 | |
| 10 | LOADER_MAKE := $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR) |
| 11 | JFFS2BLOCK := $(KDIR)/jffs2.block |
| 12 | JFFS2MARK := $(KDIR)/jffs2.mark |
| 13 | |
| 14 | define imgname |
| 15 | $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(1)) |
| 16 | endef |
| 17 | |
| 18 | define Build/Clean |
| 19 | $(LOADER_MAKE) clean |
| 20 | endef |
| 21 | |
| 22 | define Image/Prepare |
| 23 | cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma |
| 24 | rm -f $(JFFS2BLOCK) |
| 25 | touch $(JFFS2BLOCK) |
| 26 | $(call prepare_generic_squashfs,$(JFFS2BLOCK)) |
| 27 | rm -f $(JFFS2MARK) |
| 28 | touch $(JFFS2MARK) |
| 29 | $(call add_jffs2_mark,$(JFFS2MARK)) |
| 30 | endef |
| 31 | |
| 32 | define Image/Build/Loader |
| 33 | $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \ |
| 34 | LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ |
| 35 | CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ |
| 36 | compile loader.$(2) |
| 37 | endef |
| 38 | |
| 39 | define Image/Build/LZMAKernel |
| 40 | $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \ |
| 41 | LOADER=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-ramfs.$(2) \ |
| 42 | LOADER_DATA=$(KDIR)/vmlinux.lzma \ |
| 43 | LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \ |
| 44 | CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \ |
| 45 | compile loader.$(2) |
| 46 | endef |
| 47 | |
| 48 | define Image/Build/LZMAKernel/Generic |
| 49 | $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0) |
| 50 | endef |
| 51 | |
| 52 | define Image/Build/LZMAKernel/Admboot |
| 53 | $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0x6D8,y,$(1)) |
| 54 | endef |
| 55 | |
| 56 | define Image/Build/LZMAKernel/Cellvision |
| 57 | $(call Image/Build/LZMAKernel,$(1),$(3),0x80500000,0x6D8,y,$(2)) |
| 58 | endef |
| 59 | |
| 60 | define Image/Build/LZMAKernel/KArgs |
| 61 | $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1)) |
| 62 | endef |
| 63 | |
| 64 | define trxalign/jffs2-128k |
| 65 | -a 0x20000 -f $(KDIR)/root.jffs2-128k |
| 66 | endef |
| 67 | |
| 68 | define trxalign/jffs2-64k |
| 69 | -a 0x10000 -f $(KDIR)/root.jffs2-64k |
| 70 | endef |
| 71 | |
| 72 | define trxalign/squashfs |
| 73 | -a 1024 -f $(KDIR)/root.squashfs -a 0x10000 -A $(JFFS2BLOCK) |
| 74 | endef |
| 75 | |
| 76 | define Image/Build/TRX |
| 77 | $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \ |
| 78 | $(call trxalign/$(2)) |
| 79 | endef |
| 80 | |
| 81 | define Image/Build/TRXNoloader |
| 82 | $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \ |
| 83 | $(call trxalign/$(2)) |
| 84 | endef |
| 85 | |
| 86 | include $(SUBTARGET).mk |
| 87 | |
| 88 | define Image/Build |
| 89 | $(call Image/Build/Profile/$(PROFILE),$(1)) |
| 90 | endef |
| 91 | |
| 92 | define Image/Build/Initramfs |
| 93 | $(call Image/Build/Profile/$(PROFILE),Initramfs) |
| 94 | endef |
| 95 | |
| 96 | $(eval $(call BuildImage)) |
| 97 | |