How to pass a value to a builtin Linux kernel module at boot time?

后端 未结 3 1330
轮回少年
轮回少年 2021-02-04 11:14

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 ker

3条回答
  •  滥情空心
    2021-02-04 12:19

    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:

    .=

提交回复
热议问题