aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
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
commit5b0d18093d23e4e099a30e9a8701c8218ce256c5 (patch)
treed3a287104460c3f2d0074ae84974af907fa2656b /target/linux
parent95a945a7cb83b830b241931651cae2d2d44c8140 (diff)
downloadupstream-5b0d18093d23e4e099a30e9a8701c8218ce256c5.tar.gz
upstream-5b0d18093d23e4e099a30e9a8701c8218ce256c5.tar.bz2
upstream-5b0d18093d23e4e099a30e9a8701c8218ce256c5.zip
ramips: convert mt7621 images to new image building code
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 43908
Diffstat (limited to 'target/linux')
-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))