PCI ROOT HID fail=0x5 ACPI Linux错误一般解决之道
我的两台服务器里dmesg里有以下错误,请教是什么原因?
os :rhel4.4
服务器型号: hp dl380 g4 ,g5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
hw_random hardware driver 1.0.0 loaded
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
shpchp: acpi_shpchprm:\_SB_.PCI0 evaluate _BBN fail=0x5
shpchp: acpi_shpchprm:get_device PCI ROOT HID fail=0x5
解决方式:
启动选项中增加参数:
修改/boot/grub/menu.lst文件,在启动的核心kernel那行最后加上
acpi=off noapic 或者acpi=noapic或者acpi=off
1)acpi=off禁止了一些电源高级管理功能,对应用程序没有影响。
2)noapic改变了中断方式,对应用也没有影响。
如果你的linux系统网卡无法收发数据,磁盘阵列光纤卡无法访问磁盘、系统启动时报ACPI然后停止等错误时,可以尝试上面的方法,会有意想不到效果哦!
本文转自南非蚂蚁51CTO博客,原文链接: http://blog.51cto.com/ixdba/526113,如需转载请自行联系原作者
VirtualBox安装CentOS6.5
a)新建虚拟机环境,由于VBox环境没有CentOS的选项,所以可以选择Red Hat Linux(64Bit)
b)动态分配硬盘大小所以你可以选择大一点的硬盘空间(不用的话不会占用的,但是C盘性能上没固定的好)
3、下载CentOS 6.5系统
CentOS系统官网:http://www.centos.org
4、安装CentOS
a)在VBOX主界面,选择刚刚新建的CentOS64,点击启动。
b) 选择你下载的CentOS6.5 的ISO文件
c)启动后看到CentOS6.5的安装界面,这里我选择第2个install system with basic video driver 安装
Install or upgrade an existing system 安装或升级现有的系统
install system with basic video driver 安装过程中采用基本的显卡驱动
Rescue installed system 进入系统修复模式
Boot from local drive 退出安装从硬盘启动
Memory test 内存检测
d)Disc Found,选择Skip(跳过)
e)welcome信息,点击ok
f)语言选择English。(我在安装的时候选择中文会报错)
g)键盘设置选择us
h)错误警告,不用去管,直接选择Re-initialize
i)时间时区选择Asia/Shanghai(UTC时间)
j)Password设置(root密码设置界面)
k)弱密码提醒,继续选择use Anyway(我设置的密码比较弱,所以有这个提示)
l)分区类型Partitioning Type选择ok
m)write changes to disk,然后就是等待CentOS安装。
n)安装完成,需要重启,点击reboot
到此安装已经完成,没有安装桌面组件,需要安装桌面组件的可以自行百度安装
重启之后,输入root 和安装时设置的密码即可进入:
网卡启用 ifup eth0
查看网卡: vi /etc/udev/rules.d/70-persistent-net.rules
网卡设置: vi /etc/sysconfig/network-scripts/ifcfg-eth0
安装 setup 工具 (没用可以略过)
yum install setuptool
yum install ntsysv
yum install iptables
yum install system-config-network-tui
yum install system-config-securitylevel-tui
禁用seLinux
sestatus #先执行看seLinux状态,如果不是disabled,就需要执行下面步骤,否则不要执行
vi /etc/selinux/config
SELINUX=disabled #禁用SeLinux
SELINUX=enforcing #使用SeLinux
禁止IPV6(执行后需要reboot重启)
具体方法:
1.修改/etc/sysconfig/network,追加:
NETWORKING_IPV6=no
2.修改/etc/hosts,把ipv6的那句本地主机名解析的也注释掉:
#::1 localhost localhost6 localhost6.localdomain6
3.在/etc/modprobe.d/dist.conf结尾添加
alias net-pf-10 off
alias ipv6 off
然后重启系统。
执行lsmod | grep -i ipv6 和 ifconfig | grep -i inet6,如果什么都没有则说明成功禁用。
关闭服务
1
2
3
4
5
6
7
8
9
10
11
12
13
[root@localhost ~]# chkconfig auditd off
[root@localhost ~]# chkconfig blk-availability off
[root@localhost ~]# chkconfig ip6tables off
[root@localhost ~]# chkconfig lvm2-monitor off
[root@localhost ~]# chkconfig netfs off
[root@localhost ~]# chkconfig udev-post off
[root@localhost ~]# chkconfig postfix off
[root@localhost ~]# chkconfig --list | grep 3:on
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
清空防火墙并设置规则(可选)
1
2
3
4
5
6
7
8
9
10
[root@localhost~]# iptables -F #清楚防火墙规则
[root@localhost~]# iptables -L #查看防火墙规则
[root@localhost~]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
[root@localhost~]# iptables -A INPUT -p tcp --dport 22 -j ACCEPT
[root@localhost~]# iptables -A INPUT -p tcp --dport 53 -j ACCEPT
[root@localhost~]# iptables -A INPUT -p udp --dport 53 -j ACCEPT
[root@localhost~]# iptables -A INPUT -p udp --dport 123 -j ACCEPT
[root@localhost~]# iptables -A INPUT -p icmp -j ACCEPT
[root@localhost~]# iptables -P INPUT DROP
[root@localhost~]# /etc/init.d/iptables save
启动是出错: MP-BIOS bug:8254 timer not connected to IO-APIC
进入后到/boot/grub/menu.lst的kernel内核这一行来的最后添加noapic 这个选项。
本文转自hbyh 51CTO博客,原文链接:http://blog.51cto.com/norman20000/1741469,如需转载请自行联系原作者
uboot环境变量与内核MTD分区关系
分区只是内核的概念,就是说A~B地址放内核,C~D地址放文件系统,(也就是规定哪个地址区间放内核或者文件系统)等等。
1:在内核MTD中可以定义分区A~B,C~D。。。。。。并予以绝对的地址赋值给每个分区。我们可以来看看在内核中是怎样来对MTD进行分区的:arch\arm\plat-s3c24xx\common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = { [0] = { .name = "Boot", .size = SZ_16K, .offset = 0, }, [1] = { .name = "S3C2410 flash partition 1", .offset = 0, .size = SZ_2M, }, [2] = { .name = "S3C2410 flash partition 2", .offset = SZ_4M, .size = SZ_4M, }, [3] = { .name = "S3C2410 flash partition 3", .offset = SZ_8M, .size = SZ_2M, }, [4] = { .name = "S3C2410 flash partition 4", .offset = SZ_1M * 10, .size = SZ_4M, },
...... };
一般我们只需要分3-4个区,第一个为boot区,一个为boot参数区(传递给内核的参数),一个为内核区,一个为文件系统区。
而对于bootloader中只要能将内核下载到A~B区的A地址开始处就可以,C~D区的C起始地址下载文件系统。。。这些起始地址在MTD的分区信息中能找到。所以bootloader对分区的概念不重要,只要它能把内核烧到A位置,把文件系统烧到C位置。所以,在bootloader对Flash进行操作时,哪块区域放什么是以内核为主。而为了方便操作,bootloader类似也引入分区的概念,如,可以使用“nand write 0x3000000 kernel 200000”命令将uImage烧到kernel分区,而不必写那么长:nand write 3000000 A 200000,也就是用分区名来代替具体的地址。
这要对bootloader对内核重新分区:这需要重新设置一下bootloader环境参数,就可以同步更新内核分区信息
如:
setenv bootargs 'noinitrd console=ttySAC0 root=/dev/mtdblock3 rootfstype=jffs2
mtdparts=nand_flash:128k(u-boot)ro,64k(u-boot envs),3m(kernel),30m(root.jffs2),30m(root.yaffs)'
内核配置时选上Device Drivers ---> Memory Technology Device (MTD) support ---> Command line partition table parsing
在设置了mtdparts变量之后,就可以在nand read/write/erase命令中直接使用分区的名字而不必指定分区的偏移位置.而这需要内核MTD最好没有规划分区。
如果你是通过uboot的内核命令行给MTD层传递MTD分区信息,这种情况下,内核读取到的分区信息始终和u-boot中的保持一致(推荐的做法)
如果你是把分区信息写在内核源代码MTD里定义好的方法,那最好保证它和u-boot中的保持一致,即同步修改uboot及内核的相关部分。
2:
内核通过bootargs找到文件系统,bootargs中的mtdblockx即代表分区,block1,2,3代表哪个分区。
事实上,bootargs中的"root=/dev/mtdblockx"只是告诉内核,root fs从第x个(x=0,1,2...)MTD分区挂载,mtdblock0对应第一个分区,mtdblock1对应第二个分区,以此类推.
3:分区方法
1) MTD层的分区
2) 通过U-boot传递给内核的命令行中的mtdparts=...
3) 其他可以让内核知道分区信息的任何办法,(内核默认的命令参数)
下面说到mtdparts,及它的用法:
mtdparts
mtdparts=fc000000.nor_flash:1920k(linux),128k(fdt),20M(ramdisk),4M(jffs2),38272k(user),256k(env),384k(uboot)
要想这个参数起作用,内核中的mtd驱动必须要支持,即内核配置时需要选上Device Drivers ---> Memory Technology Device (MTD) support ---> Command line partition table parsing
mtdparts的格式如下:
mtdparts=[;
:= :[,]
:= [@offset][][ro]
:= unique id used in mapping driver/device
:= standard linux memsize OR "-" to denote all remaining space
:= (NAME)
因此你在使用的时候需要按照下面的格式来设置:
mtdparts=mtd-id:@(),@()
这里面有几个必须要注意的:
a. mtd-id 必须要跟你当前平台的flash的mtd-id一致,不然整个mtdparts会失效 怎样获取到当前平台的flash的mtd-id?
在bootargs参数列表中可以指定当前flash的mtd-id,如指定 mtdids:nand0=gen_nand.1,前面的nand0则表示第一个flash
b. size在设置的时候可以为实际的size(xxM,xxk,xx),也可以为'-'这表示剩余的所有空间。
相关信息可以查看drivers/mtd/cmdlinepart.c中的注释找到相关描述。
U-boot的环境变量值得注意的有两个: bootcmd 和bootargs。
引用:
u bootcmd
前面有说过bootcmd是自动启动时默认执行的一些命令,因此你可以在当前环境中定义各种不同配置,不同环境的参数设置,然后设置bootcmd为你经常使用的那种参数。
u bootargs
bootargs是环境变量中的重中之重,甚至可以说整个环境变量都是围绕着bootargs来设置的。bootargs的种类非常非常的多,我们平常只是使用了几种而已,感兴趣的可以看看这篇文章说的很全:http://www.linuxidc.com/Linux/2011-03/33599p4.htm。bootargs非常的灵活,内核和文件系统的不同搭配就会有不同的设置方法,甚至你也可以不设置bootargs,而直接将其写到内核中去(在配置内核的选项中可以进行这样的设置),正是这些原因导致了bootargs使用上的困难。
下面介绍一下bootargs常用参数,bootargs的种类非常的多,而且随着kernel的发展会出现一些新的参数,使得设置会更加灵活多样。
A. root
用来指定rootfs的位置, 常见的情况有:
root=/dev/ram rw
root=/dev/ram0 rw
请注意上面的这两种设置情况是通用的,我做过测试甚至root=/dev/ram1 rw和root=/dev/ram2 rw也是可以的,网上有人说在某些情况下是不通用的,即必须设置成ram或者ram0,但是目前还没有遇到,还需要进一步确认,遇到不行的时候可以逐一尝试。
root=/dev/mtdx rw
root=/dev/mtdblockx rw
root=/dev/mtdblock/x rw
root=31:0x
上面的这几个在一定情况下是通用的,当然这要看你当前的系统是否支持,不过mtd是字符设备,而mtdblock是块设备,有时候你的挨个的试到底当前的系统支持上面那种情况下,不过root=/dev/mtdblockx rw比较通用。此外,如果直接指定设备名可以的话,那么使用此设备的设备号也是可以的。
root=/dev/nfs
在文件系统为基于nfs的文件系统的时候使用。当然指定root=/dev/nfs之后,还需要指定nfsroot=serverip:nfs_dir,即指明文件系统存在那个主机的那个目录下面。
B. rootfstype
这个选项需要跟root一起配合使用,一般如果根文件系统是ext2的话,有没有这个选项是无所谓的,但是如果是jffs2,squashfs等文件系统的话,就需要rootfstype指明文件系统的类型,不然会无法挂载根分区.
C. console
console=tty 使用虚拟串口终端设备 .
console=ttyS[,options] 使用特定的串口,options可以是这样的形式bbbbpnx,这里bbbb是指串口的波特率,p是奇偶校验位,n是指的bits。
console=ttySAC[,options] 同上面。
看你当前的环境,有时用ttyS,有时用ttySAC,网上有人说,这是跟内核的版本有关,2.4用ttyS,2.6用ttySAC,但实际情况是官方文档中也是使用ttyS,所以应该是跟内核版本没有关联的。可以查看Documentation/serial-console.txt找到相关描述。
D. mem
mem=xxM 指定内存的大小,不是必须的
E. ramdisk_size
ramdisk=xxxxx 不推荐
ramdisk_size=xxxxx 推荐
上面这两个都可以告诉ramdisk 驱动,创建的ramdisk的size,默认情况下是4m(s390默认8M),你可以查看Documentation/ramdisk.txt找到相关的描述,不过ramdisk=xxxxx在新版的内核都已经没有提了,不推荐使用。
F. initrd, noinitrd
当你没有使用ramdisk启动系统的时候,你需要使用noinitrd这个参数,但是如果使用了的话,就需要指定initrd=r_addr,size, r_addr表示initrd在内存中的位置,size表示initrd的大小。
G. init
init指定的是内核启起来后,进入系统中运行的第一个脚本,一般init=/linuxrc, 或者init=/etc/preinit,preinit的内容一般是创建console,null设备节点,运行init程序,挂载一些文件系统等等操作。请注意,很多初学者以为init=/linuxrc是固定写法,其实不然,/linuxrc指的是/目录下面的linuxrc脚本,一般是一个连接罢了。
H. ip
指定系统启动之后网卡的ip地址,如果你使用基于nfs的文件系统,那么必须要有这个参数,其他的情况下就看你自己的喜好了。设置ip有两种方法:
ip = ip addr
ip=ip addr:server ip addr:gateway:netmask::which netcard:off
这两种方法可以用,不过很明显第二种要详细很多,请注意第二种中which netcard 是指开发板上的网卡,而不是主机上的网卡。
说完常见的几种bootargs,那么我们来讨论平常我经常使用的几种组合:
1). 假设文件系统是ramdisk,且直接就在内存中,bootargs的设置应该如下:
setenv bootargs ‘initrd=0x32000000,0xa00000 root=/dev/ram0 console=ttySAC0 mem=64M init=/linuxrc’
2). 假设文件系统是ramdisk,且在flash中,bootargs的设置应该如下:
setenv bootargs ‘mem=32M console=ttyS0,115200 root=/dev/ram rw init=/linuxrc’
注意这种情况下你应该要在bootm命令中指定ramdisk在flash中的地址,如bootm kernel_addr ramdisk_addr (fdt_addr)
3). 假设文件系统是jffs2类型的,且在flash中,bootargs的设置应该如下
setenv bootargs ‘mem=32M console=ttyS0,115200 noinitrd root=/dev/mtdblock2 rw rootfstype=jffs2 init=/linuxrc’
4). 假设文件系统是基于nfs的,bootargs的设置应该如下
setenv bootargs ‘noinitrd
mem=64M console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.3:/nfs
ip=192.168.0.5:192.168.0.3:192.168.0.3:255.255.255.0::eth0:off’
或者
setenv bootargs ‘noinitrd mem=64M console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.3:/nfs ip=192.168.0.5’
linux kernel boot arguments
The following is a consolidated list of the kernel parameters as
implemented (mostly) by the __setup() macro and sorted into English
Dictionary order (defined as ignoring all punctuation and sorting digits
before letters in a case insensitive manner), and with descriptions
where known.
Module parameters for loadable modules are specified only as the
parameter name with optional '=' and value as appropriate, such as:
modprobe usbcore blinkenlights=1
Module parameters for modules that are built into the kernel image
are specified on the kernel command line with the module name plus '.'
plus parameter name, with '=' and value if appropriate, such as:
usbcore.blinkenlights=1
The text in square brackets at the beginning of the description
states the restrictions on the kernel for the said kernel parameter to
be valid. The restrictions referred to are that the relevant option is
valid if: ACPI ACPI support is enabled. ALSA ALSA sound support is enabled. APIC APIC support is enabled. APM Advanced Power Management support is enabled. AX25 Appropriate AX.25 support is enabled. CD Appropriate CD support is enabled. DEVFS devfs support is enabled. DRM Direct Rendering Management support is enabled. EDD BIOS Enhanced Disk Drive Services (EDD) is enabled EFI EFI Partitioning (GPT) is enabled EIDE EIDE/ATAPI support is enabled. FB The frame buffer device is enabled. HW Appropriate hardware is enabled. IA-32 IA-32 aka i386 architecture is enabled. IA-64 IA-64 architecture is enabled. IOSCHED More than one I/O scheduler is enabled. IP_PNP IP DHCP, BOOTP, or RARP is enabled. ISAPNP ISA PnP code is enabled. ISDN Appropriate ISDN support is enabled. JOY Appropriate joystick support is enabled. LP Printer support is enabled. LOOP Loopback device support is enabled. M68k M68k architecture is enabled. These options have more detailed description inside of Documentation/m68k/kernel-options.txt. MCA MCA bus support is enabled. MDA MDA console support is enabled. MOUSE Appropriate mouse support is enabled. MTD MTD support is enabled. NET Appropriate network support is enabled. NUMA NUMA support is enabled. NFS Appropriate NFS support is enabled. OSS OSS sound support is enabled. PARIDE The ParIDE subsystem is enabled. PARISC The PA-RISC architecture is enabled. PCI PCI bus support is enabled. PCMCIA The PCMCIA subsystem is enabled. PNP Plug & Play support is enabled. PPC PowerPC architecture is enabled. PPT Parallel port support is enabled. PS2 Appropriate PS/2 support is enabled. RAM RAM disk support is enabled. S390 S390 architecture is enabled. SCSI Appropriate SCSI support is enabled. A lot of drivers has their options described inside of Documentation/scsi/. SELINUX SELinux support is enabled. SERIAL Serial support is enabled. SMP The kernel is an SMP kernel. SPARC Sparc architecture is enabled. SWSUSP Software suspend is enabled. TS Appropriate touchscreen support is enabled. USB USB support is enabled. USBHID USB Human Interface Device support is enabled. V4L Video For Linux support is enabled. VGA The VGA console has been enabled. VT Virtual terminal support is enabled. WDT Watchdog support is enabled. XT IBM PC/XT MFM hard disk support is enabled. X86-64 X86-64 architecture is enabled. More X86-64 boot options can be found in Documentation/x86_64/boot-options.txt .In addition, the following text indicates that the option: BUGS= Relates to possible processor bugs on the said processor. KNL Is a kernel start-up parameter. BOOT Is a boot loader parameter.Parameters denoted with BOOT are actually interpreted by the boot
loader, and have no meaning to the kernel directly. Do not modify the
syntax of boot loader parameters without extreme need or coordination
with .
Note that ALL kernel parameters listed below are CASE SENSITIVE, and
that a trailing = on the name of any parameter states that that
parameter will be entered as an environment variable, whereas its
absence indicates that it will appear as a kernel argument readable via
/proc/cmdline by programs running once the system is up. 53c7xx= [HW,SCSI] Amiga SCSI controllers See header of drivers/scsi/53c7xx.c. See also Documentation/scsi/ncr53c7xx.txt. acpi= [HW,ACPI] Advanced Configuration and Power Interface Format: { force | off | ht | strict | noirq } force -- enable ACPI if default was off off -- disable ACPI if default was on noirq -- do not use ACPI for IRQ routing ht -- run only enough ACPI to enable Hyper Threading strict -- Be less tolerant of platforms that are not strictly ACPI specification compliant. See also Documentation/pm.txt, pci=noacpi acpi_sleep= [HW,ACPI] Sleep options Format: { s3_bios, s3_mode } See Documentation/power/video.txt acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode Format: { level | edge | high | low } acpi_irq_balance [HW,ACPI] ACPI will balance active IRQs default in APIC mode acpi_irq_nobalance [HW,ACPI] ACPI will not move active IRQs (default) default in PIC mode acpi_irq_pci= [HW,ACPI] If irq_balance, clear listed IRQs for use by PCI Format: ,... acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA Format: ,... acpi_osi= [HW,ACPI] empty param disables _OSI acpi_serialize [HW,ACPI] force serialization of AML methods acpi_skip_timer_override [HW,ACPI] Recognize and ignore IRQ0/pin2 Interrupt Override. For broken nForce2 BIOS resulting in XT-PIC timer. acpi_dbg_layer= [HW,ACPI] Format: Each bit of the indicates an ACPI debug layer, 1: enable, 0: disable. It is useful for boot time debugging. After system has booted up, it can be set via /proc/acpi/debug_layer. acpi_dbg_level= [HW,ACPI] Format: Each bit of the indicates an ACPI debug level, 1: enable, 0: disable. It is useful for boot time debugging. After system has booted up, it can be set via /proc/acpi/debug_level. acpi_fake_ecdt [HW,ACPI] Workaround failure due to BIOS lacking ECDT acpi_generic_hotkey [HW,ACPI] Allow consolidated generic hotkey driver to override platform specific driver. See also Documentation/acpi-hotkey.txt. enable_timer_pin_1 [i386,x86-64] Enable PIN 1 of APIC timer Can be useful to work around chipset bugs (in particular on some ATI chipsets). The kernel tries to set a reasonable default. disable_timer_pin_1 [i386,x86-64] Disable PIN 1 of APIC timer Can be useful to work around chipset bugs. ad1816= [HW,OSS] Format: ,,, See also Documentation/sound/oss/AD1816. ad1848= [HW,OSS] Format: ,,,, adlib= [HW,OSS] Format: advansys= [HW,SCSI] See header of drivers/scsi/advansys.c. advwdt= [HW,WDT] Advantech WDT Format: , aedsp16= [HW,OSS] Audio Excel DSP 16 Format: ,,,,, See also header of sound/oss/aedsp16.c. aha152x= [HW,SCSI] See Documentation/scsi/aha152x.txt. aha1542= [HW,SCSI] Format: [,,[,]] aic7xxx= [HW,SCSI] See Documentation/scsi/aic7xxx.txt. aic79xx= [HW,SCSI] See Documentation/scsi/aic79xx.txt. amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: , See also Documentation/kernel/input/joystick.txt analog.map= [HW,JOY] Analog joystick and gamepad support Specifies type or capabilities of an analog joystick connected to one of 16 gameports Format: ,,.. apc= [HW,SPARC] Power management functions (SPARCstation-4/5 + deriv.) Format: noidle Disable APC CPU standby support. SPARCstation-Fox does not play well with APC CPU idle - disable it if you have APC and your system crashes randomly. apic= [APIC,i386] Change the output verbosity whilst booting Format: { quiet (default) | verbose | debug } Change the amount of debugging information output when initialising the APIC and IO-APIC components. apm= [APM] Advanced Power Management See header of arch/i386/kernel/apm.c. applicom= [HW] Format: , arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards Format: ,, ataflop= [HW,M68k] atarimouse= [HW,MOUSE] Atari Mouse atascsi= [HW,SCSI] Atari SCSI atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess, EzKey and similar keyboards atkbd.reset= [HW] Reset keyboard during initialization atkbd.set= [HW] Select keyboard code set Format: (2 = AT (default), 3 = PS/2) atkbd.scroll= [HW] Enable scroll wheel on MS Office and similar keyboards atkbd.softraw= [HW] Choose between synthetic and real raw mode Format: (0 = real, 1 = synthetic (default)) atkbd.softrepeat= [HW] Use software keyboard repeat autotest [IA64] awe= [HW,OSS] AWE32/SB32/AWE64 wave table synth Format: ,, aztcd= [HW,CD] Aztech CD268 CDROM driver Format: ,0x79 (?) baycom_epp= [HW,AX25] Format: , baycom_par= [HW,AX25] BayCom Parallel Port AX.25 Modem Format: , See header of drivers/net/hamradio/baycom_par.c. baycom_ser_fdx= [HW,AX25] BayCom Serial Port AX.25 Modem (Full Duplex Mode) Format: ,,[,] See header of drivers/net/hamradio/baycom_ser_fdx.c. baycom_ser_hdx= [HW,AX25] BayCom Serial Port AX.25 Modem (Half Duplex Mode) Format: ,, See header of drivers/net/hamradio/baycom_ser_hdx.c. blkmtd_device= [HW,MTD] blkmtd_erasesz= blkmtd_ro= blkmtd_bs= blkmtd_count= bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) bttv.radio= Most important insmod options are available as kernel args too. bttv.pll= See Documentation/video4linux/bttv/Insmod-options bttv.tuner= and Documentation/video4linux/bttv/CARDLIST BusLogic= [HW,SCSI] See drivers/scsi/BusLogic.c, comment before function BusLogic_ParseDriverOptions(). c101= [NET] Moxa C101 synchronous serial card cachesize= [BUGS=IA-32] Override level 2 CPU cache size detection. Sometimes CPU hardware bugs make them report the cache size incorrectly. The kernel will attempt work arounds to fix known problems, but for some CPUs it is not possible to determine what the correct size should be. This option provides an override for these situations. cdu31a= [HW,CD] Format: ,[,PAS] See header of drivers/cdrom/cdu31a.c. chandev= [HW,NET] Generic channel device initialisation checkreqprot [SELINUX] Set initial checkreqprot flag value. Format: { "0" | "1" } See security/selinux/Kconfig help text. 0 -- check protection applied by kernel (includes any implied execute protection). 1 -- check protection requested by application. Default value is set via a kernel config option. Value can be changed at runtime via /selinux/checkreqprot. clock= [BUGS=IA-32,HW] gettimeofday timesource override. Forces specified timesource (if avaliable) to be used when calculating gettimeofday(). If specicified timesource is not avalible, it defaults to PIT. Format: { pit | tsc | cyclone | pmtmr } hpet= [IA-32,HPET] option to disable HPET and use PIT. Format: disable cm206= [HW,CD] Format: { auto | [,][] } com20020= [HW,NET] ARCnet - COM20020 chipset Format:[,[,[,[,[,]]]]] com90io= [HW,NET] ARCnet - COM90xx chipset (IO-mapped buffers) Format: [,] com90xx= [HW,NET] ARCnet - COM90xx chipset (memory-mapped buffers) Format: [,[,]] condev= [HW,S390] console device conmode= console= [KNL] Output console device and options. tty Use the virtual console device . ttyS[,options] Use the specified serial port. The options are of the form "bbbbpn", where "bbbb" is the baud rate, "p" is parity ("n", "o", or "e"), and "n" is bits. Default is "9600n8". See also Documentation/serial-console.txt. uart,io,[,options] uart,mmio,[,options] Start an early, polled-mode console on the 8250/16550 UART at the specified I/O port or MMIO address, switching to the matching ttyS device later. The options are the same as for ttyS, above. cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver Format:,,,[,] cpia_pp= [HW,PPT] Format: { parport | auto | none } crashkernel=nn[KMG]@ss[KMG] [KNL] Reserve a chunk of physical memory to hold a kernel to switch to with kexec on panic. cs4232= [HW,OSS] Format: ,,,,, cs89x0_dma= [HW,NET] Format: cs89x0_media= [HW,NET] Format: { rj45 | aui | bnc } cyclades= [HW,SERIAL] Cyclades multi-serial port adapter. dasd= [HW,NET] See header of drivers/s390/block/dasd_devmap.c. db9.dev[2|3]= [HW,JOY] Multisystem joystick support via parallel port (one device per port) Format: , See also Documentation/input/joystick-parport.txt debug [KNL] Enable kernel debugging (events log level). decnet= [HW,NET] Format: [,] See also Documentation/networking/decnet.txt. devfs= [DEVFS] See Documentation/filesystems/devfs/boot-options. dhash_entries= [KNL] Set number of hash buckets for dentry cache. digi= [HW,SERIAL] IO parameters + enable/disable command. digiepca= [HW,SERIAL] See drivers/char/README.epca and Documentation/digiepca.txt. dmascc= [HW,AX25,SERIAL] AX.25 Z80SCC driver with DMA support available. Format: [,[,..]] dmasound= [HW,OSS] Sound subsystem buffers dscc4.setup= [NET] dtc3181e= [HW,SCSI] earlyprintk= [IA-32,X86-64] earlyprintk=vga earlyprintk=serial[,ttySn[,baudrate]] Append ",keep" to not disable it when the real console takes over. Only vga or serial at a time, not both. Currently only ttyS0 and ttyS1 are supported. Interaction with the standard serial driver is not very good. The VGA output is eventually overwritten by the real console. eata= [HW,SCSI] eda= [HW,PS2] edb= [HW,PS2] edd= [EDD] Format: {"of[f]" | "sk[ipmbr]"} See comment in arch/i386/boot/edd.S eicon= [HW,ISDN] Format: ,, eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c. elanfreq= [IA-32] See comment before function elanfreq_setup() in arch/i386/kernel/cpu/cpufreq/elanfreq.c. elevator= [IOSCHED] Format: {"as" | "cfq" | "deadline" | "noop"} See Documentation/block/as-iosched.txt and Documentation/block/deadline-iosched.txt for details. elfcorehdr= [IA-32] Specifies physical address of start of kernel core image elf header. See Documentation/kdump.txt for details. enforcing [SELINUX] Set initial enforcing status. Format: {"0" | "1"} See security/selinux/Kconfig help text. 0 -- permissive (log only, no denials). 1 -- enforcing (deny and log). Default value is 0. Value can be changed at runtime via /selinux/enforce. es1370= [HW,OSS] Format: [,] See also header of sound/oss/es1370.c. es1371= [HW,OSS] Format: ,[,[]] See also header of sound/oss/es1371.c. ether= [HW,NET] Ethernet cards parameters This option is obsoleted by the "netdev=" option, which has equivalent usage. See its documentation for details. eurwdt= [HW,WDT] Eurotech CPU-1220/1410 onboard watchdog. Format: [,] fd_mcs= [HW,SCSI] See header of drivers/scsi/fd_mcs.c. fdomain= [HW,SCSI] See header of drivers/scsi/fdomain.c. floppy= [HW] See Documentation/floppy.txt. ftape= [HW] Floppy Tape subsystem debugging options. See Documentation/ftape.txt. gamecon.map[2|3]= [HW,JOY] Multisystem joystick and NES/SNES/PSX pad support via parallel port (up to 5 devices per port) Format: ,,,,, See also Documentation/input/joystick-parport.txt gamma= [HW,DRM] gdth= [HW,SCSI] See header of drivers/scsi/gdth.c. gpt [EFI] Forces disk with valid GPT signature but invalid Protective MBR to be treated as GPT. gscd= [HW,CD] Format: gt96100eth= [NET] MIPS GT96100 Advanced Communication Controller gus= [HW,OSS] Format: ,,, gvp11= [HW,SCSI] hashdist= [KNL,NUMA] Large hashes allocated during boot are distributed across NUMA nodes. Defaults on for IA-64, off otherwise. Format: 0 | 1 (for off | on) hcl= [IA-64] SGI's Hardware Graph compatibility layer hd= [EIDE] (E)IDE hard drive subsystem geometry Format: ,, hd?= [HW] (E)IDE subsystem hd?lun= See Documentation/ide.txt. highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact size of . This works even on boxes that have no highmem otherwise. This also works to reduce highmem size on bigger boxes. hisax= [HW,ISDN] See Documentation/isdn/README.HiSax. hugepages= [HW,IA-32,IA-64] Maximal number of HugeTLB pages. noirqbalance [IA-32,SMP,KNL] Disable kernel irq balancing i8042.direct [HW] Put keyboard port into non-translated mode i8042.dumbkbd [HW] Pretend that controlled can only read data from keyboard and can not control its state (Don't attempt to blink the leds) i8042.noaux [HW] Don't check for auxiliary (== mouse) port i8042.nokbd [HW] Don't check/create keyboard port i8042.nomux [HW] Don't check presence of an active multiplexing controller i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX controllers i8042.panicblink= [HW] Frequency with which keyboard LEDs should blink when kernel panics (default is 0.5 sec) i8042.reset [HW] Reset the controller during init and cleanup i8042.unlock [HW] Unlock (ignore) the keylock i810= [HW,DRM] i8k.ignore_dmi [HW] Continue probing hardware even if DMI data indicates that the driver is running on unsupported hardware. i8k.force [HW] Activate i8k driver even if SMM BIOS signature does not match list of supported models. i8k.power_status [HW] Report power status in /proc/i8k (disabled by default) i8k.restricted [HW] Allow controlling fans only if SYS_ADMIN capability is set. ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter See Documentation/mca.txt. icn= [HW,ISDN] Format: [,[,[,]]] ide= [HW] (E)IDE subsystem Format: ide=nodma or ide=doubler or ide=reverse See Documentation/ide.txt. ide?= [HW] (E)IDE subsystem Format: ide?=noprobe or chipset specific parameters. See Documentation/ide.txt. idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed See Documentation/ide.txt. idle= [HW] Format: idle=poll or idle=halt ihash_entries= [KNL] Set number of hash buckets for inode cache. in2000= [HW,SCSI] See header of drivers/scsi/in2000.c. init= [KNL] Format: Run specified binary instead of /sbin/init as init process. initcall_debug [KNL] Trace initcalls as they are executed. Useful for working out where the kernel is dying during startup. initrd= [BOOT] Specify the location of the initial ramdisk inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver Format: inttest= [IA64] io7= [HW] IO7 for Marvel based alpha systems See comment before marvel_specify_io7 in arch/alpha/kernel/core_marvel.c. ip= [IP_PNP] See Documentation/nfsroot.txt. ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards See comment before ip2_setup() in drivers/char/ip2.c. ips= [HW,SCSI] Adaptec / IBM ServeRAID controller See header of drivers/scsi/ips.c. irqfixup [HW] When an interrupt is not handled search all handlers for it. Intended to get systems with badly broken firmware running. irqpoll [HW] When an interrupt is not handled search all handlers for it. Also check all handlers each timer interrupt. Intended to get systems with badly broken firmware running. isapnp= [ISAPNP] Format: ,,, isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler. Format: ,..., This option can be used to specify one or more CPUs to isolate from the general SMP balancing and scheduling algorithms. The only way to move a process onto or off an "isolated" CPU is via the CPU affinity syscalls. begins at 0 and the maximum value is "number of CPUs in system - 1". This option is the preferred way to isolate CPUs. The alternative -- manually setting the CPU mask of all tasks in the system -- can cause problems and suboptimal load balancer performance. isp16= [HW,CD] Format: ,,, iucv= [HW,NET] js= [HW,JOY] Analog joystick See Documentation/input/joystick.txt. keepinitrd [HW,ARM] kstack=N [IA-32,X86-64] Print N words from the kernel stack in oops dumps. l2cr= [PPC] lapic [IA-32,APIC] Enable the local APIC even if BIOS disabled it. lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip Format: addr:,irq: llsc*= [IA64] See function print_params() in arch/ia64/sn/kernel/llsc4.c. load_ramdisk= [RAM] List of ramdisks to load from floppy See Documentation/ramdisk.txt. lockd.udpport= [NFS] lockd.tcpport= [NFS] logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver Format: loglevel= All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed with klogd or other programs. The loglevels are defined as follows: 0 (KERN_EMERG) system is unusable 1 (KERN_ALERT) action must be taken immediately 2 (KERN_CRIT) critical conditions 3 (KERN_ERR) error conditions 4 (KERN_WARNING) warning conditions 5 (KERN_NOTICE) normal but significant condition 6 (KERN_INFO) informational 7 (KERN_DEBUG) debug-level messages log_buf_len=n Sets the size of the printk ring buffer, in bytes. Format: { n | nk | nM } n must be a power of two. The default size is set in the kernel config file. lp=0 [LP] Specify parallel ports to use, e.g, lp=port[,port...] lp=none,parport0 (lp0 not configured, lp1 uses lp=reset first parallel port). 'lp=0' disables the lp=auto printer driver. 'lp=reset' (which can be specified in addition to the ports) causes attached printers to be reset. Using lp=port1,port2,... specifies the parallel ports to associate lp devices with, starting with lp0. A port specification may be 'none' to skip that lp device, or a parport name such as 'parport0'. Specifying 'lp=auto' instead of a port specification list means that device IDs from each port should be examined, to see if an IEEE 1284-compliant printer is attached; if so, the driver will manage that printer. See also header of drivers/char/lp.c. lpj=n [KNL] Sets loops_per_jiffy to given constant, thus avoiding time-consuming boot-time autodetection (up to 250 ms per CPU). 0 enables autodetection (default). To determine the correct value for your kernel, boot with normal autodetection and see what value is printed. Note that on SMP systems the preset will be applied to all CPUs, which is likely to cause problems if your CPUs need significantly divergent settings. An incorrect value will cause delays in the kernel to be wrong, leading to unpredictable I/O errors and other breakage. Although unlikely, in the extreme case this might damage your hardware. ltpc= [NET] Format: ,, mac5380= [HW,SCSI] Format:,,,, mac53c9x= [HW,SCSI] Format:,,,,,,, machvec= [IA64] Force the use of a particular machine-vector (machvec) in a generic kernel. Example: machvec=hpzx1_swiotlb mad16= [HW,OSS] Format:,,,,,, maui= [HW,OSS] Format: , max_loop= [LOOP] Maximum number of loopback devices that can be mounted Format: maxcpus= [SMP] Maximum number of processors that an SMP kernel should make use of max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or equal to this physical address is ignored. max_luns= [SCSI] Maximum number of LUNs to probe. Should be between 1 and 2^32-1. max_report_luns= [SCSI] Maximum number of LUNs received. Should be between 1 and 16384. mca-pentium [BUGS=IA-32] mcatest= [IA-64] mcd= [HW,CD] Format: ,, mcdx= [HW,CD] mce [IA-32] Machine Check Exception md= [HW] RAID subsystems devices and level See Documentation/md.txt. mdacon= [MDA] Format: , Specifies range of consoles to be captured by the MDA. mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory Amount of memory to be used when the kernel is not able to see the whole system memory or for test. [IA-32] Use together with memmap= to avoid physical address space collisions. Without memmap= PCI devices could be placed at addresses belonging to unused RAM. mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel memory. memmap=exactmap [KNL,IA-32] Enable setting of an exact E820 memory map, as specified by the user. Such memmap=exactmap lines can be constructed based on BIOS output or other requirements. See the memmap=nn@ss option description. memmap=nn[KMG]@ss[KMG] [KNL] Force usage of a specific region of memory Region of memory to be used, from ss to ss+nn. memmap=nn[KMG]#ss[KMG] [KNL,ACPI] Mark specific memory as ACPI data. Region of memory to be used, from ss to ss+nn. memmap=nn[KMG]$ss[KMG] [KNL,ACPI] Mark specific memory as reserved. Region of memory to be used, from ss to ss+nn. meye.*= [HW] Set MotionEye Camera parameters See Documentation/video4linux/meye.txt. mga= [HW,DRM] mousedev.tap_time= [MOUSE] Maximum time between finger touching and leaving touchpad surface for touch to be considered a tap and be reported as a left button click (for touchpads working in absolute mode only). Format: mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices reporting absolute coordinates, such as tablets mousedev.yres= [MOUSE] Vertical screen resolution, used for devices reporting absolute coordinates, such as tablets mpu401= [HW,OSS] Format: , MTD_Partition= [MTD] Format: ,,, MTD_Region= [MTD] Format:,[,,,,] mtdparts= [MTD] See drivers/mtd/cmdline.c. mtouchusb.raw_coordinates= [HW] Make the MicroTouch USB driver use raw coordinates ('y', default) or cooked coordinates ('n') n2= [NET] SDL Inc. RISCom/N2 synchronous serial card NCR_D700= [HW,SCSI] See header of drivers/scsi/NCR_D700.c. ncr5380= [HW,SCSI] ncr53c400= [HW,SCSI] ncr53c400a= [HW,SCSI] ncr53c406a= [HW,SCSI] ncr53c8xx= [HW,SCSI] netdev= [NET] Network devices parameters Format: ,,,, Note that mem_start is often overloaded to mean something different and driver-specific. This usage is only documented in each driver source file if at all. nfsaddrs= [NFS] See Documentation/nfsroot.txt. nfsroot= [NFS] nfs root filesystem for disk-less boxes. See Documentation/nfsroot.txt. nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels no387 [BUGS=IA-32] Tells the kernel to use the 387 maths emulation library even if a 387 maths coprocessor is present. noalign [KNL,ARM] noapic [SMP,APIC] Tells the kernel to not make use of any IOAPICs that may be present in the system. noasync [HW,M68K] Disables async and sync negotiation for all devices. nobats [PPC] Do not use BATs for mapping kernel lowmem on "Classic" PPC cores. nocache [ARM] nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. noexec [IA-64] noexec [IA-32,X86-64] noexec=on: enable non-executable mappings (default) noexec=off: disable nn-executable mappings nofxsr [BUGS=IA-32] nohlt [BUGS=ARM] no-hlt [BUGS=IA-32] Tells the kernel that the hlt instruction doesn't work correctly and not to use it. nohalt [IA-64] Tells the kernel not to use the power saving function PAL_HALT_LIGHT when idle. This increases power-consumption. On the positive side, it reduces interrupt wake-up latency, which may improve performance in certain environments such as networked servers or real-time systems. noirqdebug [IA-32] Disables the code which attempts to detect and disable unhandled interrupt sources. noisapnp [ISAPNP] Disables ISA PnP code. noinitrd [RAM] Tells the kernel not to load any configured initial RAM disk. nointroute [IA-64] nolapic [IA-32,APIC] Do not enable or use the local APIC. noltlbs [PPC] Do not use large page/tlb entries for kernel lowmem mapping on PPC40x. nomce [IA-32] Machine Check Exception noresidual [PPC] Don't use residual data on PReP machines. noresume [SWSUSP] Disables resume and restores original swap space. no-scroll [VGA] Disables scrollback. This is required for the Braillex ib80-piezo Braille reader made by F.H. Papenmeier (Germany). nosbagart [IA-64] nosmp [SMP] Tells an SMP kernel to act as a UP kernel. nosync [HW,M68K] Disables sync negotiation for all devices. notsc [BUGS=IA-32] Disable Time Stamp Counter nousb [USB] Disable the USB subsystem nowb [ARM] opl3= [HW,OSS] Format: opl3sa= [HW,OSS] Format: ,,,,, opl3sa2= [HW,OSS] Format:,,,,,,,[,, oprofile.timer= [HW] Use timer interrupt instead of performance counters optcd= [HW,CD] Format: osst= [HW,SCSI] SCSI Tape Driver Format: , See also Documentation/scsi/st.txt. panic= [KNL] Kernel behaviour on panic Format: parkbd.port= [HW] Parallel port number the keyboard adapter is connected to, default is 0. Format: parkbd.mode= [HW] Parallel port keyboard adapter mode of operation, 0 for XT, 1 for AT (default is AT). Format: parport= [HW,PPT] Specify parallel ports. 0 disables. Format: { 0 | auto | 0xBBB[,IRQ[,DMA]] } Use 'auto' to force the driver to use any IRQ/DMA settings detected (the default is to ignore detected IRQ/DMA settings because of possible conflicts). You can specify the base address, IRQ, and DMA settings; IRQ and DMA should be numbers, or 'auto' (for using detected settings on that particular port), or 'nofifo' (to avoid using a FIFO even if it is detected). Parallel ports are assigned in the order they are specified on the command line, starting with parport0. parport_init_mode= [HW,PPT] Configure VIA parallel port to operate in a specific mode. This is necessary on Pegasos computer where firmware has no options for setting up parallel port mode and sets it to spp. Currently this function knows 686a and 8231 chips. Format: [spp|ps2|epp|ecp|ecpepp] pas2= [HW,OSS] Format:,,,,,,, pas16= [HW,SCSI] See header of drivers/scsi/pas16.c. pcbit= [HW,ISDN] pcd. [PARIDE] See header of drivers/block/paride/pcd.c. See also Documentation/paride.txt. pci=option[,option...] [PCI] various PCI subsystem options: off [IA-32] don't probe for the PCI bus bios [IA-32] force use of PCI BIOS, don't access the hardware directly. Use this if your machine has a non-standard PCI host bridge. nobios [IA-32] disallow use of PCI BIOS, only direct hardware access methods are allowed. Use this if you experience crashes upon bootup and you suspect they are caused by the BIOS. conf1 [IA-32] Force use of PCI Configuration Mechanism 1. conf2 [IA-32] Force use of PCI Configuration Mechanism 2. nosort [IA-32] Don't sort PCI devices according to order given by the PCI BIOS. This sorting is done to get a device order compatible with older kernels. biosirq [IA-32] Use PCI BIOS calls to get the interrupt routing table. These calls are known to be buggy on several machines and they hang the machine when used, but on other computers it's the only way to get the interrupt routing table. Try this option if the kernel is unable to allocate IRQs or discover secondary PCI buses on your motherboard. rom [IA-32] Assign address space to expansion ROMs. Use with caution as certain devices share address decoders between ROMs and other resources. irqmask=0xMMMM [IA-32] Set a bit mask of IRQs allowed to be assigned automatically to PCI devices. You can make the kernel exclude IRQs of your ISA cards this way. pirqaddr=0xAAAAA [IA-32] Specify the physical address of the PIRQ table (normally generated by the BIOS) if it is outside the F0000h-100000h range. lastbus=N [IA-32] Scan all buses thru bus #N. Can be useful if the kernel is unable to find your secondary buses and you want to tell it explicitly which ones they are. assign-busses [IA-32] Always assign all PCI bus numbers ourselves, overriding whatever the firmware may have done. usepirqmask [IA-32] Honor the possible IRQ mask stored in the BIOS $PIR table. This is needed on some systems with broken BIOSes, notably some HP Pavilion N5400 and Omnibook XE3 notebooks. This will have no effect if ACPI IRQ routing is enabled. noacpi [IA-32] Do not use ACPI for IRQ routing or for PCI scanning. routeirq Do IRQ routing for all PCI devices. This is normally done in pci_enable_device(), so this option is a temporary workaround for broken drivers that don't call it. firmware [ARM] Do not re-enumerate the bus but instead just use the configuration from the bootloader. This is currently used on IXP2000 systems where the bus has to be configured a certain way for adjunct CPUs. pcmv= [HW,PCMCIA] BadgePAD 4 pd. [PARIDE] See Documentation/paride.txt. pdcchassis= [PARISC,HW] Disable/Enable PDC Chassis Status codes at boot time. Format: { 0 | 1 } See arch/parisc/kernel/pdc_chassis.c pf. [PARIDE] See Documentation/paride.txt. pg. [PARIDE] See Documentation/paride.txt. pirq= [SMP,APIC] Manual mp-table setup See Documentation/i386/IO-APIC.txt. plip= [PPT,NET] Parallel port network link Format: { parport | timid | 0 } See also Documentation/parport.txt. pnpacpi= [ACPI] { off } pnpbios= [ISAPNP] { on | off | curr | res | no-curr | no-res } pnp_reserve_irq= [ISAPNP] Exclude IRQs for the autoconfiguration pnp_reserve_dma= [ISAPNP] Exclude DMAs for the autoconfiguration pnp_reserve_io= [ISAPNP] Exclude I/O ports for the autoconfiguration Ranges are in pairs (I/O port base and size). pnp_reserve_mem= [ISAPNP] Exclude memory regions for the autoconfiguration. Ranges are in pairs (memory base and size). profile= [KNL] Enable kernel profiling via /proc/profile Format: [schedule,] Param: "schedule" - profile schedule points. Param: - step/bucket size as a power of 2 for statistical time based profiling. processor.max_cstate= [HW,ACPI] Limit processor to maximum C-state max_cstate=9 overrides any DMI blacklist limit. prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk before loading. See Documentation/ramdisk.txt. psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to probe for; one of (bare|imps|exps|lifebook|any). psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports per second. psmouse.resetafter= [HW,MOUSE] Try to reset the device after so many bad packets (0 = never). psmouse.resolution= [HW,MOUSE] Set desired mouse resolution, in dpi. psmouse.smartscroll= [HW,MOUSE] Controls Logitech smartscroll autorepeat. 0 = disabled, 1 = enabled (default). pss= [HW,OSS] Personal Sound System (ECHO ESC614) Format:,,,,, pt. [PARIDE] See Documentation/paride.txt. quiet= [KNL] Disable log messages r128= [HW,DRM] raid= [HW,RAID] See Documentation/md.txt. ramdisk= [RAM] Sizes of RAM disks in kilobytes [deprecated] See Documentation/ramdisk.txt. ramdisk_blocksize= [RAM] See Documentation/ramdisk.txt. ramdisk_size= [RAM] Sizes of RAM disks in kilobytes New name for the ramdisk parameter. See Documentation/ramdisk.txt. rdinit= [KNL] Format: Run specified binary instead of /init from the ramdisk, used for early userspace startup. See initrd. reboot= [BUGS=IA-32,BUGS=ARM,BUGS=IA-64] Rebooting mode Format: [,[,...]] See arch/*/kernel/reboot.c. reserve= [KNL,BUGS] Force the kernel to ignore some iomem area resume= [SWSUSP] Specify the partition device for software suspend rhash_entries= [KNL,NET] Set number of hash buckets for route cache riscom8= [HW,SERIAL] Format: [,[,...]] ro [KNL] Mount root device read-only on boot root= [KNL] Root filesystem rootdelay= [KNL] Delay (in seconds) to pause before attempting to mount the root filesystem rootflags= [KNL] Set root filesystem mount option string rootfstype= [KNL] Set root filesystem type rw [KNL] Mount root device read-write on boot S [KNL] Run init in single mode sa1100ir [NET] See drivers/net/irda/sa1100_ir.c. sb= [HW,OSS] Format: ,,, sbni= [NET] Granch SBNI12 leased line adapter sbpcd= [HW,CD] Soundblaster CD adapter Format: , See a comment before function sbpcd_setup() in drivers/cdrom/sbpcd.c. sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver Format: [,[,]] scsi_debug_*= [SCSI] See drivers/scsi/scsi_debug.c. scsi_default_dev_flags= [SCSI] SCSI default device flags Format: scsi_dev_flags= [SCSI] Black/white list entry for vendor and model Format: :: (flags are integer value) scsi_logging= [SCSI] selinux [SELINUX] Disable or enable SELinux at boot time. Format: { "0" | "1" } See security/selinux/Kconfig help text. 0 -- disable. 1 -- enable. Default value is set via kernel config option. If enabled at boot time, /selinux/disable can be used later to disable prior to initial policy load. serialnumber [BUGS=IA-32] sg_def_reserved_size= [SCSI] sgalaxy= [HW,OSS] Format: ,,,, shapers= [NET] Maximal number of shapers. sim710= [SCSI,HW] See header of drivers/scsi/sim710.c. simeth= [IA-64] simscsi= sjcd= [HW,CD] Format: ,, See header of drivers/cdrom/sjcd.c. slram= [HW,MTD] smart2= [HW] Format: [,[,...,]] snd-ad1816a= [HW,ALSA] snd-ad1848= [HW,ALSA] snd-ali5451= [HW,ALSA] snd-als100= [HW,ALSA] snd-als4000= [HW,ALSA] snd-azt2320= [HW,ALSA] snd-cmi8330= [HW,ALSA] snd-cmipci= [HW,ALSA] snd-cs4231= [HW,ALSA] snd-cs4232= [HW,ALSA] snd-cs4236= [HW,ALSA] snd-cs4281= [HW,ALSA] snd-cs46xx= [HW,ALSA] snd-dt019x= [HW,ALSA] snd-dummy= [HW,ALSA] snd-emu10k1= [HW,ALSA] snd-ens1370= [HW,ALSA] snd-ens1371= [HW,ALSA] snd-es968= [HW,ALSA] snd-es1688= [HW,ALSA] snd-es18xx= [HW,ALSA] snd-es1938= [HW,ALSA] snd-es1968= [HW,ALSA] snd-fm801= [HW,ALSA] snd-gusclassic= [HW,ALSA] snd-gu***treme= [HW,ALSA] snd-gusmax= [HW,ALSA] snd-hdsp= [HW,ALSA] snd-ice1712= [HW,ALSA] snd-intel8x0= [HW,ALSA] snd-interwave= [HW,ALSA] snd-interwave-stb= [HW,ALSA] snd-korg1212= [HW,ALSA] snd-maestro3= [HW,ALSA] snd-mpu401= [HW,ALSA] snd-mtpav= [HW,ALSA] snd-nm256= [HW,ALSA] snd-opl3sa2= [HW,ALSA] snd-opti92x-ad1848= [HW,ALSA] snd-opti92x-cs4231= [HW,ALSA] snd-opti93x= [HW,ALSA] snd-pmac= [HW,ALSA] snd-rme32= [HW,ALSA] snd-rme96= [HW,ALSA] snd-rme9652= [HW,ALSA] snd-sb8= [HW,ALSA] snd-sb16= [HW,ALSA] snd-sbawe= [HW,ALSA] snd-serial= [HW,ALSA] snd-sgalaxy= [HW,ALSA] snd-sonicvibes= [HW,ALSA] snd-sun-amd7930= [HW,ALSA] snd-sun-cs4231= [HW,ALSA] snd-trident= [HW,ALSA] snd-usb-audio= [HW,ALSA,USB] snd-via82xx= [HW,ALSA] snd-virmidi= [HW,ALSA] snd-wavefront= [HW,ALSA] snd-ymfpci= [HW,ALSA] sonicvibes= [HW,OSS] Format: sonycd535= [HW,CD] Format: [,] sonypi.*= [HW] Sony Programmable I/O Control Device driver See Documentation/sonypi.txt specialix= [HW,SERIAL] Specialix multi-serial port adapter See Documentation/specialix.txt. spia_io_base= [HW,MTD] spia_fio_base= spia_pedr= spia_peddr= sscape= [HW,OSS] Format: ,,,, st= [HW,SCSI] SCSI tape parameters (buffers, etc.) See Documentation/scsi/st.txt. st0x= [HW,SCSI] See header of drivers/scsi/seagate.c. sti= [PARISC,HW] Format: Set the STI (builtin display/keyboard on the HP-PARISC machines) console (graphic card) which should be used as the initial boot-console. See also comment in drivers/video/console/sticore.c. sti_font= [HW] See comment in drivers/video/console/sticore.c. stifb= [HW] Format: bpp:[:[:...]] swiotlb= [IA-64] Number of I/O TLB slabs switches= [HW,M68k] sym53c416= [HW,SCSI] See header of drivers/scsi/sym53c416.c. t128= [HW,SCSI] See header of drivers/scsi/t128.c. tdfx= [HW,DRM] thash_entries= [KNL,NET] Set number of hash buckets for TCP connection time Show timing data prefixed to each printk message line tipar.timeout= [HW,PPT] Set communications timeout in tenths of a second (default 15). tipar.delay= [HW,PPT] Set inter-bit delay in microseconds (default 10). tmc8xx= [HW,SCSI] See header of drivers/scsi/seagate.c. tmscsim= [HW,SCSI] See comment before function dc390_setup() in drivers/scsi/tmscsim.c. tp720= [HW,PS2] trix= [HW,OSS] MediaTrix AudioTrix Pro Format:,,,,,,,, tsdev.xres= [TS] Horizontal screen resolution. tsdev.yres= [TS] Vertical screen resolution. turbografx.map[2|3]= [HW,JOY] TurboGraFX parallel port interface Format:,,,,,,, See also Documentation/input/joystick-parport.txt u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter See header of drivers/scsi/u14-34f.c. uart401= [HW,OSS] Format: , uart6850= [HW,OSS] Format: , usbhid.mousepoll= [USBHID] The interval which mice are to be polled at. video= [FB] Frame buffer configuration See Documentation/fb/modedb.txt. vga= [BOOT,IA-32] Select a particular video mode See Documentation/i386/boot.txt and Documentation/svga.txt. Use vga=ask for menu. This is actually a boot loader parameter; the value is passed to the kernel using a special protocol. vmalloc=nn[KMG] [KNL,BOOT] Forces the vmalloc area to have an exact size of . This can be used to increase the minimum size (128MB on x86). It can also be used to decrease the size and leave more room for directly mapped kernel RAM. vmhalt= [KNL,S390] vmpoff= [KNL,S390] waveartist= [HW,OSS] Format: ,,, wd33c93= [HW,SCSI] See header of drivers/scsi/wd33c93.c. wd7000= [HW,SCSI] See header of drivers/scsi/wd7000.c. wdt= [WDT] Watchdog See Documentation/watchdog/watchdog.txt. xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. xd_geo= See header of drivers/block/xd.c. xirc2ps_cs= [NET,PCMCIA] Format:,,,,,[,[,[,]]]
uboot环境变量与内核MTD分区关系
分区只是内核的概念,就是说A~B地址放内核,C~D地址放文件系统,(也就是规定哪个地址区间放内核或者文件系统)等等。
1:在内核MTD中可以定义分区A~B,C~D。。。。。。并予以绝对的地址赋值给每个分区。我们可以来看看在内核中是怎样来对MTD进行分区的:arch\arm\plat-s3c24xx\common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = { [0] = { .name = "Boot", .size = SZ_16K, .offset = 0, }, [1] = { .name = "S3C2410 flash partition 1", .offset = 0, .size = SZ_2M, }, [2] = { .name = "S3C2410 flash partition 2", .offset = SZ_4M, .size = SZ_4M, }, [3] = { .name = "S3C2410 flash partition 3", .offset = SZ_8M, .size = SZ_2M, }, [4] = { .name = "S3C2410 flash partition 4", .offset = SZ_1M * 10, .size = SZ_4M, },
...... };
一般我们只需要分3-4个区,第一个为boot区,一个为boot参数区(传递给内核的参数),一个为内核区,一个为文件系统区。
而对于bootloader中只要能将内核下载到A~B区的A地址开始处就可以,C~D区的C起始地址下载文件系统。。。这些起始地址在MTD的分区信息中能找到。所以bootloader对分区的概念不重要,只要它能把内核烧到A位置,把文件系统烧到C位置。所以,在bootloader对Flash进行操作时,哪块区域放什么是以内核为主。而为了方便操作,bootloader类似也引入分区的概念,如,可以使用“nand write 0x3000000 kernel 200000”命令将uImage烧到kernel分区,而不必写那么长:nand write 3000000 A 200000,也就是用分区名来代替具体的地址。
这要对bootloader对内核重新分区:这需要重新设置一下bootloader环境参数,就可以同步更新内核分区信息
如:
setenv bootargs 'noinitrd console=ttySAC0 root=/dev/mtdblock3 rootfstype=jffs2
mtdparts=nand_flash:128k(u-boot)ro,64k(u-boot envs),3m(kernel),30m(root.jffs2),30m(root.yaffs)'
内核配置时选上Device Drivers ---> Memory Technology Device (MTD) support ---> Command line partition table parsing
在设置了mtdparts变量之后,就可以在nand read/write/erase命令中直接使用分区的名字而不必指定分区的偏移位置.而这需要内核MTD最好没有规划分区。
如果你是通过uboot的内核命令行给MTD层传递MTD分区信息,这种情况下,内核读取到的分区信息始终和u-boot中的保持一致(推荐的做法)
如果你是把分区信息写在内核源代码MTD里定义好的方法,那最好保证它和u-boot中的保持一致,即同步修改uboot及内核的相关部分。
2:
内核通过bootargs找到文件系统,bootargs中的mtdblockx即代表分区,block1,2,3代表哪个分区。
事实上,bootargs中的"root=/dev/mtdblockx"只是告诉内核,root fs从第x个(x=0,1,2...)MTD分区挂载,mtdblock0对应第一个分区,mtdblock1对应第二个分区,以此类推.
3:分区方法
1) MTD层的分区
2) 通过U-boot传递给内核的命令行中的mtdparts=...
3) 其他可以让内核知道分区信息的任何办法,(内核默认的命令参数)
下面说到mtdparts,及它的用法:
mtdparts
mtdparts=fc000000.nor_flash:1920k(linux),128k(fdt),20M(ramdisk),4M(jffs2),38272k(user),256k(env),384k(uboot)
要想这个参数起作用,内核中的mtd驱动必须要支持,即内核配置时需要选上Device Drivers ---> Memory Technology Device (MTD) support ---> Command line partition table parsing
mtdparts的格式如下:
mtdparts=[;
:= :[,]
:= [@offset][][ro]
:= unique id used in mapping driver/device
:= standard linux memsize OR "-" to denote all remaining space
:= (NAME)
因此你在使用的时候需要按照下面的格式来设置:
mtdparts=mtd-id:@(),@()
这里面有几个必须要注意的:
a. mtd-id 必须要跟你当前平台的flash的mtd-id一致,不然整个mtdparts会失效 怎样获取到当前平台的flash的mtd-id?
在bootargs参数列表中可以指定当前flash的mtd-id,如指定 mtdids:nand0=gen_nand.1,前面的nand0则表示第一个flash
b. size在设置的时候可以为实际的size(xxM,xxk,xx),也可以为'-'这表示剩余的所有空间。
相关信息可以查看drivers/mtd/cmdlinepart.c中的注释找到相关描述。
U-boot的环境变量值得注意的有两个: bootcmd 和bootargs。
引用:
u bootcmd
前面有说过bootcmd是自动启动时默认执行的一些命令,因此你可以在当前环境中定义各种不同配置,不同环境的参数设置,然后设置bootcmd为你经常使用的那种参数。
u bootargs
bootargs是环境变量中的重中之重,甚至可以说整个环境变量都是围绕着bootargs来设置的。bootargs的种类非常非常的多,我们平常只是使用了几种而已,感兴趣的可以看看这篇文章说的很全:http://www.linuxidc.com/Linux/2011-03/33599p4.htm。bootargs非常的灵活,内核和文件系统的不同搭配就会有不同的设置方法,甚至你也可以不设置bootargs,而直接将其写到内核中去(在配置内核的选项中可以进行这样的设置),正是这些原因导致了bootargs使用上的困难。
下面介绍一下bootargs常用参数,bootargs的种类非常的多,而且随着kernel的发展会出现一些新的参数,使得设置会更加灵活多样。
A. root
用来指定rootfs的位置, 常见的情况有:
root=/dev/ram rw
root=/dev/ram0 rw
请注意上面的这两种设置情况是通用的,我做过测试甚至root=/dev/ram1 rw和root=/dev/ram2 rw也是可以的,网上有人说在某些情况下是不通用的,即必须设置成ram或者ram0,但是目前还没有遇到,还需要进一步确认,遇到不行的时候可以逐一尝试。
root=/dev/mtdx rw
root=/dev/mtdblockx rw
root=/dev/mtdblock/x rw
root=31:0x
上面的这几个在一定情况下是通用的,当然这要看你当前的系统是否支持,不过mtd是字符设备,而mtdblock是块设备,有时候你的挨个的试到底当前的系统支持上面那种情况下,不过root=/dev/mtdblockx rw比较通用。此外,如果直接指定设备名可以的话,那么使用此设备的设备号也是可以的。
root=/dev/nfs
在文件系统为基于nfs的文件系统的时候使用。当然指定root=/dev/nfs之后,还需要指定nfsroot=serverip:nfs_dir,即指明文件系统存在那个主机的那个目录下面。
B. rootfstype
这个选项需要跟root一起配合使用,一般如果根文件系统是ext2的话,有没有这个选项是无所谓的,但是如果是jffs2,squashfs等文件系统的话,就需要rootfstype指明文件系统的类型,不然会无法挂载根分区.
C. console
console=tty 使用虚拟串口终端设备 .
console=ttyS[,options] 使用特定的串口,options可以是这样的形式bbbbpnx,这里bbbb是指串口的波特率,p是奇偶校验位,n是指的bits。
console=ttySAC[,options] 同上面。
看你当前的环境,有时用ttyS,有时用ttySAC,网上有人说,这是跟内核的版本有关,2.4用ttyS,2.6用ttySAC,但实际情况是官方文档中也是使用ttyS,所以应该是跟内核版本没有关联的。可以查看Documentation/serial-console.txt找到相关描述。
D. mem
mem=xxM 指定内存的大小,不是必须的
E. ramdisk_size
ramdisk=xxxxx 不推荐
ramdisk_size=xxxxx 推荐
上面这两个都可以告诉ramdisk 驱动,创建的ramdisk的size,默认情况下是4m(s390默认8M),你可以查看Documentation/ramdisk.txt找到相关的描述,不过ramdisk=xxxxx在新版的内核都已经没有提了,不推荐使用。
F. initrd, noinitrd
当你没有使用ramdisk启动系统的时候,你需要使用noinitrd这个参数,但是如果使用了的话,就需要指定initrd=r_addr,size, r_addr表示initrd在内存中的位置,size表示initrd的大小。
G. init
init指定的是内核启起来后,进入系统中运行的第一个脚本,一般init=/linuxrc, 或者init=/etc/preinit,preinit的内容一般是创建console,null设备节点,运行init程序,挂载一些文件系统等等操作。请注意,很多初学者以为init=/linuxrc是固定写法,其实不然,/linuxrc指的是/目录下面的linuxrc脚本,一般是一个连接罢了。
H. ip
指定系统启动之后网卡的ip地址,如果你使用基于nfs的文件系统,那么必须要有这个参数,其他的情况下就看你自己的喜好了。设置ip有两种方法:
ip = ip addr
ip=ip addr:server ip addr:gateway:netmask::which netcard:off
这两种方法可以用,不过很明显第二种要详细很多,请注意第二种中which netcard 是指开发板上的网卡,而不是主机上的网卡。
说完常见的几种bootargs,那么我们来讨论平常我经常使用的几种组合:
1). 假设文件系统是ramdisk,且直接就在内存中,bootargs的设置应该如下:
setenv bootargs ‘initrd=0x32000000,0xa00000 root=/dev/ram0 console=ttySAC0 mem=64M init=/linuxrc’
2). 假设文件系统是ramdisk,且在flash中,bootargs的设置应该如下:
setenv bootargs ‘mem=32M console=ttyS0,115200 root=/dev/ram rw init=/linuxrc’
注意这种情况下你应该要在bootm命令中指定ramdisk在flash中的地址,如bootm kernel_addr ramdisk_addr (fdt_addr)
3). 假设文件系统是jffs2类型的,且在flash中,bootargs的设置应该如下
setenv bootargs ‘mem=32M console=ttyS0,115200 noinitrd root=/dev/mtdblock2 rw rootfstype=jffs2 init=/linuxrc’
4). 假设文件系统是基于nfs的,bootargs的设置应该如下
setenv bootargs ‘noinitrd
mem=64M console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.3:/nfs
ip=192.168.0.5:192.168.0.3:192.168.0.3:255.255.255.0::eth0:off’
或者
setenv bootargs ‘noinitrd mem=64M console=ttySAC0 root=/dev/nfs nfsroot=192.168.0.3:/nfs ip=192.168.0.5’
linux kernel boot arguments
The following is a consolidated list of the kernel parameters as
implemented (mostly) by the __setup() macro and sorted into English
Dictionary order (defined as ignoring all punctuation and sorting digits
before letters in a case insensitive manner), and with descriptions
where known.
Module parameters for loadable modules are specified only as the
parameter name with optional '=' and value as appropriate, such as:
modprobe usbcore blinkenlights=1
Module parameters for modules that are built into the kernel image
are specified on the kernel command line with the module name plus '.'
plus parameter name, with '=' and value if appropriate, such as:
usbcore.blinkenlights=1
The text in square brackets at the beginning of the description
states the restrictions on the kernel for the said kernel parameter to
be valid. The restrictions referred to are that the relevant option is
valid if: ACPI ACPI support is enabled. ALSA ALSA sound support is enabled. APIC APIC support is enabled. APM Advanced Power Management support is enabled. AX25 Appropriate AX.25 support is enabled. CD Appropriate CD support is enabled. DEVFS devfs support is enabled. DRM Direct Rendering Management support is enabled. EDD BIOS Enhanced Disk Drive Services (EDD) is enabled EFI EFI Partitioning (GPT) is enabled EIDE EIDE/ATAPI support is enabled. FB The frame buffer device is enabled. HW Appropriate hardware is enabled. IA-32 IA-32 aka i386 architecture is enabled. IA-64 IA-64 architecture is enabled. IOSCHED More than one I/O scheduler is enabled. IP_PNP IP DHCP, BOOTP, or RARP is enabled. ISAPNP ISA PnP code is enabled. ISDN Appropriate ISDN support is enabled. JOY Appropriate joystick support is enabled. LP Printer support is enabled. LOOP Loopback device support is enabled. M68k M68k architecture is enabled. These options have more detailed description inside of Documentation/m68k/kernel-options.txt. MCA MCA bus support is enabled. MDA MDA console support is enabled. MOUSE Appropriate mouse support is enabled. MTD MTD support is enabled. NET Appropriate network support is enabled. NUMA NUMA support is enabled. NFS Appropriate NFS support is enabled. OSS OSS sound support is enabled. PARIDE The ParIDE subsystem is enabled. PARISC The PA-RISC architecture is enabled. PCI PCI bus support is enabled. PCMCIA The PCMCIA subsystem is enabled. PNP Plug & Play support is enabled. PPC PowerPC architecture is enabled. PPT Parallel port support is enabled. PS2 Appropriate PS/2 support is enabled. RAM RAM disk support is enabled. S390 S390 architecture is enabled. SCSI Appropriate SCSI support is enabled. A lot of drivers has their options described inside of Documentation/scsi/. SELINUX SELinux support is enabled. SERIAL Serial support is enabled. SMP The kernel is an SMP kernel. SPARC Sparc architecture is enabled. SWSUSP Software suspend is enabled. TS Appropriate touchscreen support is enabled. USB USB support is enabled. USBHID USB Human Interface Device support is enabled. V4L Video For Linux support is enabled. VGA The VGA console has been enabled. VT Virtual terminal support is enabled. WDT Watchdog support is enabled. XT IBM PC/XT MFM hard disk support is enabled. X86-64 X86-64 architecture is enabled. More X86-64 boot options can be found in Documentation/x86_64/boot-options.txt .In addition, the following text indicates that the option: BUGS= Relates to possible processor bugs on the said processor. KNL Is a kernel start-up parameter. BOOT Is a boot loader parameter.Parameters denoted with BOOT are actually interpreted by the boot
loader, and have no meaning to the kernel directly. Do not modify the
syntax of boot loader parameters without extreme need or coordination
with .
Note that ALL kernel parameters listed below are CASE SENSITIVE, and
that a trailing = on the name of any parameter states that that
parameter will be entered as an environment variable, whereas its
absence indicates that it will appear as a kernel argument readable via
/proc/cmdline by programs running once the system is up. 53c7xx= [HW,SCSI] Amiga SCSI controllers See header of drivers/scsi/53c7xx.c. See also Documentation/scsi/ncr53c7xx.txt. acpi= [HW,ACPI] Advanced Configuration and Power Interface Format: { force | off | ht | strict | noirq } force -- enable ACPI if default was off off -- disable ACPI if default was on noirq -- do not use ACPI for IRQ routing ht -- run only enough ACPI to enable Hyper Threading strict -- Be less tolerant of platforms that are not strictly ACPI specification compliant. See also Documentation/pm.txt, pci=noacpi acpi_sleep= [HW,ACPI] Sleep options Format: { s3_bios, s3_mode } See Documentation/power/video.txt acpi_sci= [HW,ACPI] ACPI System Control Interrupt trigger mode Format: { level | edge | high | low } acpi_irq_balance [HW,ACPI] ACPI will balance active IRQs default in APIC mode acpi_irq_nobalance [HW,ACPI] ACPI will not move active IRQs (default) default in PIC mode acpi_irq_pci= [HW,ACPI] If irq_balance, clear listed IRQs for use by PCI Format: ,... acpi_irq_isa= [HW,ACPI] If irq_balance, mark listed IRQs used by ISA Format: ,... acpi_osi= [HW,ACPI] empty param disables _OSI acpi_serialize [HW,ACPI] force serialization of AML methods acpi_skip_timer_override [HW,ACPI] Recognize and ignore IRQ0/pin2 Interrupt Override. For broken nForce2 BIOS resulting in XT-PIC timer. acpi_dbg_layer= [HW,ACPI] Format: Each bit of the indicates an ACPI debug layer, 1: enable, 0: disable. It is useful for boot time debugging. After system has booted up, it can be set via /proc/acpi/debug_layer. acpi_dbg_level= [HW,ACPI] Format: Each bit of the indicates an ACPI debug level, 1: enable, 0: disable. It is useful for boot time debugging. After system has booted up, it can be set via /proc/acpi/debug_level. acpi_fake_ecdt [HW,ACPI] Workaround failure due to BIOS lacking ECDT acpi_generic_hotkey [HW,ACPI] Allow consolidated generic hotkey driver to override platform specific driver. See also Documentation/acpi-hotkey.txt. enable_timer_pin_1 [i386,x86-64] Enable PIN 1 of APIC timer Can be useful to work around chipset bugs (in particular on some ATI chipsets). The kernel tries to set a reasonable default. disable_timer_pin_1 [i386,x86-64] Disable PIN 1 of APIC timer Can be useful to work around chipset bugs. ad1816= [HW,OSS] Format: ,,, See also Documentation/sound/oss/AD1816. ad1848= [HW,OSS] Format: ,,,, adlib= [HW,OSS] Format: advansys= [HW,SCSI] See header of drivers/scsi/advansys.c. advwdt= [HW,WDT] Advantech WDT Format: , aedsp16= [HW,OSS] Audio Excel DSP 16 Format: ,,,,, See also header of sound/oss/aedsp16.c. aha152x= [HW,SCSI] See Documentation/scsi/aha152x.txt. aha1542= [HW,SCSI] Format: [,,[,]] aic7xxx= [HW,SCSI] See Documentation/scsi/aic7xxx.txt. aic79xx= [HW,SCSI] See Documentation/scsi/aic79xx.txt. amijoy.map= [HW,JOY] Amiga joystick support Map of devices attached to JOY0DAT and JOY1DAT Format: , See also Documentation/kernel/input/joystick.txt analog.map= [HW,JOY] Analog joystick and gamepad support Specifies type or capabilities of an analog joystick connected to one of 16 gameports Format: ,,.. apc= [HW,SPARC] Power management functions (SPARCstation-4/5 + deriv.) Format: noidle Disable APC CPU standby support. SPARCstation-Fox does not play well with APC CPU idle - disable it if you have APC and your system crashes randomly. apic= [APIC,i386] Change the output verbosity whilst booting Format: { quiet (default) | verbose | debug } Change the amount of debugging information output when initialising the APIC and IO-APIC components. apm= [APM] Advanced Power Management See header of arch/i386/kernel/apm.c. applicom= [HW] Format: , arcrimi= [HW,NET] ARCnet - "RIM I" (entirely mem-mapped) cards Format: ,, ataflop= [HW,M68k] atarimouse= [HW,MOUSE] Atari Mouse atascsi= [HW,SCSI] Atari SCSI atkbd.extra= [HW] Enable extra LEDs and keys on IBM RapidAccess, EzKey and similar keyboards atkbd.reset= [HW] Reset keyboard during initialization atkbd.set= [HW] Select keyboard code set Format: (2 = AT (default), 3 = PS/2) atkbd.scroll= [HW] Enable scroll wheel on MS Office and similar keyboards atkbd.softraw= [HW] Choose between synthetic and real raw mode Format: (0 = real, 1 = synthetic (default)) atkbd.softrepeat= [HW] Use software keyboard repeat autotest [IA64] awe= [HW,OSS] AWE32/SB32/AWE64 wave table synth Format: ,, aztcd= [HW,CD] Aztech CD268 CDROM driver Format: ,0x79 (?) baycom_epp= [HW,AX25] Format: , baycom_par= [HW,AX25] BayCom Parallel Port AX.25 Modem Format: , See header of drivers/net/hamradio/baycom_par.c. baycom_ser_fdx= [HW,AX25] BayCom Serial Port AX.25 Modem (Full Duplex Mode) Format: ,,[,] See header of drivers/net/hamradio/baycom_ser_fdx.c. baycom_ser_hdx= [HW,AX25] BayCom Serial Port AX.25 Modem (Half Duplex Mode) Format: ,, See header of drivers/net/hamradio/baycom_ser_hdx.c. blkmtd_device= [HW,MTD] blkmtd_erasesz= blkmtd_ro= blkmtd_bs= blkmtd_count= bttv.card= [HW,V4L] bttv (bt848 + bt878 based grabber cards) bttv.radio= Most important insmod options are available as kernel args too. bttv.pll= See Documentation/video4linux/bttv/Insmod-options bttv.tuner= and Documentation/video4linux/bttv/CARDLIST BusLogic= [HW,SCSI] See drivers/scsi/BusLogic.c, comment before function BusLogic_ParseDriverOptions(). c101= [NET] Moxa C101 synchronous serial card cachesize= [BUGS=IA-32] Override level 2 CPU cache size detection. Sometimes CPU hardware bugs make them report the cache size incorrectly. The kernel will attempt work arounds to fix known problems, but for some CPUs it is not possible to determine what the correct size should be. This option provides an override for these situations. cdu31a= [HW,CD] Format: ,[,PAS] See header of drivers/cdrom/cdu31a.c. chandev= [HW,NET] Generic channel device initialisation checkreqprot [SELINUX] Set initial checkreqprot flag value. Format: { "0" | "1" } See security/selinux/Kconfig help text. 0 -- check protection applied by kernel (includes any implied execute protection). 1 -- check protection requested by application. Default value is set via a kernel config option. Value can be changed at runtime via /selinux/checkreqprot. clock= [BUGS=IA-32,HW] gettimeofday timesource override. Forces specified timesource (if avaliable) to be used when calculating gettimeofday(). If specicified timesource is not avalible, it defaults to PIT. Format: { pit | tsc | cyclone | pmtmr } hpet= [IA-32,HPET] option to disable HPET and use PIT. Format: disable cm206= [HW,CD] Format: { auto | [,][] } com20020= [HW,NET] ARCnet - COM20020 chipset Format:[,[,[,[,[,]]]]] com90io= [HW,NET] ARCnet - COM90xx chipset (IO-mapped buffers) Format: [,] com90xx= [HW,NET] ARCnet - COM90xx chipset (memory-mapped buffers) Format: [,[,]] condev= [HW,S390] console device conmode= console= [KNL] Output console device and options. tty Use the virtual console device . ttyS[,options] Use the specified serial port. The options are of the form "bbbbpn", where "bbbb" is the baud rate, "p" is parity ("n", "o", or "e"), and "n" is bits. Default is "9600n8". See also Documentation/serial-console.txt. uart,io,[,options] uart,mmio,[,options] Start an early, polled-mode console on the 8250/16550 UART at the specified I/O port or MMIO address, switching to the matching ttyS device later. The options are the same as for ttyS, above. cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver Format:,,,[,] cpia_pp= [HW,PPT] Format: { parport | auto | none } crashkernel=nn[KMG]@ss[KMG] [KNL] Reserve a chunk of physical memory to hold a kernel to switch to with kexec on panic. cs4232= [HW,OSS] Format: ,,,,, cs89x0_dma= [HW,NET] Format: cs89x0_media= [HW,NET] Format: { rj45 | aui | bnc } cyclades= [HW,SERIAL] Cyclades multi-serial port adapter. dasd= [HW,NET] See header of drivers/s390/block/dasd_devmap.c. db9.dev[2|3]= [HW,JOY] Multisystem joystick support via parallel port (one device per port) Format: , See also Documentation/input/joystick-parport.txt debug [KNL] Enable kernel debugging (events log level). decnet= [HW,NET] Format: [,] See also Documentation/networking/decnet.txt. devfs= [DEVFS] See Documentation/filesystems/devfs/boot-options. dhash_entries= [KNL] Set number of hash buckets for dentry cache. digi= [HW,SERIAL] IO parameters + enable/disable command. digiepca= [HW,SERIAL] See drivers/char/README.epca and Documentation/digiepca.txt. dmascc= [HW,AX25,SERIAL] AX.25 Z80SCC driver with DMA support available. Format: [,[,..]] dmasound= [HW,OSS] Sound subsystem buffers dscc4.setup= [NET] dtc3181e= [HW,SCSI] earlyprintk= [IA-32,X86-64] earlyprintk=vga earlyprintk=serial[,ttySn[,baudrate]] Append ",keep" to not disable it when the real console takes over. Only vga or serial at a time, not both. Currently only ttyS0 and ttyS1 are supported. Interaction with the standard serial driver is not very good. The VGA output is eventually overwritten by the real console. eata= [HW,SCSI] eda= [HW,PS2] edb= [HW,PS2] edd= [EDD] Format: {"of[f]" | "sk[ipmbr]"} See comment in arch/i386/boot/edd.S eicon= [HW,ISDN] Format: ,, eisa_irq_edge= [PARISC,HW] See header of drivers/parisc/eisa.c. elanfreq= [IA-32] See comment before function elanfreq_setup() in arch/i386/kernel/cpu/cpufreq/elanfreq.c. elevator= [IOSCHED] Format: {"as" | "cfq" | "deadline" | "noop"} See Documentation/block/as-iosched.txt and Documentation/block/deadline-iosched.txt for details. elfcorehdr= [IA-32] Specifies physical address of start of kernel core image elf header. See Documentation/kdump.txt for details. enforcing [SELINUX] Set initial enforcing status. Format: {"0" | "1"} See security/selinux/Kconfig help text. 0 -- permissive (log only, no denials). 1 -- enforcing (deny and log). Default value is 0. Value can be changed at runtime via /selinux/enforce. es1370= [HW,OSS] Format: [,] See also header of sound/oss/es1370.c. es1371= [HW,OSS] Format: ,[,[]] See also header of sound/oss/es1371.c. ether= [HW,NET] Ethernet cards parameters This option is obsoleted by the "netdev=" option, which has equivalent usage. See its documentation for details. eurwdt= [HW,WDT] Eurotech CPU-1220/1410 onboard watchdog. Format: [,] fd_mcs= [HW,SCSI] See header of drivers/scsi/fd_mcs.c. fdomain= [HW,SCSI] See header of drivers/scsi/fdomain.c. floppy= [HW] See Documentation/floppy.txt. ftape= [HW] Floppy Tape subsystem debugging options. See Documentation/ftape.txt. gamecon.map[2|3]= [HW,JOY] Multisystem joystick and NES/SNES/PSX pad support via parallel port (up to 5 devices per port) Format: ,,,,, See also Documentation/input/joystick-parport.txt gamma= [HW,DRM] gdth= [HW,SCSI] See header of drivers/scsi/gdth.c. gpt [EFI] Forces disk with valid GPT signature but invalid Protective MBR to be treated as GPT. gscd= [HW,CD] Format: gt96100eth= [NET] MIPS GT96100 Advanced Communication Controller gus= [HW,OSS] Format: ,,, gvp11= [HW,SCSI] hashdist= [KNL,NUMA] Large hashes allocated during boot are distributed across NUMA nodes. Defaults on for IA-64, off otherwise. Format: 0 | 1 (for off | on) hcl= [IA-64] SGI's Hardware Graph compatibility layer hd= [EIDE] (E)IDE hard drive subsystem geometry Format: ,, hd?= [HW] (E)IDE subsystem hd?lun= See Documentation/ide.txt. highmem=nn[KMG] [KNL,BOOT] forces the highmem zone to have an exact size of . This works even on boxes that have no highmem otherwise. This also works to reduce highmem size on bigger boxes. hisax= [HW,ISDN] See Documentation/isdn/README.HiSax. hugepages= [HW,IA-32,IA-64] Maximal number of HugeTLB pages. noirqbalance [IA-32,SMP,KNL] Disable kernel irq balancing i8042.direct [HW] Put keyboard port into non-translated mode i8042.dumbkbd [HW] Pretend that controlled can only read data from keyboard and can not control its state (Don't attempt to blink the leds) i8042.noaux [HW] Don't check for auxiliary (== mouse) port i8042.nokbd [HW] Don't check/create keyboard port i8042.nomux [HW] Don't check presence of an active multiplexing controller i8042.nopnp [HW] Don't use ACPIPnP / PnPBIOS to discover KBD/AUX controllers i8042.panicblink= [HW] Frequency with which keyboard LEDs should blink when kernel panics (default is 0.5 sec) i8042.reset [HW] Reset the controller during init and cleanup i8042.unlock [HW] Unlock (ignore) the keylock i810= [HW,DRM] i8k.ignore_dmi [HW] Continue probing hardware even if DMI data indicates that the driver is running on unsupported hardware. i8k.force [HW] Activate i8k driver even if SMM BIOS signature does not match list of supported models. i8k.power_status [HW] Report power status in /proc/i8k (disabled by default) i8k.restricted [HW] Allow controlling fans only if SYS_ADMIN capability is set. ibmmcascsi= [HW,MCA,SCSI] IBM MicroChannel SCSI adapter See Documentation/mca.txt. icn= [HW,ISDN] Format: [,[,[,]]] ide= [HW] (E)IDE subsystem Format: ide=nodma or ide=doubler or ide=reverse See Documentation/ide.txt. ide?= [HW] (E)IDE subsystem Format: ide?=noprobe or chipset specific parameters. See Documentation/ide.txt. idebus= [HW] (E)IDE subsystem - VLB/PCI bus speed See Documentation/ide.txt. idle= [HW] Format: idle=poll or idle=halt ihash_entries= [KNL] Set number of hash buckets for inode cache. in2000= [HW,SCSI] See header of drivers/scsi/in2000.c. init= [KNL] Format: Run specified binary instead of /sbin/init as init process. initcall_debug [KNL] Trace initcalls as they are executed. Useful for working out where the kernel is dying during startup. initrd= [BOOT] Specify the location of the initial ramdisk inport.irq= [HW] Inport (ATI XL and Microsoft) busmouse driver Format: inttest= [IA64] io7= [HW] IO7 for Marvel based alpha systems See comment before marvel_specify_io7 in arch/alpha/kernel/core_marvel.c. ip= [IP_PNP] See Documentation/nfsroot.txt. ip2= [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards See comment before ip2_setup() in drivers/char/ip2.c. ips= [HW,SCSI] Adaptec / IBM ServeRAID controller See header of drivers/scsi/ips.c. irqfixup [HW] When an interrupt is not handled search all handlers for it. Intended to get systems with badly broken firmware running. irqpoll [HW] When an interrupt is not handled search all handlers for it. Also check all handlers each timer interrupt. Intended to get systems with badly broken firmware running. isapnp= [ISAPNP] Format: ,,, isolcpus= [KNL,SMP] Isolate CPUs from the general scheduler. Format: ,..., This option can be used to specify one or more CPUs to isolate from the general SMP balancing and scheduling algorithms. The only way to move a process onto or off an "isolated" CPU is via the CPU affinity syscalls. begins at 0 and the maximum value is "number of CPUs in system - 1". This option is the preferred way to isolate CPUs. The alternative -- manually setting the CPU mask of all tasks in the system -- can cause problems and suboptimal load balancer performance. isp16= [HW,CD] Format: ,,, iucv= [HW,NET] js= [HW,JOY] Analog joystick See Documentation/input/joystick.txt. keepinitrd [HW,ARM] kstack=N [IA-32,X86-64] Print N words from the kernel stack in oops dumps. l2cr= [PPC] lapic [IA-32,APIC] Enable the local APIC even if BIOS disabled it. lasi= [HW,SCSI] PARISC LASI driver for the 53c700 chip Format: addr:,irq: llsc*= [IA64] See function print_params() in arch/ia64/sn/kernel/llsc4.c. load_ramdisk= [RAM] List of ramdisks to load from floppy See Documentation/ramdisk.txt. lockd.udpport= [NFS] lockd.tcpport= [NFS] logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver Format: loglevel= All Kernel Messages with a loglevel smaller than the console loglevel will be printed to the console. It can also be changed with klogd or other programs. The loglevels are defined as follows: 0 (KERN_EMERG) system is unusable 1 (KERN_ALERT) action must be taken immediately 2 (KERN_CRIT) critical conditions 3 (KERN_ERR) error conditions 4 (KERN_WARNING) warning conditions 5 (KERN_NOTICE) normal but significant condition 6 (KERN_INFO) informational 7 (KERN_DEBUG) debug-level messages log_buf_len=n Sets the size of the printk ring buffer, in bytes. Format: { n | nk | nM } n must be a power of two. The default size is set in the kernel config file. lp=0 [LP] Specify parallel ports to use, e.g, lp=port[,port...] lp=none,parport0 (lp0 not configured, lp1 uses lp=reset first parallel port). 'lp=0' disables the lp=auto printer driver. 'lp=reset' (which can be specified in addition to the ports) causes attached printers to be reset. Using lp=port1,port2,... specifies the parallel ports to associate lp devices with, starting with lp0. A port specification may be 'none' to skip that lp device, or a parport name such as 'parport0'. Specifying 'lp=auto' instead of a port specification list means that device IDs from each port should be examined, to see if an IEEE 1284-compliant printer is attached; if so, the driver will manage that printer. See also header of drivers/char/lp.c. lpj=n [KNL] Sets loops_per_jiffy to given constant, thus avoiding time-consuming boot-time autodetection (up to 250 ms per CPU). 0 enables autodetection (default). To determine the correct value for your kernel, boot with normal autodetection and see what value is printed. Note that on SMP systems the preset will be applied to all CPUs, which is likely to cause problems if your CPUs need significantly divergent settings. An incorrect value will cause delays in the kernel to be wrong, leading to unpredictable I/O errors and other breakage. Although unlikely, in the extreme case this might damage your hardware. ltpc= [NET] Format: ,, mac5380= [HW,SCSI] Format:,,,, mac53c9x= [HW,SCSI] Format:,,,,,,, machvec= [IA64] Force the use of a particular machine-vector (machvec) in a generic kernel. Example: machvec=hpzx1_swiotlb mad16= [HW,OSS] Format:,,,,,, maui= [HW,OSS] Format: , max_loop= [LOOP] Maximum number of loopback devices that can be mounted Format: maxcpus= [SMP] Maximum number of processors that an SMP kernel should make use of max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or equal to this physical address is ignored. max_luns= [SCSI] Maximum number of LUNs to probe. Should be between 1 and 2^32-1. max_report_luns= [SCSI] Maximum number of LUNs received. Should be between 1 and 16384. mca-pentium [BUGS=IA-32] mcatest= [IA-64] mcd= [HW,CD] Format: ,, mcdx= [HW,CD] mce [IA-32] Machine Check Exception md= [HW] RAID subsystems devices and level See Documentation/md.txt. mdacon= [MDA] Format: , Specifies range of consoles to be captured by the MDA. mem=nn[KMG] [KNL,BOOT] Force usage of a specific amount of memory Amount of memory to be used when the kernel is not able to see the whole system memory or for test. [IA-32] Use together with memmap= to avoid physical address space collisions. Without memmap= PCI devices could be placed at addresses belonging to unused RAM. mem=nopentium [BUGS=IA-32] Disable usage of 4MB pages for kernel memory. memmap=exactmap [KNL,IA-32] Enable setting of an exact E820 memory map, as specified by the user. Such memmap=exactmap lines can be constructed based on BIOS output or other requirements. See the memmap=nn@ss option description. memmap=nn[KMG]@ss[KMG] [KNL] Force usage of a specific region of memory Region of memory to be used, from ss to ss+nn. memmap=nn[KMG]#ss[KMG] [KNL,ACPI] Mark specific memory as ACPI data. Region of memory to be used, from ss to ss+nn. memmap=nn[KMG]$ss[KMG] [KNL,ACPI] Mark specific memory as reserved. Region of memory to be used, from ss to ss+nn. meye.*= [HW] Set MotionEye Camera parameters See Documentation/video4linux/meye.txt. mga= [HW,DRM] mousedev.tap_time= [MOUSE] Maximum time between finger touching and leaving touchpad surface for touch to be considered a tap and be reported as a left button click (for touchpads working in absolute mode only). Format: mousedev.xres= [MOUSE] Horizontal screen resolution, used for devices reporting absolute coordinates, such as tablets mousedev.yres= [MOUSE] Vertical screen resolution, used for devices reporting absolute coordinates, such as tablets mpu401= [HW,OSS] Format: , MTD_Partition= [MTD] Format: ,,, MTD_Region= [MTD] Format:,[,,,,] mtdparts= [MTD] See drivers/mtd/cmdline.c. mtouchusb.raw_coordinates= [HW] Make the MicroTouch USB driver use raw coordinates ('y', default) or cooked coordinates ('n') n2= [NET] SDL Inc. RISCom/N2 synchronous serial card NCR_D700= [HW,SCSI] See header of drivers/scsi/NCR_D700.c. ncr5380= [HW,SCSI] ncr53c400= [HW,SCSI] ncr53c400a= [HW,SCSI] ncr53c406a= [HW,SCSI] ncr53c8xx= [HW,SCSI] netdev= [NET] Network devices parameters Format: ,,,, Note that mem_start is often overloaded to mean something different and driver-specific. This usage is only documented in each driver source file if at all. nfsaddrs= [NFS] See Documentation/nfsroot.txt. nfsroot= [NFS] nfs root filesystem for disk-less boxes. See Documentation/nfsroot.txt. nmi_watchdog= [KNL,BUGS=IA-32] Debugging features for SMP kernels no387 [BUGS=IA-32] Tells the kernel to use the 387 maths emulation library even if a 387 maths coprocessor is present. noalign [KNL,ARM] noapic [SMP,APIC] Tells the kernel to not make use of any IOAPICs that may be present in the system. noasync [HW,M68K] Disables async and sync negotiation for all devices. nobats [PPC] Do not use BATs for mapping kernel lowmem on "Classic" PPC cores. nocache [ARM] nodisconnect [HW,SCSI,M68K] Disables SCSI disconnects. noexec [IA-64] noexec [IA-32,X86-64] noexec=on: enable non-executable mappings (default) noexec=off: disable nn-executable mappings nofxsr [BUGS=IA-32] nohlt [BUGS=ARM] no-hlt [BUGS=IA-32] Tells the kernel that the hlt instruction doesn't work correctly and not to use it. nohalt [IA-64] Tells the kernel not to use the power saving function PAL_HALT_LIGHT when idle. This increases power-consumption. On the positive side, it reduces interrupt wake-up latency, which may improve performance in certain environments such as networked servers or real-time systems. noirqdebug [IA-32] Disables the code which attempts to detect and disable unhandled interrupt sources. noisapnp [ISAPNP] Disables ISA PnP code. noinitrd [RAM] Tells the kernel not to load any configured initial RAM disk. nointroute [IA-64] nolapic [IA-32,APIC] Do not enable or use the local APIC. noltlbs [PPC] Do not use large page/tlb entries for kernel lowmem mapping on PPC40x. nomce [IA-32] Machine Check Exception noresidual [PPC] Don't use residual data on PReP machines. noresume [SWSUSP] Disables resume and restores original swap space. no-scroll [VGA] Disables scrollback. This is required for the Braillex ib80-piezo Braille reader made by F.H. Papenmeier (Germany). nosbagart [IA-64] nosmp [SMP] Tells an SMP kernel to act as a UP kernel. nosync [HW,M68K] Disables sync negotiation for all devices. notsc [BUGS=IA-32] Disable Time Stamp Counter nousb [USB] Disable the USB subsystem nowb [ARM] opl3= [HW,OSS] Format: opl3sa= [HW,OSS] Format: ,,,,, opl3sa2= [HW,OSS] Format:,,,,,,,[,, oprofile.timer= [HW] Use timer interrupt instead of performance counters optcd= [HW,CD] Format: osst= [HW,SCSI] SCSI Tape Driver Format: , See also Documentation/scsi/st.txt. panic= [KNL] Kernel behaviour on panic Format: parkbd.port= [HW] Parallel port number the keyboard adapter is connected to, default is 0. Format: parkbd.mode= [HW] Parallel port keyboard adapter mode of operation, 0 for XT, 1 for AT (default is AT). Format: parport= [HW,PPT] Specify parallel ports. 0 disables. Format: { 0 | auto | 0xBBB[,IRQ[,DMA]] } Use 'auto' to force the driver to use any IRQ/DMA settings detected (the default is to ignore detected IRQ/DMA settings because of possible conflicts). You can specify the base address, IRQ, and DMA settings; IRQ and DMA should be numbers, or 'auto' (for using detected settings on that particular port), or 'nofifo' (to avoid using a FIFO even if it is detected). Parallel ports are assigned in the order they are specified on the command line, starting with parport0. parport_init_mode= [HW,PPT] Configure VIA parallel port to operate in a specific mode. This is necessary on Pegasos computer where firmware has no options for setting up parallel port mode and sets it to spp. Currently this function knows 686a and 8231 chips. Format: [spp|ps2|epp|ecp|ecpepp] pas2= [HW,OSS] Format:,,,,,,, pas16= [HW,SCSI] See header of drivers/scsi/pas16.c. pcbit= [HW,ISDN] pcd. [PARIDE] See header of drivers/block/paride/pcd.c. See also Documentation/paride.txt. pci=option[,option...] [PCI] various PCI subsystem options: off [IA-32] don't probe for the PCI bus bios [IA-32] force use of PCI BIOS, don't access the hardware directly. Use this if your machine has a non-standard PCI host bridge. nobios [IA-32] disallow use of PCI BIOS, only direct hardware access methods are allowed. Use this if you experience crashes upon bootup and you suspect they are caused by the BIOS. conf1 [IA-32] Force use of PCI Configuration Mechanism 1. conf2 [IA-32] Force use of PCI Configuration Mechanism 2. nosort [IA-32] Don't sort PCI devices according to order given by the PCI BIOS. This sorting is done to get a device order compatible with older kernels. biosirq [IA-32] Use PCI BIOS calls to get the interrupt routing table. These calls are known to be buggy on several machines and they hang the machine when used, but on other computers it's the only way to get the interrupt routing table. Try this option if the kernel is unable to allocate IRQs or discover secondary PCI buses on your motherboard. rom [IA-32] Assign address space to expansion ROMs. Use with caution as certain devices share address decoders between ROMs and other resources. irqmask=0xMMMM [IA-32] Set a bit mask of IRQs allowed to be assigned automatically to PCI devices. You can make the kernel exclude IRQs of your ISA cards this way. pirqaddr=0xAAAAA [IA-32] Specify the physical address of the PIRQ table (normally generated by the BIOS) if it is outside the F0000h-100000h range. lastbus=N [IA-32] Scan all buses thru bus #N. Can be useful if the kernel is unable to find your secondary buses and you want to tell it explicitly which ones they are. assign-busses [IA-32] Always assign all PCI bus numbers ourselves, overriding whatever the firmware may have done. usepirqmask [IA-32] Honor the possible IRQ mask stored in the BIOS $PIR table. This is needed on some systems with broken BIOSes, notably some HP Pavilion N5400 and Omnibook XE3 notebooks. This will have no effect if ACPI IRQ routing is enabled. noacpi [IA-32] Do not use ACPI for IRQ routing or for PCI scanning. routeirq Do IRQ routing for all PCI devices. This is normally done in pci_enable_device(), so this option is a temporary workaround for broken drivers that don't call it. firmware [ARM] Do not re-enumerate the bus but instead just use the configuration from the bootloader. This is currently used on IXP2000 systems where the bus has to be configured a certain way for adjunct CPUs. pcmv= [HW,PCMCIA] BadgePAD 4 pd. [PARIDE] See Documentation/paride.txt. pdcchassis= [PARISC,HW] Disable/Enable PDC Chassis Status codes at boot time. Format: { 0 | 1 } See arch/parisc/kernel/pdc_chassis.c pf. [PARIDE] See Documentation/paride.txt. pg. [PARIDE] See Documentation/paride.txt. pirq= [SMP,APIC] Manual mp-table setup See Documentation/i386/IO-APIC.txt. plip= [PPT,NET] Parallel port network link Format: { parport | timid | 0 } See also Documentation/parport.txt. pnpacpi= [ACPI] { off } pnpbios= [ISAPNP] { on | off | curr | res | no-curr | no-res } pnp_reserve_irq= [ISAPNP] Exclude IRQs for the autoconfiguration pnp_reserve_dma= [ISAPNP] Exclude DMAs for the autoconfiguration pnp_reserve_io= [ISAPNP] Exclude I/O ports for the autoconfiguration Ranges are in pairs (I/O port base and size). pnp_reserve_mem= [ISAPNP] Exclude memory regions for the autoconfiguration. Ranges are in pairs (memory base and size). profile= [KNL] Enable kernel profiling via /proc/profile Format: [schedule,] Param: "schedule" - profile schedule points. Param: - step/bucket size as a power of 2 for statistical time based profiling. processor.max_cstate= [HW,ACPI] Limit processor to maximum C-state max_cstate=9 overrides any DMI blacklist limit. prompt_ramdisk= [RAM] List of RAM disks to prompt for floppy disk before loading. See Documentation/ramdisk.txt. psmouse.proto= [HW,MOUSE] Highest PS2 mouse protocol extension to probe for; one of (bare|imps|exps|lifebook|any). psmouse.rate= [HW,MOUSE] Set desired mouse report rate, in reports per second. psmouse.resetafter= [HW,MOUSE] Try to reset the device after so many bad packets (0 = never). psmouse.resolution= [HW,MOUSE] Set desired mouse resolution, in dpi. psmouse.smartscroll= [HW,MOUSE] Controls Logitech smartscroll autorepeat. 0 = disabled, 1 = enabled (default). pss= [HW,OSS] Personal Sound System (ECHO ESC614) Format:,,,,, pt. [PARIDE] See Documentation/paride.txt. quiet= [KNL] Disable log messages r128= [HW,DRM] raid= [HW,RAID] See Documentation/md.txt. ramdisk= [RAM] Sizes of RAM disks in kilobytes [deprecated] See Documentation/ramdisk.txt. ramdisk_blocksize= [RAM] See Documentation/ramdisk.txt. ramdisk_size= [RAM] Sizes of RAM disks in kilobytes New name for the ramdisk parameter. See Documentation/ramdisk.txt. rdinit= [KNL] Format: Run specified binary instead of /init from the ramdisk, used for early userspace startup. See initrd. reboot= [BUGS=IA-32,BUGS=ARM,BUGS=IA-64] Rebooting mode Format: [,[,...]] See arch/*/kernel/reboot.c. reserve= [KNL,BUGS] Force the kernel to ignore some iomem area resume= [SWSUSP] Specify the partition device for software suspend rhash_entries= [KNL,NET] Set number of hash buckets for route cache riscom8= [HW,SERIAL] Format: [,[,...]] ro [KNL] Mount root device read-only on boot root= [KNL] Root filesystem rootdelay= [KNL] Delay (in seconds) to pause before attempting to mount the root filesystem rootflags= [KNL] Set root filesystem mount option string rootfstype= [KNL] Set root filesystem type rw [KNL] Mount root device read-write on boot S [KNL] Run init in single mode sa1100ir [NET] See drivers/net/irda/sa1100_ir.c. sb= [HW,OSS] Format: ,,, sbni= [NET] Granch SBNI12 leased line adapter sbpcd= [HW,CD] Soundblaster CD adapter Format: , See a comment before function sbpcd_setup() in drivers/cdrom/sbpcd.c. sc1200wdt= [HW,WDT] SC1200 WDT (watchdog) driver Format: [,[,]] scsi_debug_*= [SCSI] See drivers/scsi/scsi_debug.c. scsi_default_dev_flags= [SCSI] SCSI default device flags Format: scsi_dev_flags= [SCSI] Black/white list entry for vendor and model Format: :: (flags are integer value) scsi_logging= [SCSI] selinux [SELINUX] Disable or enable SELinux at boot time. Format: { "0" | "1" } See security/selinux/Kconfig help text. 0 -- disable. 1 -- enable. Default value is set via kernel config option. If enabled at boot time, /selinux/disable can be used later to disable prior to initial policy load. serialnumber [BUGS=IA-32] sg_def_reserved_size= [SCSI] sgalaxy= [HW,OSS] Format: ,,,, shapers= [NET] Maximal number of shapers. sim710= [SCSI,HW] See header of drivers/scsi/sim710.c. simeth= [IA-64] simscsi= sjcd= [HW,CD] Format: ,, See header of drivers/cdrom/sjcd.c. slram= [HW,MTD] smart2= [HW] Format: [,[,...,]] snd-ad1816a= [HW,ALSA] snd-ad1848= [HW,ALSA] snd-ali5451= [HW,ALSA] snd-als100= [HW,ALSA] snd-als4000= [HW,ALSA] snd-azt2320= [HW,ALSA] snd-cmi8330= [HW,ALSA] snd-cmipci= [HW,ALSA] snd-cs4231= [HW,ALSA] snd-cs4232= [HW,ALSA] snd-cs4236= [HW,ALSA] snd-cs4281= [HW,ALSA] snd-cs46xx= [HW,ALSA] snd-dt019x= [HW,ALSA] snd-dummy= [HW,ALSA] snd-emu10k1= [HW,ALSA] snd-ens1370= [HW,ALSA] snd-ens1371= [HW,ALSA] snd-es968= [HW,ALSA] snd-es1688= [HW,ALSA] snd-es18xx= [HW,ALSA] snd-es1938= [HW,ALSA] snd-es1968= [HW,ALSA] snd-fm801= [HW,ALSA] snd-gusclassic= [HW,ALSA] snd-gu***treme= [HW,ALSA] snd-gusmax= [HW,ALSA] snd-hdsp= [HW,ALSA] snd-ice1712= [HW,ALSA] snd-intel8x0= [HW,ALSA] snd-interwave= [HW,ALSA] snd-interwave-stb= [HW,ALSA] snd-korg1212= [HW,ALSA] snd-maestro3= [HW,ALSA] snd-mpu401= [HW,ALSA] snd-mtpav= [HW,ALSA] snd-nm256= [HW,ALSA] snd-opl3sa2= [HW,ALSA] snd-opti92x-ad1848= [HW,ALSA] snd-opti92x-cs4231= [HW,ALSA] snd-opti93x= [HW,ALSA] snd-pmac= [HW,ALSA] snd-rme32= [HW,ALSA] snd-rme96= [HW,ALSA] snd-rme9652= [HW,ALSA] snd-sb8= [HW,ALSA] snd-sb16= [HW,ALSA] snd-sbawe= [HW,ALSA] snd-serial= [HW,ALSA] snd-sgalaxy= [HW,ALSA] snd-sonicvibes= [HW,ALSA] snd-sun-amd7930= [HW,ALSA] snd-sun-cs4231= [HW,ALSA] snd-trident= [HW,ALSA] snd-usb-audio= [HW,ALSA,USB] snd-via82xx= [HW,ALSA] snd-virmidi= [HW,ALSA] snd-wavefront= [HW,ALSA] snd-ymfpci= [HW,ALSA] sonicvibes= [HW,OSS] Format: sonycd535= [HW,CD] Format: [,] sonypi.*= [HW] Sony Programmable I/O Control Device driver See Documentation/sonypi.txt specialix= [HW,SERIAL] Specialix multi-serial port adapter See Documentation/specialix.txt. spia_io_base= [HW,MTD] spia_fio_base= spia_pedr= spia_peddr= sscape= [HW,OSS] Format: ,,,, st= [HW,SCSI] SCSI tape parameters (buffers, etc.) See Documentation/scsi/st.txt. st0x= [HW,SCSI] See header of drivers/scsi/seagate.c. sti= [PARISC,HW] Format: Set the STI (builtin display/keyboard on the HP-PARISC machines) console (graphic card) which should be used as the initial boot-console. See also comment in drivers/video/console/sticore.c. sti_font= [HW] See comment in drivers/video/console/sticore.c. stifb= [HW] Format: bpp:[:[:...]] swiotlb= [IA-64] Number of I/O TLB slabs switches= [HW,M68k] sym53c416= [HW,SCSI] See header of drivers/scsi/sym53c416.c. t128= [HW,SCSI] See header of drivers/scsi/t128.c. tdfx= [HW,DRM] thash_entries= [KNL,NET] Set number of hash buckets for TCP connection time Show timing data prefixed to each printk message line tipar.timeout= [HW,PPT] Set communications timeout in tenths of a second (default 15). tipar.delay= [HW,PPT] Set inter-bit delay in microseconds (default 10). tmc8xx= [HW,SCSI] See header of drivers/scsi/seagate.c. tmscsim= [HW,SCSI] See comment before function dc390_setup() in drivers/scsi/tmscsim.c. tp720= [HW,PS2] trix= [HW,OSS] MediaTrix AudioTrix Pro Format:,,,,,,,, tsdev.xres= [TS] Horizontal screen resolution. tsdev.yres= [TS] Vertical screen resolution. turbografx.map[2|3]= [HW,JOY] TurboGraFX parallel port interface Format:,,,,,,, See also Documentation/input/joystick-parport.txt u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter See header of drivers/scsi/u14-34f.c. uart401= [HW,OSS] Format: , uart6850= [HW,OSS] Format: , usbhid.mousepoll= [USBHID] The interval which mice are to be polled at. video= [FB] Frame buffer configuration See Documentation/fb/modedb.txt. vga= [BOOT,IA-32] Select a particular video mode See Documentation/i386/boot.txt and Documentation/svga.txt. Use vga=ask for menu. This is actually a boot loader parameter; the value is passed to the kernel using a special protocol. vmalloc=nn[KMG] [KNL,BOOT] Forces the vmalloc area to have an exact size of . This can be used to increase the minimum size (128MB on x86). It can also be used to decrease the size and leave more room for directly mapped kernel RAM. vmhalt= [KNL,S390] vmpoff= [KNL,S390] waveartist= [HW,OSS] Format: ,,, wd33c93= [HW,SCSI] See header of drivers/scsi/wd33c93.c. wd7000= [HW,SCSI] See header of drivers/scsi/wd7000.c. wdt= [WDT] Watchdog See Documentation/watchdog/watchdog.txt. xd= [HW,XT] Original XT pre-IDE (RLL encoded) disks. xd_geo= See header of drivers/block/xd.c. xirc2ps_cs= [NET,PCMCIA] Format:,,,,,[,[,[,]]]
VIII virtualization&kvm
OS将对硬件资源的使用都虚拟成system call,某个进程只要与硬件打交道都要经过kernel提供的接口(system call)
rss(进程启动后必须要位于内存中,绝对不可以被交换出去(不被清出去))
page cache(进程运行时打开的文件,可放到交换分区中(可被清出去))
anon page(进程运行过程当中产生的数据,如堆中的一部分数据)
第一个进程运行打开一个很大的文件,第二个进程运行没有足够的内存时,内核会将第一个进程打开的文件(page cache)统统清出去,之后CPU又切到第一个进程时发现打开的文件没了,产生缺页异常,再重新从硬盘上调取
MMU(memory management unit,线性地址-->物理地址,MMU每次转换都要一级页目录查找、二级页目录查找,再平移计算才得到内存,为加速这个过程有TLB)
CPU通过IO port知道在某时刻与哪个IO打交道(CPU与IO设备交换数据通过IOport实现),IO设备在启动时要向CPU注册它使用的IO port,一个IO设备可使用一片连续的IO port,并注册使用中断号(让IO设备通知CPU有紧急事件要处理)以实现当IO设备上有信号让CPU知道哪个IO设备有信号,而且要通过IO port与这个设备打交道,CPU通过可编程中断控制器让每一个IO设备注册使用中断线上的中断设备号,如网卡上有人ping来一个报文,要将产生的电信号读下来放在内存网络缓冲区,若是disk IO放在disk缓冲区(每个设备都有缓冲区)
站在OS内核角度,kernel认为自己可使用所有硬件:CPU(全量CPU时间片),内存(连续,全部的内存空间0x0000-max,32bitOS内存最开始1M给BIOS,16M留给DMA;64bitOS有1G给DMA,这1G内核也能用),I/O(全部可用IO)
VA(virtual address线性地址)
PA(physical address)
虚拟化(将一个物理硬件平台虚拟成多个)
vmware(模拟出一堆硬件设备,每一个硬件设备都是独立平台)
虚拟化要解决的问题(硬件之上的OS,有用户空间、内核空间;vmware虚拟机所模拟出的多个硬件平台上的每一个OS也有用户空间、内核空间;每个内核都意识不到其它主机存在,直接使用硬件设备(内存),这将会覆盖掉其它的正在使用的内存空间,产生资源争用会使系统崩溃,硬件之上的这个OS将内存留一部分给kernel用,其它的给进程用,vmware虚拟机及其它进程使用的内存是高地址内存空间(非0地址空间),关键是每个内核都要使用从0开始的内存地址空间)
guest OS(虚拟出来的虚拟机,内存地址转换要有两次,效率低,多个guest OS要与IO设备(网卡、磁盘)交互)
hypervisor(虚拟机管理程序)
CPU虚拟化(将时间片再分细点,指令分普通指令和特权指令,ring{0,1,2,3},ring0,privileged ring特权环是能运行敏感指令(特权指令)的,进程运行只能运行普通指令(进程在cpu上运行无非将进程的代码转换为cpu上运行的指令),要想用特权指令,如要访问硬盘、访问内存中的数据时通过system call,这时进程要退出,内核在cpu的ring0上运行;guest OS的kernel中同样有普通指令、特权指令,当guest OS上的进程需要运行特权指令(实际上管理虚拟机软件vmware的运行是在用户空间的,所以guest OS是不能运行敏感指令的,不能让虚拟机的内核运行在ring0上,只能运行在ring3上,否则它会将硬件资源视为可全量使用,会清空其它进程的内存、重启系统等操作)又不能运行这显然不合适,每一个kernel都认为自己在ring0上,通过模拟让guest OS认为自己在ring0上,保留一些关键的特权指令(如重启系统等),否则无法保证整个OS的安全性,实际上guest OS并不真正运行特权指令,每次guest OS的进程-->guest OS的内核-->host OS的内核,ring0就是一堆特权指令集来保证各guest OS间是隔离的,当host OS要关机就能控制整个系统关机,不管guest允不允许,host OS的内核才是真正意义的特权阶层,host OS要能监控每一个guest OS执行的指令并判定它能否运行)
X86平台要实现CPU的虚拟化面临的挑战(特权级压缩ring compression,VMM,virtual machine monitor必须要运行在ring0上,为避免guest OS控制系统资源,guestOS不得不降低自身的运行级别在ring3上(特权级不够使用),VMM使用分页或段限制的方式保护物理内存的访问,但64bit模式下段限制不起作用,而分页又不区分ring{0,1,2},为统一和简化VMM的设计,guest OS只能和用户进程一样运行在ring3上,VMM必须监控guest OS对GDT、IDT(CPU寄存器)等特权资源的位置,防止guest OS运行在ring0,同时又要保护降级后的guest OS不受guest进程的主动攻击或无意破坏;特权级别名ring alias,搞一些假的特权指令集告诉guest OS这就是ring0;地址空间压缩address space compression;非特权敏感指令;静默特权失败silentprivilege failure;中断虚拟化interrupt virtualization)
classical virtualization的基本需求(1974,Popek、Goldberg,真正意义的VMM至少需要三个方面的标准:等价执行equivalient execution,除资源可用性及时间上的不同之外,程序在虚拟化环境中及真正环境中的执行是完全相同的;性能performance,指令集中的大部分指令要能直接运行在CPU上;安全safety,VMM要能完全控制系统资源,某个guest OS运行不能影响到其它的guest OS,各guest OS间要实现隔离,且任何一个guest OS要执行特权指令,host OS要能提前捕获对其处理,任何一个guest OS都不能越过host OS对整个物理硬件发出任何特权控制指令)
注:Intel和AMD的CPU(X86)上有模糊地带(普通指令与特权指令间)
CPU硬件虚拟化(Intel:VT-x;AMD:AMD-V;特权级别加入ring-1,guest OS在ring0上,事实上ring0是空出来的一环没有指令,当guestOS试图要在ring0上运行时会触发ring-1,由ring-1决定执行指令、转换并翻译这个指令运行)
内存虚拟化(Intel(EPT,extended page table)和AMD(RVI,rapid virtualization indexing;NPT,nested pagetables)分别通过EPT、RVI技术为虚拟化应用提升shadow MMU(完成VA-->HA一步到位)的性能,降低CPU的占用率,提供良好的吞吐量;并通过标记tagged TLB来避免虚拟机切换时频繁清写flush TLB以提高TLB缓存的命中率(用TLB保存MMU的转换结果)
KVM 还借助于KSM(KernelSame-pageMerging)这个内核特性实现了内存页面共享。KSM 通过扫描每个虚拟机的内存查找各虚拟机间相同的内存页,并将这些内存页合并为一个被各相关虚拟机共享的单独页面。在某虚拟机试图修改此页面中的数据时,KSM 会重新为其提供一个新的页面副本。实践中,运行于同一台物理主机上的具有相同 GuestOS 的虚拟机之间出现相同内存页面的概率是很的,比如共享库、内核或其它内存对象等都有可能表现为相同的内存页,因此,KSM 技术可以降低内存占用进而提高整体性能。
注:将离散的内存地址空间在hypervisor上再整合在一起分给guest OS,guest OS的VA-->guest OS的PA-->host OS的PA(HA);MMU,memory management unit
IO设备虚拟化(网卡、硬盘等大多数的IO设备是通过软件(如vmware)模拟(假网卡、假硬盘),guestOS的网卡往外发报文(IP报文本身是独立的),来的报文哪个主机收(guest OS还是host OS),是根据MAC接收报文的,假硬盘上存的数据最终都要到物理硬盘上,在物理硬盘上建立本地回环镜像文件(如用dd命令创建的文件,格式化后能充当swap分区用)与模拟的磁盘建立关联关系,guest OS就把假硬盘当硬盘用,但真正在物理机上表现的是个文件,虚拟的磁盘没物理硬盘性能好,IO要转换两次,若要让guest OS的IO disk性能好点,使用共享存储(iSCSI),guest OS作为client直接使用共享存储;网卡也是这样,模拟一个假网卡与本地的文件建立关联关系,guest OS A同guest OS B之间经网卡通信(或guest OS同host OS通信)借助于OS通过IPC解决(vmware中有虚拟通道),无论使用什么MAC都无所谓,若与外部网络通信,通过bridge、NAT,NAT这种方式是将物理机网卡上的MAC当作网关,源地址转换,类似各guest OS组成网络,要与外部网络通信时将报文发至网关,物理机通过地址转换送到外部网络,外部网络是看不到guest OS的,bridge这种方式将guest OS的虚拟网卡绑定在物理网卡上且让物理网卡运行在混杂模式下(无论目标MAC是不是它都要接收,接收下来转给guest OS,二层代理机制,在二层就转了),bridge这种方式可将物理网卡理解为是switch,host OS的网卡可理解为也是虚拟网卡,guest OS上的网卡也是虚拟网卡,物理网卡接收到报文目标MAC是哪个虚拟网卡就转发到对应的虚拟网卡上(桥接就是网桥,模拟的是switch))
IO虚拟化(Intel和AMD在主板上创建芯片组时,这个芯片组可完成IO虚拟化(在硬件级别上),如Intel:IOMMU,IO设备要映射到当前OS上,为IO分配缓冲区,在passthrough技术上要借助IOMMU)
半虚拟化PV(para virtualization,IO设备虚拟化,guest OS的kernel-->vmware-->host OS的kernel-->物理网卡,性能不好,若直接与host OS的内核打交道则性能会好很多,将中间那步绕过去,模拟的文件该存在让它存在直接绕过它,将host OS网卡的驱动程序做成system call直接输出给虚拟机使用(guest OS-->host OS的system call),这违反虚拟化原则,guest OS就知道它在虚拟化环境中,这种技术叫半虚拟化para virtualization,性能好,直接与硬件打交道速度要快)
完全虚拟化FV(full virtualization,guest OS不认为它在虚拟化环境中;CPU不支持硬件虚拟化技术,要模拟特权指令)
硬件辅助的虚拟化HVM(hardware-assistant VM,CPU支持硬件虚拟化技术,VMM运行在ring-1,guest OS运行在ring0, HVM,hardware-assistant VM,硬件辅助的虚拟化)
PV和HVM整合(guest OS知道自己在虚拟化环境中,只要与硬件打交道,host OS都向guest OS输出system call(将特权指令集也输出为system call)或叫hypercall(hypervisor call),这样性能会好很多,要求在PV下的OS必须要改内核才能使用hypercall(win不能改内核))
PV on HVM(基于HVM的PV技术,把PV中的CPU不用了而用HVM,用IO的PV,这样既利用了CPU的HVM,又利用IO的PV技术,性能会很好)
注:cpu、memory、io都可用PV,有了HVM,cpu的PV将用不着,io的PV能用得上,硬件再辅助,某一种IO设备就那一个,有资源争用
IO穿透技术passthrough I/O(guest OS直接使用独立的网卡)
常见的虚拟化模型:
有宿主机的VMM,VMM要借助于内核才能完成虚拟化(hosted VMM)
硬件之上直接是VMM,这种模型下的VMM称为hypervisor,VMM具备OS的管理机制(VMM自带对CPU、memory等的管理),可理解为是精简的OS只提供虚拟化服务,VMM具备驱动底层硬件的能力(安装前要查看VMM所支持的硬件类型)
注:vmware workstation,vmware server,vmware ESX商业(hypervisor),vmware ESXi(免费,简易版)
Xen提供对CPU、memory、interrupt这三个关键性硬件管理外,其它功能如驱动等都不提供,Xen它自己驱动不了任何硬件设备,要在Xen之上立即安装一个虚拟机(Linux),这个特权Linux提供驱动,提供管理界面,可直接操作底层硬件,Xen中的虚拟机称为Dom{0,1,2,3……}(domain),Dom0为特权虚拟机,通过Dom0来管理其它的Dom{1,2,3}(称为DomU),Dom0要使用CPU、memory、interrupt这三个关键性硬件要通过Xen,而其它的IO设备可直接使用,在Dom0上创建一模拟设备,要通过Xen关联至Dom1上(Dom0将半虚拟化的硬件驱动程序通过Xen的hypercall送给Dom1),Dom1要使用网卡向外发数据要先发至Dom0由Dom0访问硬件网卡,Xen不管理IO等硬件设备,Dom1要使用CPU(或memory或interrupt)则直接由Xen管理,这样一部分要交由Xen管理,一部分交由Dom0管理,Xen是一种半虚拟化的解决方案,就算cpu、memory不支持HVM,Xen照样可高性能运行,若cpu、memory支持HVM,Xen也可使用full virtualization,各硬件是模拟的性能较差,完全虚拟化FV和PV的最大区别,FV中的guest OS的kernel不用修改了,那Xen之上的虚拟机可使用win了(FV的好处),若Dom1是Linux可使用PV on HVM(CPU不虚拟化了使用HVM,而对于其它的IO硬件使用PV))
Qemu(quickemulator,是独立虚拟软件,能独立运行虚拟机,kqemu是该软件的加速软件;常用于模拟器,1M,虚拟化软件,跨平台虚拟,如将硬件CPUx86的模拟成苹果的arm或IBM的power pc,可帮助程序员提供测试环境,好处如底层是X86的CPU,可在guest OS上也使用X86的CPU并进行优化,让其接近硬件CPU的性能运行)
通常Xen和Qemu结合使用,Qemu主要实现为其它guest OS基于软件方式模拟硬件(虚拟网卡、虚拟硬盘等)、本地回环文件(用文件充当虚拟硬盘用),qemu-img支持众多的格式,包括vmware的格式
Xend/xm(在Xen上创建虚拟机,安装OS并引导,Xen提供了专门的管理工具Xend/xm,Xend是管理服务,xm是命令(可start、pause、suspend某个虚拟机,完全在CLI下),Xen将其对硬件的管理功能通过API输出给xm这个管理工具,创建好硬件不用重启直接附加在虚拟机上并能让虚拟机识别出来,Xen可虚拟CPU,用xm通过Xen的API创建多个CPU,虚拟机可直接使用,比vmware workstation要强大灵活,通过Xen的API可开发出图形管理工具,有数十种管理工具(CLI下和GUI下),如openstack、cloudstack,这些云平台就是利用虚拟机(Xen)的API提供了能够管理虚拟机进程的管理程序
注:如redhat为Xen提供的管理工具virsh比xm更强大且易用,virsh支持众多虚拟化技术且更通用
KVM(kernel-based VM,基于内核的虚拟机,KVM是内核模块,没有这个模块OS还是本来的OS,这个模块一旦被kernel装载了,OS就摇身变成了hypervisor,KVM可让OS成为hypervisor,KVM取巧利用内核提供的各种驱动,在OS kernel的基础上成为hypervisor,在hypervisor之上跑的是虚拟机(实际上是进程),用ps也能看到,内核自身管理硬件,在内核之上还要提供OS用来管理虚拟机,在硬件之上的 host OS可启动额外的进程(虚拟机),所有的虚拟机都表现为进程,在guest mode(来宾模式)下有user space和kernel space)
kvm(结构简单,分两部分(设备驱动/dev/kvm;针对模拟pc硬件的用户空间组件);
注:百科上的kvm:KVM 是 kernel-based Virtual Machine 的简称,是一个开源的系统虚拟化模块,自Linux2.6.20之后集成在Linux的各个主要发行版本中。它使用Linux自身的调度器进行管理,所以相对于Xen,其核心源码很少。KVM已成为学术界的主流VMM之一。KVM的虚拟化需要硬件支持(如Intel VT技术或者AMD V技术)。是基于硬件的完全虚拟化。而Xen早期则是基于软件模拟的Para-Virtualization,新版本则是基于硬件支持的完全虚拟化。但Xen本身有自己到进程调度器,存储管理模块等,所以代码较为庞大。广为流传的商业系统虚拟化软件VMware ESX系列也是基于软件模拟的Para-Virtualization。
KVM (全称是 Kernel-based Virtual Machine) 是 Linux 下 x86 硬件平台上的全功能虚拟化解决方案,包含一个可加载的内核模块 kvm.ko 提供和虚拟化核心架构和处理器规范模块。
使用 KVM ,可允许运行多个虚拟机,包括 Linux 和 Windows操作系统。每个虚拟机有私有的硬件,包括网卡、磁盘以及图形适配卡等。
KVM如何使用硬件(kernel将CPU时间片分给虚拟机;memory,kernel虚拟化一部分即可;iodevice,管理的OS模拟硬件,虚拟机用网卡时,虚拟机的kernel-->管理的OS模拟的硬件-->真正的kernel-->硬件(类似Xen);模拟硬件借助Qemu,它可虚拟化任何硬件,乍看KVM是多余的,没有KVM,Qemu照样可虚拟化,KVM有Qemu没有的优势,Qemu对CPU的虚拟是在user space通过软件模拟加速实现的,性能再好也无法与kernel性能相比,而KVM是内核模块比Qemu模拟出的硬件性能要好,更能接近硬件性能)
通常使用KVM+Qemu,KVM要求只能装在支持硬件虚拟化的CPU上,而且只能在X86_64平台(Xen若硬件不支持虚拟化可半虚拟化);KVM在2.6.20后直接整合进kernel上,Xen没有;2.6.37以后Xen也加入kernel(注意是运行在Xen上的DomU而非Dom0);3.0以后的kernel运行在Dom0上的Xen也收入内核(也就是3.0以后的kernel可直接使用Xen,3.0之前的kernel要使用Xen得打补丁);redhat2008年收购了KVM(以色列公司的KVM),redhat6.0之后只支持KVM;Xen比KVM强大、稳定,Xen(英国剑桥大学)被Citrix思杰(仅次于vmware第二大虚拟化提供商)收购
redhat(KVM)、citrix(Xen)、vmware(vmware)、microsoft(hyper-V)
KVM(redhat引入virtio(将IO实现PV),支持passthroughI/O)
container(在kernel之上提供了userspace(有对网卡、硬盘的配置程序,可理解为是VM),kernel是公共的,性能比FV和PV要好,对于FV和PV要运行两个kernel,若任何一个VM管理不慎将kernel搞崩溃了,其它VM将不能正常运行,VM间隔离效果没FV和PV好)
openVZ(Linux上的container技术,很多IDC提供VPS(virtualprivate server)时使用openVZ或Xen)
wine(虚拟出win的库,这样win的所有程序都能运行,cywin在win下虚拟linux的库运行linux程序)
注:只要底层有真正硬件,所有硬件都能模拟,Qemu还可跨平台模拟
常见的虚拟化技术(virtualization products at a glance):
X86平台虚拟化技术(Intel:VT-x、EPT、IOMMU)
虚拟化中的网络模型(如vmware下的NAT、host-only、bridge、vmnet{1,2,3},NAT模型下可自动分配IP):
可理解为VMM用软件模拟了一个switch,创建的虚拟机VM1只要关联到虚拟网络上,就意味着关联到虚拟的switch上,这个虚拟的switch是连到host OS的虚拟网卡上的(网上邻居可看到vmnet1);host-only,VM1通过虚拟网卡可与物理机通信,不能同外部网络通信,若在物理机上有一dhcp服务指定在物理网卡上,switch不隔离广播报文,那VM{1,2,3}均可获取到地址;虚拟通道是专用网络,如vmnet2是仅模拟了一个switch,物理机上没有对应的虚拟网卡,仅能让在此虚拟通道上的VM{1,2,3}通信;NAT模型下VM{1,2,3}可访问外网,而外网主机不能主动访问VM{1,2,3}除非做DNAT规则要定义在物理主机上(win下的vmware会自动生成规则,而linux下要自己写规则);bridge模型下可理解为物理网卡成为了模拟的switch,所有的报文都通过switch出去,对于发来的报文switch会全部接收下来,再根据MAC判断是哪个网卡上的,是物理网卡还是VM{1,2,3}的网卡,桥接时是不提供dhcp服务的
虚拟机多时,彼此间通信要统一管理会比较麻烦,openstack和cloudstack提供了一种平台,能让物理机随时能加进来,如当前的物理机不够用再加几台进来,正在运行的虚拟机流动的在不同的物理机上运行(实时迁移),某一物理机出问题,其上的虚拟机会迁移到其它物理机上运行,不影响虚拟机的使用,云还能管理网络,虚拟机加进来后要给这个虚拟机分配IP,如何与其它公司的虚拟机隔离,云还要提供存储,云为虚拟机更方便的使用提供了统一管理的接口(IaaS基础架构即服务)
raw格式(优点:寻址简单,访问效率较高,可通过格式转换工具方便的转换为其它格式,可方便的被宿主机挂载,可在不启动VM的情况下和宿主机进行数据传输;缺点:实现简单,不支持压缩、快照、加密、cow等特性,raw格式文件在创建时指定大小之后就占用了宿主机指定大小的空间,而qcow2等稀疏模式的镜像格式可从很小的文件按需增长);
qcow2格式(是qcow的改进,建议使用,是qemu实现的一种VM镜像格式,qcow2文件存储数据的基本单元是cluster,每一个cluster由若干个数据扇区组成,每个数据扇区的大小是512byte,在qcow2中,要定位镜像文件的cluster,需要经过两次地址查询操作,类似于主存二级页表转换机制;更小的存储空间,即使不支持holes FS也可,使用du -h和ll看到的一模一样;copy on write support,where the image only represents changes madeto an underlying disk image,此特性在SUN ZFS表现的淋漓尽致;支持多个snapshot;支持zlib磁盘压缩;支持AES加密
[root@master ~]# virsh -h #(management user interface,The virsh program is the main interface for managing virsh guest domains. The program can be used to create,pause, and shutdown domains. It canalso be used to list current domains.)
virsh [options]... [<command_string>]
virsh [options]... <command>[args...]
options:
-c | --connect=URI hypervisorconnection URI
-r | --readonly connectreadonly
-d | --debug=NUM debuglevel [0-4]
-h | --help this help
-q | --quiet quiet mode
-t | --timing printtiming information
-l | --log=FILE outputlogging to file
-v shortversion
-V longversion
--version[=TYPE] version, TYPEis short or long (default short)
-e | --escape <char> setescape sequence for console
commands (non interactive mode):
Domain Management
attach-device attach device from an XML file
attach-disk attach disk device
attach-interface attach network interface
autostart autostart a domain
blkdeviotune Setor query a block device I/O tuning parameters.
blkiotune Getor set blkio parameters
blockcommit Start a block commit operation.
blockcopy Start a block copy operation.
blockjob Manage active block operations
blockpull Populate a disk from its backing image.
blockresize Resize block device of domain.
change-media Change media of CD or floppy drive
console connect to the guest console
cpu-baseline compute baseline CPU
cpu-compare compare host CPU with a CPU described by an XML file
cpu-stats show domain cpu statistics
create create a domain from an XML file
define define (but don'tstart) a domain from an XML file
desc show or set domain's description or title
destroy destroy (stop) a domain
detach-device detach device from an XML file
detach-disk detach disk device
detach-interface detach network interface
domdisplay domain display connection URI
domhostname print the domain's hostname
domid convert a domain name or UUID to domain id
domif-setlink setlink state of a virtual interface
domiftune get/set parameters of a virtual interface
domjobabort abort active domain job
domjobinfo domain job information
domname convert a domain id or UUID to domain name
dompmsuspend suspend a domain gracefully using power management functions
dompmwakeup wakeup a domain from pmsuspended state
domuuid convert a domain name or id to domain UUID
domxml-from-native Convert native config to domain XML
domxml-to-native Convert domain XML to native config
dump dump the core of a domain to a file for analysis
dumpxml domain information inXML
edit edit XML configuration for a domain
inject-nmi Inject NMI to the guest
send-key Send keycodes to the guest
managedsave managed save of a domain state
managedsave-remove Remove managed save of a domain
maxvcpus connection vcpu maximum
memtune Getor set memory parameters
migrate migrate domain to another host
migrate-setmaxdowntime setmaximum tolerable downtime
migrate-setspeed Setthe maximum migration bandwidth
migrate-getspeed Getthe maximum migration bandwidth
numatune Getor set numa parameters
reboot reboot a domain
reset reset a domain
restore restore a domain from a saved state in a file
resume resume a domain
save save a domain stateto a file
save-image-define redefine the XML for a domain's saved state file
save-image-dumpxml saved state domain information in XML
save-image-edit edit XML for a domain's saved state file
schedinfo show/set scheduler parameters
screenshot take a screenshot of a current domain console and store it into a file
setmaxmem change maximum memory limit
setmem change memory allocation
setvcpus change number of virtual CPUs
shutdown gracefully shutdown adomain
start start a (previously defined)inactive domain
suspend suspend a domain
ttyconsole ttyconsole
undefine undefine a domain
update-device update device from an XML file
vcpucount domain vcpu counts
vcpuinfo detailed domain vcpu information
vcpupin control or query domain vcpu affinity
emulatorpin control or query domain emulator affinity
vncdisplay vncdisplay
Domain Monitoring
domblkerror Show errors on block devices
domblkinfo domain block device size information
domblklist list all domain blocks
domblkstat getdevice block stats for a domain
domcontrol domain control interface state
domif-getlink getlink state of a virtual interface
domiflist list all domain virtual interfaces
domifstat getnetwork interface stats for a domain
dominfo domain information
dommemstat getmemory statistics for a domain
domstate domain state
list list domains
Host and Hypervisor
Interface
iface-bridge create a bridge device andattach an existing network device to it
iface-unbridge undefine a bridge device afterdetaching its slave device
Network Filter
Networking
Node Device
Secret
Snapshot
snapshot-create Create a snapshot from XML
snapshot-create-as Create a snapshot from a set of args
snapshot-current Getor set the current snapshot
snapshot-delete Delete a domain snapshot
snapshot-dumpxml Dump XML for a domain snapshot
snapshot-edit edit XML for a snapshot
snapshot-info snapshot information
snapshot-list List snapshots for a domain
snapshot-parent Getthe name of the parent of a snapshot
snapshot-revert Revert a domain to a snapshot
Storage Pool
Storage Volume
Virsh itself
cd change the current directory
connect (re)connect to hypervisor
echo echo arguments
exit quit this interactive terminal
help print help
pwd print the current directory
quit quit this interactive terminal
[root@master ~]# qemu-img -h
qemu-img version 0.12.1, Copyright (c) 2004-2008Fabrice Bellard
usage: qemu-img command [command options]
QEMU disk image utility
Command syntax:
check [-f fmt] [--output=ofmt] [-r [leaks |all]] [-T src_cache] filename
create [-f fmt] [-o options] filename [size]
commit [-f fmt] [-t cache] filename
compare [-f fmt] [-F fmt] [-T src_cache] [-p] [-s] filename1 filename2
convert [-c] [-p] [-f fmt] [-t cache] [-Tsrc_cache] [-O output_fmt] [-o options] [-S sparse_size] filename [filename2[...]] output_filename
info [-f fmt] [--output=ofmt] filename
map[-f fmt] [--output=ofmt] filename
snapshot [-l | -a snapshot | -c snapshot | -dsnapshot] filename
rebase [-f fmt] [-t cache] [-T src_cache] [-p] [-u] -b backing_file [-Fbacking_fmt] filename
resize filename [+ | -]size
Command parameters:
'filename' is a disk image filename
'fmt' is the disk image format. It is guessed automatically in mostcases
'cache' is the cache mode used to write the output disk image, the valid
options are: 'none', 'writeback' (default), 'writethrough', 'directsync'
and 'unsafe'
'size' is the disk image size in bytes. Optional suffixes
'k' or 'K' (kilobyte, 1024), 'M' (megabyte, 1024k), 'G' (gigabyte,1024M)
and T (terabyte, 1024G) are supported. 'b' is ignored.
'output_filename' is the destination disk image filename
'output_fmt' is the destination format
'options' is a comma separated list of format specific options in a
name=value format. Use -o ? for an overview of the options supported bythe
used format
'-c' indicates that target image must be compressed (qcow format only)
'-u' enables unsafe rebasing. It is assumed that old and new backingfile
match exactly. The image doesn't need a working backing file before
rebasing in this case (useful for renaming the backing file)
'-h' with or without a command shows this help and lists the supportedformats
'-p' show progress of command (only certain commands)
'-S' indicates the consecutive number of bytes that must contain onlyzeros
for qemu-img to create a sparse image during conversion
'--output' takes the format in which the output must be done (human orjson)
Parameters to checksubcommand:
'-r' tries to repair any inconsistencies that are found during thecheck.
'-r leaks' repairs only cluster leaks, whereas '-r all' fixes all
kinds of errors, with a higher risk of choosing the wrong fix or
hiding corruption that has already occurred.
Parameters to snapshotsubcommand:
'snapshot' is the name of the snapshot to create, apply or delete
'-a' applies a snapshot (revert disk to saved state)
'-c' creates a snapshot
'-d' deletes a snapshot
'-l' lists all snapshots in the given image
Parameters to compare subcommand:
'-f' first image format
'-F' second image format
'-s' run in Strict mode - fail on different image size or sectorallocation
Supported formats: raw cow qcow vdi vmdkcloop dmg bochs vpc vvfat qcow2 qed vhdx parallels nbd blkdebug null host_cdromhost_floppy host_device file gluster
[root@master ~]# qemu-kvm -h
QEMU PC emulator version 0.12.1(qemu-kvm-0.12.1.2-2.491.el6_8.3), Copyright (c) 2003-2008
usage: qemu [options] [disk_image]
'disk_image' is a raw hard image image forIDE hard disk 0
Standard options:
-h or -help display this help and exit
-version display version information and exit
-M machine select emulated machine (-M ? for list)
-cpu cpu select CPU (-cpu ? for list)
-smp n[,maxcpus=cpus][,cores=cores][,threads=threads][,sockets=sockets]
set the number of CPUs to 'n'[default=1]
maxcpus= maximum number oftotal cpus, including
offline CPUs for hotplug etc.
cores= number of CPU cores onone socket
threads= number of threads onone CPU core
sockets= number of discretesockets in the system
-numa node[,mem=size][,cpus=cpu[-cpu]][,nodeid=node]
-fda/-fdb file use 'file' as floppy disk 0/1 image
-hda/-hdb file use 'file' as IDE hard disk 0/1 image
-hdc/-hdd file use 'file' as IDE hard disk 2/3 image
-cdrom file use 'file' as IDE cdrom image (cdrom iside1 master)
-drive [file=file][,if=type][,bus=n][,unit=m][,media=d][,index=i]
[,cyls=c,heads=h,secs=s[,trans=t]][,snapshot=on|off]
[,cache=writethrough|writeback|none|directsync|unsafe][,format=f]
[,serial=s][,addr=A][,id=name][,aio=threads|native]
[,readonly=on|off][,copy-on-read=on|off]
use 'file' as a drive image
-set group.id.arg=value
set <arg> parameter foritem <id> of type <group>
i.e. -setdrive.$id.file=/path/to/image
-global driver.prop=value
set a global default for adriver property
-mtdblock file use 'file' as on-board Flash memory image
-sd file use 'file' as SecureDigital card image
-pflash file use 'file' as a parallel flash image
-boot [order=drives][,once=drives][,menu=on|off]
[,reboot-timeout=rb_time][,strict=on|off]
'drives': floppy (a), hard disk(c), CD-ROM (d), network (n)
'rb_timeout': the timeoutbefore guest reboot when boot failed, unit is ms
-snapshot write to temporary filesinstead of disk image files
-m megs set virtual RAM sizeto megs MB [default=128]
-redhat-disable-KSM disable KSM on guest physical memory
-k language use keyboard layout (for example 'fr' forFrench)
-audio-help print list of audio drivers andtheir options
-soundhw c1,... enable audio support
and only specified sound cards(comma separated list)
use -soundhw ? to get the listof supported cards
use -soundhw all to enable allof them
-usb enable the USB driver (will be thedefault soon)
-usbdevice name add the host or guest USB device 'name'
-device driver[,prop[=value][,...]]
add device (based on driver)
prop=value,... sets driverproperties
use -device ? to print allpossible drivers
use -device driver,? to printall possible properties
-name string1[,process=string2] set the name of the guest
string1 sets the window title andstring2 the process name (on Linux)
-uuid %08x-%04x-%04x-%04x-%012x
specify machine UUID
Display options:
-nographic disable graphical output and redirectserial I/Os to console
-spice [port=port][,tls-port=secured-port][,x509-dir=<dir>]
[,x509-key-file=<file>][,x509-key-password=<file>]
[,x509-cert-file=<file>][,x509-cacert-file=<file>]
[,x509-dh-key-file=<file>][,addr=addr][,ipv4|ipv6]
[,tls-ciphers=<list>]
[,tls-channel=[main|display|cursor|inputs|record|playback]]
[,plaintext-channel=[main|display|cursor|inputs|record|playback]]
[,sasl][,password=<secret>][,disable-ticketing]
[,image-compression=[auto_glz|auto_lz|quic|glz|lz|off]]
[,jpeg-wan-compression=[auto|never|always]]
[,zlib-glz-wan-compression=[auto|never|always]]
[,streaming-video=[off|all|filter]][,disable-copy-paste]
[,disable-agent-file-xfer][,agent-mouse=[on|off]]
[,playback-compression=[on|off]][,seamless-migration=[on|off]]
enable spice
atleast one of {port, tls-port} is mandatory
-portrait rotate graphical output 90 deg left(only PXA LCD)
-vga [std|cirrus|vmware|qxl|xenfb|none]
select video card type
-full-screen start in full screen
-vnc display start a VNC server on display
i386 target only:
-win2k-hack use it when installing Windows 2000 toavoid a disk full bug
-no-fd-bootchk disable boot signature checking for floppydisks
-no-acpi disable ACPI
-balloon none disable balloon device
-balloon virtio[,addr=str]
enable virtio balloon device(default)
-acpitable[sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,data=file1[:file2]...]
ACPI table description
-smbios file=binary
Load SMBIOS entry from binaryfile
-smbiostype=0[,vendor=str][,version=str][,date=str][,release=%d.%d]
Specify SMBIOS type 0 fields
-smbios type=1[,manufacturer=str][,product=str][,version=str][,serial=str]
[,uuid=uuid][,sku=str][,family=str]
Specify SMBIOS type 1 fields
Network options:
-netnic[,vlan=n][,macaddr=mac][,model=type][,name=str][,addr=str][,vectors=v]
create a new Network InterfaceCard and connect it to VLAN 'n'
-netuser[,vlan=n][,name=str][,net=addr[/mask]][,host=addr][,restrict=y|n]
[,hostname=host][,dhcpstart=addr][,dns=addr][,tftp=dir][,bootfile=f]
[,hostfwd=rule][,guestfwd=rule][,smb=dir[,smbserver=addr]]
connect the user mode networkstack to VLAN 'n', configure its
DHCP server and enabledoptional services
-nettap[,vlan=n][,name=str][,fd=h][,ifname=name][,script=file][,downscript=dfile][,sndbuf=nbytes][,vnet_hdr=on|off][,vhost=on|off][,vhostfd=h][,vhostforce=on|off]
connect the host TAP networkinterface to VLAN 'n' and use the
network scripts 'file'(default=/etc/qemu-ifup)
and 'dfile'(default=/etc/qemu-ifdown);
use '[down]script=no' todisable script execution;
use 'fd=h' to connect to analready opened TAP interface
use 'sndbuf=nbytes' tolimit the size of the send buffer (the
default is disabled 'sndbuf=0'to enable flow control set 'sndbuf=1048576')
use vnet_hdr=off to avoidenabling the IFF_VNET_HDR tap flag; use
vnet_hdr=on to make the lack ofIFF_VNET_HDR support an error condition
use vhost=on to enableexperimental in kernel accelerator
(only has effect for virtioguests which use MSIX)
use vhostforce=on to forcevhost on for non-MSIX virtio guests
use 'vhostfd=h' to connect toan already opened vhost net device
-netsocket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]
connect the vlan 'n' to anotherVLAN using a socket connection
-netsocket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]
connect the vlan 'n' tomulticast maddr and port
-net dump[,vlan=n][,file=f][,len=n]
dump traffic on vlan 'n' tofile 'f' (max n bytes per packet)
-net none use it alone to have zero networkdevices; if no -net option
is provided, the default is'-net nic -net user'
-netdev[user|tap|socket],id=str[,option][,option][,...]
Character device options:
-chardev null,id=id
-chardevsocket,id=id[,host=host],port=host[,to=to][,ipv4][,ipv6][,nodelay]
[,server][,nowait][,telnet] (tcp)
-chardevsocket,id=id,path=path[,server][,nowait][,telnet] (unix)
-chardevudp,id=id[,host=host],port=port[,localaddr=localaddr]
[,localport=localport][,ipv4][,ipv6]
-chardev msmouse,id=id
-chardevvc,id=id[[,width=width][,height=height]][[,cols=cols][,rows=rows]]
-chardev file,id=id,path=path
-chardev pipe,id=id,path=path
-chardev pty,id=id
-chardev stdio,id=id
-chardev serial,id=id,path=path
-chardev tty,id=id,path=path
-chardev parallel,id=id,path=path
-chardev parport,id=id,path=path
-chardevspicevmc,id=id,debug=debug,name=name
Bluetooth(R) options:
-bt hci,null dumb bluetooth HCI - doesn't respond tocommands
-bt hci,host[:id]
use host's HCI with the givenname
-bt hci[,vlan=n]
emulate a standard HCI invirtual scatternet 'n'
-bt vhci[,vlan=n]
add host computer to virtualscatternet 'n' using VHCI
-bt device:dev[,vlan=n]
emulate a bluetooth device'dev' in scatternet 'n'
Linux/Multiboot boot specific:
-kernel bzImage use 'bzImage' as kernelimage
-append cmdline use 'cmdline' as kernelcommand line
-initrd file use 'file' as initial ram disk
Debug/Expert options:
-serial dev redirect the serial port to char device'dev'
-parallel dev redirect the parallel port to char device'dev'
-monitor dev redirect the monitor to char device 'dev'
-qmp dev like -monitor but opens in 'control'mode.
-monchardev=[name][,mode=readline|control][,default]
-debugcon dev redirect the debug console to char device'dev'
-pidfile file write PID to 'file'
-singlestep always run in singlestep mode
-S freeze CPU at startup (use 'c' tostart execution)
-realtime [mlock=on|off]
run qemu with realtime features
mlock=on|off controls mlocksupport (default: on)
-gdb dev wait for gdb connection on 'dev'
-s shorthand for -gdb tcp::1234
-d item1,... output log to /tmp/qemu.log (use -d ? for alist of log items)
-hdachs c,h,s[,t]
force hard disk 0 physicalgeometry and the optional BIOS
translation (t=none or lba)(usually qemu can guess them)
-L path set the directory for the BIOS, VGABIOS and keymaps
-bios file set the filename for the BIOS
-enable-kvm enable KVM full virtualization support
-machine [type=]name[,prop[=value][,...]]
selects emulated machine(-machine ? for list)
propertyaccel=accel1[:accel2[:...]] selects accelerator
supported accelerators are kvm,tcg (default: kvm:tcg)
dump-guest-core=on|off includeguest memory in a core dump (default=on)
-no-reboot exit instead of rebooting
-no-shutdown stop before shutdown
-loadvm [tag|id]
start right away with a savedstate (loadvm in monitor)
-daemonize daemonize QEMU after initializing
-option-rom rom load a file, rom, into theoption ROM space
-clock force the use of the given methodsfor timer alarm.
To see what timers areavailable use -clock ?
-rtc[base=utc|localtime|date][,clock=host|vm][,driftfix=none|slew]
set the RTC base and clock,enable drift fix for clock ticks
-icount [N|auto]
enable virtual instructioncounter with 2^N clock ticks per
instruction
-watchdog i6300esb|ib700
enable virtual hardwarewatchdog [default=none]
-watchdog-actionreset|shutdown|poweroff|pause|debug|none
action when watchdog fires[default=reset]
-echr chr set terminal escape character instead ofctrl-a
-virtioconsole c
set virtio console
-show-cursor show cursor
-tb-size n set TB size
-incoming p prepare for incoming migration, listen onport p
-nodefaults don't create default devices.
-chroot dir Chroot to dir just before starting the VM.
-runas user Change to user id user just before startingthe VM.
-nodefconfig
do not load default configfiles at startup
-readconfig <file>
-writeconfig <file>
read/write config file
-no-kvm disable KVM hardware virtualization
-no-kvm-irqchip disable KVM kernel modePIC/IOAPIC/LAPIC
-no-kvm-pit disable KVM kernel mode PIT
-no-kvm-pit-reinjection disable KVM kernelmode PIT interrupt reinjection
-pcidevicehost=[seg:]bus:dev.func[,dma=none][,name=string]
expose a PCI device to theguest OS.
dma=none: don't perform any dmatranslations (default is to use an iommu)
'string' is used in log output.
-nvram FILE provide ia64 nvram contents
-tdf enable guest time driftcompensation
-kvm-shadow-memory MEGABYTES
allocate MEGABYTES for kvmmmu shadowing
-mem-path FILE provide backing storage for guest RAM
-mem-prealloc preallocate guest memory (use with-mempath)
-msg timestamp[=on|off]
change the format of messages
on|off controls leadingtimestamps (default:on)
-object TYPENAME[,PROP1=VALUE1,...]
create an new object of typeTYPENAME setting properties
in the order they arespecified. Note that the 'id'
property must be set. These objects are placed in the
'/objects' path.
-dump-vmstate <file>
Output vmstate information inJSON format to file.
Use the scripts/vmstate-static-checker.pyfile to
check for possible regressionsin migration code
by comparing two such vmstatedumps.
During emulation, the following keys areuseful:
ctrl-alt-f toggle full screen
ctrl-alt-n switch to virtual console 'n'
ctrl-alt toggle mouse and keyboard grab
When using -nographic, press 'ctrl-a h' toget some help.
[root@master ~]# virt-install -h
Usage: virt-install --name NAME --ram RAMSTORAGE INSTALL [options]
Options:
--version showprogram's version number and exit
-h,--help show this help messageand exit
--connect=URI Connect tohypervisor with libvirt URI
General Options:
-n NAME, --name=NAME
Name of the guestinstance
-r MEMORY, --ram=MEMORY
Memory to allocate forguest instance in megabytes
--vcpus=VCPUS Number of vcpus to configure for your guest. Ex:
--vcpus 5
--vcpus 5,maxcpus=10
--vcpussockets=2,cores=4,threads=2
--cpuset=CPUSET Set whichphysical CPUs domain can use.
--cpu=CPU CPU model andfeatures. Ex: --cpu coreduo,+x2apic
--description=DESCRIPTION
Human readabledescription of the VM to store in the
generated XML.
--security=SECURITY
Set domain securitydriver configuration.
--numatune=NUMATUNE
Tune NUMA policy forthe domain process.
Installation Method Options:
-c CDROM, --cdrom=CDROM
CD-ROM installationmedia
-l LOCATION, --location=LOCATION
Installation source(eg, nfs:host:/path,
http://host/path,ftp://host/path)
--pxe Boot from thenetwork using the PXE protocol
--import Build guestaround an existing disk image
--init=INIT Path to initbinary for container guest. Ex:
--init /path/to/app (tocontain an application)
--init /sbin/init (fora full OS container)
--livecd Treat theCD-ROM media as a Live CD
-x EXTRA, --extra-args=EXTRA
Additional arguments to pass to theinstall kernel
booted from --location
--initrd-inject=INITRD_INJECTIONS
Add given file to rootof initrd from --location
--os-type=DISTRO_TYPE
The OS type beinginstalled, e.g. 'linux', 'unix',
'windows'
--os-variant=DISTRO_VARIANT
The OS variant beinginstalled guests, e.g. 'fedora6',
'rhel5', 'solaris10','win2k'
--boot=BOOTOPTS Optionallyconfigure post-install boot order, menu,
permanent kernel boot,etc.
Storage Configuration:
--disk=DISKOPTS Specify storage with various options. Ex.
--disk path=/my/existing/disk
--diskpath=/my/new/disk,size=5 (in gigabytes)
--disk vol=poolname:volname,device=cdrom,bus=scsi,...
--nodisks Don't set upany disks for the guest.
--filesystem=FILESYSTEMS
Pass host directory tothe guest. Ex:
--filesystem/my/source/dir,/dir/in/guest
--filesystemtemplate_name,/,type=template
Networking Configuration:
-w NETWORK, --network=NETWORK
Configure a guestnetwork interface. Ex:
--network bridge=mybr0
--network network=my_libvirt_virtual_net
--networknetwork=mynet,model=virtio,mac=00:11...
--nonetworks Don't createnetwork interfaces for the guest.
Graphics Configuration:
--graphics=GRAPHICS
Configure guest displaysettings. Ex:
--graphics vnc
--graphicsspice,port=5901,tlsport=5902
--graphics none
--graphics vnc,password=foobar,port=5910,keymap=ja
--noautoconsole Don't automatically try to connect to theguest
console
Device Options:
--serial=SERIALS Configure aguest serial device
--parallel=PARALLELS
Configure a guestparallel device
--channel=CHANNELS Configure aguest communication channel
--console=CONSOLES Configure atext console connection between the guest
and host
--host-device=HOSTDEVS
Configure physical hostdevices attached to the guest
--soundhw=SOUNDHW Configureguest sound device emulation
--watchdog=WATCHDOG
Configure a guestwatchdog device
--video=VIDEO Configureguest video hardware.
--smartcard=SMARTCARD
Configure a guestsmartcard device. Ex:
--smartcardmode=passthrough
--redirdev=REDIRDEV
Configure a guestredirection device. Ex:
--redirdevusb,type=tcp,server=192.168.1.1:4000
--panic=PANIC Configure aguest panic device. Ex:
--panic default
Virtualization Platform Options:
-v, --hvm This guestshould be a fully virtualized guest
-p, --paravirt This guestshould be a paravirtualized guest
--container This guestshould be a container guest
--virt-type=HV_TYPE
Hypervisor name to use(kvm, qemu, xen, ...)
--arch=ARCH The CPUarchitecture to simulate
--machine=MACHINE The machinetype to emulate
--noapic Disables APICfor fully virtualized guest (overrides
value inos-type/os-variant db)
--noacpi Disables ACPIfor fully virtualized guest (overrides
value inos-type/os-variant db)
-u UUID, --uuid=UUID
UUID for the guest.
Miscellaneous Options:
--autostart Have domainautostart on host boot up.
--print-xml Print thegenerated domain XML rather than define the
guest.
--print-step=XMLSTEP
Print XML of a specificinstall step (1, 2, 3, all)
rather than define theguest.
--noreboot Don't bootguest after completing install.
--wait=WAIT Time to wait(in minutes)
--dry-run Run throughinstall process, but do not create devices
or define the guest.
--force Forces 'yes' for any applicableprompts, terminates
for all others
-q, --quiet Suppressnon-error output
--prompt Request userinput for ambiguous situations or
required options.
-d, --debug Printdebugging information
操作(KVM):
1、准备:
注:kvm仅可在具有虚拟化功能的cpu上运行,intel-vt技术或amd-v技术;内存方面intel的EPT或amd的RVI
[root@master ~]# uname -rm
2.6.32-431.el6.x86_64 x86_64
[root@master ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.5(Santiago)
[root@master ~]# egrep --color "vmx|svm" /proc/cpuinfo #(intel-vt关键字用vmx,amd-v关键字svm)
flags :fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflushdts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tscarch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperfunfair_spinlock pni pclmulqdq vmx ssse3 fma cx16pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16crdrand hypervisor lahf_lm abm ida arat xsaveopt pln pts dts tpr_shadow vnmi eptvpid fsgsbase bmi1 avx2 smep bmi2 invpcid
flags :fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflushdts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tscarch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperfunfair_spinlock pni pclmulqdq vmx ssse3 fma cx16pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16crdrand hypervisor lahf_lm abm ida arat xsaveopt pln pts dts tpr_shadow vnmi eptvpid fsgsbase bmi1 avx2 smep bmi2 invpcid
flags :fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflushdts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tscarch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperfunfair_spinlock pni pclmulqdq vmx ssse3 fma cx16pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16crdrand hypervisor lahf_lm abm ida arat xsaveopt pln pts dts tpr_shadow vnmi eptvpid fsgsbase bmi1 avx2 smep bmi2 invpcid
flags :fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflushdts mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tscarch_perfmon pebs bts xtopology tsc_reliable nonstop_tsc aperfmperfunfair_spinlock pni pclmulqdq vmx ssse3 fma cx16pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16crdrand hypervisor lahf_lm abm ida arat xsaveopt pln pts dts tpr_shadow vnmi eptvpid fsgsbase bmi1 avx2 smep bmi2 invpcid
[root@master ~]# lsmod | grep kvm
[root@master ~]# modprobe kvm #(启用kvm模块)
[root@master ~]# modprobe kvm-intel #(是intel加载kvm-intel,是amd加载kvm-amd)
[root@master ~]# lsmod | grep kvm
kvm_intel 54285 0
kvm 333172 1 kvm_intel
2、部署kvm环境:
[root@master ~]# llepel-release-6-8.noarch.rpm
-rw-r--r--. 1 root root 14540 Nov 5 2012epel-release-6-8.noarch.rpm
[root@master ~]# rpm -ivhepel-release-6-8.noarch.rpm #(利用epel的yum源安装相关软件包)
[root@master ~]# yum -y install libvirt qemu-kvm virt-manager #(KVM 虚拟机的创建依赖qemu-kvm :虽然 kvm 的技术已经相当成熟而且可以对很多东西进行隔离,但是在某些方面还是无法虚拟出真实的机器,比如对网卡的虚拟,那这个时候就需要另外的技术来做补充,而qemu-kvm则是这样一种技术,它补充了 kvm 技术的不足,而且在性能上对 kvm 进行了优化。还可用 virt-manager,virt-viewer 来管理虚拟机;在创建和管理 KVM 虚拟机时还需要 libvirt 这个重要的组件:它是一系列提供出来的库函数,用以其他技术调用,来管理机器上的虚拟机。包括各种虚拟机技术, kvm 、xen 与 lxc 等,都可以调用 libvirt 提供的 api 对虚拟机进行管理。有这么多的虚拟机技术,它为何能提供这么多的管理功能那。是因为它的设计理念,它是面向驱动的架构设计。对任何一种虚拟机技术都开发设计相对于该技术的驱动。这样不同虚拟机技术就可以使用不同驱动,而且相互直接不会影响,方便扩展。而且 libvirt 提供了多种语言的编程接口,可以直接通过编程,调用 libvirt 提供的对外接口实现对虚拟机的操作。如今流行的云计算中的 IaaS 是与该库联系相当密切的)
Installed:
libvirt.x86_64 0:0.10.2-60.el6 qemu-kvm.x86_64 2:0.12.1.2-2.491.el6_8.3 virt-manager.x86_64 0:0.9.0-31.el6
Dependency Installed:
……
注:libvirt的架构设计思想,在 libvirtapi 之上会有很多个 driver ,对于每一种虚拟机技术都会有一种 driver ,用来充当该虚拟机技术与 libvirt 之间的包装接口。如此设计就可以避免 libvirt 需要设计各种针对不同虚拟机技术的接口,它主要关注底层的实现,提供对外接口调用,而不同的虚拟机技术通过调用 libvirt 提供的接口来完成自己所需要的功能。
[root@master ~]# service libvirtd start
Starting libvirtd daemon: libvirtd:relocation error: libvirtd: symbol dm_task_get_info_with_deferred_remove,version Base not defined in file libdevmapper.so.1.02 with link time reference
[FAILED]
[root@master ~]# yum-y install device-mapper
[root@master ~]# service libvirtd start
Starting libvirtd daemon: [ OK ]
[root@master ~]# ifconfig #(libvirtd启动后,会自动创建一个桥设备,相当于vmware中host-only网络设备)
eth0 Link encap:Ethernet HWaddr00:0C:29:1F:B6:AC
inet addr:10.96.20.113 Bcast:10.96.20.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1f:b6ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:49554 errors:0 dropped:0 overruns:0 frame:0
TX packets:16997 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:47453022 (45.2 MiB) TXbytes:1472183 (1.4 MiB)
eth1 Link encap:Ethernet HWaddr00:0C:29:1F:B6:B6
inet addr:192.168.10.113 Bcast:192.168.10.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1f:b6b6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16561 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1380247 (1.3 MiB) TXbytes:636 (636.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:390 errors:0 dropped:0 overruns:0 frame:0
TX packets:390 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:26626 (26.0 KiB) TXbytes:26626 (26.0 KiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:A4:A9:C5
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:0(0.0 b)
[root@master ~]# brctl show #(使用网桥管理命令查看)
bridge name bridgeid STP enabled interfaces
virbr0 8000.525400a4a9c5 yes virbr0-nic
[root@master ~]# rpm -ql qemu-kvm
/etc/ksmtuned.conf
/etc/modprobe.d/blacklist-kvm.conf
/etc/rc.d/init.d/ksm
/etc/rc.d/init.d/ksmtuned
/etc/sasl2/qemu-kvm.conf
/etc/sysconfig/ksm
/etc/sysconfig/modules/kvm.modules
/etc/udev/rules.d/80-kvm.rules
/usr/libexec/qemu-kvm
/usr/sbin/ksmtuned
……
[root@master ~]# ln -sv /usr/libexec/qemu-kvm /usr/bin/qemu-kvm
`/usr/bin/qemu-kvm' ->`/usr/libexec/qemu-kvm'
[root@master ~]# ll /etc/sysconfig/modules/kvm.modules
-rwxr-xr-x. 1 root root 245 Aug 9 10:55 /etc/sysconfig/modules/kvm.modules
[root@master ~]# service NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[root@master ~]# chkconfig NetworkManageroff
[root@master ~]# virsh iface-bridge eth0 br0 #(使用virsh创建桥设备,关联网卡到桥设备上,类似vmware中创建的物理桥接设备;语法virsh iface-bridge interfacebridge [--no-stp] [delay] [--no-start];virsh iface-unbridgebridge [--no-start])
Created bridge br0 with attached deviceeth0
Bridge interface br0 started
[root@master ~]# ifconfig
br0 Link encap:Ethernet HWaddr00:0C:29:1F:B6:AC
inet addr:10.96.20.113 Bcast:10.96.20.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe1f:b6ac/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:758 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:55900 (54.5 KiB) TXbytes:2250 (2.1 KiB)
eth0 Link encap:Ethernet HWaddr00:0C:29:1F:B6:AC
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:54072 errors:0 dropped:0 overruns:0 frame:0
TX packets:17300 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:47983909 (45.7 MiB) TXbytes:1514563 (1.4 MiB)
……
[root@master ~]# brctl show
bridge name bridgeid STP enabled interfaces
br0 8000.000c291fb6ac yes eth0
virbr0 8000.525400a4a9c5 yes virbr0-nic
[root@master ~]# yum -y install tigervnc tigervnc-server #(安装vncviewer)
[root@master ~]# rpm -ql tigervnc-server
/etc/rc.d/init.d/vncserver
/etc/sysconfig/vncservers
/usr/bin/Xvnc
/usr/bin/vncconfig
/usr/bin/vncpasswd
/usr/bin/vncserver
/usr/bin/x0vncserver
……
[root@master ~]# vncpasswd
Password:
Verify:
[root@master ~]# vncserver #(启动vncserver)
New 'master:1 (root)' desktop is master:1
Creating default startup script/root/.vnc/xstartup
Starting applications specified in/root/.vnc/xstartup
Log file is /root/.vnc/master:1.log
[root@master ~]# vncserver -list
TigerVNC server sessions:
X DISPLAY # PROCESSID
:1 6469
3、在kvm上部署guest os:
方式一(使用qemu-kvm):
[root@master ~]# mkdir -pv /kvm/images
mkdir: created directory `/kvm'
mkdir: created directory `/kvm/images'
[root@master ~]# qemu-img create -f raw /kvm/images/test.raw 5G
Formatting '/kvm/images/test.raw', fmt=rawsize=5368709120
[root@master ~]# ll -h /kvm/images/test.raw
-rw-r--r--. 1 root root 5.0G Sep 5 18:46 /kvm/images/test.raw
[root@master ~]# dd if=/dev/cdrom1 of=/kvm/images/rhel6.iso #(制作安装guest os的光盘镜像)
7526400+0 records in
7526400+0 records out
3853516800 bytes (3.9 GB) copied, 385.314s, 10.0 MB/s
[root@master ~]# qemu-kvm -cpu host -smp 1 -m 512 -drive file=/kvm/images/test.raw,if=ide,media=disk,format=raw -drive file=/kvm/images/rhel6.iso,media=cdrom -boot dc -usbdevice tablet #(此命令是在前台运行,占据当前终端,默认位置在/usr/libexec/qemu-kvm已将其链接至/usr/bin/qemu-kvm)
VNC server running on `::1:5900'
[root@master ~]# vncviewer :5900 #(开启另一窗口进入guestos,在前台运行占据当前终端窗口)
TigerVNC Viewer for X version 1.1.0 - builtMay 11 2016 13:00:50
Copyright (C) 1999-2011 TigerVNC Team andmany others (see README.txt)
See http://www.tigervnc.org for informationon TigerVNC.
Mon Sep 5 19:07:08 2016
CConn: connected to host localhost port 5900
CConnection: Server supports RFB protocolversion 3.8
CConnection: Using RFB protocol version 3.8
TXImage: Using default colormap and visual, TrueColor, depth 24.
CConn: Using pixel format depth 24 (32bpp) little-endian rgb888
CConn: Using Tight encoding
[root@master ~]# qemu-img info /kvm/images/test.raw
image: /kvm/images/test.raw
file format: raw
virtual size: 5.0G (5368709120 bytes)
disk size: 1.5G
方式二(使用virt-install):
[root@master ~]# qemu-img create -f qcow2 /kvm/images/test2.qcow2 5G
Formatting '/kvm/images/test2.qcow2',fmt=qcow2 size=5368709120 encryption=off cluster_size=65536
[root@master ~]# qemu-img info /kvm/images/test2.qcow2
image: /kvm/images/test2.qcow2
file format: qcow2
virtual size: 5.0G (5368709120 bytes)
disk size: 196K
cluster_size: 65536
[root@master ~]# qemu-img check /kvm/images/test2.qcow2
No errors were found on the image.
Image end offset: 262144
[root@master ~]# ll -h /kvm/images/
total 5.1G
-rw-r--r--. 1 qemu qemu 3.6G Sep 5 03:20 rhel6.iso
-rw-r--r--. 1 root root193K Sep 5 19:32 test2.qcow2
-rw-r--r--. 1 root root 5.0G Sep 5 19:30 test.raw
[root@master ~]# virt-install --name=test2 --ram=512 --vcpus=1 --os-variant=rhel6 --disk path=/kvm/images/test2.qcow2,format=qcow2,size=5,bus=virtio --accelerate --cdrom=/kvm/images/rhel6.iso --graphics vnc,listen=0.0.0.0,port=5911 --network bridge=br0,model=virtio --noautoconsole #(使用qcow2镜像格式,创建guestos时必须要在此处指定其格式和使用virtio驱动,否则系统无法正常安装,会提示virtio block device为0M)
Starting install...
Creating domain... | 0 B 00:00
Domain installation still in progress. You can reconnect to
the console to complete the installationprocess.
[root@master ~]# ps aux | grep kvm
root 903 0.0 0.0 0 0 ? S 17:58 0:00 [kvm-irqfd-clean]
qemu 9804 0.5 32.0 1370892 321788? Sl 21:20 0:24 /usr/libexec/qemu-kvm -name test2 -S -M rhel6.6.0 -enable-kvm -m512 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid5b4b8e46-3036-31a6-5670-77370675a550 -nodefconfig -nodefaults -chardevsocket,id=charmonitor,path=/var/lib/libvirt/qemu/test2.monitor,server,nowait-mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown-device ich9-usb-ehci1,id=usb,bus=pci.0,addr=0x4.0x7 -deviceich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pci.0,multifunction=on,addr=0x4-device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pci.0,addr=0x4.0x1-device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pci.0,addr=0x4.0x2-drive file=/kvm/images/test2.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none-devicevirtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1-drive if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -deviceide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -netdevtap,fd=22,id=hostnet0,vhost=on,vhostfd=23 -devicevirtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:7f:03:2f,bus=pci.0,addr=0x3-chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0-device usb-tablet,id=input0 -vnc 0.0.0.0:11 -vga cirrus -devicevirtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6 -msg timestamp=on
root 9827 0.0 0.0 0 0 ? S 21:20 0:00 [kvm-pit-wq]
root 12075 0.0 0.0 103256 832 pts/1 S+ 22:34 0:00 grep kvm
在win上使用TigerVNC连接
装完系统后会要求重启,此窗口会关闭
[root@master ~]# virsh start test2
Domain test2 started
[root@master ~]# virsh list #(#virsh list--all可查看所有domain包括关机的)
Id Name State
----------------------------------------------------
6 test2 running
[root@master ~]# ls /etc/libvirt
libvirt.conf libvirtd.conf lxc.conf nwfilter qemu qemu.conf
[root@master ~]# ll /etc/libvirt/qemu/ #(自动生成test2.xml,此文件很关键记录着VM的所有配置)
total 8
drwx------. 3 root root 4096 Sep 4 23:58 networks
-rw-------. 1 root root3031 Sep 5 20:27 test2.xml
4、更改guest os配置:
注:使用#virsh reboot test2,不能加载新配置,要先用destroy再start
方式一(通过virsh edit DOMAIN直接编辑):
[root@master ~]# head -13 /etc/libvirt/qemu/test2.xml
……
<domain type='kvm'>
<name>test2</name>
<uuid>5b4b8e46-3036-31a6-5670-77370675a550</uuid>
<memoryunit='KiB'>524288</memory>
<currentMemoryunit='KiB'>524288</currentMemory>
<vcpu placement='static'>1</vcpu>
[root@master ~]# virsh edit test2
<domain type='kvm'>
<name>test2</name>
<uuid>5b4b8e46-3036-31a6-5670-77370675a550</uuid>
<memory unit='KiB'>824288</memory>
<currentMemory unit='KiB'>824288</currentMemory>
[root@master ~]# virsh list --all
Id Name State
----------------------------------------------------
6 test2 running
[root@master~]# virsh destroy test2
Domain test2 destroyed
[root@master~]# virsh list --all
Id Name State
----------------------------------------------------
- test2 shut off
[root@master ~]# virsh start test2
Domain test2 started
[root@master~]# virsh list
Id Name State
---------------------------------------------------
6 test2 running
方式二(用dumpxml导出-->通过vim编辑-->用define重新定义domain的xml配置文件):
[root@master ~]# virsh dumpxml test2 > test_tmp.xml
[root@master ~]# vim test_tmp.xml
<domain type='kvm' id='7'>
<name>test2</name>
<uuid>5b4b8e46-3036-31a6-5670-77370675a550</uuid>
<memory unit='KiB'>424320</memory>
<currentMemory unit='KiB'>424288</currentMemory>
[root@master ~]# cp test_tmp.xml /etc/libvirt/qemu/test2.xml
cp: overwrite`/etc/libvirt/qemu/test2.xml'? y
[root@master ~]# virsh define /etc/libvirt/qemu/test2.xml
Domain test2 defined from/etc/libvirt/qemu/test2.xml
[root@master ~]# virsh destroy test2
Domain test2 destroyed
[root@master ~]# virsh start test2
Domain test2 started
注:
#qemu-img convert -c -f raw -O qcow2 test.rawtest.qcow2 #(-c,compressed)
#virsh edit test
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'cache='none'/>
<source file='/kvm/images/test.qcow2'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05'function='0x0'/>
</disk>
#virsh start test
本文转自 chaijowin 51CTO博客,原文链接:http://blog.51cto.com/jowin/1846881,如需转载请自行联系原作者