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
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
.\"	$NetBSD: netboot,v 1.39 2021/04/24 15:38:10 tsutsui 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.
.\"
.
.(enum
Introduction
.Pp
To netboot a \*M, you must configure one or more servers to provide
information and files to your \*M (the
.Sq client ) .
If you are using
.Nx
(any architecture) on your netboot server(s), the information
provided here should be sufficient to configure everything.
Additionally, you may wish to look at the
.Xr diskless 8
manual page and the manual pages for each daemon you'll be configuring.
If the server(s) are another operating system, you should consult the
NetBSD Diskless HOW-TO, which will walk you through the steps necessary to
configure the netboot services on a variety of platforms:
.Lk https://www.NetBSD.org/docs/network/netboot/
.if !\n[hppa]:\n[next68k] \{\
.Pp
You may either netboot the installer so you can install onto a locally
attached disk, or you may run your system entirely over the network.
.\}
.Pp
.ie \n[evbppc] \{\
Briefly, the netboot
process involves discovery, kernel and file system stages.
In the first stage, the client discovers information
about where to find the kernel image.
Once the kernel is loaded, it starts executing.
.\}
.el \{\
Briefly, the netboot
process involves discovery, bootstrap, kernel and file system stages.
In the first stage, the client discovers information
about where to find the bootstrap program.
Next, it downloads and executes the bootstrap program.
.ie \n[hppa] \{\
The server contains one large file (a LIF file system) with the bootloader
and the kernel.  The bootstrap program simply loads the kernel from the
LIF image.
.\}
.el \{\
The bootstrap program goes through another discovery phase to determine
where the kernel is located.
The bootstrap program tries to mount the NFS share containing the kernel.
.\}
Once the kernel is loaded, it starts executing.
.\}
.ie !\n[hppa]:\n[next68k] \{\
For RAM disk kernels, it mounts the RAM disk file system and begins
executing the installer from the RAM disk.
For normal (non-RAM disk) kernels, the
.\}
.el The
kernel tries to mount the NFS share that had the kernel and starts
executing
.if !\n[hppa]:\n[next68k] the installation tools or
.Xr init 8 .
.if \n[hp300] \{\
All supported \*M systems use HP's proprietary RMP (the
.Xr rbootd 8
daemon) for the first discovery stage and bootstrap download stages.
The bootstrap program uses DHCP for its discovery stage.
.\}
.if \n[hppa] \{\
Early \*M systems use HP's proprietary RMP (the
.Xr rbootd 8
daemon) for the discovery stage, bootstrap download, and kernel download 
stages.  Later \*M systems use  BOOTP for the discovery stage and TFTP for
the bootstrap and kernel download.
.\}
.if \n[evbppc]:\n[macppc]:\n[next68k] \{\
All \*M systems use BOOTP for the discovery stage.
.\}
.if \n[sparc] \{\
All \*M systems except JavaStations with OpenFirmware PROM
use a combination of RARP and BOOTP for the discovery stage.
In the past, these systems used RARP and BOOTPARAMS. JavaStations
booting from OpenFirmware use DHCP.
.\}
.if \n[sparc64] \{\
All \*M systems use a combination of RARP and DHCP for the discovery stage.
.\}
.if !\n[hp300]:\n[hppa] \{\
TFTP is used in the bootstrap phase to download
.if \n[macppc] \{\
the bootstrap program,
.Pa ofwboot.xcf .
.\}
.if \n[next68k] \{\
the bootstrap program,
.Pa boot .
.\}
.if \n[sparc] \{\
the bootstrap program,
.Pa boot.net ,
which has been linked to a file name appropriate to the client's
architecture and IP address as described in the TFTP section below.
JavaStations with OpenFirmware need a special bootstrap program,
.Pa bootjs.net ,
which is a version of boot.net in ELF format.
It is not linked to the IP address.
.\}
.if \n[sparc64] \{\
the bootstrap program,
.Pa ofwboot.net ,
which has been linked to a file name appropriate to the client's
IP address as described in the TFTP section below.
.\}
.if \n[evbppc] \{\
the kernel via the on-board Ethernet card by the firmware.
Thus,
.Nx
support for the on-board card is not needed in this step.
For NFS mounting a file system on the other hand,
.Nx
support for the Ethernet card is needed, and the on-board one
will not suffice; you have to provide a second Ethernet card
supported by
.Nx "" .
.\}
.\} \" ! !\n[hp300]:\n[hppa]
.if !\n[evbppc]:\n[hppa] \{\
NFS is used in both the kernel and file system stages to download the
kernel, and to access files on the file server.
.\} \" !\n[evbppc]
.Pp
We will use
.Sq Li "CC:CC:CC:CC:CC:CC"
as the MAC address (ethernet hardware address) of your netboot client
machine.
You should have determined this address in an earlier stage.
In this example, we will use
.Sq Li 192.168.1.10
as the IP address of your client and
.Sq Li client.test.net
as its name.
We will assume you're providing all of your netboot services
on one machine called
.Sq Li server.test.net
with the client's files exported from the directory
.Pa /export/client/root .
You should, of course, replace all of these with the names, addresses,
and paths appropriate to your environment.
.Pp
You should set up each netboot stage in order (i.e., discovery,
bootstrap, kernel, and then file system) so that you can test them as you
proceed.
.if \n[hppa] \{\
.Pp
If your system uses RMP to netboot, you must set up
.Xr rbootd 8
but can skip
.Xr dhcpd 8
and
.Xr tftpd 8 .
If your system uses BOOTP to netboot, then you must set up
.Xr dhcpd 8
and
.Xr tftpd 8
but can skip
.Xr rbootd 8 .
.\}
.Pp
.It
.if \n[hp300]:\n[hppa] \{\
.Xr rbootd 8
.Pp
Get
.if \n[hp300] .Pa SYS_UBOOT
.if \n[hppa] .Pa SYSNBSD
from the
.if \n[hp300] .Pa installation/misc
.if \n[hppa] .Pa installation
directory of the distribution.
.Pp
.(disp
.No # Ic "mkdir -p /usr/mdec/rbootd"
.if \n[hp300] .No # Ic "cp SYS_UBOOT /usr/mdec/rbootd"
.if \n[hppa] .No # Ic "cp SYSNBSD /usr/mdec/rbootd"
.No # Ic "chmod -R a+rX /usr/mdec/rbootd"
.disp)
.Pp
Create
.Pa /etc/rbootd.conf
with the following line:
.(disp
.if \n[hp300] CC:CC:CC:CC:CC:CC SYS_UBOOT
.if \n[hppa] CC:CC:CC:CC:CC:CC SYSNBSD
.disp)
.Pp
You will need to start the
.Ic rbootd .
If it's already running, you will need to
restart it to force it to re-read its configuration file.
If the server is running
.Nx ,
you can achieve this with:
.Pp
.(disp
.No # Ic "/etc/rc.d/rbootd restart"
.disp)
.Pp
If your netboot server is not running
.Nx 
but other OSs (like Linux, Solaris etc.), you have to use
YAMAMORI Takenori's
.Li sun-rbootd
package instead of native
.Xr rbootd 8 .
Please refer the "Setting up the rbootd server" section
in the
.Lk https://www.NetBSD.org/docs/network/netboot/rbootd/ "NetBSD Diskless HOW-TO"
for details.
.Pp
.It
.\} \" ! \n[hp300]:\n[hppa]
.if \n[evbppc]:\n[hp300]:\n[hppa]:\n[macppc]:\n[next68k]:\n[sparc]:\n[sparc64] \{\
.ie !\n[hp300] \{\
.Xr dhcpd 8
in
.Xr bootpd 8
compatible mode
.Pp
.\}
.el \{\
.Xr dhcpd 8
.Pp
The bootstrap program uses DHCP to discover the location of the kernel.
.\}
Put the following lines in your
.Pa /etc/dhcpd.conf
(see
.Xr dhcpd.conf 5
and
.Xr dhcp-options 5
for more information):
.(disp
ddns-update-style none;
                # Do not use any dynamic DNS features
                #
allow bootp;    # Allow bootp requests, thus the dhcp server
                # will act as a bootp server.
                #
authoritative;  # master DHCP server for this subnet
                #
subnet 192.168.1.0 netmask 255.255.255.0 {
                # Which network interface to listen on.
                # The zeros indicate the range of addresses
                # that are allowed to connect.
}
group {
                # Set of parameters common to all clients
                # in this "group".
                #
        option broadcast-address        192.168.1.255;
        option domain-name              "test.net";
        option domain-name-servers      dns.test.net;
        option routers                  router.test.net;
        option subnet-mask              255.255.255.0;
                #
                # An individual client.
                #
        host client.test.net {
                hardware ethernet       CC:CC:CC:CC:CC:CC;
                fixed-address           192.168.1.10;
                #
                # Name of the host (if the fixed address
                # doesn't resolve to a simple name).
                #
                option host-name        "client";
.if !\n[hp300] \{\
.if \n[evbppc] \{\

                #
                # Name of the kernel image to download via tftp.
                # Note: Plain (ELF) kernels won't work, you
                # have to use the corresponding *.img file.
                #
                filename                "netbsd-INSTALL_WALNUT.img"
.\}
                #
                # Name of the bootloader or kernel
                # to download via tftp.
.if \n[sparc] \{\

                #
                # Only needed for JavaStations with OpenFirmware!
                #
                filename                "bootjs.net";
.\}
.if \n[hppa] \{\
                #
                filename                "SYSNBSD";
.\}
.ie \n[macppc] \{\
                #
                filename                "ofwboot.xcf";
.\}
.el \{\
.if \n[next68k] \{\
                #
                filename                "boot";
.\} \" \n[next68k]
.\} \" \n[macppc]
.\} \" !\n[hp300]

                #
                # The path on the NFS server.
                #
                option root-path "/export/client/root";
.if \n[next68k] \{\

                #
                #next68k machines require non-RFC1048 BOOTP
                #
                always-reply-rfc1048 false;
.\}

                #
                # The host address of the NFS server. This is mandatory for
                # NetBSD kernels even it's the same host as the DHCP server.
.if \n[macppc] \{\
                #
                # macppc machines will look for their bootloader, 
                # ofwboot.xcf, on the next-server as well.
.\}
                #
                next-server server.test.net;
        }
 #you may paste another "host" entry here for additional 
 #clients on this network
}
.disp)
.if \n[sparc] \{\
Note that for JavaStations booting from OpenFirmware you do not need
the 
.(disp
allow bootp;
.disp)
statement, since this machines use real DHCP.
.\}
.Pp
You will need to make sure that the
.Pa dhcpd.leases
file exists.
.Pp
.(disp
.No # Ic "touch /var/db/dhcpd.leases"
.disp)
.Pp
You will need to start the
.Ic dhcpd .
If it's already running, you will need to
restart it to force it to re-read its configuration file.
If the server is running
.Nx ,
you can achieve this with:
.Pp
.(disp
.No # Ic "/etc/rc.d/dhcpd restart"
.disp)
.Pp
.\} \" ! \n[evbppc]:\n[hp300]:\n[hppa]:\n[macppc]:\n[next68k]:\n[sparc]:\n[sparc64]
.if \n[sparc]:\n[sparc64] \{\
.Pp
.It
.Xr rarpd 8
.Pp
.if \n[sparc] \{\
Note: no
.Nm rarpd
is needed to boot OpenFirmware based JavaStations.
.Pp
.\}
Create an
.Pa /etc/ethers
file with the following line:
.Pp
.(disp
CC:CC:CC:CC:CC:CC     client
.disp)
.Pp
Add your client to the server's
.Pa /etc/hosts
file:
.Pp
.(disp
192.168.1.10 client
.disp)
.Pp
You will need to start the
.Ic rarpd .
If it's already running, you will need to
restart it to force it to re-read its configuration file.
If the server is running
.Nx ,
you can achieve this with:
.Pp
.(disp
.No # Ic "/etc/rc.d/rarpd restart"
.disp)
.Pp
.\} \" ! \n[sparc]:\n[sparc64]
.if !\n[hp300] \{\
.Pp
.It
.Xr tftpd 8
.Pp
The default configuration of the TFTP server is to run in a
.Xr chroot 8
environment in the
.Pa /tftpboot
directory.
Thus, the first order of business is to create this directory:
.(disp
.No # Ic "mkdir -p /tftpboot"
.disp)
.Pp
Next, edit
.Pa /etc/inetd.conf
and uncomment the line with the TFTP daemon:
.(disp
tftp  dgram  udp  wait  root  /usr/libexec/tftpd tftpd -l -s /tftpboot 
.disp)
.Pp
Now, restart
.Xr inetd 8 .
If the server is running
.Nx ,
you can achieve this with:
.Pp
.(disp
.No # Ic "/etc/rc.d/inetd restart"
.disp)
.Pp
Now, you need to copy the
.ie \n[evbppc] kernel
.el bootloader
for your \*M machine to
.Pa /tftpboot .
.if \n[hppa] \{\
Get
.Pa SYSNBSD
from the
.Pa installation
directory of the distribution.
.(disp
.No # Ic "cp SYSNBSD /tftpboot"
.disp)
.\}
.if \n[macppc] \{\
Get
.Xr ofwboot.xcf 8
from the
.Pa installation
directory of the distribution.
.(disp
.No # Ic "cp ofwboot.xcf /tftpboot"
.disp)
.\}
.if \n[next68k] \{\
Get
.Pa boot
from the
.Pa installation
directory of the distribution.
.(disp
.No # Ic "cp boot /tftpboot"
.disp)
.\}
.if \n[sparc]:\n[sparc64] \{\
Get
.if \n[sparc] .Pa boot.net
.if \n[sparc64] .Pa ofwboot.net
from the
.Pa installation/netboot
directory of the distribution.
.(disp
.if \n[sparc] .No # Ic "cp boot.net /tftpboot"
.if \n[sparc64] .No # Ic "cp ofwboot.net /tftpboot"
.disp)
.Pp
Now, you need to link
.if \n[sparc] .Pa boot.net
.if \n[sparc64] .Pa ofwboot.net
to the filename that your \*M will look for.
It will look for a filename composed of the machine's IP address
.if \n[sparc] \{\
(in hexadecimal) followed by the machine's architecture,
separated by a period.
For example, a sun4c machine which has been assigned IP address
192.168.1.10, will make a TFTP request for
.Pa C0A8010A.SUN4C .
.\}
.if \n[sparc64] \{\
(in hexadecimal).
For example, a machine which has been assigned IP address
192.168.1.10, will make a TFTP request for
.Pa C0A8010A .
.\}
.Pp
You can use
.Xr bc 1
to help calculate the filename:
.(disp
.No # Ic bc
.Ic obase=16
.Ic 192
C0
.Ic 168
A8
.Ic 1
1
.Ic 10
A
.Ic quit
.No # Ic "cd /tftpboot"
.if \n[sparc] .No # Ic "ln -s boot.net C0A8010A.SUN4C"
.if \n[sparc64] .No # Ic "ln -s ofwboot.net C0A8010A"
.disp)
.Pp
.\} \" \n[sparc]:\n[sparc64]
.if \n[sparc] \{\
For OpenFirmware based JavaStations you use the file
.Pa bootjs.net
and do not create a symlink for the IP address. This machines do full
DHCP autoconfiguration, so the bootstrap filename is provided by the
DHCP server.
.Pp
.\}
Just to be sure, let's make everything readable.
.(disp
.No # Ic "chmod -R a+rX /tftpboot"
.disp)
.Pp
Sometimes, the
.Xr arp 8
table gets messed up, and the TFTP server can't communicate with the
client.
In this case, it will write a log message (via
.Xr syslogd 8 )
to
.Pa /var/log/messages
saying:
.Sq Li "tftpd: write: Host is down" .
If this is the case, you may need to force the server to map your client's
ethernet address to its IP address:
.(disp
.No # Ic "arp -s client CC:CC:CC:CC:CC:CC"
.disp)
.\} \" ! !\n[hp300]
.Pp
.It
.Xr nfsd 8 ,
.Xr mountd 8 ,
and
.Xr rpcbind 8
.ie !\n[evbppc] \{\
.Pp
Now your system should be able to load the bootstrap program and start
looking for the kernel.
.\}
.el \{\
.Pp
You can either boot a kernel, or the RAM disk-based installer
.Pa binary/kernel/netbsd-INSTALL.img.gz .
In the first case you'll also need an NFS-mounted userland.
.\}
Let's set up the NFS server.
Create the directory you are exporting for the netboot client:
.Pp
.(disp
.No # Ic "mkdir -p /export/client/root"
.disp)
.Pp
Put the following line in
.Pa /etc/exports
to enable NFS sharing:
.Pp
.(disp
.No "/export/client/root -maproot=root client.test.net"
.disp)
.Pp
If your server is currently running an NFS server, you only need to
restart
.Xr mountd 8 .
Otherwise, you need to start
.Xr rpcbind 8
and
.Xr nfsd 8 .
If the server is running
.Nx ,
you can achieve this with:
.Pp
.(disp
.No # Ic "/etc/rc.d/rpcbind start"
.No # Ic "/etc/rc.d/nfsd start"
.No # Ic "/etc/rc.d/mountd restart"
.disp)
.Pp
.It
.Nx
kernel
.if !\n[next68k]:\n[hppa] and installation tools
.Pp
.if !\n[evbppc]:\n[hppa] \{\
Now, if you place a kernel named
.Pa netbsd
in
.Pa /export/client/root
your client should boot the kernel.
.\} \" !\n[evbppc]:\n[hppa]
.if \n[hp300] \{\
If you are netbooting the installer, you can use either
the traditional miniroot-based installer
.Pa installation/miniroot/miniroot.fs.gz
or the experimental RAM disk-based installer
.Pa binary/kernel/netbsd-RAMDISK.gz .
.Pp
To use the miniroot-based installer, mount the miniroot file system on your
netboot server.
This procedure does
.Em not
work on any operating system other than
.Nx .
You'll also need to either set up a new NFS share point or an FTP server
for the distribution files, as they won't fit inside the miniroot
file system.
.Pp
.(disp
.No # Ic "gunzip miniroot.fs.gz"
.No # Ic "vnconfig -c /dev/vnd0c /path/to/miniroot.fs"
.No # Ic "mount -o ro /dev/vnd0c /export/client/root"
.No # Ic "ls /export/client/root"
 .profile     dist/        install.md   mnt/         sbin/        usr/
 bin/         etc/         install.sub  mnt2/        tmp/         var/
 dev/         install*     kern/        netbsd*      upgrade*
.disp)
.Pp
If there are no files present in your exported directory, then
something is wrong.
.Pp
To use the RAM disk-based installer, uncompress and rename the kernel.
Also, copy the distribution files to the client's root directory.
.Pp
.(disp
.No # Ic "cp *.\*[setsuffix] /export/client/root"
.No # Ic "gunzip netbsd-RAMDISK.gz"
.No # Ic "mv netbsd-RAMDISK /export/client/root/netbsd"
.disp)
.Pp
If you are running your \*M diskless, simply use
.Pa binary/kernel/netbsd-GENERIC.gz .
.\} \" \n[hp300]
.if \n[hppa] \{\
You do not need to place a kernel in
.Pa /export/client/root
since the kernel is contained inside 
.Pa SYSNBSD .
.\}
.if \n[macppc] \{\
If you are netbooting the installer, use
.Pa binary/kernel/netbsd-GENERIC_MD.gz
(this has the installation tools in a RAM disk).
Also, copy the distribution files to the client's root directory.
.Pp
.(Note
Some combinations of Open Firmware version and 
.Pa ofwboot.xcf
version have trouble loading compressed kernels.  If you have trouble loading
a kernel, try uncompressing it with
.Xr gunzip 1
.Note)
.Pp
.(disp
.No # Ic "cp *.\*[setsuffix] /export/client/root"
.No # Ic "gunzip netbsd-GENERIC_MD.gz"
.No # Ic "mv netbsd-GENERIC_MD /export/client/root/netbsd"
.disp)
.Pp
If you are running your \*M diskless, simply use
.Pa binary/kernel/netbsd-GENERIC.gz .
.\}
.if \n[next68k] \{\
Use
.Pa binary/kernel/netbsd-GENERIC.gz .
.Pp
.(disp
.No # Ic "gunzip netbsd-GENERIC.gz"
.No # Ic "mv netbsd-GENERIC /export/client/root/netbsd"
.disp)
.\}
.if \n[sparc]:\n[sparc64] \{\
Use
.Pa binary/kernel/netbsd-GENERIC.gz .
.Pp
.(disp
.No # Ic "gunzip netbsd-GENERIC.gz"
.No # Ic "mv netbsd-GENERIC /export/client/root/netbsd"
.disp)
.Pp
If you are netbooting the installer, copy the distribution files to
the client's root directory and extract the tools from
.if \n[sparc] .Pa installation/netboot/rootfs.\*[setsuffix] .
.if \n[sparc64] .Pa installation/misc/instfs.\*[setsuffix] .
.Pp
.(disp
.No # Ic "cp *.\*[setsuffix] /export/client/root"
.No # Ic "cd /export/client/root"
.if \n[sparc] .No # Ic "tar -xpzf rootfs.\*[setsuffix]"
.if \n[sparc64] .No # Ic "tar -xpzf instfs.\*[setsuffix]"
.disp)
.\}
.if \n[evbppc] \{\
If you are netbooting the installer, use
.Pa binary/kernel/netbsd-INSTALL_WALNUT.img.gz
(this has the installation tools in a RAM disk).
Also, copy the distribution files to the client's root directory.
.Pp
.(disp
.No # Ic "cp *.\*[setsuffix] /export/client/root"
.No # Ic "gunzip netbsd-INSTALL.img.gz"
.No # Ic "mv netbsd-INSTALL.img /export/client/root/netbsd"
.disp)
.Pp
If you are running your \*M diskless, simply use
.Pa binary/kernel/netbsd.img-WALNUT.gz .
.\}
.It
Client file system
.Pp
.ie !\n[hppa]:\n[next68k] \{\
You can skip this step if you do not plan to run your client
diskless after installation.
Otherwise, you
.\}
.el You
need to extract and set up the client's installation of
.Nx .
The Diskless HOW-TO describes how to provide better security and save
space on the NFS server over the procedure listed here.
See
.Lk https://www.NetBSD.org/docs/network/netboot/nfs.html "for details" .
.(bullet -compact
Extracting distribution sets
.Pp
.(disp
.No # Ic "cd /export/client/root"
.No # Ic "tar -xpzf /path/to/files/base.\*[setsuffix]"
.No # Ic "tar -xpzf /path/to/files/etc.\*[setsuffix]"
.disp)
.Pp
Continue with the other non-essential distribution sets if desired.
.Pp
.It
Set up swap
.Pp
.(disp
.No # Ic "mkdir /export/client/root/swap"
.No # Ic "dd if=/dev/zero of=/export/client/swap bs=4k count=4k"
.No # Ic "echo '/export/client/swap -maproot=root:wheel client.test.net' \*[Gt]\*[Gt] /etc/exports"
.No # Ic "/etc/rc.d/mountd restart"
.disp)
This creates a 16 MB swap file and exports it to the client.
.Pp
.It
Create device nodes
.Pp
.(disp
.No # Ic "cd /export/client/root/dev"
.No # Ic "./MAKEDEV all"
.disp)
.Pp
This procedure only works on
.Nx
hosts.
.Pp
.It
Set up the client's
.Xr fstab 5
.Pp
Create a file in
.Pa /export/client/root/etc/fstab
with the following lines:
.Pp
.(disp
server:/export/client/swap   none  swap  sw,nfsmntpt=/swap
server:/export/client/root   /     nfs   rw 0 0
.disp)
.Pp
.It
Set up the client's
.Xr rc.conf 5
.Pp
Edit
.Pa /export/client/root/etc/rc.conf
.(disp
rc_configured=YES
hostname="client"
defaultroute="192.168.1.1"
nfs_client=YES
auto_ifconfig=NO
net_interfaces=""
.disp)
.Pp
Make sure rc does not reconfigure the network device since it will lose
its connection to the NFS server with your root file system.
.Pp
.It
Set up the client's
.Xr hosts 5
file.
.Pp
Edit
.Pa /export/client/root/etc/hosts
.Pp
.(disp
::1                     localhost
127.0.0.1               localhost
192.168.1.10 client.test.net client
192.168.1.5  server.test.net server
.disp)
.bullet)
.Pp
.It
Setting up the server daemons
.Pp
.ie !\n[hppa]:\n[next68k] If you want
.el You need
these services to start up every time you boot
your server, make sure the following lines are present in your
.Pa /etc/rc.conf :
.(disp
.if \n[hp300]:\n[hppa] \{\
rbootd=YES       rbootd_flags=""
.\}
.if \n[hp300]:\n[hppa]:\n[macppc]:\n[next68k]:\n[sparc]:\n[sparc64] \{\
dhcpd=YES        dhcpd_flags="-q"
.\}
.if \n[sparc]:\n[sparc64] \{\
rarpd=YES        rarpd_flags="-a"
.\}
nfs_server=YES         # enable server daemons
mountd=YES
rpcbind=YES      rpcbind_flags="-l"   # -l logs libwrap
.disp)
.Pp
.if !\n[hp300] \{\
Also, you'll need to make sure the
.Pa tftpd
line in
.Pa /etc/inetd.conf
remains uncommented.
.\}
.enum)