u-boot tag代码疑问
void setup_commandline_tag (char *commandline)
{
char *p;
if (!commandline)
return;
/* eat leading white space */
for (p = commandline; *p == ' '; p++);
/* skip non-existent command lines so the kernel will still
* use its default command line.
*/
if (*p == '\0')
return;
params->hdr.tag = ATAG_CMDLINE;
params->hdr.size =
(sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2;
strcpy (params->u.cmdline.cmdline, p);
params = tag_next (params);
}
其中为什么有sizeof (struct tag_header) + strlen (p) + 1 + 4 要加1加4呢???
[解决办法]
路过,从代码上来看
看上去加1是字符串结束符
加4是为了>>2也就是处以4的时候取上值