NAME
rdev - 查询/设置内核映像文件的根设备,RAM 磁盘大小或视频模式
总览 SYNOPSIS
rdev [ -rvh ] [ -o offset ] [ image [ value [ offset ] ] ] rdev [ -o offset ] [ image [ root_device [ offset ] ] ] ramsize [ -o offset ] [ image [ size [ offset ] ] ] vidmode [ -o offset ] [ image [ mode [ offset ] ] ] rootflags [ -o offset ] [ image [ flags [ offset ] ] ]
描述 DESCRIPTION
不带任何参数的 rdev 命令将输出当前根文件系统的 /etc/mtab 文件行。不带任何参数的 ramsize, vidmode, 和 rootflags 将显示帮助信息。
在一个 i386 上的 linux 可引导内核映像文件中,有几对字节用来指定根设备,视频模式和 RAM 磁盘的大小。这些字节对,在默认情况下起始在内核映像的偏移量504 (十进制) 处。
- 498 Root flags (根标志) (500 和 502 保留) 504 RAM Disk Size RAM (磁盘大小) 506 VGA Mode (VGA 模式) 508 Root Device (根设备) (510 Boot Signature (启动标记))
rdev 可以改变这些值。
典型的 image 参数的值是一个可启动的 linux 内核映像,可能是
- /vmlinux /vmunix /boot/bzImage-2.4.0 /dev/fd0 /dev/fd1
当使用 rdev 命令时, root_device 参数是类似如下所示的值:
- /dev/hda1 /dev/hdf13 /dev/sda2 /dev/sdc4 /dev/ida/c0d0p1
也可以通过使用一个逗号 (comma) 分隔的十进制整数对 major,minor 来指定这个设备。
对于 ramsize 命令, size 参数指定了 RAM 磁盘的大小,以千字节为单位。
对于 rootflags 命令, flags 参数包含在挂载 root 文件系统时额外的信息。当前这些标志的***作用是当 flags 非零时,强制内核以只读模式来挂载 root 文件系统。
对于 vidmode 命令, mode 参数指定了视频模式。
- -3 = Prompt (提示) -2 = Extended VGA (扩展的VGA) -1 = Normal VGA (普通VGA) 0 = as if "0" was pressed at the prompt (假设在提示时按下了"0") 1 = as if "1" was pressed at the prompt 2 = as if "2" was pressed at the prompt n = as if "n" was pressed at the prompt
如果没有指定 value ,将检测 image 来得到当前的设置。
选项 OPTIONS
- -r
- 使得 rdev 作为 ramsize 运行。
- -R
- 使得 rdev 作为 rootflags 运行。
- -v
- 使得 rdev 作为 vidmode 运行。
- -h
- 提供帮助。
BUGS
rdev 工具,如果不是用做查找当前根设备的名称,那么就是一种古老的破解 (hack) ,依靠对内核的一个特定 (magic) 位移以特殊 (magic) 数字进行修改来工作。它在 i386 之外的体系中不能工作。不鼓励使用它。使用一个启动管理器,例如 SysLinux , LILO 或者 grub 来替代它。
历史 HISTORY
偏移 502 从前是交换设备的设备号 (在 linux 0.12 中),运行 "rdev -s" 或者 "swapdev" 将设置它。但是,从 linux 0.95 起,这个常量不再使用,交换设备是以 swapon() 系统调用来指定的。
#p#
NAME
rdev - query/set image root device, RAM disk size, or video mode
SYNOPSIS
rdev [ -rvh ] [ -o offset ] [ image [ value [ offset ] ] ] rdev [ -o offset ] [ image [ root_device [ offset ] ] ] ramsize [ -o offset ] [ image [ size [ offset ] ] ] vidmode [ -o offset ] [ image [ mode [ offset ] ] ] rootflags [ -o offset ] [ image [ flags [ offset ] ] ]
DESCRIPTION
With no arguments, rdev outputs an /etc/mtab line for the current root file system. With no arguments, ramsize, vidmode, and rootflags print usage information.
In a bootable image for the Linux kernel on i386, there are several pairs of bytes which specify the root device, the video mode, and the size of the RAM disk. These pairs of bytes, by default, begin at offset 504 (decimal) in the kernel image:
- 498 Root flags (500 and 502 Reserved) 504 RAM Disk Size 506 VGA Mode 508 Root Device (510 Boot Signature)
rdev will change these values.
Typical values for the image parameter, which is a bootable Linux kernel image, might be:
- /vmlinux /vmunix /boot/bzImage-2.4.0 /dev/fd0 /dev/fd1
When using the rdev command, the root_device parameter might be something like:
- /dev/hda1 /dev/hdf13 /dev/sda2 /dev/sdc4 /dev/ida/c0d0p1
One may also specify the device by a comma-separated pair of decimal integers major,minor.
For the ramsize command, the size parameter specifies the size of the RAM disk in kilobytes. 2.0.x kernels and newer dynamically allocate the ramdisk and do not need this setting.
For the rootflags command, the flags parameter contains extra information used when mounting root. Currently the only effect of these flags is to force the kernel to mount the root filesystem in readonly mode if flags is non-zero.
For the vidmode command, the mode parameter specifies the video mode:
- -3 = Prompt -2 = Extended VGA -1 = Normal VGA 0 = as if "0" was pressed at the prompt 1 = as if "1" was pressed at the prompt 2 = as if "2" was pressed at the prompt n = as if "n" was pressed at the prompt
If the value is not specified, the image will be examined to determine the current settings.
OPTIONS
- -r
- Causes rdev to act like ramsize. (Not relevant for 2.0.x and newer kernels.)
- -R
- Causes rdev to act like rootflags.
- -v
- Causes rdev to act like vidmode.
- -h
- Provides help.
BUGS
The rdev utility, when used other than to find a name for the current root device, is an ancient hack that works by patching a kernel image at a magic offset with magic numbers. It does not work on architectures other than i386. Its use is strongly discouraged. Use a boot loader like SysLinux or LILO instead.
HISTORY
At offset 502 there used to be the device number of the swap device (in Linux 0.12), and "rdev -s" or "swapdev" would set this. However, since Linux 0.95 this constant is not used any longer, and the swap device is specified using the swapon() system call.