- $(call PatchKernelLzma,$(2),$(3) $($(4)))
- $(call MkImage,lzma,"$(KDIR)/vmlinux-$(2).bin.lzma","$(KDIR)/vmlinux-$(2).uImage")
- 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 MkImageLzma,$(2),$(3))
+ $(call Sysupgrade/KRuImage,$(1),$(2),$(4),$(5))
+endef
+
+define BuildFirmware/Generic/initramfs
+ $(call MkImageLzma,$(2),$(3))
+ $(CP) $(KDIR)/vmlinux-$(2).uImage $(call imgname,$(1),$(2))-uImage.bin
+endef
+
+mtdlayout_4M=192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,896k(kernel),2880k(rootfs),3776k@0x50000(firmware)
+define BuildFirmware/GENERIC_4M
+ $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_4M)),917504,2949120)
+endef
+
+define BuildFirmware/GENERIC_4M/initramfs
+ $(call BuildFirmware/Generic/initramfs,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_4M)))
+endef
+
+mtdlayout_8M=192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,896k(kernel),6976k(rootfs),7872k@0x50000(firmware)
+kernel_size_8M=917504
+rootfs_size_8M=7143424
+define BuildFirmware/GENERIC_8M
+ $(call BuildFirmware/Generic,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)),$(kernel_size_8M),$(rootfs_size_8M))
+endef
+
+define BuildFirmware/GENERIC_8M/initramfs
+ $(call BuildFirmware/Generic/initramfs,$(1),$(2),$(call mkcmdline,$(3),$(4),$(5)) $(call mkmtd/$(6),$(mtdlayout_8M)))
+endef
+
+mtdlayout_argus_atp52b=192k(bootloader)ro,64k(config),64k(factory),1152k(kernel),6656k(rootfs),7808k@0x50000(firmware)
+mtd_argus_atp52b_kernel_part_size=1179648
+mtd_argus_atp52b_rootfs_part_size=6815744
+define BuildFirmware/ARGUS_ATP52B
+ $(call BuildFirmware/Generic,$(1),$(2),board=$(3) $(call mkmtd/phys,$(mtdlayout_argus_atp52b)),$(mtd_argus_atp52b_kernel_part_size),$(mtd_argus_atp52b_rootfs_part_size))