$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)
endef
$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(1)
endef
+define sysupname
+$(call imgname,$(1),$(2))-sysupgrade.bin
+endef
+
VMLINUX:=$(IMG_PREFIX)-vmlinux
UIMAGE:=$(IMG_PREFIX)-uImage
fs_squash:=squashfs-only
VMLINUX:=$(IMG_PREFIX)-vmlinux
UIMAGE:=$(IMG_PREFIX)-uImage
fs_squash:=squashfs-only
$(call MkImage,lzma,$(KDIR)/vmlinux-$(1).bin.lzma,$(KDIR)/vmlinux-$(1).uImage)
endef
$(call MkImage,lzma,$(KDIR)/vmlinux-$(1).bin.lzma,$(KDIR)/vmlinux-$(1).uImage)
endef
+define CatFiles
+ if [ `stat -c%s "$(1)"` -gt $(2) ]; then \
+ echo "Warning: $(1) is too big"; \
+ else if [ `stat -c%s $(3)` -gt $(4) ]; then \
+ echo "Warning: $(3) is too big"; \
+ else \
+ ( dd if=$(1) bs=$(2) conv=sync; dd if=$(3) ) > $(5); \
+ fi; fi
+endef
+
+define Sysupgrade/KRuImage
+ $(call CatFiles,$(KDIR)/vmlinux-$(2).uImage,$(3),$(KDIR)/root.$(1),$(4),$(call sysupname,$(1),$(2)))
+endef
+
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
cp $(KDIR)/vmlinux $(BIN_DIR)/$(VMLINUX).bin
define BuildFirmware/Generic
$(call MkImageLzma,$(2),$(3) $($(4)))
define BuildFirmware/Generic
$(call MkImageLzma,$(2),$(3) $($(4)))
- if [ `stat -c%s "$(KDIR)/vmlinux-$(2).uImage"` -gt $(5) ]; then \
- echo "Warning: $(KDIR)/vmlinux-$(2).uImage is too big"; \
- else if [ `stat -c%s $(KDIR)/root.$(1)` -gt $(6) ]; then \
- echo "Warning: $(KDIR)/root.$(1) is too big"; \
- else \
- ( \
- dd if=$(KDIR)/vmlinux-$(2).uImage bs=$(5) conv=sync; \
- dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
- ) > $(call imgname,$(1),$(2))-sysupgrade.bin; \
- fi; fi
+ $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
endef
define BuildFirmware/Generic/initramfs
endef
define BuildFirmware/Generic/initramfs
define BuildFirmware/WL341V3
$(call MkImageLzma,$(2),$(3) $($(4)))
define BuildFirmware/WL341V3
$(call MkImageLzma,$(2),$(3) $($(4)))
- if [ `stat -c%s "$(KDIR)/vmlinux-$(2).uImage"` -gt $(5) ]; then \
- echo "Warning: $(KDIR)/vmlinux-$(2).uImage is too big"; \
- else if [ `stat -c%s $(KDIR)/root.$(1)` -gt $(6) ]; then \
- echo "Warning: $(KDIR)/root.$(1) is too big"; \
- else \
+ $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
+ if [ -e "$(call sysupname,$(1),$(2))" ]; then \
( \
dd if=/dev/zero bs=195936 count=1; \
echo "1.01"; \
( \
dd if=/dev/zero bs=195936 count=1; \
echo "1.01"; \
dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(5) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
) > $(call imgname,$(1),$(2))-factory.bin; \
dd if=/dev/zero bs=`expr 4194304 - 262144 - 16 - $(5) - \( \( \( \`stat -c%s $(KDIR)/root.$(1)\` / 65536 \) + 1 \) \* 65536 \)` count=1; \
echo -n -e "\x11\x03\x80\x00\x10\x12\x90\xF7\x65\x52\x63\x4F\x6D\x4D\x00\x00"; \
) > $(call imgname,$(1),$(2))-factory.bin; \
endef
define BuildFirmware/Buffalo
$(call MkImageLzma,$(2),board=$(3) $($(4)))
endef
define BuildFirmware/Buffalo
$(call MkImageLzma,$(2),board=$(3) $($(4)))
- if [ `stat -c%s "$(KDIR)/vmlinux-$(2).uImage"` -gt $(5) ]; then \
- echo "Warning: $(KDIR)/vmlinux-$(2).uImage is too big"; \
- else if [ `stat -c%s $(KDIR)/root.$(1)` -gt $(6) ]; then \
- echo "Warning: $(KDIR)/root.$(1) is too big"; \
- else \
+ $(call Sysupgrade/KRuImage,$(1),$(2),$(5),$(6))
+ if [ -e "$(call sysupname,$(1),$(2))" ]; then \
buffalo-enc -p $(3) -v 1.76 \
-i $(KDIR)/vmlinux-$(2).uImage \
-o $(KDIR)/vmlinux-$(2).uImage.enc; \
buffalo-enc -p $(3) -v 1.76 \
-i $(KDIR)/vmlinux-$(2).uImage \
-o $(KDIR)/vmlinux-$(2).uImage.enc; \
-i $(KDIR)/vmlinux-$(2).uImage.enc \
-i $(KDIR)/root.$(2).enc \
-o $(call imgname,$(1),$(2))-factory-EU.bin; \
-i $(KDIR)/vmlinux-$(2).uImage.enc \
-i $(KDIR)/root.$(2).enc \
-o $(call imgname,$(1),$(2))-factory-EU.bin; \
endef
define BuildFirmware/Buffalo2
endef
define BuildFirmware/Buffalo2
endef
define BuildFirmware/Edimax
endef
define BuildFirmware/Edimax
- mkedimaximg -i $(call imgname,$(1),$(2))-sysupgrade.bin \
+ mkedimaximg -i $(call sysupname,$(1),$(2)) \
-o $(call imgname,$(1),$(2))-factory.bin \
-s $(3) -m $(4) -f $(5) -S $(6)
endef
-o $(call imgname,$(1),$(2))-factory.bin \
-s $(3) -m $(4) -f $(5) -S $(6)
endef
define Image/Build/Template/DIR300B1
$(call BuildFirmware/Generic,$(1),$(2),board=$(3),mtdlayout_dir300b1,$(mtd_dir300b1_kernel_part_size),$(mtd_dir300b1_rootfs_part_size))
mkwrgimg -s $(4) -d /dev/mtdblock/2 \
define Image/Build/Template/DIR300B1
$(call BuildFirmware/Generic,$(1),$(2),board=$(3),mtdlayout_dir300b1,$(mtd_dir300b1_kernel_part_size),$(mtd_dir300b1_rootfs_part_size))
mkwrgimg -s $(4) -d /dev/mtdblock/2 \
- -i $(call imgname,$(1),$(2))-sysupgrade.bin \
+ -i $(call sysupname,$(1),$(2)) \
-o $(call imgname,$(1),$(2))-factory.bin
endef
-o $(call imgname,$(1),$(2))-factory.bin
endef
( \
echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
dd bs=512 count=1 conv=sync; \
( \
echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \
dd bs=512 count=1 conv=sync; \
- dd if=$(call imgname,$(1),whr-g300n)-sysupgrade.bin; \
+ dd if=$(call sysupname,$(1),whr-g300n); \
) > $(KDIR)/whr-g300n-tftp.tmp
buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
-o $(call imgname,$(1),whr-g300n)-tftp.bin
) > $(KDIR)/whr-g300n-tftp.tmp
buffalo-tftp -i $(KDIR)/whr-g300n-tftp.tmp \
-o $(call imgname,$(1),whr-g300n)-tftp.bin