summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander Kurz <akurz@blala.de>2016-06-26 21:47:13 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2016-06-29 08:20:28 +0200
commit0544df5be653d849ab03402984f4256f35a8c2b3 (patch)
treeda314376a3f6ea60fa3e7e4d80c0278925fd5a89 /arch
parentdb77cf34864e6a4acc10f8e398db0d71075e6447 (diff)
downloadbarebox-0544df5be653d849ab03402984f4256f35a8c2b3.tar.gz
barebox-0544df5be653d849ab03402984f4256f35a8c2b3.tar.xz
ARM: boot: add prepend option for board specific ATAGs
Board specific ATAGs might be passed to vendor provided kernels via the ARM_BOARD_APPEND_ATAG option. In this case, the board specific ATAGs will be appended to the end of the ATAG list. Anyway, some vendor provided kernels might crop the ATAG list at ATAG_MEM, also chopping off the board specific ATAGs, see linux squash_mem_tags() as reference. The Kindle-3 kernel is one example. This conflict might be solved by a) making ATAG_MEM optional which might break the existing behavour around squash_mem_tags() or b) by allowing the insertion of board specific ATAGs in front of ATAG_MEM which violates the requirement from Documentation/arm/Booting to order ATAGs by increasing address. Add option to insert board specific ATAGs in front of ATAG_MEM. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/Kconfig10
-rw-r--r--arch/arm/lib/armlinux.c12
2 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1fc887ba59..71374cce70 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -313,6 +313,16 @@ config ARM_BOARD_APPEND_ATAG
This option is purely to start some vendor provided kernels.
** DO NOT USE FOR YOUR OWN DESIGNS! **
+config ARM_BOARD_PREPEND_ATAG
+ bool "Prepend the board specific ATAGs"
+ depends on ARM_BOARD_APPEND_ATAG
+ help
+ Choose this option if your kernel crops the passed ATAG list e.g. at
+ ATAG_MEM, also cropping off the board specific ATAGs. This option
+ will pass all board specific ATAGs in front of all other ATAGs.
+ This option is purely to start some vendor provided kernels.
+ ** DO NOT USE FOR YOUR OWN DESIGNS! **
+
endmenu
menu "ARM specific settings"
diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 47b9bd33ed..6c7bd101c2 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -107,8 +107,9 @@ static struct tag *armlinux_get_bootparams(void)
BUG();
}
-#ifdef CONFIG_ARM_BOARD_APPEND_ATAG
static struct tag *(*atag_appender)(struct tag *);
+
+#if defined CONFIG_ARM_BOARD_APPEND_ATAG
void armlinux_set_atag_appender(struct tag *(*func)(struct tag *))
{
atag_appender = func;
@@ -234,6 +235,9 @@ static void setup_tags(unsigned long initrd_address,
const char *commandline = linux_bootargs_get();
setup_start_tag();
+ if (IS_ENABLED(CONFIG_ARM_BOARD_PREPEND_ATAG) && atag_appender)
+ params = atag_appender(params);
+
setup_memory_tags();
setup_commandline_tag(commandline, swap);
@@ -242,10 +246,10 @@ static void setup_tags(unsigned long initrd_address,
setup_revision_tag();
setup_serial_tag();
-#ifdef CONFIG_ARM_BOARD_APPEND_ATAG
- if (atag_appender != NULL)
+ if (IS_ENABLED(CONFIG_ARM_BOARD_APPEND_ATAG) && atag_appender &&
+ !IS_ENABLED(CONFIG_ARM_BOARD_PREPEND_ATAG))
params = atag_appender(params);
-#endif
+
setup_end_tag();
printf("commandline: %s\n"