aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2012-02-14 17:48:04 +0000
committerJohn Crispin <blogic@openwrt.org>2012-02-14 17:48:04 +0000
commitf7b9691687050c32e7bb25a4655d4850630ef7df (patch)
tree99f52b7f4e0ef57fdafe33f296ef62795f501987 /target/linux/lantiq/patches
parentb90d992cc7f30e7dac8e2a6221ccc2a7c63174cb (diff)
downloadupstream-f7b9691687050c32e7bb25a4655d4850630ef7df.tar.gz
upstream-f7b9691687050c32e7bb25a4655d4850630ef7df.tar.bz2
upstream-f7b9691687050c32e7bb25a4655d4850630ef7df.zip
[lantiq] Support booting the Speedport W502V using BRN-BOOT.
While the disadvantage is less available flash space, it's easy and safe to flash without opening the device. Going back to the original firmware is also possible. This patch add two firmware utilities, mkbrncmdline and mkbrnboot. mkbrncmdline patches the uncompressed kernel so the registeres a0 to a3 are initialized and the memory size is passed in. mkbrnboot takes the lzma compressed kernel and squashfs images and creates a firmware image that can be flashed using the BRN-BOOT recovery kernel, which is booted by holding both buttons when powering up the device and will listen on http://192.168.2.1. The firmware file from bin/lantiq/ to use is openwrt-lantiq-danube-ARV4525PW-BRNDTW502-brnImage The BRN-BOOT recovery kernel does size-check the image, so if it's too big to fit into flash it will complain accordingly. A second patch is needed to make the wired network interface work since there is no u-boot to pre-initialise it. Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30532 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/patches')
-rw-r--r--target/linux/lantiq/patches/206-owrt-brnboot.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/target/linux/lantiq/patches/206-owrt-brnboot.patch b/target/linux/lantiq/patches/206-owrt-brnboot.patch
new file mode 100644
index 0000000000..c21d76d1f8
--- /dev/null
+++ b/target/linux/lantiq/patches/206-owrt-brnboot.patch
@@ -0,0 +1,93 @@
+Index: linux-3.1.9/drivers/mtd/mtdpart.c
+===================================================================
+--- linux-3.1.9.orig/drivers/mtd/mtdpart.c 2012-01-29 22:55:30.295904157 +0100
++++ linux-3.1.9/drivers/mtd/mtdpart.c 2012-01-29 22:55:30.395904294 +0100
+@@ -899,6 +899,38 @@
+ return le32_to_cpu(temp) == SQUASHFS_MAGIC;
+ }
+
++static unsigned long find_brnimage_size(struct mtd_info *mtd,
++ unsigned long offset)
++{
++ unsigned long buf[4];
++ // Assume at most 2MB of kernel image
++ unsigned long end = offset + (2 << 20);
++ unsigned long ptr = offset + 0x400 - 12;
++ size_t len;
++ int ret;
++
++ while (ptr < end) {
++ long size_min = ptr - 0x400 - 12 - offset;
++ long size_max = ptr + 12 - offset;
++ ret = mtd->read(mtd, ptr, 16, &len, (void *)buf);
++ if (ret || len != 16)
++ return 0;
++
++ if (le32_to_cpu(buf[0]) < size_min ||
++ le32_to_cpu(buf[0]) > size_max) {
++ ptr += 0x400;
++ continue;
++ }
++
++ if (le32_to_cpu(buf[3]) == SQUASHFS_MAGIC)
++ return ptr + 12 - offset;
++
++ ptr += 0x400;
++ }
++
++ return 0;
++}
++
+ static int split_uimage(struct mtd_info *mtd,
+ const struct mtd_partition *part)
+ {
+@@ -916,8 +948,11 @@
+
+ split_partitions[0].size = find_uimage_size(mtd, part->offset);
+ if (!split_partitions[0].size) {
+- printk(KERN_NOTICE "no uImage found in linux partition\n");
+- return -1;
++ split_partitions[0].size = find_brnimage_size(mtd, part->offset);
++ if (!split_partitions[0].size) {
++ printk(KERN_NOTICE "no uImage or brnImage found in linux partition\n");
++ return -1;
++ }
+ }
+
+ if (!detect_squashfs_partition(mtd,
+Index: linux-3.1.9/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h
+===================================================================
+--- linux-3.1.9.orig/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 2012-01-29 22:55:30.195904014 +0100
++++ linux-3.1.9/arch/mips/include/asm/mach-lantiq/xway/lantiq_soc.h 2012-01-29 22:55:30.395904294 +0100
+@@ -149,6 +149,7 @@
+
+ extern __iomem void *ltq_ebu_membase;
+ extern __iomem void *ltq_cgu_membase;
++extern long ltq_brn_boot;
+
+ /* request a non-gpio and set the PIO config */
+ extern int ltq_gpio_request(unsigned int pin, unsigned int alt0,
+Index: linux-3.1.9/arch/mips/lantiq/setup.c
+===================================================================
+--- linux-3.1.9.orig/arch/mips/lantiq/setup.c 2012-01-29 22:55:30.095903875 +0100
++++ linux-3.1.9/arch/mips/lantiq/setup.c 2012-01-29 22:59:28.686237119 +0100
+@@ -20,6 +20,8 @@
+
+ /* assume 16M as default incase uboot fails to pass proper ramsize */
+ unsigned long physical_memsize = 16L;
++/* set to 1 if the bootloader is BRN-BOOT instead of u-boot */
++unsigned long ltq_brn_boot = 0;
+
+ void __init plat_mem_setup(void)
+ {
+@@ -39,6 +41,10 @@
+ if (strict_strtoul(e, 0, &physical_memsize))
+ pr_warn("bad memsize specified\n");
+ }
++ if (!strncmp(e, "BRN-BOOT", 8)){
++ pr_info("Found BRN-BOOT instead of u-boot\n");
++ ltq_brn_boot = 1;
++ }
+ envp++;
+ }
+ physical_memsize *= 1024 * 1024;