In Head.s, there is such a call:
/* Pass the Uboot arguments to the global value command
R0 = R7;
Call _cmdline_init;
In fact, it is to save the parameters passed by the u-boot, and transmit them to the corresponding modules at the appropriate time (see "U-boot to Uclinux"). Because it does not use a bootstrapper such as U-boot, it is directed directly, so the appropriate modifications are made.
First look at the implementation of Cmdline_init, this function in Arch/blackfin/kernel/setup.c (714):
Char __initdata command_line[command_line_size];
void __init cmdline_init (const char *r0)
{
if (R0)
strncpy (Command_line, R0, command_line_size);
}
It's very simple to save the parameters and then analyze the parameters in the process of starting later.
I wanted to put the parameter definition in Config.h, but in this case, each modification of the parameter necessarily caused the entire kernel to recompile, too painful, so directly replace the string to save the parameter r0.
void __init cmdline_init (const char *r0)
{
if (R0)
strncpy (Command_line, R0, command_line_size);
if (R0)
strncpy (Command_line, "", command_line_size);
}
An empty string is temporarily used, and the content is added later.