[U-Boot] LIBFDT - changing command line

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@0/serial@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@0/serial@84000000"; }; U-Boot-mONStR>

Hi Michal
Michal Simek wrote:
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
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

Jerry Van Baren wrote:
Hi Michal
Michal Simek wrote:
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
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@0/serial@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@0/serial@84000000"; }; U-Boot-mONStR>
Can you tried it on your ppc?
Michal
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

Hi Michal,
Michal Simek wrote:
Jerry Van Baren wrote:
Hi Michal
Michal Simek wrote:
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
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@0/serial@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@0/serial@84000000"; }; 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@e0000000/serial@4500"; }; => fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0 => fdt print /chosen chosen { bootargs = "console=ttyUL root=/dev/mtdblock0"; linux,stdout-path = "/soc8360@e0000000/serial@4500"; }; => fdt set /chosen bootargs console=ttyUL\ root=dev => fdt print /chosen chosen { bootargs = "console=ttyUL root=dev"; linux,stdout-path = "/soc8360@e0000000/serial@4500"; };
Best regards, gvb

Dear Jerry Van Baren,
In message 4A837625.6010507@gmail.com 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

Wolfgang Denk wrote:
Dear Jerry Van Baren,
In message 4A837625.6010507@gmail.com 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
Hi Wolfgang,
I did not try that last night. I should have because it should work, at least for hush.
Best regards, gvb

Dear Jerry Van Baren,
In message 4A8405FF.1060305@ge.com you wrote:
=> fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0
Why not simply => fdt set /chosen bootargs "console=ttyUL root=/dev/mtdblock0" ?
...
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

Jerry Van Baren wrote:
Hi Michal,
Michal Simek wrote:
Jerry Van Baren wrote:
Hi Michal
Michal Simek wrote:
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
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@0/serial@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@0/serial@84000000"; }; 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?
old scripting. With hush works + 11kB.
Thanks, Michal
=> fdt print /chosen chosen { linux,stdout-path = "/soc8360@e0000000/serial@4500"; }; => fdt set /chosen bootargs console=ttyUL\ root=/dev/mtdblock0 => fdt print /chosen chosen { bootargs = "console=ttyUL root=/dev/mtdblock0"; linux,stdout-path = "/soc8360@e0000000/serial@4500"; }; => fdt set /chosen bootargs console=ttyUL\ root=dev => fdt print /chosen chosen { bootargs = "console=ttyUL root=dev"; linux,stdout-path = "/soc8360@e0000000/serial@4500"; };
Best regards, gvb

Dear Michal Simek,
In message 4A83DB8E.1030707@monstr.eu you wrote:
...
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
participants (4)
-
Jerry Van Baren
-
Jerry Van Baren
-
Michal Simek
-
Wolfgang Denk