branding: add LEDE branding
[openwrt/staging/mkresin.git] / target / linux / mcs814x / image / Makefile
1 #
2 # Copyright (C) 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 JFFS2_BLOCKSIZE = 128k
9
10 include $(TOPDIR)/rules.mk
11 include $(INCLUDE_DIR)/image.mk
12
13 TARGET_DTBS := rbt-832 dlan-usb-extender
14
15 DTBS_DIR:=dts/
16
17 LOADADDR:=0x00008000
18
19 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
20
21 define Image/Build/MkuImage
22 mkimage -A arm -O linux -T kernel -a $(LOADADDR) -C none -e $(LOADADDR) \
23 -n 'ARM LEDE Linux-$(LINUX_VERSION)' -d $(1) $(2);
24 endef
25
26 define Image/Build/DTB
27 cp $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1);
28 cat $(LINUX_DIR)/arch/$(ARCH)/boot/$(DTBS_DIR)$(1).dtb >> $(KDIR)/zImage$(2)-$(1);
29 $(call Image/Build/MkuImage,$(KDIR)/zImage$(2)-$(1),$(KDIR)/uImage$(2)-$(1))
30 cp $(KDIR)/uImage$(2)-$(1) $(UIMAGE)$(2)-$(1);
31 endef
32
33 define Image/Build/Profile/dLAN_USB_Extender
34 dd if=$(KDIR)/uImage-dlan-usb-extender bs=64k conv=sync of=$(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
35 cat $(KDIR)/root.$(1) >> $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin
36 cp $(KDIR)/$(IMG_PREFIX)-dlan-usb-extender-upgrade-$(1).bin $(BIN_DIR)/
37 endef
38
39 define Image/BuildKernel
40 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb)))
41 endef
42
43 define Image/Build/Initramfs
44 $(foreach dtb,$(TARGET_DTBS),$(call Image/Build/DTB,$(dtb),-initramfs))
45 endef
46
47 define Image/Build/squashfs
48 $(STAGING_DIR_HOST)/bin/padjffs2 $(KDIR)/root.squashfs 128
49 endef
50
51 define Image/Build
52 $(call Image/Build/$(1))
53 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
54 $(call Image/Build/Profile/$(PROFILE),$(1))
55 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
56 $(call Image/Build/Initramfs)
57 endif
58 endef
59
60 $(eval $(call BuildImage))