mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
Merge pull request #398 from Linchenguang/master
[翻译完成]How to add kernel boot parameters via GRUB on Linux
This commit is contained in:
commit
ba73cfb854
@ -1,56 +0,0 @@
|
||||
|
||||
**【晨光】翻译中**
|
||||
|
||||
How to add kernel boot parameters via GRUB on Linux
|
||||
================================================================================
|
||||
The Linux kernel can be supplied with various parameters during boot time or at run time. These parameters customize the default behavior of the kernel, or inform the kernel about hardware configuration. Kernel parameters can be changed at run time by modifying files in /proc or /sys, while certain kernel parameters need be passed to the kernel at boot time by a boot loader such as GRUB or LILO.
|
||||
|
||||
In this tutorial, I will describe **how to add kernel boot parameters via GRUB on Linux**.
|
||||
|
||||
If you want to change or add kernel parameters when you are using GRUB boot loader, you can edit GRUB config file. The following are distro-specific ways to add kernel boot parameters to a GRUB config file.
|
||||
|
||||
### Add Kernel Boot Parameters on Debian or Ubuntu ###
|
||||
|
||||
If you want to add kernel parameters during boot time on a Debian based system, edit GRUB config template at /etc/default/grub. Add a kernel parameter in the form of “name=value” in GRUB_CMDLINE_LINUX_DEFAULT variable.
|
||||
|
||||
$ sudo -e /etc/default/grub
|
||||
|
||||
> GRUB_CMDLINE_LINUX_DEFAULT="...... name=value"
|
||||
|
||||
Then run the following command to actually generate a GRUB config file.
|
||||
|
||||
$ sudo update-grub
|
||||
|
||||
If the command update-grub is not found, you can install it as follows.
|
||||
|
||||
$ sudo apt-get install grub2-common
|
||||
|
||||
### Add Kernel Boot Parameters on Fedora ###
|
||||
|
||||
To add kernel parameters during boot time on Fedora, edit GRUB config template at /etc/default/grub. Add a kernel parameter in the form of “name=value” in GRUB_CMDLINE_LINUX variable.
|
||||
|
||||
$ sudo -e /etc/default/grub
|
||||
|
||||
> GRUB_CMDLINE_LINUX="...... name=value"
|
||||
|
||||
Then run the following command to generate a GRUB2 config file.
|
||||
|
||||
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
### Add Kernel Boot Parameters on CentOS ###
|
||||
|
||||
To add kernel parameters during boot on CentOS, directly edit a GRUB config file located at /boot/grub/grub.conf. In the config file, look for the entry describing the default Linux image used. The string “default=N” at the top of the config file indicates which entry is the default image.
|
||||
|
||||
[![](http://farm8.staticflickr.com/7429/10618657834_8082c2806b_z.jpg)][1]
|
||||
|
||||
Under the default image entry, append a kernel parameter to the line starting with “kernel /vmlinuz-”. A kernel parameter should be formatted as “name=value”.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2013/11/add-kernel-boot-parameters-via-grub-linux.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.flickr.com/photos/xmodulo/10618657834/
|
@ -0,0 +1,54 @@
|
||||
如何在linux上通过GRUB添加内核参数
|
||||
================================================================================
|
||||
|
||||
我们可以在linux内核启动时为其提供各种各样的参数。这些参数可以自定义内核默认的行为,或者通知内核关于硬件的配置信息。内核参数应在内核启动时通过引导装载程序如GRUB或LILO传递给内核。
|
||||
|
||||
在本教程中,我将会描述**如何在linux上通过GRUB添加内核参数**。
|
||||
|
||||
如果你在使用GRUB引导装载程序,想修改或添加内核参数,你可以编辑GRUB配置文件。下面是针对特定发行版在GRUB的配置文件中添加内核启动参数的方法。
|
||||
|
||||
### 在Debian或Ubuntu上添加内核启动参数###
|
||||
|
||||
在基于Debian的系统上,如果你想在系统启动时添加内核参数,你可以编辑 /etc/default/grub 目录下的GRUB配置模板。在 GRUB_CMDLINE_LINUX_DEFAULT 变量中以 “name=value” 的格式添加内核参数。
|
||||
|
||||
$ sudo -e /etc/default/grub
|
||||
|
||||
> GRUB_CMDLINE_LINUX_DEFAULT="...... name=value"
|
||||
|
||||
然后运行下面的命令来生成一个GRUB的配置文件。
|
||||
|
||||
$ sudo update-grub
|
||||
|
||||
如果无法找到 update-grub 命令,你可以通过下面的命令安装它。
|
||||
|
||||
$ sudo apt-get install grub2-common
|
||||
|
||||
### 在Fedora上添加内核启动参数 ###
|
||||
|
||||
在Fedora上,想要在启动时添加内核参数,你可以编辑 /etc/default/grub目录下的 GRUB 配置模板。在 GRUB_CMDLINE_LINUX 变量中以 “name=value” 的格式添加内核参数。
|
||||
|
||||
$ sudo -e /etc/default/grub
|
||||
|
||||
> GRUB_CMDLINE_LINUX="...... name=value"
|
||||
|
||||
然后运行下面的命令生成 GRUB2 配置文件。
|
||||
|
||||
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
### 在CentOS上添加内核启动参数 ###
|
||||
|
||||
在CentOS上,想要在启动时添加内核参数,你可以直接编辑GRUB配置文件 /boot/grub/grub.conf。在配置文件中,找到描述默认使用的Linux映像的条目。文件中最顶行的字符串 “default=N”会指示哪一个条目是默认的映像。
|
||||
|
||||
[![](http://farm8.staticflickr.com/7429/10618657834_8082c2806b_z.jpg)][1]
|
||||
|
||||
找到默认的映像条目后,在以 “kernel /vmlinuz-” 开头的那一段的结尾附加上内核参数。参数的格式为 “name=value” 。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2013/11/add-kernel-boot-parameters-via-grub-linux.html
|
||||
|
||||
译者:[Linchenguang](https://github.com/Linchenguang) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://www.flickr.com/photos/xmodulo/10618657834/
|
Loading…
Reference in New Issue
Block a user