int __init early_init_dt_scan_chosen(char *cmdline) { int l, node; constchar *p; constvoid *rng_seed; constvoid *fdt = initial_boot_params;
node = fdt_path_offset(fdt, "/chosen"); if (node < 0) node = fdt_path_offset(fdt, "/chosen@0"); if (node < 0) /* Handle the cmdline config options even if no /chosen node */ goto handle_cmdline;
/* Retrieve command line */ p = of_get_flat_dt_prop(node, "bootargs", &l); if (p != NULL && l > 0) strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
handle_cmdline: /* * CONFIG_CMDLINE is meant to be a default in case nothing else * managed to set the command line, unless CONFIG_CMDLINE_FORCE * is set in which case we override whatever was found earlier. */ #ifdef CONFIG_CMDLINE #if defined(CONFIG_CMDLINE_EXTEND) strlcat(cmdline, " ", COMMAND_LINE_SIZE); strlcat(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #elif defined(CONFIG_CMDLINE_FORCE) strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #else /* No arguments from boot loader, use kernel's cmdl*/ if (!((char *)cmdline)[0]) strscpy(cmdline, CONFIG_CMDLINE, COMMAND_LINE_SIZE); #endif #endif/* CONFIG_CMDLINE */
pr_debug("Command line is: %s\n", (char *)cmdline);
return0; }
void __init early_init_dt_scan_nodes(void) { int rc;
/* Initialize {size,address}-cells info */ early_init_dt_scan_root();
/* Retrieve various information from the /chosen node */ rc = early_init_dt_scan_chosen(boot_command_line); if (rc) pr_warn("No chosen node found, continuing without\n");
/* * param_sysfs_builtin - add sysfs parameters for built-in modules * * Add module_parameters to sysfs for "modules" built into the kernel. * * The "module" name (KBUILD_MODNAME) is stored before a dot, the * "parameter" name is stored behind a dot in kernel_param->name. So, * extract the "module" name for all built-in kernel_param-eters, * and for all who have the same, call kernel_add_sysfs_param. */ staticvoid __init param_sysfs_builtin(void) { conststructkernel_param *kp; unsignedint name_len; char modname[MODULE_NAME_LEN];