在linux中,可以使用 dracut 命令生成 initrd 文件,命令格式是:
dracut [OPTION...] [<image> [<kernel version>]]
在生成的过程中,可以指定需要添加的驱动模块,例如下面这条命令中的 module1、module2(位于 /lib/modules 目录下):
$ dracut --add-drivers "module1 module2" image kernel_version
dracut 的 -l 选项可以激活本地模式,当指定 -l 选项后,dracut 将会使用当前目录里的模块,而不是使用整个系统安装的模块目录:/usr/lib/dracut/modules.d