I want to pass a custom parameter to the kernel at boot time, which my new code will use. This parameter is a number.
I know how to pass value to kernel module using kernel command line i.e module_param()
. Now i want to pass value from u-boot.
Is there a way to do this, either during or after boot?
Advertisement
Answer
Modify your board file present in include/config/board_xxx.h of U-Boot, modify $bootargs similar to the last variable that is set in this example:
setenv bootargs display=${display} console=${consoledev},${baudrate} root=/dev/mmcblk0p1 rw rootdelay=1 control.cmd1={cmd1}
control is the name of the built-in driver module that I cannot insmod because I need it for booting fully to the Linux prompt.
cmd1 is the global variable I’ve defined in the module in which I’ve used:
module_param(cmd1, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
so, your $bootargs var simply needs to be appended with something like:
<your_mod_name>.<your_mod_parameter_var_name>=<an_appropriate_value>