2013-05-29 09:27:29 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2013 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/image.mk
|
|
|
|
|
2013-10-24 06:55:00 +08:00
|
|
|
define sanitize_profile_name
|
2013-10-18 08:02:45 +08:00
|
|
|
$(shell echo $(PROFILE) | tr '[:upper:]' '[:lower:]' | sed 's/_/-/g')
|
|
|
|
endef
|
2013-05-29 09:27:29 +08:00
|
|
|
|
2013-10-18 08:02:45 +08:00
|
|
|
define Image/BuildKernel/Template
|
2013-10-24 06:16:12 +08:00
|
|
|
$(CP) $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb
|
2013-10-16 18:29:50 +08:00
|
|
|
|
2013-10-18 08:02:45 +08:00
|
|
|
$(call Image/BuildKernel/MkFIT,$(1),$(KDIR)/zImage,$(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb,none,0x10008000,0x10008000)
|
2013-10-24 06:16:12 +08:00
|
|
|
$(CP) $(KDIR)/fit-$(1).itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage.itb
|
2013-10-16 18:29:50 +08:00
|
|
|
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
2013-10-18 08:02:45 +08:00
|
|
|
$(call Image/BuildKernel/MkFIT,$(1),$(KDIR)/zImage-initramfs,$(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb,none,0x10008000,0x10008000,-initramfs)
|
2013-10-24 06:16:12 +08:00
|
|
|
$(CP) $(KDIR)/fit-$(1)-initramfs.itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage-initramfs.itb
|
2013-10-16 18:29:50 +08:00
|
|
|
endif
|
|
|
|
|
2013-10-24 06:16:12 +08:00
|
|
|
$(CP) $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
|
|
|
|
$(call Image/BuildKernel/MkuImage, \
|
|
|
|
none, 0x10008000, 0x10008000, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-zImage, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-uImage \
|
|
|
|
)
|
2013-10-16 18:29:50 +08:00
|
|
|
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
|
2013-10-24 06:16:12 +08:00
|
|
|
$(CP) $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs
|
|
|
|
$(call Image/BuildKernel/MkuImage, \
|
|
|
|
none, 0x10008000, 0x10008000, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-zImage-initramfs, \
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-uImage-initramfs \
|
|
|
|
)
|
2013-10-16 18:29:50 +08:00
|
|
|
endif
|
2013-05-29 09:27:29 +08:00
|
|
|
endef
|
|
|
|
|
2013-10-18 08:02:45 +08:00
|
|
|
define Image/InstallKernel/Template
|
2013-05-29 09:27:29 +08:00
|
|
|
|
2013-10-18 08:02:45 +08:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_KERNEL),)
|
|
|
|
$(INSTALL_DIR) $(TARGET_DIR)/boot
|
2013-10-24 06:16:12 +08:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_UIMAGE),)
|
|
|
|
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/
|
|
|
|
ln -sf $(IMG_PREFIX)-uImage $(TARGET_DIR)/boot/uImage
|
|
|
|
endif
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_ZIMAGE),)
|
2013-10-18 08:02:45 +08:00
|
|
|
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/
|
|
|
|
ln -sf $(IMG_PREFIX)-zImage $(TARGET_DIR)/boot/zImage
|
2013-10-24 06:16:12 +08:00
|
|
|
endif
|
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_FIT),)
|
|
|
|
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage.itb $(TARGET_DIR)/boot/
|
|
|
|
ln -sf $(IMG_PREFIX)-$(1)-fit-uImage.itb $(TARGET_DIR)/boot/uImage.itb
|
|
|
|
endif
|
2013-10-18 08:02:45 +08:00
|
|
|
endif
|
2013-10-31 19:44:27 +08:00
|
|
|
|
2013-10-18 08:02:45 +08:00
|
|
|
ifneq ($(CONFIG_TARGET_ROOTFS_INCLUDE_DTB),)
|
|
|
|
$(INSTALL_DIR) $(TARGET_DIR)/boot
|
|
|
|
ifneq ($(1),)
|
|
|
|
$(CP) $(BIN_DIR)/$(IMG_PREFIX)-$(1).dtb $(TARGET_DIR)/boot/
|
2013-10-24 04:21:27 +08:00
|
|
|
ln -sf $(IMG_PREFIX)-$(1).dtb $(TARGET_DIR)/boot/$(1).dtb
|
2013-10-18 08:02:45 +08:00
|
|
|
endif
|
|
|
|
endif
|
2013-05-29 09:27:29 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/squashfs
|
|
|
|
$(call prepare_generic_squashfs,$(KDIR)/root.$(1))
|
2013-10-18 08:02:45 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).bin bs=128k conv=sync
|
|
|
|
( \
|
2013-10-24 06:55:00 +08:00
|
|
|
dd if=$(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-fit-uImage.itb bs=2048k conv=sync; \
|
2013-10-18 08:02:45 +08:00
|
|
|
dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
|
2013-10-24 06:55:00 +08:00
|
|
|
) > $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-fit-$(1).bin
|
2013-10-18 08:02:45 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/mkfs/targz
|
|
|
|
|
2013-10-24 06:55:00 +08:00
|
|
|
$(TAR) -czpf $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs.tar.gz --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
|
2013-10-18 08:02:45 +08:00
|
|
|
endef
|
|
|
|
|
2013-11-19 06:23:40 +08:00
|
|
|
define ubifs_imx_gateworks_ventana
|
|
|
|
# Micron MT29F1G08ABAD/MT29F2G08ABAE/MT29F4G08ABAD/MT29F8G08ADAD NAND
|
|
|
|
$(eval IMX6Q_GW54XX_UBIFS_OPTS:="-m 2048 -e 124KiB -c 8124")
|
|
|
|
$(eval IMX6Q_GW54XX_UBI_OPTS:="-m 2048 -p 128KiB -s 2048")
|
|
|
|
$(call Image/mkfs/ubifs)
|
|
|
|
$(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs_normal.ubifs
|
|
|
|
$(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs_normal.ubi
|
|
|
|
|
|
|
|
# Micron MT29F8G08ABAC/MT29F16G08ADAC 1GB/2GB NAND
|
|
|
|
$(eval IMX6Q_GW54XX_UBIFS_OPTS:="-m 4096 -e 248KiB -c 8124")
|
|
|
|
$(eval IMX6Q_GW54XX_UBI_OPTS:="-m 4096 -p 256KiB -s 4096")
|
|
|
|
$(call Image/mkfs/ubifs)
|
|
|
|
$(CP) $(KDIR)/root.ubifs $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs_large.ubifs
|
|
|
|
$(CP) $(KDIR)/root.ubi $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-rootfs_large.ubi
|
|
|
|
endef
|
2013-10-18 08:02:45 +08:00
|
|
|
|
2013-11-19 06:23:40 +08:00
|
|
|
define Image/Build/ubifs
|
|
|
|
true
|
2013-10-18 08:02:45 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/ubi
|
2013-11-19 06:23:40 +08:00
|
|
|
true
|
2013-10-18 08:02:45 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
Image/BuildKernel/Template/generic=$(call Image/BuildKernel/Template)
|
|
|
|
Image/InstallKernel/Template/generic=$(call Image/InstallKernel/Template)
|
|
|
|
|
|
|
|
Image/BuildKernel/Template/IMX6DL_WANDBOARD=$(call Image/BuildKernel/Template,imx6dl-wandboard)
|
|
|
|
Image/InstallKernel/Template/IMX6DL_WANDBOARD=$(call Image/InstallKernel/Template,imx6dl-wandboard)
|
|
|
|
|
|
|
|
Image/BuildKernel/Template/IMX6Q_GW5400_A=$(call Image/BuildKernel/Template,imx6q-gw5400-a)
|
|
|
|
Image/InstallKernel/Template/IMX6Q_GW5400_A=$(call Image/InstallKernel/Template,imx6q-gw5400-a)
|
|
|
|
|
|
|
|
Image/BuildKernel/Template/IMX6Q_GW54XX=$(call Image/BuildKernel/Template,imx6q-gw54xx)
|
|
|
|
Image/InstallKernel/Template/IMX6Q_GW54XX=$(call Image/InstallKernel/Template,imx6q-gw54xx)
|
2013-11-19 06:23:40 +08:00
|
|
|
Image/ubifs/IMX6Q_GW54XX=$(call ubifs_imx_gateworks_ventana)
|
2013-10-18 08:02:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
define Image/BuildKernel
|
|
|
|
$(call Image/BuildKernel/Template/$(PROFILE))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/InstallKernel
|
|
|
|
$(call Image/InstallKernel/Template/$(PROFILE))
|
2013-11-19 06:23:40 +08:00
|
|
|
$(if $(Image/ubifs/$(PROFILE)), \
|
|
|
|
$(call Image/ubifs/$(PROFILE))
|
|
|
|
)
|
2013-10-18 08:02:45 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build
|
|
|
|
$(if $(Image/Build/$(1)), \
|
|
|
|
$(call Image/Build/$(1),$(1)), \
|
2013-10-31 19:44:27 +08:00
|
|
|
$(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(call sanitize_profile_name)-$(1).img \
|
2013-05-29 09:27:29 +08:00
|
|
|
)
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildImage))
|