[U-Boot] platform configuration

Hello
Reading u-boot's README paper and trying to figure out a few aspects:
(1) as I know the bootloader sets up memory area for argument passing, initializes it with data structures and fill up with the values. Is this the structure defined in $(UBOOT)/include/asm-arm/global_data.h, named 'global_data' ?
(2) this question is a consequence of the first. 'struct bd_info' from $(UBOOT)/include/asm-arm/u-boot.h is a structure holding board's specific information, am I right?
How is the address of boot parameters determined ("bd->bi_boot_params"). If speaking about Linux, it is defined in $(LINUX)/arch/arm/mach-xxx/Makefile.boot -- but how is it defined to be what it is?
(3) can't yet figure out how CONFIG_BOOTARGS is pulled in. Somwhow it should get into board's information structure?
Thanks in advance for comments.

Dear Roman,
In message 40a670230809250104h7b21926x7d4e3b2370d5f6d8@mail.gmail.com you wrote:
Reading u-boot's README paper and trying to figure out a few aspects:
(1) as I know the bootloader sets up memory area for argument passing, initializes it with data structures and fill up with the values. Is this the structure defined in $(UBOOT)/include/asm-arm/global_data.h, named 'global_data' ?
If by "argument passing" you mean argument passing to the Linux kernel, then no.
The "global data" structure is just ameans to work around the limitations of early start up, i. e. befor relocation to RAM when no stack is available yet and the data segment is not writable yet either.
(2) this question is a consequence of the first. 'struct bd_info' from $(UBOOT)/include/asm-arm/u-boot.h is a structure holding board's specific information, am I right?
Not really. bd_info is passing boot information ot old (arch/ppc) PowerPC Linux kernels.
How is the address of boot parameters determined ("bd->bi_boot_params"). If speaking about Linux, it is defined in $(LINUX)/arch/arm/mach-xxx/Makefile.boot -- but how is it defined to be what it is?
It's decided when you define the memory map for your Linux port.
(3) can't yet figure out how CONFIG_BOOTARGS is pulled in. Somwhow it should get into board's information structure?
No, not at all. It becomes part of the default U-Boot environment. See common/env_common.c
Best regards,
Wolfgang Denk

Hello,
2008/9/25 Wolfgang Denk wd@denx.de:
(2) this question is a consequence of the first. 'struct bd_info' from $(UBOOT)/include/asm-arm/u-boot.h is a structure holding board's specific information, am I right?
Not really. bd_info is passing boot information ot old (arch/ppc) PowerPC Linux kernels.
On the other hand this structure is used on many other platforms -- for example, in 'board_init()' functions presenting in $(UBOOT)/board/board_name/... Is this for compatibility or this structure was later enhanced to support other target as well?
(3) can't yet figure out how CONFIG_BOOTARGS is pulled in. Somwhow it should get into board's information structure?
No, not at all. It becomes part of the default U-Boot environment. See common/env_common.c
Alright -- 'default_environment' is populated with environment variables and values. Environment is stored either in FLASH, NAND, EEPROM etc. (depending on CFG_ENV_IS_IN_*).
'env_relocate()' is invoked from lib_<arch>/board.c. For instance, for ARM it will be start_armboot() right after initialization gets done (i.e. CPU, board, memory are ready) => therefore possible to put environment in RAM.
The process also involves CRC checking and if it's faulty, then restore configuration.
Well, something like that :) Correct me if I'm wrong.

On Thu, Sep 25, 2008 at 3:04 AM, Roman Mashak romez777@gmail.com wrote:
Hello
Reading u-boot's README paper and trying to figure out a few aspects:
(1) as I know the bootloader sets up memory area for argument passing, initializes it with data structures and fill up with the values. Is this the structure defined in $(UBOOT)/include/asm-arm/global_data.h, named 'global_data' ?
(2) this question is a consequence of the first. 'struct bd_info' from $(UBOOT)/include/asm-arm/u-boot.h is a structure holding board's specific information, am I right?
How is the address of boot parameters determined ("bd->bi_boot_params"). If speaking about Linux, it is defined in $(LINUX)/arch/arm/mach-xxx/Makefile.boot -- but how is it defined to be what it is?
(3) can't yet figure out how CONFIG_BOOTARGS is pulled in. Somwhow it should get into board's information structure?
Thanks in advance for comments.
Many (most?) ARM kernel ports use a format called ATAGS to pass information to the linux kernel at startup. CONFIG_CMDLINE_TAG tells u-boot to include ATAGS support, there are a variety of tags that can be included with different CONFIG options. Have a look at lib_arm/bootm.c - where the kernel actually gets called is in line 125, like so: theKernel(0, machid, bd->bi_boot_params)
where the arguments get put into registers r0, r1, r2 and are 0, the machine ID, and a pointer to the ATAGS structure respectively.
http://www.arm.linux.org.uk/developer/booting.php#5 also has some more info about the tags & booting

Hello,
2008/9/25 Andrew Dyer amdyer@gmail.com:
Many (most?) ARM kernel ports use a format called ATAGS to pass information to the linux kernel at startup.CONFIG_CMDLINE_TAG tells u-boot to include ATAGS support, there are a variety of tags that can
Oh, I see now. The TAG structures are defined in $(u-boot)/include/asm-arm/setup.h --- great deal of various tags (video, memory, initrd and so on).
be included with different CONFIG options. Have a look at lib_arm/bootm.c - where the kernel actually gets called is in line 125, like so: theKernel(0, machid, bd->bi_boot_params)
where the arguments get put into registers r0, r1, r2 and are 0, the machine ID, and a pointer to the ATAGS structure respectively.
Thanks a lot for such a useful and clear explanation.
participants (3)
-
Andrew Dyer
-
Roman Mashak
-
Wolfgang Denk