[cns3xxx]: add uImage image build
[openwrt/svn-archive/archive.git] / target / linux / cns3xxx / image / Makefile
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 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 define Image/Prepare
11 mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e 0x20008000 -n 'OpenWrt Linux-$(LINUX_VERSION)' -d $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/uImage
12 endef
13
14 # Build sysupgrade image
15 define BuildFirmware/Generic
16 dd if=$(KDIR)/uImage of=$(KDIR)/uImage.pad bs=64k conv=sync; \
17 dd if=$(KDIR)/root.$(1) of=$(KDIR)/root.$(1).pad bs=128k conv=sync; \
18 sh $(TOPDIR)/scripts/combined-image.sh \
19 $(KDIR)/uImage.pad \
20 $(KDIR)/root.$(1).pad \
21 $(BIN_DIR)/$(IMG_PREFIX)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))-uboot-sysupgrade.bin
22 sh $(TOPDIR)/scripts/combined-image.sh \
23 $(KDIR)/uImage.pad \
24 $(KDIR)/root.$(1).pad \
25 $(BIN_DIR)/$(IMG_PREFIX)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))-sysupgrade.bin
26 endef
27
28 define Image/Build
29 $(call Image/Build/$(1),$(1))
30 $(call BuildFirmware/Generic,$(1))
31 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
32 endef
33
34 define Image/Build/jffs2-64k
35 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=64k conv=sync
36 ( \
37 dd if=$(KDIR)/uImage bs=2048k conv=sync; \
38 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
39 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
40 endef
41
42 define Image/Build/jffs2-128k
43 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=128k conv=sync
44 ( \
45 dd if=$(KDIR)/uImage bs=2048k conv=sync; \
46 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
47 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
48 endef
49
50 define Image/Build/squashfs
51 $(call prepare_generic_squashfs,$(KDIR)/root.$(1))
52 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=128k conv=sync
53 ( \
54 dd if=$(KDIR)/uImage bs=2048k conv=sync; \
55 dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
56 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_nor.bin
57 ( \
58 dd if=$(KDIR)/uImage bs=1536k conv=sync; \
59 dd if=$(KDIR)/root.$(1) bs=256k conv=sync; \
60 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1)_laguna_spi.bin
61 endef
62
63 $(eval $(call BuildImage))