<div dir="ltr">I guess you guys are right as the fourth option indeed does not exist nor has been discussed in the past. <div><br></div><div style>I am developing on multiple Amlogic Meson3 devices at the moment. As it is still unclear which uboot sources the Chinese used and I do not want to brick people their devices by flashing a custom firmware. I simply do not want to touch the whole uboot environment. I just flash the kernel to the same partition on the NAND, so uboot starts it. From that point I want to take over full control.</div>
<div style><br></div><div style>By using the FORCE option we also loose the MAC variable which is set in hardware and passed by uboot (+ any other strange params, they Chinese put in for whatever reason?). I just want to overwrite the root= and rootfstype= parameter, and use the rest from uboot. That way, I do not have to touch the uboot stuff on the nand, which can hardbrick the devices as they are not as well protected as the Allwinner for instance.</div>
<div style><br></div><div style>Anyway, the fourth option has been created;</div><div style><br></div><div style><div>diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig</div><div>index c824452..4c5a7ab 100644</div><div>--- a/arch/arm/Kconfig</div>
<div>+++ b/arch/arm/Kconfig</div><div>@@ -1481,6 +1481,12 @@ config CMDLINE_FORCE</div><div> command-line options your boot loader passes to the kernel.</div><div><br></div><div> If unsure, say N.</div><div>
+</div><div>+config CMDLINE_APPEND</div><div>+ bool "Append default kernel command string to bootloader kernel arguments"</div><div>+ help</div><div>+ The default kernel command string will be appended to the</div>
<div>+ command-line arguments provided by the boot loader.</div><div> endchoice</div><div><br></div><div> config XIP_KERNEL</div><div>diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c</div><div>index b0c25fa..418308e 100644</div>
<div>--- a/arch/arm/kernel/setup.c</div><div>+++ b/arch/arm/kernel/setup.c</div><div>@@ -652,6 +652,10 @@ static int __init parse_tag_cmdline(const struct tag *tag)</div><div> strlcat(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);</div>
<div> #elif defined(CONFIG_CMDLINE_FORCE)</div><div> pr_warning("Ignoring tag cmdline (using the default kernel command line)\n");</div><div>+#elif defined(CONFIG_CMDLINE_APPEND)</div><div>+ strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);</div>
<div>+ strlcat(default_command_line, " ", COMMAND_LINE_SIZE);</div><div>+ strlcat(default_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);</div><div> #else</div><div> strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);</div>
<div> #endif</div><div><br></div><div style>Was just suprised I am the first one that only want to override some of the uboot parameters. But guess, that what I want is to "hacky" as you would normally just change the uboot parameters.</div>
<div style><br></div><div style>Thanks guys</div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Feb 20, 2013 at 11:26 AM, Liviu Dudau <span dir="ltr"><<a href="mailto:liviu@dudau.co.uk" target="_blank">liviu@dudau.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Peter,<br>
<br>
The 4th option that you want doesn't exist.<br>
<br>
Thing is, if you want to overwrite some of u-boot options then the following<br>
two things are true:<br>
<br>
a. you know the u-boot parameters<br>
b. you know one (or many) of them are wrong<br>
<br>
Most people in that case use option 2) and overwrite the bootloader command<br>
line with the one they want. If you are worried about someone going into<br>
u-boot and adding another useful command line parameter that you might be<br>
missing if you use option 2) then you need to explain to them what they<br>
also need to correct in that command line that is currently broken.<br>
<br>
Best regards,<br>
Liviu<br>
<div><div class="h5"><br>
<br>
On Wed, Feb 20, 2013 at 10:17:31AM +0100, Peter Steenbergen wrote:<br>
> Thanks Piyush,<br>
><br>
> I know about the uboot saved parameters. The whole point is that I do not<br>
> want to touch the by the factory flashed uboot. There are now three<br>
> CONFIG_CMDLINE options<br>
> 1) CONFIG_CMDLINE_BOOTLOADER == Always use the ones passed by the bootloader<br>
> 2 CONFIG_CMDLINE_FORCE == Always use the under CMDLINE defined parameters,<br>
> ignore the ones passed by the bootloader<br>
> 3) CONFIG_EXTEND == Insert parameters and APPEND the ones passed by the<br>
> bootloader. This is designed such, that you can define missing parameters<br>
> not defined by the bootloader.<br>
><br>
> With the latter, if you define a parameter which is also passed by the<br>
> bootloader, the by CMDLINE configured one wil be overwritten by the one<br>
> passed from the bootloader. This is simply because the function to fill for<br>
> instance the rootfstype parameter is called twice.<br>
><br>
> What I am basically are looking for is a fourth config option,<br>
> CONFIG_CMDLINE_OVERRIDE, where the by the bootloader passed parameters are<br>
> being appended by the ones defined in the CMDLINE. It is basically the<br>
> EXTEND, but then the other way around. It still EXTENDS the ones not<br>
> defined by the bootloader, but if you define a parameter in the kernel<br>
> which is also set by the CMDLINE the ones from the bootloader are<br>
> overwritten by the ones defined in the kernel.<br>
><br>
> At this moment, a quick hack has been applied to set a boolean for the<br>
> rootfstype one;<br>
> <a href="https://github.com/j1nx/buildroot-linux-kernel-m3/commit/52476f9f911ee9c08acda0976331aa5465ff16a7" target="_blank">https://github.com/j1nx/buildroot-linux-kernel-m3/commit/52476f9f911ee9c08acda0976331aa5465ff16a7</a><br>
> But a fourth CONFIG parameter will solve the same issue for any other<br>
> possible parameters. The thing is; I can't believe I am the only one that<br>
> wants to override uboot parameters. It might be already out there...<br>
><br>
> Cheers<br>
><br>
><br>
> On Wed, Feb 20, 2013 at 3:32 AM, Piyush Verma <<a href="mailto:piyush.pv@gmail.com">piyush.pv@gmail.com</a>> wrote:<br>
><br>
> > While booting we can stop at uboot prompt.<br>
> ><br>
> > there we can see all environment variable with printenv.<br>
> > we can change it by setenv. don't forget to save it by saveenv after<br>
> > changing environment variable.<br>
> ><br>
> > bootargs is the environment variable where we can pass all rootfs details.<br>
> ><br>
> > Does it solve ur issue ?<br>
> ><br>
> > On Wed, Feb 20, 2013 at 4:01 AM, Peter Steenbergen <<a href="mailto:p.steenbergen@j1nx.nl">p.steenbergen@j1nx.nl</a>>wrote:<br>
> ><br>
> >> I am running into an issue with my Amlogic XBMC development. Before I go<br>
> >> out searching the dark secrets of the linux kernel, I thought why not ask<br>
> >> you guys first.<br>
> >><br>
> >> There is this patch;<br>
> >><br>
> >> <a href="http://lists.infradead.org/pipermail/linux-arm-kernel/2011-April/047506.html" target="_blank">http://lists.infradead.org/pipermail/linux-arm-kernel/2011-April/047506.html</a><br>
> >> Which is used often. It adds the CONFIG_CMDLINE_EXTEND to the possible<br>
> >> CMDLINE options. It is designed to prepend the cmdline parameters in case<br>
> >> there are missing values. The passed parameters by uboot are then appended<br>
> >> to the ones from CONFIG_CMDLINE.<br>
> >><br>
> >> This all works fine if you indeed are missing parameters, but what if i<br>
> >> want to overwrite/override an already by uboot passed parameter? (like<br>
> >> root= and rootfstype=)<br>
> >><br>
> >> I don't want to FORCE everything, because I then have to take over the<br>
> >> complete line as passed by uboot. If I do that I will loose the parameters<br>
> >> set by variables within uboot (MAC)<br>
> >><br>
> >> If I set them in CMDLINE, then the ones passed from uboot are appended<br>
> >> and overriding the ones from CMDLINE.<br>
> >><br>
> >> I also do not want to change uboot as that is still kind of tricky on the<br>
> >> Amlogic boxes.<br>
> >><br>
> >> Do anyone of you guys have some tips and/or directions?<br>
> >><br>
> >> thanks<br>
> >><br>
> >> _______________________________________________<br>
> >> arm-netbook mailing list <a href="mailto:arm-netbook@lists.phcomp.co.uk">arm-netbook@lists.phcomp.co.uk</a><br>
> >> <a href="http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook" target="_blank">http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook</a><br>
> >> Send large attachments to <a href="mailto:arm-netbook@files.phcomp.co.uk">arm-netbook@files.phcomp.co.uk</a><br>
> >><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Thanks & Regards<br>
> ><br>
> > Piyush Verma<br>
> ><br>
> ><br>
> > _______________________________________________<br>
> > arm-netbook mailing list <a href="mailto:arm-netbook@lists.phcomp.co.uk">arm-netbook@lists.phcomp.co.uk</a><br>
> > <a href="http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook" target="_blank">http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook</a><br>
> > Send large attachments to <a href="mailto:arm-netbook@files.phcomp.co.uk">arm-netbook@files.phcomp.co.uk</a><br>
> ><br>
<br>
> _______________________________________________<br>
> arm-netbook mailing list <a href="mailto:arm-netbook@lists.phcomp.co.uk">arm-netbook@lists.phcomp.co.uk</a><br>
> <a href="http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook" target="_blank">http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook</a><br>
> Send large attachments to <a href="mailto:arm-netbook@files.phcomp.co.uk">arm-netbook@files.phcomp.co.uk</a><br>
<br>
<br>
--<br>
</div></div>-------------------<br>
.oooO<br>
( )<br>
\ ( Oooo.<br>
\_) ( )<br>
) /<br>
(_/<br>
<br>
One small step<br>
for me ...<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
_______________________________________________<br>
arm-netbook mailing list <a href="mailto:arm-netbook@lists.phcomp.co.uk">arm-netbook@lists.phcomp.co.uk</a><br>
<a href="http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook" target="_blank">http://lists.phcomp.co.uk/mailman/listinfo/arm-netbook</a><br>
Send large attachments to <a href="mailto:arm-netbook@files.phcomp.co.uk">arm-netbook@files.phcomp.co.uk</a><br>
</div></div></blockquote></div><br></div>