[U-Boot] [help] how does u-boot passing ``fdt'' to linux kernel & where is cmd_line?

Baojun Wang wangbj at gmail.com
Mon Jul 13 16:39:55 CEST 2009


On Mon, Jul 13, 2009 at 10:27 PM, Kumar Gala<galak at kernel.crashing.org> wrote:
>> My question is how does the kernel cmd line being passed? I know it's
>> possible for u-boot to patching the target uImage (assume we're using
>> kernel image cuImage.bamboo)'s dtb by overwrite the dtb ``chosen''
>> section, but I didn't find any code in u-boot trying to do this.
>
> Did you look at common/fdt_support.c and fdt_chosen()
>
> The command lines is passed in there as "bootargs"

That's all I need ;-)

>> Even more, after the kernel is bootstraping, (assume we're using a
>> bamboo board), we'll run into:
>>
>> static bd_t bd;
>>
>> ...
>> void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
>>                unsigned long r6, unsigned long r7)
>> {
>>        CUBOOT_INIT();
>>        bamboo_init(&bd.bi_enetaddr, &bd.bi_enet1addr);
>> }
>>
>> ...
>>
>> void bamboo_init(void *mac0, void *mac1)
>> {
>>        platform_ops.fixups = bamboo_fixups;
>>        platform_ops.exit = ibm44x_dbcr_reset;
>>        bamboo_mac0 = mac0;
>>        bamboo_mac1 = mac1;
>>        fdt_init(_dtb_start);
>>        serial_console_init();
>> }
>> ...
>>
>> this code will assume $r3 is passed as a ``bd_t'' structure, but $r3
>> passed in I think it's the dtb address (not bd_t), and bamboo_init
>> will set the NIC wrong MAC addresses. I'm quite sure I misunderstand
>> something between u-boot & linux kernel, could some help me to figure
>> it out? Thanks in advance!
>
> Where is the code you are referencing above?  This is the "old" bd_t style
> of booting.  Only the boot wrapper code or and old kernel would still be
> using this.
>
> - k
>

the code is from arch/powerpc/boot/cuboot-bamboo.c, and the kernel is
2.6.30.1, the boot image I'm using is something like cuImage.bamboo, I
checked zImage.ld.S, and found that when we're running cuImage.bamboo,
we actually fall into arch/powerpc/boot/crt0.S:_zimage_start(), which
will call platform_init() and then bamboo_init() finally. but sounds
like if we passing r3 as fdt, then the code (platform_init, etc.., and
even arch/powerpc/kernel/head_xxx.S start() function, only comments,
though) is actually wrong, isn't it? Thank you very much for help.

  Best Regards,
Wang


More information about the U-Boot mailing list