diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index 99e98119f0..b64d629be3 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -6,27 +6,7 @@ include $(INCLUDE_DIR)/image.mk UBIFS_OPTS = -m 2048 -e 124KiB -c 4096 -U -F UBINIZE_OPTS = -m 2048 -p 128KiB -E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_PARTSIZE)*1024))) - -define Image/BuildKernel/zImage - cat $(KDIR)/zImage $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb > $(KDIR)/zImage-$(1) - $(CP) $(KDIR)/zImage-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-zImage -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - cat $(KDIR)/zImage-initramfs $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb > $(KDIR)/zImage-initramfs-$(1) - $(CP) $(KDIR)/zImage-initramfs-$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-zImage-initramfs -endif -endef - -define Image/BuildKernel/FIT - gzip -9n -c $(KDIR)/Image > $(KDIR)/Image.gz - $(call CompressLzma,$(KDIR)/Image,$(KDIR)/Image.gz) - $(call Image/BuildKernel/MkFIT,$(1), $(KDIR)/Image.gz, $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb,gzip,0x42208000,0x42208000) - $(CP) $(KDIR)/fit-$(1).itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage.itb -ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),) - $(call Image/BuildKernel/MkFIT,$(1), $(KDIR)/Image-initramfs, $(LINUX_DIR)/arch/arm/boot/dts/$(1).dtb, none,0x42208000,0x42208000) - $(CP) $(KDIR)/fit-$(1).itb $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fit-uImage-initramfs.itb -endif -endef +KERNEL_LOADADDR := 0x42208000 define Image/Prepare $(CP) $(LINUX_DIR)/vmlinux $(KDIR)/$(IMG_PREFIX)-vmlinux.elf @@ -34,9 +14,6 @@ endef define Image/BuildKernel $(CP) $(KDIR)/$(IMG_PREFIX)-vmlinux.elf $(BIN_DIR) - $(call Image/BuildKernel/FIT,qcom-ipq8064-ap148) - $(call Image/BuildKernel/zImage,qcom-ipq8064-ap148) - $(call Image/BuildKernel/FIT,qcom-ipq8064-db149) endef define Image/Build/squashfs @@ -48,4 +25,47 @@ define Image/Build dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-$(1)-root.img bs=2k conv=sync endef +define Build/append-dtb + cat $(DTS_DIR)/$(DEVICE_DTS).dtb >> $@ +endef + +define Device/Default + PROFILES := Default + KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs + DEVICE_DTS := + KERNEL_PREFIX := $$(IMAGE_PREFIX) +endef +DEVICE_VARS += DEVICE_DTS + +define Device/LegacyImage + KERNEL_SUFFIX := -zImage + KERNEL = kernel-bin | append-dtb + KERNEL_NAME := zImage + KERNEL_INSTALL := 1 +endef + +define Device/FitImage + KERNEL_SUFFIX := -fit-uImage.itb + KERNEL = kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb + KERNEL_NAME := Image + KERNEL_INSTALL := 1 +endef + +define Device/AP148 + $(call Device/FitImage) + DEVICE_DTS := qcom-ipq8064-ap148 +endef + +define Device/AP148-legacy + $(call Device/LegacyImage) + DEVICE_DTS := qcom-ipq8064-ap148 +endef + +define Device/DB149 + $(call Device/FitImage) + DEVICE_DTS := qcom-ipq8064-db149 +endef + +TARGET_DEVICES += AP148 AP148-legacy DB149 + $(eval $(call BuildImage))