aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/image
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-01-10 15:26:53 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-01-10 15:26:53 +0000
commit6ee18aa54e9fa3a0df4c3ae31e774af4b3b770da (patch)
tree2bd62705262d7f8e5a85a05ccf82dd4c4708e3f7 /target/linux/ramips/image
parent0565d88e3b04993f966c87b91b8b08e9efda2fe3 (diff)
downloadmaster-187ad058-6ee18aa54e9fa3a0df4c3ae31e774af4b3b770da.tar.gz
master-187ad058-6ee18aa54e9fa3a0df4c3ae31e774af4b3b770da.tar.bz2
master-187ad058-6ee18aa54e9fa3a0df4c3ae31e774af4b3b770da.zip
ramips: convert mt7621 images to new image building code
Signed-off-by: Felix Fietkau <nbd@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@43908 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips/image')
-rw-r--r--target/linux/ramips/image/Makefile72
1 files changed, 43 insertions, 29 deletions
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 18c1330bf6..82cadd742b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -22,10 +22,35 @@ define Image/Build/Initramfs
$(call Image/Build/Profile/$(PROFILE),initramfs)
endef
+DEVICE_VARS += DTS
+
loadaddr-y := 0x80000000
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
+KERNEL_LOADADDR := $(loadaddr-y)
+
+KERNEL_DTB = kernel-bin | patch-dtb | lzma
+define Device/Default
+ KERNEL := $(KERNEL_DTB) | uImage lzma
+ IMAGES := sysupgrade.bin
+ IMAGE_SIZE := $(ralink_default_fw_size_8M)
+ IMAGE/sysupgrade.bin := append-kernel | append-rootfs | check-size $$$$(IMAGE_SIZE) | pad-rootfs
+endef
+
+define Build/patch-dtb
+ $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $@.dtb ../dts/$(DTS).dts
+ $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
+endef
+
+define Build/trx
+ $(STAGING_DIR_HOST)/bin/trx \
+ -o $@ \
+ -m $(IMAGE_SIZE) \
+ -f $(word 1,$^) \
+ -a 4 -f $(word 2,$^)
+endef
+
define MkCombineduImage
$(call PatchKernelLzma,$(2),$(3))
if [ `stat -c%s "$(KDIR)/vmlinux-$(2).bin.lzma"` -gt `expr $(4) - 64` ]; then \
@@ -67,17 +92,6 @@ define MkImageSysupgrade/squashfs
fi
endef
-define MkImageTrx/squashfs
- $(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
- $(STAGING_DIR_HOST)/bin/trx \
- -o $(KDIR)/$(output_name) \
- -m $(3) \
- -f $(KDIR)/vmlinux-$(2).uImage \
- -a 4 -f $(KDIR)/root.$(1)
- $(call prepare_generic_squashfs,$(KDIR)/$(output_name))
- $(CP) $(KDIR)/$(output_name) $(BIN_DIR)/$(output_name)
-endef
-
define MkImageTpl/squashfs
$(eval output_name=$(IMG_PREFIX)-$(2)-$(1)-$(if $(4),$(4),sysupgrade).bin)
$(STAGING_DIR_HOST)/bin/mktplinkfw2 -V "ver. 2.0" -B "$(2)" -j \
@@ -124,11 +138,6 @@ define BuildFirmware/OF
$(call MkImageSysupgrade/$(1),$(1),$(2),$(4),$(6))
endef
-define BuildFirmware/OF/trx
- $(call MkImageLzmaDtb,$(2),$(3),$(5))
- $(call MkImageTrx/$(1),$(1),$(2),$(4),$(6))
-endef
-
define BuildFirmware/OF/tplink
$(call PatchKernelLzmaDtb,$(1),$(2),$(4))
$(call MkImageTpl/$(1),$(1),$(2),$(4),$(5))
@@ -167,8 +176,6 @@ BuildFirmware/Default4M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(
ralink_default_fw_size_8M=8060928
BuildFirmware/Default8M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
BuildFirmware/Default8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
-BuildFirmware/Trx8M/squashfs=$(call BuildFirmware/OF/trx,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
-BuildFirmware/Trx8M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
BuildFirmware/Tplink/squashfs=$(call BuildFirmware/OF/tplink,$(1),$(2),$(3),$(4))
BuildFirmware/Tplink/initramfs=$(call BuildFirmware/OF/tplink/initramfs,$(1),$(2),$(3),$(4))
@@ -862,18 +869,24 @@ endif
# MT7621 Profiles
#
-Image/Build/Profile/MT7621=$(call BuildFirmware/Default4M/$(1),$(1),mt7621,MT7621)
-Image/Build/Profile/WSR-600=$(call BuildFirmware/Default8M/$(1),$(1),wsr-600,WSR-600)
-Image/Build/Profile/WSR-1166=$(call BuildFirmware/Trx8M/$(1),$(1),wsr-1166,WSR-1166)
-
ifeq ($(SUBTARGET),mt7621)
-define Image/Build/Profile/Default
- $(call Image/Build/Profile/MT7621,$(1))
- $(call Image/Build/Profile/WSR-600,$(1))
- $(call Image/Build/Profile/WSR-1166,$(1))
-endef
+ TARGET_DEVICES += mt7621 wsr-600 wsr-1166
endif
+define Device/mt7621
+ DTS := MT7621
+ IMAGE_SIZE := $(ralink_default_fw_size_4M)
+endef
+
+define Device/wsr-600
+ DTS := WSR-600
+endef
+
+define Device/wsr-1166
+ DTS := WSR-1166
+ IMAGE/sysupgrade.bin := trx | pad-rootfs
+endef
+
#
# MT7628 Profiles
#
@@ -886,9 +899,9 @@ define Image/Build/Profile/Default
endef
endif
-
+ifndef TARGET_DEVICES
#
-# Generic Targets
+# Generic Targets - only needed for legacy image building code
#
define Image/BuildKernel
cp $(KDIR)/vmlinux.elf $(BIN_DIR)/$(VMLINUX).elf
@@ -912,5 +925,6 @@ define Image/Build
dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1) bs=128k conv=sync
$(call Image/Build/Profile/$(PROFILE),$(1))
endef
+endif
$(eval $(call BuildImage))