cmdline.txt character limit

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

cmdline.txt character limit

Postby pezz » Sun Oct 14, 2012 5:45 am

Hi all,

I seem to be coming up against some sort of maximum character limit in "cmdline.txt", e.g. I had "... all the other options... root=/dev/mapper/root initrd=0x00f00000 ro quiet" truncated to "... root=/dev/mapper/r"

Haven't found any info searching, so I was wondering if anyone knew what the actual limit is so can I can trim some options and make sure everything I want is getting passed.

Also, is it possible to increase this limit or work around it somehow?

Cheers.
pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: cmdline.txt character limit

Postby pepedog » Sun Oct 14, 2012 9:27 am

It would have been interesting to see your complete cmdline.txt, but I think only Dom can answer, unless there is a kernel param limit?
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: cmdline.txt character limit

Postby pezz » Sun Oct 14, 2012 9:38 am

Ah, I've changed it now, but pretty sure this was it:

$this->bbcode_second_pass_code('', 'sdhci-bcm2708.enable_llm=1 sdhci-bcm2708.sync_after_dma=0 sdhci-bcm2708.cycle_delay=1000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 ip=192.168.150.2::192.168.150.254:255.255.255.0:pi:eth0:none cryptdevice=/dev/mmcblk0p3:root:allow-discards root=/dev/mapper/root initrd=0x00f00000 ro quiet')
pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: cmdline.txt character limit

Postby pepedog » Sun Oct 14, 2012 9:43 am

324 characters? Turning into a novel?
http://www.kernel.org/doc/Documentation/kernel-parameters.txt
$this->bbcode_second_pass_quote('', 'T')he number of kernel parameters is not limited, but the length of the
complete command line (parameters including spaces etc.) is limited to
a fixed number of characters. This limit depends on the architecture
and is between 256 and 4096 characters. It is defined in the file
./include/asm/setup.h as COMMAND_LINE_SIZE.
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: cmdline.txt character limit

Postby pezz » Sun Oct 14, 2012 10:04 am

Thanks for that. I had some kernel source lying around from a while ago (I don't need to build kernels any more thanks to you adding the option I wanted - cheers btw), and it says:

$this->bbcode_second_pass_code('', '#define COMMAND_LINE_SIZE 512')

So with my trimmed version, plus a bunch of other stuff that gets added from somewhere else, it's:

$this->bbcode_second_pass_code('', '% wc -c /proc/cmdline
494 /proc/cmdline')

So I have 18 chars to play with... :)
pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: cmdline.txt character limit

Postby pezz » Wed Oct 24, 2012 5:44 am

Sorry to bump this, but after the recent kernel updates, I've again run out of characters for the cmdline.txt I want to use.

Once I remove my ip=<long string> option, my /proc/cmdline is 473 characters.

There's a bunch of arguments that cmdline.txt is appended to that I have no control over.

If it's going to change at various times with kernel updates, then it's going to be very hard for me to add the things suggested by updates (e.g. a recent update said to add "sdhci-bcm2708.cycle_delay=1000") as well as have my own options work (and keep things bootable).

All of this (for example):
$this->bbcode_second_pass_code('', '
dma.dmachans=0x7f35 bcm2708_fb.fbwidth=1280 bcm2708_fb.fbheight=1024 bcm2708.boardrev=0x2 bcm2708.serial=0x12345678 smsc95xx.macaddr=xx:xx:xx:xx:xx:xx sdhci-bcm2708.emmc_clock_freq=100000000 vc_mem.mem_base=0xf000000 vc_mem.mem_size=0x10000000')
Is part of the kernel cmdline before cmdline.txt gets appended.

Would it be considered too hacky to ask for asm-generic/setup.h to be patched to something bigger than 512?

Cheers.
pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: cmdline.txt character limit

Postby pepedog » Wed Oct 24, 2012 8:48 am

Ill try to remember
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: cmdline.txt character limit

Postby pezz » Wed Oct 24, 2012 8:54 am

I can lodge a Github request if that'll help?
pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia

Re: cmdline.txt character limit

Postby pepedog » Wed Oct 24, 2012 9:01 am

It might be better upstream, then all distro can make use
https://github.com/raspberrypi/linux/issues
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: cmdline.txt character limit

Postby pezz » Wed Oct 24, 2012 9:47 am

pezz
 
Posts: 76
Joined: Fri Sep 14, 2012 11:19 pm
Location: Geelong, Australia


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 28 guests