Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
.\"	$NetBSD: postinstall,v 1.83.2.4 2022/06/14 10:27:32 martin Exp $
.\"
.\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
Once you've got the operating system running, there are a few
things you need to do in order to bring the system into a properly
configured state.
The most important steps are described below.
.(enum
Before all else, read
.Xr postinstall 8 .
.It
Configuring
.Pa /etc/rc.conf
.Pp
If you or the installation software haven't done any configuration of
.Pa /etc/rc.conf
.Ic ( sysinst
normally will),
the system will drop you into single user mode on first reboot with the
message
.Pp
.Dl /etc/rc.conf is not configured. Multiuser boot aborted.
.Pp
and with the root file system
.Pq Pa /
mounted read-only.
When the system asks you to choose a shell, simply press
.Key RETURN
to get to a
.Pa /bin/sh
prompt.
If you are asked for a terminal type, respond with
.
.ds termtype vt220
.
.ie \n[hp300] \{\
.ds termtype hp300h
.Ic \*[termtype]
for a local console, or whatever is appropriate for your serial console.
.\}
.el \{\
.ie \n[macppc] \{\
.ds termtype vt100
.Ic \*[termtype]
(or whatever is appropriate for your terminal type)
.\}
.el \{\
.ie \n[pmax] \{\
.ds termtype termtype
the correct terminal type as discussed in the
.Sx Once you've booted the diskimage
section.
.\}
.el \{\
.ie \n[sparc]:\n[sparc64] \{\
.ds termtype sun
.Ic \*[termtype]
for a local console, or whatever is appropriate for your serial
console (some systems display garbage with a
.Ic \*[termtype]
terminal type, you may need to use
.Ic sun-ss5 )
.ds termtype sun
.\}
.el \{\
.Ic \*[termtype]
(or whatever is appropriate for your terminal type)
.\}
.\}
.\}
.\}
and press
.Key RETURN .
You may need to type one of the following commands to get your delete key
to work properly, depending on your keyboard:
.Dl # Ic "stty erase '^h'"
.Dl # Ic "stty erase '^?'"
At this point, you need to configure at least
one file in the
.Pa /etc
directory.
You will need to mount your root file system read/write with:
.Dl # Ic "/sbin/mount -u -w /"
Change to the
.Pa /etc
directory and take a look at the
.Pa /etc/rc.conf
file.
Modify it to your tastes, making sure that you set
.Li rc_configured=YES
so that your changes will be enabled and a multi-user boot can
proceed.
Default values for the various programs can be found in
.Pa /etc/defaults/rc.conf ,
where some in-line documentation may be found.
More complete documentation can be found in
.Xr rc.conf 5 .
.Pp
When you have finished editing
.Pa /etc/rc.conf ,
type
.Ic exit
at the prompt to
leave the single-user shell and continue with the multi-user boot.
.Pp
Other values that may need to be set in
.Pa /etc/rc.conf
for a networked environment are
.Ar hostname
and possibly
.Ar defaultroute .
You may also need to add an
.Ar ifconfig_int
for your
.Aq int
network interface,
.ie \n[mac68k] \{\
where your on-board, NuBus or PDS interface may be
.Li ae0 ,
.Li mc0
or
.Li sn0 .
For example:
.\}
.el \{\
.ie \n[macppc] \{\
where your on-board interfaces may be one of
.Li mc0 ,
.Li bm0 ,
.Li tlp0
or
.Li gem0 .
For example:
.\}
.el along the lines of
.\}
.Pp
.
.ds IFname le0
.if \n[acorn32]   .ds IFname ei0
.if \n[amd64]     .ds IFname wm0
.if \n[arc]       .ds IFname sn0
.if \n[cats]      .ds IFname tlp0
.if \n[evbarm]    .ds IFname fxp0
.if \n[hppa]      .ds IFname ie0
.if \n[hpcmips]   .ds IFname ne0
.if \n[hpcsh]     .ds IFname ne0
.if \n[i386]      .ds IFname wm0
.if \n[landisk]   .ds IFname re0
.if \n[mac68k]    .ds IFname sn0
.if \n[macppc]    .ds IFname mc0
.if \n[next68k]   .ds IFname xe0
.if \n[prep]      .ds IFname pcn0
.if \n[sandpoint] .ds IFname tlp0
.if \n[sgimips]   .ds IFname sq0
.if \n[shark]     .ds IFname cs0
.if \n[sparc64]   .ds IFname hme0
.if \n[x68k]      .ds IFname ne0
.
.Dl ifconfig_\*[IFname]="inet 192.0.2.123 netmask 255.255.255.0"
.Pp
or, if you have
.Ar myname.my.dom
in
.Pa /etc/hosts :
.Pp
.Dl ifconfig_\*[IFname]="inet myname.my.dom netmask 255.255.255.0"
.Pp
To enable proper hostname resolution, you will also want to add an
.Pa /etc/resolv.conf
file or (if you are feeling a little more adventurous) run
.Xr named 8 .
See
.Xr resolv.conf 5
or
.Xr named 8
for more information.
.Pp
Instead of manually configuring networking,
DHCP can be used by setting
.Li dhcpcd=YES
in
.Pa /etc/rc.conf .
.if \n[shark] \{\
.It
Select the proper terminal devices
.Pp
You will have to edit the
.Pa /etc/ttys
file and change the console terminal type from vt100 to pc3.
.\}
.if \n[atari] \{\
.It
Select the proper terminal devices
.Pp
You will have to edit the
.Pa /etc/ttys
file.
If you don't have a Milan, you must disable the
.Pa ttyEx
devices.
For the Milan, you will have to disable the
.Pa ttyex
devices.
This is easy, just change 'on' to 'off' on the corresponding lines.
.\}
.if \n[cats] \{\
.Pp
For the
.Xr savecore 8
facility to work with the a.out and elf kernel images supplied with
\*M installations you will need to set
.Li savecore_flags="-z -N /netbsd"
.\}
.if \n[sparc]:\n[sparc64] \{\
.It
Select the proper terminal devices
.Pp
If you are using a serial console, you will have to edit the
.Pa /etc/ttys
file and change
.if \n[sparc] sun
.if \n[sparc64] sun-ss5
to the appropriate terminal type, such as vt220.
.\}
.It
Logging in
.Pp
After reboot, you can log in as
.Li root
at the login prompt.
If you didn't set a password in
.Ic sysinst ,
there
is no initial password.
You should create an account for yourself (see below) and protect it and the
.Dq root
account with good passwords.
By default, root login from the network is disabled (even via
.Xr ssh 1 ) .
One way to become root over the network is to log in as a different
user that belongs to group
.Dq wheel
(see
.Xr group 5 )
and use
.Xr su 1
to become root.
.It
Adding accounts
.Pp
Use the
.Xr useradd 8
command to add accounts to your system.
Do not
edit
.Pa /etc/passwd
directly! See
.Xr vipw 8
and
.Xr pwd_mkdb 8
if you want to edit the password database.
.if !\n[sun2] \{\
.It
The X Window System
.Pp
If you installed the X Window System, you may want to read the
chapter about X in the
.Lk https://www.NetBSD.org/docs/guide/en/chap-x.html "NetBSD Guide" :
.if \n[hp300] \{\
Also, you may want to read through the
.Nx*M
.Lk https://www.NetBSD.org/ports/hp300/faq.html#x11 "FAQ entry on X11" .
.\}
.if \n[mac68k] \{\
.(tag [Color_X]
.It [Color_X]
Some systems are capable of supporting a color X Server in either thousands
or millions of colors.
The \*M port does not support resolution switching at this time.
If your system is capable of running the color X Server it can be
installed at this point and the Booter options can be
modified to match the resolution depth.
.tag)
.\}
.\}
.It
Installing third party packages
.Pp
If you wish to install any of the software freely available for
.Ul
systems you are strongly advised to first check the
.Nx
package system, pkgsrc.
pkgsrc automatically handles any changes necessary to make the
software run on
.Nx .
This includes the retrieval and installation of any other
packages the software may depend upon.
.Pp
.(bullet
More information on the package system is available at
.Lk https://www.NetBSD.org/docs/software/packages.html
.It
A list of available packages suitable for browsing is at
.Lk https://cdn.NetBSD.org/pub/pkgsrc/current/pkgsrc/README.html
.It
Precompiled binaries can be found at
.Lk https://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/
usually in the
.Pa \*M/\*V/All
subdir.
If you installed
.Xr pkgin 1
in the
.Ic sysinst
post-installation configuration menu, you can use it to automatically install
binary packages over the network.
Assuming that
.Pa /usr/pkg/etc/pkgin/repositories.conf
is correctly configured, you can install them with the following commands:
.Pp
.Bd -unfilled
.Ic # pkgin install tcsh
.Ic # pkgin install bash
.Ic # pkgin install perl
.Ic # pkgin install apache
.Ic # pkgin install kde
.Ic # pkgin install firefox
\&...
.Ed
.(Note
Some mirror sites don't mirror the
.Pa /pub/pkgsrc
directory.
.Note)
.Pp
The above commands will install the Tenex-csh and Bourne Again shells,
the Perl programming language, Apache web server, KDE desktop
environment and the Firefox web browser
as well as all the packages they depend on.
.It
If you did not install it from the
.Ic sysinst
post-installation configuration menu, the
.Xr pkgsrc 7
framework for compiling packages can be obtained by
retrieving the file
.Lk https://cdn.NetBSD.org/pub/pkgsrc/stable/pkgsrc.tar.gz .
It is typically extracted into
.Pa /usr/pkgsrc
(though other locations work fine) with the commands:
.Pp
.Dl # Ic "cd /usr"
.Dl # Ic "tar -zxpf pkgsrc.tar.gz"
.Pp
After extracting, see the
.Pa doc/pkgsrc.txt
file in the extraction directory (e.g.,
.Pa /usr/pkgsrc/doc/pkgsrc.txt )
for more information.
.bullet)
.It
Misc
.(bullet
Edit
.Pa /etc/mail/aliases
to forward root mail to the right place.
Don't forget to run
.Xr newaliases 1
afterwards.
.It
Edit
.Pa /etc/rc.local
to run any local daemons you use.
.It
Many of the
.Pa /etc
files are documented in section 5 of the manual; so just invoking
.Pp
.Dl # Ic man 5 Ar filename
.Pp
is likely to give you more information on these files.
.bullet)
.enum)