Skip to contentSkip to conversation

LIBFDT - changing command line

U-Boot Michal Simek 4 participants 9 messages Aug 11, 2009 – Aug 13, 2009

lore
Share & tools
lore
#0 lore raw

Hi All,

I would like to use fdt for changing command line in DTB but
I found there is one problem if I have longer command line which contains any spaces.
Below is my workflow.
If I understand correctly the problem is in cmd_fdt.c:fdt_parse_prop:593-603. It will be worth to add case for supporting
fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0"
copy from first " to next "

Or is it there any solution which I miss for this case?

Thanks,
Michal

U-Boot-mONStR> tftp 90780000 system.dtb
Using Xilinx LL TEMAC device
TFTP from server 192.168.0.102; our IP address is 192.168.0.3 Filename 'system.dtb'.
Load address: 0x90780000
Loading: 100BASE-T/FD
#
done
Bytes transferred = 9121 (23a1 hex)
U-Boot-mONStR> fdt addr 90780000
U-Boot-mONStR> fdt h

magic:                  0xd00dfeed
totalsize:              0x23a1 (9121)
off_dt_struct:          0x38
off_dt_strings:         0x14a0
off_mem_rsvmap:         0x28
version:                17
last_comp_version:      16
boot_cpuid_phys:        0x0
size_dt_strings:        0xf01
size_dt_struct:         0x1468
number mem_rsv:         0x0

U-Boot-mONStR> fdt list /chosen

chosen {
        bootargs = "console=ttyUL0,115200 highres=on root=/dev/mtdblock0";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};
U-Boot-mONStR> fdt set /chosen bootargs console=ttyUL root=/dev/mtdblock0
U-Boot-mONStR> fdt list /chosen
chosen {
        bootargs = "root=/dev/mtdblock0";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};

U-Boot-mONStR>

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#1 lore raw

Hi Michal

Quoted 11 lines · Michal Simek

Hi All,

I would like to use fdt for changing command line in DTB but
I found there is one problem if I have longer command line which contains any spaces.
Below is my workflow.
If I understand correctly the problem is in cmd_fdt.c:fdt_parse_prop:593-603. It will be worth to add case for supporting
fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0"
copy from first " to next "

Quoted 4 lines

Or is it there any solution which I miss for this case?

Thanks,
Michal

It is somewhat ugly, but the you can use "\" to escape the spaces:
fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

I did this originally (IIRC) so that I wouldn't have to deal with handling quotes in the parsing (Are they there? Are they balanced? What to do if not balanced?). Add in a dash of lazy...

[snip]

Best regards,
gvb

#2 lore raw
Quoted 15 lines · Jerry Van Baren

Hi Michal

Quoted 12 lines · Michal Simek

Hi All,

I would like to use fdt for changing command line in DTB but I found there is one problem if I have longer command line which contains any spaces.
Below is my workflow.
If I understand correctly the problem is in cmd_fdt.c:fdt_parse_prop:593-603.
It will be worth to add case for supporting
fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0" copy from first " to next "

Quoted 7 lines
Quoted 4 lines

Or is it there any solution which I miss for this case?

Thanks,
Michal

It is somewhat ugly, but the you can use "\" to escape the spaces:
fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Of course I tried it but simply not work.

U-Boot-mONStR> fdt list /chosen

chosen {
        bootargs = "console=ttyUL0,115200 highres=on root=/dev/mtdblock0";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};
U-Boot-mONStR> fdt set /chosen bootargs console=ttyUL\ root=dev
U-Boot-mONStR> fdt list /chosen
chosen {
        bootargs = "root=dev";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};

U-Boot-mONStR>

Can you tried it on your ppc?

Michal

Quoted 11 lines

I did this originally (IIRC) so that I wouldn't have to deal with handling quotes in the parsing (Are they there? Are they balanced? What to do if not balanced?). Add in a dash of lazy...

[snip]

Best regards,
gvb

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#3 lore raw

Hi Michal,

Quoted 37 lines · Michal Simek
Quoted 15 lines · Jerry Van Baren

Hi Michal

Quoted 12 lines · Michal Simek

Hi All,

I would like to use fdt for changing command line in DTB but I found there is one problem if I have longer command line which contains any spaces.
Below is my workflow.
If I understand correctly the problem is in cmd_fdt.c:fdt_parse_prop:593-603.
It will be worth to add case for supporting
fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0" copy from first " to next "

Quoted 6 lines
Quoted 4 lines

