2 # Copyright (C) 2013 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
10 define sanitize_profile_name
11 $(shell echo
$(PROFILE
) | tr
'[:upper:]' '[:lower:]' | sed
's/_/-/g')
14 define Image
/BuildKernel
/Template
15 $(CP
) $(LINUX_DIR
)/arch
/arm
/boot
/dts
/$(1).dtb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
17 $(call Image
/BuildKernel
/MkFIT
,$(1),$(KDIR
)/zImage
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
,none
,0x10008000,0x10008000)
18 $(CP
) $(KDIR
)/fit-
$(1).itb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage.itb
20 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
21 $(call Image
/BuildKernel
/MkFIT
,$(1),$(KDIR
)/zImage-initramfs
,$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
,none
,0x10008000,0x10008000,-initramfs
)
22 $(CP
) $(KDIR
)/fit-
$(1)-initramfs.itb
$(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage-initramfs.itb
25 $(CP
) $(KDIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage
26 $(call Image
/BuildKernel
/MkuImage
, \
27 none
, 0x10008000, 0x10008000, \
28 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
, \
29 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage \
32 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),)
33 $(CP
) $(KDIR
)/zImage-initramfs
$(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
34 $(call Image
/BuildKernel
/MkuImage
, \
35 none
, 0x10008000, 0x10008000, \
36 $(BIN_DIR
)/$(IMG_PREFIX
)-zImage-initramfs
, \
37 $(BIN_DIR
)/$(IMG_PREFIX
)-uImage-initramfs \
42 define Image
/InstallKernel
/Template
44 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL
),)
45 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
46 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE
),)
47 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/
48 ln
-sf
$(IMG_PREFIX
)-uImage
$(TARGET_DIR
)/boot
/uImage
50 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE
),)
51 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/
52 ln
-sf
$(IMG_PREFIX
)-zImage
$(TARGET_DIR
)/boot
/zImage
54 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_FIT
),)
55 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1)-fit-uImage.itb
$(TARGET_DIR
)/boot
/
56 ln
-sf
$(IMG_PREFIX
)-$(1)-fit-uImage.itb
$(TARGET_DIR
)/boot
/uImage.itb
60 ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB
),)
61 $(INSTALL_DIR
) $(TARGET_DIR
)/boot
63 $(CP
) $(BIN_DIR
)/$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/
64 ln
-sf
$(IMG_PREFIX
)-$(1).dtb
$(TARGET_DIR
)/boot
/$(1).dtb
69 define Image
/Build
/squashfs
70 $(call prepare_generic_squashfs
,$(KDIR
)/root.
$(1))
71 dd if
=$(KDIR
)/root.
$(1) of
=$(BIN_DIR
)/$(IMG_PREFIX
)-$(1).bin bs
=128k conv
=sync
73 dd if
=$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-fit-uImage.itb bs
=2048k conv
=sync
; \
74 dd if
=$(KDIR
)/root.
$(1) bs
=128k conv
=sync
; \
75 ) > $(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-fit-
$(1).bin
78 define Image
/mkfs
/targz
80 $(TAR
) -czpf
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs.
tar.gz
--numeric-owner
--owner
=0 --group
=0 -C
$(TARGET_DIR
)/ .
83 define ubifs_imx_gateworks_ventana
84 # Micron MT29F1G08ABAD/MT29F2G08ABAE/MT29F4G08ABAD/MT29F8G08ADAD NAND
85 $(eval IMX6Q_GW54XX_UBIFS_OPTS
:="-m 2048 -e 124KiB -c 8124")
86 $(eval IMX6Q_GW54XX_UBI_OPTS
:="-m 2048 -p 128KiB -s 2048")
87 $(call Image
/mkfs
/ubifs
)
88 $(CP
) $(KDIR
)/root.ubifs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs_normal.ubifs
89 $(CP
) $(KDIR
)/root.ubi
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs_normal.ubi
91 # Micron MT29F8G08ABAC/MT29F16G08ADAC 1GB/2GB NAND
92 $(eval IMX6Q_GW54XX_UBIFS_OPTS
:="-m 4096 -e 248KiB -c 8124")
93 $(eval IMX6Q_GW54XX_UBI_OPTS
:="-m 4096 -p 256KiB -s 4096")
94 $(call Image
/mkfs
/ubifs
)
95 $(CP
) $(KDIR
)/root.ubifs
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs_large.ubifs
96 $(CP
) $(KDIR
)/root.ubi
$(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-rootfs_large.ubi
99 define Image
/Build
/ubifs
103 define Image
/Build
/ubi
108 Image
/BuildKernel
/Template
/generic
=$(call Image
/BuildKernel
/Template
)
109 Image
/InstallKernel
/Template
/generic
=$(call Image
/InstallKernel
/Template
)
111 Image
/BuildKernel
/Template
/IMX6DL_WANDBOARD
=$(call Image
/BuildKernel
/Template
,imx6dl-wandboard
)
112 Image
/InstallKernel
/Template
/IMX6DL_WANDBOARD
=$(call Image
/InstallKernel
/Template
,imx6dl-wandboard
)
114 Image
/BuildKernel
/Template
/IMX6Q_GW5400_A
=$(call Image
/BuildKernel
/Template
,imx6q-gw5400-a
)
115 Image
/InstallKernel
/Template
/IMX6Q_GW5400_A
=$(call Image
/InstallKernel
/Template
,imx6q-gw5400-a
)
117 Image
/BuildKernel
/Template
/IMX6Q_GW54XX
=$(call Image
/BuildKernel
/Template
,imx6q-gw54xx
)
118 Image
/InstallKernel
/Template
/IMX6Q_GW54XX
=$(call Image
/InstallKernel
/Template
,imx6q-gw54xx
)
119 Image
/ubifs
/IMX6Q_GW54XX
=$(call ubifs_imx_gateworks_ventana
)
122 define Image
/BuildKernel
123 $(call Image
/BuildKernel
/Template
/$(PROFILE
))
126 define Image
/InstallKernel
127 $(call Image
/InstallKernel
/Template
/$(PROFILE
))
128 $(if
$(Image
/ubifs
/$(PROFILE
)), \
129 $(call Image
/ubifs
/$(PROFILE
))
134 $(if
$(Image
/Build
/$(1)), \
135 $(call Image
/Build
/$(1),$(1)), \
136 $(CP
) $(KDIR
)/root.
$(1) $(BIN_DIR
)/$(IMG_PREFIX
)-$(call sanitize_profile_name
)-$(1).img \
140 $(eval
$(call BuildImage
))