| 1 | # |
| 2 | # Copyright (C) 2010-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 | |
| 8 | # boards missing since devicetree update |
| 9 | #EASY50712 ARV3527P GIGASX76X ARV4519PW BTHOMEHUBV2B BTHOMEHUBV2BOPENRG |
| 10 | #WBMR P2601HNFX H201L |
| 11 | |
| 12 | include $(TOPDIR)/rules.mk |
| 13 | include $(INCLUDE_DIR)/image.mk |
| 14 | |
| 15 | JFFS2_BLOCKSIZE = 64k 128k 256k |
| 16 | |
| 17 | define CompressLzma |
| 18 | $(STAGING_DIR_HOST)/bin/lzma e $(1) $(2) |
| 19 | endef |
| 20 | |
| 21 | define PatchKernelLzma |
| 22 | cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1) |
| 23 | $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(1).dtb ./$(1).dts |
| 24 | $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1) $(KDIR)/$(1).dtb |
| 25 | $(call CompressLzma,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).lzma) |
| 26 | endef |
| 27 | |
| 28 | define MkBrnImage |
| 29 | mkbrncmdline -i $(KDIR)/vmlinux-$(4) -o $(KDIR)/vmlinux-$(4)-brn BRN-BOOT $(6) |
| 30 | $(call CompressLzma,$(KDIR)/vmlinux-$(4)-brn,$(KDIR)/vmlinux-$(4)-brn.lzma) |
| 31 | mkbrnimg -s $(1) -m $(2) -o $(3) $(KDIR)/vmlinux-$(4)-brn.lzma $(KDIR)/root.$(5) |
| 32 | endef |
| 33 | |
| 34 | define MkImageLzma |
| 35 | mkimage -A mips -O linux -T kernel -a 0x80002000 -C lzma \ |
| 36 | -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ |
| 37 | -d $(KDIR)/vmlinux-$(1).lzma $(KDIR)/uImage-$(1) |
| 38 | endef |
| 39 | |
| 40 | define MkImageEVA |
| 41 | lzma2eva 0x80002000 0x80002000 $(KDIR)/vmlinux-$(1).lzma $(KDIR)/$(1).eva.prealign |
| 42 | dd if=$(KDIR)/$(1).eva.prealign of=$(KDIR)/$(1).eva bs=64k conv=sync |
| 43 | cat ./eva.dummy.squashfs >> $(KDIR)/$(1).eva |
| 44 | endef |
| 45 | |
| 46 | define CompressGzip |
| 47 | gzip -c $(1) > $(2) |
| 48 | endef |
| 49 | |
| 50 | define PatchKernelGzip |
| 51 | cp $(KDIR)/vmlinux $(KDIR)/vmlinux-$(1) |
| 52 | $(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR)/vmlinux-$(1) '$(strip $(2))' |
| 53 | $(call CompressGzip,$(KDIR)/vmlinux-$(1),$(KDIR)/vmlinux-$(1).gzip) |
| 54 | endef |
| 55 | |
| 56 | define MkImageGzip |
| 57 | mkimage -A mips -O linux -T kernel -a 0x80002000 -C gzip \ |
| 58 | -e 0x80002000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' \ |
| 59 | -d $(KDIR)/vmlinux-$(1).gzip $(KDIR)/uImage-$(1) |
| 60 | endef |
| 61 | |
| 62 | define Image/Build/squashfs |
| 63 | cat $(KDIR)/uImage-$(2) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image |
| 64 | $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image) |
| 65 | $(if $(3),$(call MkBrnImage,$(3),$(4),$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(3)-brnImage,$(2),$(1),$(5))) |
| 66 | endef |
| 67 | |
| 68 | define Image/BuildEVA/squashfs |
| 69 | cat $(KDIR)/$(2).eva $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva |
| 70 | $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image.eva) |
| 71 | endef |
| 72 | |
| 73 | define Image/Build/jffs2-64k |
| 74 | dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=64k conv=sync |
| 75 | cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image |
| 76 | endef |
| 77 | |
| 78 | define Image/Build/jffs2-128k |
| 79 | dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=128k conv=sync |
| 80 | cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image |
| 81 | endef |
| 82 | |
| 83 | define Image/Build/jffs2-256k |
| 84 | dd if=$(KDIR)/uImage-$(2) of=$(KDIR)/uImage-$(2)-$(1) bs=256k conv=sync |
| 85 | cat $(KDIR)/uImage-$(2)-$(1) $(KDIR)/root.$(1) > $(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1).image |
| 86 | endef |
| 87 | |
| 88 | define Image/BuildKernel/Template |
| 89 | $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),)) |
| 90 | $(call MkImageLzma,$(1)) |
| 91 | $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage |
| 92 | endef |
| 93 | |
| 94 | define Image/BuildKernelEVA/Template |
| 95 | $(call PatchKernelLzma,$(1),$(if $(2),$(2) machtype=$(1),)) |
| 96 | $(call MkImageEVA,$(1)) |
| 97 | $(CP) $(KDIR)/$(1).eva $(BIN_DIR)/$(IMG_PREFIX)-$(1).eva |
| 98 | endef |
| 99 | |
| 100 | define Image/BuildKernelGzip/Template |
| 101 | $(call PatchKernelGzip,$(1),$(if $(2),$(2) machtype=$(1),)) |
| 102 | $(call MkImageGzip,$(1)) |
| 103 | $(CP) $(KDIR)/uImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-uImage |
| 104 | endef |
| 105 | |
| 106 | |
| 107 | ifeq ($(CONFIG_TARGET_lantiq_falcon),y) |
| 108 | |
| 109 | Image/BuildKernel/Profile/EASY98000NOR=$(call Image/BuildKernel/Template,EASY98000NOR) |
| 110 | Image/Build/Profile/EASY98000NOR=$(call Image/Build/$(1),$(1),EASY98000NOR) |
| 111 | |
| 112 | Image/BuildKernel/Profile/EASY98000SFLASH=$(call Image/BuildKernel/Template,EASY98000SFLASH) |
| 113 | Image/Build/Profile/EASY98000SFLASH=$(call Image/Build/$(1),$(1),EASY98000SFLASH) |
| 114 | |
| 115 | endif |
| 116 | |
| 117 | |
| 118 | |
| 119 | ifeq ($(CONFIG_TARGET_lantiq_ase),y) |
| 120 | |
| 121 | Image/BuildKernel/Profile/DGN1000B=$(call Image/BuildKernel/Template,DGN1000B) |
| 122 | Image/Build/Profile/DGN1000B=$(call Image/Build/$(1),$(1),DGN1000B) |
| 123 | |
| 124 | endif |
| 125 | |
| 126 | |
| 127 | |
| 128 | ifeq ($(CONFIG_TARGET_lantiq_xway),y) |
| 129 | |
| 130 | # Danube |
| 131 | Image/BuildKernel/Profile/EASY50712=$(call Image/BuildKernel/Template,EASY50712) |
| 132 | Image/Build/Profile/EASY50712=$(call Image/Build/$(1),$(1),EASY50712) |
| 133 | |
| 134 | Image/BuildKernel/Profile/ARV4510PW=$(call Image/BuildKernel/Template,ARV4510PW) |
| 135 | Image/Build/Profile/ARV4510PW=$(call Image/Build/$(1),$(1),ARV4510PW) |
| 136 | |
| 137 | Image/BuildKernel/Profile/ARV4525PW=$(call Image/BuildKernel/Template,ARV4525PW) |
| 138 | Image/Build/Profile/ARV4525PW=$(call Image/Build/$(1),$(1),ARV4525PW) |
| 139 | |
| 140 | Image/BuildKernel/Profile/ARV7525PW=$(call Image/BuildKernel/Template,ARV7525PW) |
| 141 | Image/Build/Profile/ARV7525PW=$(call Image/Build/$(1),$(1),ARV7525PW) |
| 142 | |
| 143 | Image/BuildKernel/Profile/ARV4518PW=$(call Image/BuildKernel/Template,ARV4518PW) |
| 144 | Image/Build/Profile/ARV4518PW=$(call Image/Build/$(1),$(1),ARV4518PW) |
| 145 | |
| 146 | Image/BuildKernel/Profile/ARV4520PW=$(call Image/BuildKernel/Template,ARV4520PW) |
| 147 | Image/Build/Profile/ARV4520PW=$(call Image/Build/$(1),$(1),ARV4520PW) |
| 148 | |
| 149 | Image/BuildKernel/Profile/ARV452CQW=$(call Image/BuildKernel/Template,ARV452CQW) |
| 150 | Image/Build/Profile/ARV452CQW=$(call Image/Build/$(1),$(1),ARV452CQW) |
| 151 | |
| 152 | Image/BuildKernel/Profile/ARV7518PW=$(call Image/BuildKernel/Template,ARV7518PW) |
| 153 | Image/Build/Profile/ARV7518PW=$(call Image/Build/$(1),$(1),ARV7518PW) |
| 154 | |
| 155 | Image/BuildKernel/Profile/ARV752DPW=$(call Image/BuildKernel/Template,ARV752DPW) |
| 156 | Image/Build/Profile/ARV752DPW=$(call Image/Build/$(1),$(1),ARV752DPW) |
| 157 | |
| 158 | Image/BuildKernel/Profile/ARV752DPW22=$(call Image/BuildKernel/Template,ARV752DPW22) |
| 159 | Image/Build/Profile/ARV752DPW22=$(call Image/Build/$(1),$(1),ARV752DPW22) |
| 160 | |
| 161 | |
| 162 | # AR9 |
| 163 | Image/BuildKernel/Profile/DGN3500=$(call Image/BuildKernel/Template,DGN3500) |
| 164 | Image/Build/Profile/DGN3500=$(call Image/Build/$(1),$(1),DGN3500) |
| 165 | |
| 166 | Image/BuildKernel/Profile/DGN3500B=$(call Image/BuildKernel/Template,DGN3500) |
| 167 | Image/Build/Profile/DGN3500B=$(call Image/Build/$(1),$(1),DGN3500) |
| 168 | |
| 169 | Image/BuildKernel/Profile/WBMRA=$(call Image/BuildKernel/Template,WBMR) |
| 170 | Image/Build/Profile/WBMRA=$(call Image/Build/$(1),$(1),WBMR) |
| 171 | |
| 172 | Image/BuildKernel/Profile/WBMRB=$(call Image/BuildKernel/Template,WBMR) |
| 173 | Image/Build/Profile/WBMRB=$(call Image/Build/$(1),$(1),WBMR) |
| 174 | |
| 175 | Image/BuildKernel/Profile/FRITZ7320=$(call Image/BuildKernelEVA/Template,FRITZ7320) |
| 176 | Image/Build/Profile/FRITZ7320=$(call Image/BuildEVA/$(1),$(1),FRITZ7320) |
| 177 | |
| 178 | |
| 179 | # VR9 |
| 180 | Image/BuildKernel/Profile/EASY80920NAND=$(call Image/BuildKernel/Template,EASY80920NAND) |
| 181 | Image/Build/Profile/EASY80920NAND=$(call Image/Build/$(1),$(1),EASY80920NAND) |
| 182 | |
| 183 | Image/BuildKernel/Profile/EASY80920NOR=$(call Image/BuildKernel/Template,EASY80920NOR) |
| 184 | Image/Build/Profile/EASY80920NOR=$(call Image/Build/$(1),$(1),EASY80920NOR) |
| 185 | |
| 186 | Image/BuildKernel/Profile/FRITZ3370=$(call Image/BuildKernelEVA/Template,FRITZ3370) |
| 187 | Image/Build/Profile/FRITZ3370=$(call Image/BuildEVA/$(1),$(1),FRITZ3370) |
| 188 | |
| 189 | endif |
| 190 | |
| 191 | |
| 192 | |
| 193 | ifeq ($(CONFIG_TARGET_lantiq_svip_be),y) |
| 194 | |
| 195 | Image/BuildKernel/Profile/EASY33016=$(call Image/BuildKernelGzip/Template,EASY33016) |
| 196 | Image/Build/Profile/EASY33016=$(call Image/Build/$(1),$(1),EASY33016) |
| 197 | |
| 198 | endif |
| 199 | |
| 200 | |
| 201 | define Image/BuildKernel |
| 202 | $(call Image/BuildKernel/Profile/$(PROFILE)) |
| 203 | endef |
| 204 | |
| 205 | define Image/Build |
| 206 | $(call Image/Build/Profile/$(PROFILE),$(1)) |
| 207 | endef |
| 208 | |
| 209 | $(eval $(call BuildImage)) |
| 210 | |