Or is it there any solution which I miss for this case?

Thanks,
Michal

It is somewhat ugly, but the you can use "\" to escape the spaces:
fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Of course I tried it but simply not work.

U-Boot-mONStR> fdt list /chosen

chosen {
        bootargs = "console=ttyUL0,115200 highres=on root=/dev/mtdblock0";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};
U-Boot-mONStR> fdt set /chosen bootargs console=ttyUL\ root=dev
U-Boot-mONStR> fdt list /chosen
chosen {
        bootargs = "root=dev";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};
Quoted 5 lines

U-Boot-mONStR>

Can you tried it on your ppc?

Michal

It is working for me. Are you running the "hush" shell or the old scripting interpreter?

=> fdt print /chosen

chosen {
         linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};
=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0
=> fdt print /chosen
chosen {
         bootargs = "console=ttyUL root=/dev/mtdblock0";
         linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};
=> fdt set /chosen bootargs console=ttyUL\ root=dev
=> fdt print /chosen
chosen {
         bootargs = "console=ttyUL root=dev";
         linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};

Best regards,
gvb

#4 lore raw

Dear Jerry Van Baren,

Quoted 2 lines · In message <[email protected]> you wrote:

=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Why not simply

=> fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0"

?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A man is not complete until he is married -- then he is finished.
#7 lore raw
In reply to Jerry Van Baren
Quoted 44 lines · Jerry Van Baren

Hi Michal,

Quoted 41 lines · Michal Simek
Quoted 16 lines · Jerry Van Baren

Hi Michal

Quoted 13 lines · Michal Simek

Hi All,

I would like to use fdt for changing command line in DTB but I found there is one problem if I have longer command line which contains
any spaces.
Below is my workflow.
If I understand correctly the problem is in cmd_fdt.c:fdt_parse_prop:593-603.
It will be worth to add case for supporting
fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0" copy from first " to next "

Quoted 6 lines
Quoted 4 lines

Or is it there any solution which I miss for this case?

Thanks,
Michal

It is somewhat ugly, but the you can use "\" to escape the spaces:
fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Of course I tried it but simply not work.

U-Boot-mONStR> fdt list /chosen

chosen {
        bootargs = "console=ttyUL0,115200 highres=on
root=/dev/mtdblock0";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};
U-Boot-mONStR> fdt set /chosen bootargs console=ttyUL\ root=dev
U-Boot-mONStR> fdt list /chosen
chosen {
        bootargs = "root=dev";
        linux,stdout-path = "/plb at 0/serial at 84000000";
};

U-Boot-mONStR>

Quoted 6 lines
Quoted 3 lines

Can you tried it on your ppc?

Michal

It is working for me. Are you running the "hush" shell or the old scripting interpreter?

old scripting. With hush works + 11kB.

Thanks,
Michal

Quoted 20 lines

=> fdt print /chosen

chosen {
        linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};
=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0
=> fdt print /chosen
chosen {
        bootargs = "console=ttyUL root=/dev/mtdblock0";
        linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};
=> fdt set /chosen bootargs console=ttyUL\ root=dev
=> fdt print /chosen
chosen {
        bootargs = "console=ttyUL root=dev";
        linux,stdout-path = "/soc8360 at e0000000/serial at 4500";
};

Best regards,
gvb

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#8 lore raw

Dear Michal Simek,

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 4 lines
Quoted 2 lines

It is working for me. Are you running the "hush" shell or the old scripting interpreter?

old scripting. With hush works + 11kB.

Actually this should make no difference.

Are you absolutely sure it does? If so, can you please prvide exact details?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Today is the yesterday you worried about tomorrow.
#5 lore raw
In reply to Wolfgang Denk
Quoted 7 lines · Wolfgang Denk

Dear Jerry Van Baren,

Quoted 1 line · In message <[email protected]> you wrote:

=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Why not simply

Quoted 7 lines

=> fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0"

?

Best regards,

Wolfgang Denk

Hi Wolfgang,

I did not try that last night. I should have because it should work, at least for hush.

Best regards,
gvb

#6 lore raw

Dear Jerry Van Baren,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 2 lines

=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0

Why not simply
=> fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0"
?

...

Quoted 2 lines

I did not try that last night. I should have because it should work, at least for hush.

Not only for hush. Ther eshould be no difference in this respect between the hush shell and the simple command line parser.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You may call me by my name, Wirth, or by my value, Worth.
- Nicklaus Wirth