summaryrefslogtreecommitdiff
path: root/sys-utils/rdev.8
blob: 16d6420f0feeb17ec3e20c62fd2852b225f06e9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
.\" May be distributed under the GNU General Public License
.\" Changes from sct@dcs.ed.ac.uk added Sat Oct  9 09:54:00 1993.
.TH RDEV 8 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual"
.SH NAME
rdev \- query/set image root device, RAM disk size, or video mode
.SH SYNOPSIS
.B rdev
.RB [ \-Rrvh ]
.RB [ \-o
.IR offset ]
.RI [ image
.RI [ value
.RI [  offset ]]]
.br
.B rdev
.RB [ \-o
.IR offset ]
.RI [ image
.RI [ root_device
.RI [  offset ]]]
.br
.B ramsize
.RB [ \-o
.IR offset ]
.RI [ image
.RI [ size
.RI [  offset ]]]
.br
.B vidmode
.RB [ \-o
.IR offset ]
.RI [ image
.RI [ mode
.RI [  offset ]]]
.br
.B rootflags
.RB [ \-o
.IR offset ]
.RI [ image
.RI [ flags
.RI [  offset ]]]
.SH DESCRIPTION
With no arguments,
.B rdev
outputs an
.I /etc/mtab
line for the current root file system.
With no arguments,
.BR 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:

.nf
.RS
 498 Root flags
(500 and 502 Reserved)
 504 RAM Disk Size
 506 VGA Mode
 508 Root Device
(510 Boot Signature)
.RE
.fi

.B rdev
will change these values.

Typical values for the
.I image
parameter, which is a bootable Linux kernel image, might be:

.nf
.RS
/vmlinux
/vmunix
/boot/bzImage-2.4.0
/dev/fd0
/dev/fd1
.RE
.fi

When using the
.B rdev
command, the
.I root_device
parameter might be something like:

.nf
.RS
/dev/hda1
/dev/hdf13
/dev/sda2
/dev/sdc4
/dev/ida/c0d0p1
.RE
.fi

One may also specify the device by a comma-separated pair
of decimal integers
.IR major , minor .

For the
.B ramsize
command, the
.I 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
.B rootflags
command, the
.I 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
.I flags
is non-zero.

For the
.B vidmode
command, the
.I mode
parameter specifies the video mode:

.nf
.RS
-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
.RE
.fi

If the
.I value
is not specified, the
.I image
will be examined to determine the current settings.
.SH OPTIONS
.TP
.B \-r
Causes
.B rdev
to act like
.BR ramsize
(Not relevant for 2.0.x and newer kernels).
.TP
.B \-R
Causes
.B rdev
to act like
.BR rootflags .
.TP
.B \-v
Causes
.B rdev
to act like
.BR vidmode .
.TP
.B \-h
Provides help.
.SH BUGS
The
.B 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.
.SH 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
.BR swapon (2)
system call.

At offset 504 there used to be the size of the ramdisk in kilobytes.
One would specify a size, and this much was grabbed off the top of memory.
In Linux 1.1.39 it became also possible to set this value on the kernel
command line.
In Linux 1.3.48 the ramdisk setup was changed. Ramdisk memory is now
taken from the buffer cache, so that the ramdisk can grow dynamically.
The interpretation of the ramdisk word was changed to a word of which
the high order bit is a prompt flag (1: prompt for ramdisk:
"VFS: Insert ramdisk floppy and press ENTER" - this is needed with a
two-floppy boot), the next bit a load flag (1: load ramdisk),
and the low order 11 bits give the starting block number of the
root filesystem image (so that one can have a single floppy boot).
See also
.IR linux/Documentation/ramdisk.txt .
.SH AUTHORS
.nf
Originally by Werner Almesberger (almesber@nessie.cs.id.ethz.ch)
Modified by Peter MacDonald (pmacdona@sanjuan.UVic.CA)
rootflags support added by Stephen Tweedie (sct@dcs.ed.ac.uk)
.fi
.SH AVAILABILITY
The rdev command is part of the util-linux-ng package and is available from
ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.