summaryrefslogtreecommitdiff
path: root/target/mips/mikrotik-rb4xx/patches/3.14.45/0027-ar71xx-add-zboot-support.patch
blob: 1963931a901b2d0bcd77bd9f124480e392ff50dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From 38af1d72bd5c760623996c7a8978e05e007f0e96 Mon Sep 17 00:00:00 2001
From: Phil Sutter <phil@nwl.cc>
Date: Mon, 23 Jun 2014 02:51:10 +0200
Subject: [PATCH] ar71xx: add zboot support

This also contains a workaround for the decompressor overwriting the
bootloader-passed kernel parameters in memory.
---
 arch/mips/Kconfig                      | 2 ++
 arch/mips/boot/compressed/Makefile     | 6 ++++++
 arch/mips/boot/compressed/uart-16550.c | 6 ++++++
 3 files changed, 14 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 95fa1f1..3bb5324 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -106,6 +106,8 @@ config ATH79
 	select SYS_HAS_EARLY_PRINTK
 	select SYS_SUPPORTS_32BIT_KERNEL
 	select SYS_SUPPORTS_BIG_ENDIAN
+	select SYS_SUPPORTS_ZBOOT
+	select SYS_SUPPORTS_ZBOOT_UART16550
 	help
 	  Support for the Atheros AR71XX/AR724X/AR913X SoCs.
 
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 61af6b6..5a4491d 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -13,7 +13,13 @@
 #
 
 # set the default size of the mallocing area for decompressing
+ifeq ($(CONFIG_ATH79_MACH_RB4XX),y)
+# this needs to be smaller, otherwise the routerboot passed
+# kernel parameters fall into bss area (and are therefore zeroed)
+BOOT_HEAP_SIZE := 0x100000
+else
 BOOT_HEAP_SIZE := 0x400000
+endif
 
 # Disable Function Tracer
 KBUILD_CFLAGS := $(shell echo $(KBUILD_CFLAGS) | sed -e "s/-pg//")
diff --git a/arch/mips/boot/compressed/uart-16550.c b/arch/mips/boot/compressed/uart-16550.c
index 237494b..25cb145 100644
--- a/arch/mips/boot/compressed/uart-16550.c
+++ b/arch/mips/boot/compressed/uart-16550.c
@@ -12,6 +12,12 @@
 #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
 #endif
 
+#ifdef CONFIG_SOC_AR71XX
+#include <ar71xx_regs.h>
+#define PORT(offset) (CKSEG1ADDR(AR71XX_UART_BASE) + (4 * offset))
+#define IOTYPE unsigned int
+#endif
+
 #ifdef CONFIG_AR7
 #include <ar7.h>
 #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
-- 
1.8.5.3