Reserving a portion of SDRAM for data transfer between U-Boot and the Linux kernel

How can I reserve a portion of SDRAM, say 4 bytes, to pass a flag between the U-Boot and the Linux kernel so that this reserved memory location is not initialized by the linker and the value stored after warm boot? I am trying to avoid using bootargs to minimize the wear and tear of the NAND flash used in the firmware. My question could be considered as an addition to the solution provided: How to determine cold boot and warm boot on an ARM processor?

I built u-boot.lds with the linker script below and built it with: -fno-zero-initialized-in-bss without success.

OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) ENTRY(_start) SECTIONS { . = 0x00000000; . = ALIGN(4); .text : { cpu/arm926ejs/start.o (.text) *(.text) } . = ALIGN(4); .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } . = ALIGN(4); .data : { *(.data) } . = ALIGN(4); .got : { *(.got) } . = .; __u_boot_cmd_start = .; .u_boot_cmd : { *(.u_boot_cmd) } __u_boot_cmd_end = .; . = ALIGN(4); __bss_start = .; _U_BOOT_FLAG = .; . = . + 4; .bss (NOLOAD) : { *(.bss) . = ALIGN(4); } _end = .; } 

Any ideas?

+8
arm memory linux-kernel embedded-linux u-boot
source share
2 answers

There is already a method for transferring data between the U-Boot and the Linux ARM kernel. It is called the ATAG memory list. Information, such as areas of useful memory and information about the board, is transferred from the U-Boot to the Linux ARM kernel using this data list. You can define a custom ATAG for your data. In U-Boot, add your routine to create your ARM tag in lib_arm/armlinux.c . ATAGs are then processed in arch/arm/kernel/setup.c .

For documentation, see section 8 this or this alt site .

ADDITION
Links to the referenced ATAG documentation are minor (even Google has a bad link).
Try to find the actual name of the document, which is "Download ARM Linux" by Vincent Sanders.
There is currently a copy in the Google cache on simtec, and a Korean translation (?) Has appeared in a broader search.

Another or earlier version (?) (But it seems to have been updated) of Russel King on ARM download here .

+3
source share

If you want to move on to the global variable approach in How to detect cold boot or warm boot on an ARM processor? :

You can make this global variable reside in a specific ELF section (see http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Variable-Attributes.html ), and then set this section to a specific address in the script builder .

If you have good ld-script skills, you can even get a linker to initialize all bss sections except one :)

0
source share

All Articles