Skip to content

Commit

Permalink
dev_tree: Fix appending cmdline if "bootargs" is already in DT
Browse files Browse the repository at this point in the history
Downstream device trees contain bootargs = "sched_enable_hmp=1".
The original intention was that this would get prepended to the real
command line. However, this currently only works with a modification
in libfdt (see 5ac5542) and has
therefore been broken since the libfdt update. Booting downstream was
effectively broken because the proper cmdline was missing.

Instead of modifying libfdt, fix this properly by replacing the null
terminator with a space.
  • Loading branch information
stephan-gh committed Jan 8, 2022
1 parent f5ebd9a commit 6e1deba
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions platform/msm_shared/dev_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,13 @@ int update_device_tree(void *fdt, const char *cmdline,
offset = ret;
if (cmdline)
{
int len;
char *oldargs = fdt_getprop_w(fdt, offset, "bootargs", &len);

/* Replace old null terminator so the strings are concatenated */
if (oldargs && len >= 1 && oldargs[len-1] == '\0')
oldargs[len-1] = ' ';

/* Adding the cmdline to the chosen node */
ret = fdt_appendprop_string(fdt, offset, (const char*)"bootargs", (const void*)cmdline);
if (ret)
Expand Down

0 comments on commit 6e1deba

Please sign in to comment.