uboot-lantiq: vrx200 - lzma compress gphy firmware
The default bootloader partition of some devices is to small for an u-boot with uncompressed gphy firmware(s). Instead of increasing the bootloader partition size, in compare to the stock firmware, compress the firmware. This would allow the bootloader of at least the FritzBox 3370 as well as the bootloader of the VGV7510KW22 to fit into the bootloader partition of the stock firmware. Signed-off-by: Mathias Kresin <dev@kresin.me>
This commit is contained in:
parent
8df4eb0b9b
commit
ecf10d3796
2 changed files with 29 additions and 18 deletions
|
@ -330,18 +330,19 @@ define BuildUBootPackage
|
||||||
$(call Package/uboot/template,$(1),$(TITLE),$(DEPS))
|
$(call Package/uboot/template,$(1),$(TITLE),$(DEPS))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define CopyVR9Firmware
|
define CompressVR9Firmware
|
||||||
$(CP) $(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
|
$(STAGING_DIR_HOST)/bin/lzma e \
|
||||||
|
$(FIRMWARE_LANTIQ_SOURCE)/vr9_phy$(1)_a$(2)x.bin \
|
||||||
$(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
|
$(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/fw_phy$(1)_a$(2)x.blob
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Prepare
|
define Build/Prepare
|
||||||
$(call Build/Prepare/Default)
|
$(call Build/Prepare/Default)
|
||||||
mkdir -p $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/
|
mkdir -p $(PKG_BUILD_DIR)/arch/mips/cpu/mips32/vrx200/
|
||||||
$(call CopyVR9Firmware,11g,1)
|
$(call CompressVR9Firmware,11g,1)
|
||||||
$(call CopyVR9Firmware,11g,2)
|
$(call CompressVR9Firmware,11g,2)
|
||||||
$(call CopyVR9Firmware,22f,1)
|
$(call CompressVR9Firmware,22f,1)
|
||||||
$(call CopyVR9Firmware,22f,2)
|
$(call CompressVR9Firmware,22f,2)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Configure
|
define Build/Configure
|
||||||
|
|
|
@ -2510,7 +2510,7 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+}
|
+}
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/arch/mips/cpu/mips32/vrx200/gphy.c
|
+++ b/arch/mips/cpu/mips32/vrx200/gphy.c
|
||||||
@@ -0,0 +1,58 @@
|
@@ -0,0 +1,68 @@
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
|
+ * Copyright (C) 2011-2013 Daniel Schwierzeck, daniel.schwierzeck@gmail.com
|
||||||
+ *
|
+ *
|
||||||
|
@ -2521,17 +2521,23 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+#include <asm/lantiq/io.h>
|
+#include <asm/lantiq/io.h>
|
||||||
+#include <asm/arch/soc.h>
|
+#include <asm/arch/soc.h>
|
||||||
+#include <asm/arch/gphy.h>
|
+#include <asm/arch/gphy.h>
|
||||||
|
+#include <lzma/LzmaTypes.h>
|
||||||
|
+#include <lzma/LzmaDec.h>
|
||||||
|
+#include <lzma/LzmaTools.h>
|
||||||
+
|
+
|
||||||
+static inline void ltq_gphy_copy(const void *fw_start, const void *fw_end,
|
+static inline void ltq_gphy_decompress(const void *fw_start, const void *fw_end,
|
||||||
+ ulong dst_addr)
|
+ ulong dst_addr)
|
||||||
+{
|
+{
|
||||||
+ const ulong fw_len = (ulong) fw_end - (ulong) fw_start;
|
+ const ulong fw_len = (ulong) fw_end - (ulong) fw_start;
|
||||||
+ const ulong addr = CKSEG1ADDR(dst_addr);
|
+ const ulong addr = CKSEG1ADDR(dst_addr);
|
||||||
+
|
+
|
||||||
+ debug("ltq_gphy_copy: addr %08lx, fw_start %p, fw_end %p\n",
|
+ debug("ltq_gphy_decompress: addr %08lx, fw_start %p, fw_end %p\n",
|
||||||
+ addr, fw_start, fw_end);
|
+ addr, fw_start, fw_end);
|
||||||
+
|
+
|
||||||
+ memcpy((void *) addr, fw_start, fw_len);
|
+ SizeT lzma_len = 65536;
|
||||||
|
+ int ret = lzmaBuffToBuffDecompress(
|
||||||
|
+ (unsigned char *)addr, &lzma_len,
|
||||||
|
+ (unsigned char *)fw_start, fw_len);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void ltq_gphy_phy11g_a1x_load(ulong addr)
|
+void ltq_gphy_phy11g_a1x_load(ulong addr)
|
||||||
|
@ -2539,8 +2545,9 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+ extern ulong __ltq_fw_phy11g_a1x_start;
|
+ extern ulong __ltq_fw_phy11g_a1x_start;
|
||||||
+ extern ulong __ltq_fw_phy11g_a1x_end;
|
+ extern ulong __ltq_fw_phy11g_a1x_end;
|
||||||
+
|
+
|
||||||
+ ltq_gphy_copy(&__ltq_fw_phy11g_a1x_start, &__ltq_fw_phy11g_a1x_end,
|
+ ltq_gphy_decompress(&__ltq_fw_phy11g_a1x_start,
|
||||||
+ addr);
|
+ &__ltq_fw_phy11g_a1x_end,
|
||||||
|
+ addr);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void ltq_gphy_phy11g_a2x_load(ulong addr)
|
+void ltq_gphy_phy11g_a2x_load(ulong addr)
|
||||||
|
@ -2548,8 +2555,9 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+ extern ulong __ltq_fw_phy11g_a2x_start;
|
+ extern ulong __ltq_fw_phy11g_a2x_start;
|
||||||
+ extern ulong __ltq_fw_phy11g_a2x_end;
|
+ extern ulong __ltq_fw_phy11g_a2x_end;
|
||||||
+
|
+
|
||||||
+ ltq_gphy_copy(&__ltq_fw_phy11g_a2x_start, &__ltq_fw_phy11g_a2x_end,
|
+ ltq_gphy_decompress(&__ltq_fw_phy11g_a2x_start,
|
||||||
+ addr);
|
+ &__ltq_fw_phy11g_a2x_end,
|
||||||
|
+ addr);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void ltq_gphy_phy22f_a1x_load(ulong addr)
|
+void ltq_gphy_phy22f_a1x_load(ulong addr)
|
||||||
|
@ -2557,8 +2565,9 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+ extern ulong __ltq_fw_phy22f_a1x_start;
|
+ extern ulong __ltq_fw_phy22f_a1x_start;
|
||||||
+ extern ulong __ltq_fw_phy22f_a1x_end;
|
+ extern ulong __ltq_fw_phy22f_a1x_end;
|
||||||
+
|
+
|
||||||
+ ltq_gphy_copy(&__ltq_fw_phy22f_a1x_start, &__ltq_fw_phy22f_a1x_end,
|
+ ltq_gphy_decompress(&__ltq_fw_phy22f_a1x_start,
|
||||||
+ addr);
|
+ &__ltq_fw_phy22f_a1x_end,
|
||||||
|
+ addr);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+void ltq_gphy_phy22f_a2x_load(ulong addr)
|
+void ltq_gphy_phy22f_a2x_load(ulong addr)
|
||||||
|
@ -2566,8 +2575,9 @@ Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
|
||||||
+ extern ulong __ltq_fw_phy22f_a2x_start;
|
+ extern ulong __ltq_fw_phy22f_a2x_start;
|
||||||
+ extern ulong __ltq_fw_phy22f_a2x_end;
|
+ extern ulong __ltq_fw_phy22f_a2x_end;
|
||||||
+
|
+
|
||||||
+ ltq_gphy_copy(&__ltq_fw_phy22f_a2x_start, &__ltq_fw_phy22f_a2x_end,
|
+ ltq_gphy_decompress(&__ltq_fw_phy22f_a2x_start,
|
||||||
+ addr);
|
+ &__ltq_fw_phy22f_a2x_end,
|
||||||
|
+ addr);
|
||||||
+}
|
+}
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/arch/mips/cpu/mips32/vrx200/gphy_fw.S
|
+++ b/arch/mips/cpu/mips32/vrx200/gphy_fw.S
|
||||||
|
|
Loading…
Reference in a new issue