From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from vs81.iboxed.net ([185.82.85.146]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bHG3X-0006Sv-S7 for barebox@lists.infradead.org; Sun, 26 Jun 2016 19:49:25 +0000 From: Alexander Kurz Date: Sun, 26 Jun 2016 21:47:13 +0200 Message-Id: <1466970433-19810-1-git-send-email-akurz@blala.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH] ARM: boot: add prepend option for board specific ATAGs To: barebox@lists.infradead.org Cc: Alexander Kurz 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 --- arch/arm/Kconfig | 10 ++++++++++ arch/arm/lib/armlinux.c | 9 ++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 1fc887b..71374cc 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 47b9bd3..e1f8146 100644 --- a/arch/arm/lib/armlinux.c +++ b/arch/arm/lib/armlinux.c @@ -234,6 +234,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 +245,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" -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox