+ dd if=/dev/zero bs=1024 count=1 >> $@
+
+ALIGN:=1024
+ifeq ($(FS),jffs2-8MB)
+ALIGN:=131072
+endif
+ifeq ($(FS),jffs2-4MB)
+ALIGN:=65536
+endif
+
+$(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin:
+ dd if=$(BIN_DIR)/openwrt-ar7-zimage.bin bs=$(ALIGN) conv=sync | head -c -1024 > $@
+ $(STAGING_DIR)/bin/trx -a 1024 $(BUILD_DIR)/linux-$(KERNEL)-ar7/root.$(FS) >> $@
+
+define pattern_template
+$(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS)-$(1).bin: $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin
+ (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS).bin) | \
+ $(STAGING_DIR)/bin/addpattern -p $(1) -o $(BIN_DIR)/openwrt-ar7-$(KERNEL)-$(FS)-$(1).bin