From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Date: Thu, 1 Sep 2011 13:34:28 +0200 Subject: [U-Boot] [PATCH 02/15] Store existing atags at startup if chainloading. In-Reply-To: <1314876881-9669-1-git-send-email-pali.rohar@gmail.com> References: <201109011304.46581.marek.vasut@gmail.com> <1314876881-9669-1-git-send-email-pali.rohar@gmail.com> Message-ID: <1314876881-9669-2-git-send-email-pali.rohar@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Alistair Buxton This patch stores the values in r1 and r2 at startup. It also stores the address which u-boot was originally loaded to. This is useful if you feed some other bootloader a u-boot.bin instead of the linux kernel it was expecting. It is rather ugly because it stores these values in an arbitrary memory address. Signed-off-by: Alistair Buxton --- arch/arm/cpu/armv7/start.S | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index db8e9d2..8a456f0 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -134,6 +134,22 @@ IRQ_STACK_START_IN: */ reset: +#if (CONFIG_CHAINLOADER) + /* + * Ugly hack: store the u-boot load address and kernel params + * 0x82000004: address where this image was loaded + * 0x82000008: mach_type + * 0x8200000c: atags address + */ + adr r0, _start + mov r3, #0x82000000 + add r3, r3, #4 + str r0, [r3] + add r3, r3, #4 + str r1, [r3] + add r3, r3, #4 + str r2, [r3] +#endif bl save_boot_params /* * set the cpu to SVC32 mode -- 1.7.4.1