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
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
.\"	$NetBSD: installboot.8,v 1.107 2023/05/17 01:35:00 uwe Exp $
.\"
.\" Copyright (c) 2002-2023 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Luke Mewburn of Wasabi Systems.
.\"
.\" 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.
.\"
.
.\" Prevent accidental hyphenation after the hyphen in "U-Boot"
.\" Usage: \*(UB
.ds UB U\(hyBoot
.
.Dd May 16, 2023
.Dt INSTALLBOOT 8
.Os
.Sh NAME
.Nm installboot
.Nd install disk bootstrap software
.
.Sh SYNOPSIS
.Nm
.Op Fl fnv
.Op Fl B Ar s2bno
.Op Fl b Ar s1bno
.Op Fl m Ar machine
.Op Fl o Ar options
.Op Fl t Ar fstype
.Op Fl u Ar U-Boot-paths
.Ar filesystem
.Ar primary
.Op Ar secondary
.Nm
.Fl c
.Op Fl fnv
.Op Fl m Ar machine
.Op Fl o Ar options
.Op Fl t Ar fstype
.Ar filesystem
.Nm
.Fl e
.Op Fl fnv
.Op Fl m Ar machine
.Op Fl o Ar options
.Ar bootstrap
.
.Sh DESCRIPTION
The
.Nm
utility installs and removes
.Nx
disk bootstrap software into a file system.
.Nm
can install
.Ar primary
into
.Ar filesystem ,
or disable an existing bootstrap in
.Ar filesystem .
.Ss Traditional NetBSD boot
Generally,
.Nx
disk bootstrap software consists of two parts: a
.Dq primary
bootstrap program usually written into the disklabel area of the
file system by
.Nm ,
and a
.Dq secondary
bootstrap program that usually resides as an ordinary file in the file system.
.Pp
When booting, the primary bootstrap program is loaded and invoked by
the machine's
.Tn PROM
or
.Tn BIOS .
After receiving control of the system it loads and runs the secondary
bootstrap program, which in turn loads and runs the kernel.
The secondary bootstrap may allow control over various boot parameters
passed to the kernel.
.Pp
Perform the following steps to make a file system bootable:
.Bl -enum
.It
Copy the secondary bootstrap
.Po
usually
.Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^
or
.Pa /usr/mdec/boot
.Pc
to the root directory of the target file system.
.
.It
Use
.Nm
to install the primary bootstrap program
.Po
usually
.Pa /usr/mdec/bootxx_ Ns Aq Ar FSTYPE\^
.Pc
into
.Ar filesystem .
.Pp
The following platforms do not require this step if the primary bootstrap
already exists and the secondary bootstrap file is just being updated:
.Sy alpha ,
.Sy amd64 ,
.Sy amiga ,
.Sy i386 ,
.Sy pmax ,
.Sy sparc64 ,
and
.Sy vax .
.Pp
The following platform does not require the first step since a
single bootstrap file is used.
The single bootstrap is installed like the primary bootstrap on
other platforms:
.Sy next68k .
.El
.Pp
On some architectures the options of an existing installed bootstrap,
or those of a bootstrap file can be changed.
Installing a new primary bootstrap will reset those options to default
values.
.Ss Embedded board types
Some platforms, typically embedded system platforms, are umbrella platforms
that support many different individual board types, each with their own
boot loader binary and installation procedure requirements.
On these platforms, it may be necessary to provide specific board type
information to
.Nm .
Information about known boards and their requirements is loaded from a
database at run-time.
Sometimes these platforms also require the use of 3rd-party boot loader
software, such as \*(UB.
To support these platforms,
.Nm
scans known locations for these 3rd-party boot loader packages for
database overlays that contain additional board-specific boot loader
installation information in a file called
.Pa installboot.plist .
.Pp
The following platforms have this requirement and utilize this database
overlay feature:
.Sy evbarm .
.Ss UEFI boot
On platforms that boot with
.Tn UEFI ,
there is a single boot loader in the
.Tn EFI
system partition at
.Pa EFI/boot/boot Ns Ao Ar ARCH\^ Ac Ns Pa .efi
where
.Ar ARCH
is the
.Tn UEFI
name for the architecture, such as
.Li ia32
.Pq Nx Ns /i386 ,
.Li x64
.Pq Nx Ns /amd64 ,
or
.Li aa64
.Pq Nx Ns /aarch64 .
.Pp
.Nm
is not needed for
.Tn UEFI
boot.
However, it may be used on a platform that supports
.Tn UEFI
boot to make a
hybrid image that can be booted
.Em either
with
.Tn UEFI
boot or with, e.g.,
.Tn BIOS
or \*(UB.
Hybrid images may also require a special
.Tn GPT
for
.Tn BIOS
boot; see
.Xr gpt 8 .
.Ss Options
The options and arguments recognized by
.Nm
are as follows:
.
.Bl -tag -width Fl
.
.It Fl B Ar s2bno
When hard-coding the blocks of
.Ar secondary
into
.Ar primary ,
start from block
.Ar s2bno
instead of trying to determine the block numbers occupied by
.Ar secondary
by examining
.Ar filesystem .
If this option is supplied,
.Ar secondary
should refer to an actual secondary bootstrap
.Po
rather than the file name of the one present in
.Ar filesystem
.Pc
so that its size can be determined.
.
.It Fl b Ar s1bno
Install
.Ar primary
at block number
.Ar s1bno
instead of the default location for the machine and file system type.
.Sy [ alpha ,
.Sy i386/amd64
.Po
.Pa bootxx_fat16
only
.Pc ,
.Sy pmax ,
.Sy vax ]
.
.It Fl c
Clear (remove) any existing bootstrap instead of installing one.
.
.It Fl e
Edit the options of an existing bootstrap.
This can be used to change the options in
.Pa bootxx_ Ns Aq Ar FSTYPE\^
files,
raw disk partitions, and the
.Pa pxeboot_ia32.bin
file.
With
.Fl v
and without
.Fl o ,
show the current options.
.Sy [ amd64 , i386 ]
.
.It Fl f
Forces
.Nm
to ignore some errors.
.
.It Fl m Ar machine
Use
.Ar machine
as the target machine type.
The default machine is determined from
.Xr uname 3
and then
.Ev MACHINE
environment variable.
The following machines are currently supported:
.Bd -ragged -offset indent
.Ic alpha ,
.Ic amd64 ,
.Ic amiga ,
.Ic evbarm ,
.Ic ews4800mips ,
.Ic hp300 ,
.Ic hppa ,
.Ic i386 ,
.Ic landisk ,
.Ic macppc ,
.Ic news68k ,
.Ic newsmips ,
.Ic next68k ,
.Ic pmax ,
.Ic sparc ,
.Ic sparc64 ,
.Ic sun2 ,
.Ic sun3 ,
.Ic vax ,
.Ic x68k
.Ed
.
.
.It Fl n
Do not write to
.Ar filesystem .
.
.It Fl o Ar options
Machine specific
.Nm
options, comma separated.
.Pp
Supported options are
.Pq with the machines for they are valid in brackets :
.
.Bl -tag -width Ic
.
.It Ic alphasum
.Sy [ alpha ]
Recalculate and restore the Alpha checksum.
This is the default for
.Nx Ns /alpha .
.
.It Ic append
.Sy [ alpha ,
.Sy pmax ,
.Sy vax ]
Append
.Ar primary
to the end of
.Ar filesystem ,
which must be a regular file in this case.
.
.It Ic board Ns Op Ns Li = Ns Ar type
.Sy [ evbarm ]
Specify the board type used to determine the correct boot loader image
and installation procedure.
If omitted,
.Nm
will attempt to guess the board type based on system information if run
natively.
.
.It Ic bootconf
.Sy [ amd64 ,
.Sy i386 ]
(Don't) read a
.Pa boot.cfg
file.
.
.It Ic command Ns Li = Ns Ar commandline
.Sy [ amiga ]
Modify the default boot command line.
.
.It Ic console Ns Li = Ns Ar name
.Sy [ amd64 ,
.Sy i386 ]
Set the console device.
.Ar name
must be one of:
.Ic pc ,
.Ic com0 ,
.Ic com1 ,
.Ic com2 ,
.Ic com3 ,
.Ic com0kbd ,
.Ic com1kbd ,
.Ic com2kbd ,
.Ic com3kbd ,
or
.Ic auto .
.
.It Ic dtb Ns Li = Ns Ar dtbfile
.Sy [ evbarm ]
Attempt to determine the board type from information in the device tree
blob file at
.Ar dtbfile .
If both
.Ic board
and
.Ic dtb
options are specified,
.Ic board
takes precendence.
.
.It Ic ioaddr Ns Li = Ns Ar ioaddr
.Sy [ amd64 ,
.Sy i386 ]
Set the IO address to be used for the console serial port.
Defaults to the IO address used by the system
.Tn BIOS
for the specified port.
.
.It Ic keymap Ns Li = Ns Ar keymap
.Sy [ amd64 ,
.Sy i386 ]
Set a boot time keyboard translation map.
Each character in
.Ar keymap
will be replaced by the one following it.
For example, an argument of
.Li zyz
would swap the lowercase letters
.Aq y
and
.Aq z .
.
.It Ic media Ns Li = Ns Ar type
.Sy [ evbarm ]
Some boards require a different boot loader binary and/or installation
procedure depending on what type of media will be used to boot the system.
For such boards, this option is required, and omitting it will display a
usage message that lists the valid media types for the board.
For boards that do not require special media handling, this option is
not allowed.
Common values:
.Ic sdmmc ,
.Ic emmc ,
.Ic usb .
.
.It Ic modules
.Sy [ amd64 ,
.Sy i386 ]
(Don't) load kernel modules.
.
.It Ic password Ns Li = Ns Ar password
.Sy [ amd64 ,
.Sy i386 ]
Set the password which must be entered before the boot menu can be accessed.
.
.It Ic resetvideo
.Sy [ amd64 ,
.Sy i386 ]
Reset the video before booting.
.
.It Ic speed Ns Li = Ns Ar baud
.Sy [ amd64 ,
.Sy i386 ]
Set the baud rate for the serial console.
If a value of zero is specified, then the current baud rate (set by the
.Tn BIOS )
will be used.
.
.It Ic sunsum
.Sy [ alpha ,
.Sy pmax ,
.Sy vax ]
Recalculate and restore the Sun and
.Nx Ns /sparc
compatible checksum.
.Em Note :
The existing
.Nx Ns /sparc
disklabel should use no more than 4 partitions.
.
.It Ic timeout Ns Li = Ns Ar seconds
.Sy [ amd64 ,
.Sy i386 ]
Set the timeout before the automatic boot begins to the given number of seconds.
.El
.
.It Fl t Ar fstype
Use
.Ar fstype
as the type of
.Ar filesystem .
The default operation is to attempt to auto-detect this setting.
The following file system types are currently supported by:
.
.Bl -tag -width Ic
.
.It Ic ffs
.Bx
Fast File System.
.
.It Ic raid
Mirrored RAIDframe File System.
.
.It Ic raw
.Dq Raw
image.
.Em Note :
if a platform needs to hard-code the block offset of the secondary
bootstrap, it cannot be searched for on this file system type, and must
be provided with
.Fl B Ar s2bno .
.El
.
.It Fl u Ar U-Boot-paths
.Ar U-Boot-paths
is a colon-separated list of search paths to scan for
\*(UB packages with
.Nm
installation overlays.
If multiple overlays are found, overlays from paths closer to the front
of the list take precedence.
If not specified, environment variable
.Ev INSTALLBOOT_UBOOT_PATHS
is used if defined; otherwise, the default path is
.Pa /usr/pkg/share/u-boot .
This option is only used on platforms that support
using \*(UB.
.
.It Fl v
Verbose operation.
.
.It Ar filesystem
The path name of the device or file system image that
.Nm
is to operate on.
It is not necessary for
.Ar filesystem
to be a currently mounted file system.
.
.It Ar primary
The path name of the
.Dq primary
boot block to install.
The path name must refer to a file in a file system that is currently
mounted.
.
.It Ar secondary
The path name of the
.Dq secondary
boot block, relative to the root of
the file system in the device or image specified by the
.Ar filesystem
argument.
Note that this may refer to a file in a file system that is not mounted.
Most systems require
.Ar secondary
to be in the
.Dq root
directory of the file system, so the leading
.Ql /
is not necessary on
.Ar secondary .
.Pp
Only certain combinations of
platform
.Pq Fl m Ar machine
and file system type
.Pq Fl t Ar fstype
require that the name of the secondary bootstrap is
supplied as
.Ar secondary ,
so that information such as the disk block numbers occupied
by the secondary bootstrap can be stored in the primary bootstrap.
These are:
.Bl -column "Platform" "File systems" -offset indent
.It Sy "Platform" Ta Sy "File systems"
.It macppc Ta ffs, raw
.It news68k Ta ffs, raw
.It newsmips Ta ffs, raw
.It sparc Ta ffs, raid, raw
.It sun2 Ta ffs, raw
.It sun3 Ta ffs, raw
.El
.El
.
.Sh ENVIRONMENT
.Bl -tag -width Ev
.
.It Ev INSTALLBOOT_UBOOT_PATHS
A colon-separated list of search paths to scan for
\*(UB packages with
.Nm
installation overlays.
If multiple overlays are found, overlays from paths closer to the front
of the list take precedence.
If not specified, the default path is
.Pa /usr/pkg/share/u-boot .
This environment variable is only used on platforms that support
using \*(UB.
.
.It Ev MACHINE
Default value for
.Ar machine ,
overriding the result from
.Xr uname 3 .
.
.El
.
.Sh FILES
Most
.Nx
ports will contain variations of the following files:
.Bl -tag -width Pa
.
.It Pa /usr/mdec/bootxx_ Ns Aq Ar FSTYPE\^
Primary bootstrap for file system type
.Ar FSTYPE .
Installed into the bootstrap area of the file system by
.Nm .
.
.It Pa /usr/mdec/bootxx_fat16
Primary bootstrap for
.Tn MS-DOS
.Sy FAT16
file systems.
This differs from
.Pa bootxx_msdos
in that it doesn't require the filesystem to have been initialised with
any
.Dq reserved sectors .
It also uses the information in the
.Dq Boot Parameter Block
to get the media and filesystem properties.
The
.Dq hidden sectors
field of the
.Tn BPB
must be the offset of the partition in the disk.
This can be set using the
.Fl b Ar s1bno
option.
.
.It Pa /usr/mdec/bootxx_ffsv1
Primary bootstrap for
.Sy FFSv1
file systems
.Po
the
.Dq traditional
file system prior to
.Nx 6.0
.Pc .
Use
.Xr dumpfs 8
to confirm the file system format is FFSv1.
.
.It Pa /usr/mdec/bootxx_ffsv2
Primary bootstrap for
.Sy FFSv2
file systems
.Po
the default file system for some platforms as of
.Nx 6.0
.Pc .
Use
.Xr dumpfs 8
to confirm the file system format is FFSv2.
.
.It Pa /usr/mdec/bootxx_lfsv1
Primary bootstrap for
.Sy LFSv1
file systems.
.
.It Pa /usr/mdec/bootxx_lfsv2
Primary bootstrap for
.Sy LFSv2
file systems
.Pq the default Tn LFS version .
.
.It Pa /usr/mdec/bootxx_msdos
Primary bootstrap for
.Tn MS-DOS
.Sy FAT
file systems.
.
.It Pa /usr/mdec/bootxx_ustarfs
Primary bootstrap for
.Sy TARFS
boot images.
This is used by various install media.
.
.It Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^
Secondary bootstrap for machine type
.Ar MACHINE .
This should be installed into the file system before
.Nm
is run.
.
.It Pa /usr/mdec/boot
Synonym for
.Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^
.
.It Pa /boot. Ns Aq Ar MACHINE\^
Installed copy of secondary bootstrap for machine type
.Ar MACHINE .
.
.It Pa /boot
Installed copy of secondary bootstrap.
Searched for by the primary bootstrap if
.Pa /boot. Ns Aq Ar MACHINE\^
is not found.
.
.El
.
.Ss NetBSD/evbarm files
The
.Nx Ns /evbarm
platform covers a wide variety of board types, many of which use \*(UB.
Running
.Nm
with no options will display a list of known boards.
Using the verbose option will also display information about which
\*(UB package needs to be installed to support that board,
and if the required \*(UB package is installed,
the path at which it is located.
.Bl -tag -width Pa
.It Pa /usr/pkg/share/u-boot
The default location scanned for
\*(UB packages with installation overlays.
.It Pa /usr/share/installboot/evbarm/boards.plist
Base board database, used to provide information about which
\*(UB package is required for a given board.
.El
.
.Ss NetBSD/evbmips files
.
The
.Nx Ns /evbmips
bootstrap files currently only apply to the
.Tn SBMIPS
kernels for the
SiByte/Broadcom
.Tn BCM1250
and
.Tn BCM1480
CPUs.
.Bl -tag -width Pa
.
.It Pa /usr/mdec/sbmips/boot
.Nx Ns /evbmips
secondary bootstrap for FFSv1, FFSv2, LFSv1, and LFSv2.
.It Pa /usr/mdec/sbmips/bootxx_cd9660
.Tn SBMIPS
primary bootstrap for ISO 9660 file system.
.It Pa /usr/mdec/sbmips/bootxx_ffs
.Tn SBMIPS
primary bootstrap for FFSv1 and FFSv2 file system.
.It Pa /usr/mdec/sbmips/bootxx_lfs
.Tn SBMIPS
primary bootstrap for LFSv1 and LFSv2 file system.
.It Pa /usr/mdec/sbmips/netboot
.Tn SBMIPS
primary bootstrap for network root.
.Pp
Note that
.Nm
does not currently support evbmips directly.
.
.El
.
.Ss NetBSD/hppa files
.
.Bl -tag -width Pa
.
.It Pa /usr/mdec/xxboot
.Nx Ns /hppa
primary bootstrap for FFSv1, FFSv2, LFSv1, and LFSv2.
.It Pa /usr/mdec/cdboot
.Nx Ns /hppa
primary bootstrap for ISO 9660 file system.
.It Pa /usr/mdec/sdboot
Synonym for
.Pa /usr/mdec/xxboot
.
.El
.
.Ss NetBSD/macppc files
.
.Bl -tag -width Pa
.
.It Pa /usr/mdec/bootxx
.Nx Ns /macppc
primary bootstrap.
.
.It Pa /usr/mdec/ofwboot
.Nx Ns /macppc
secondary bootstrap.
.
.It Pa /ofwboot
Installed copy of
.Nx Ns /macppc
secondary bootstrap.
.
.El
.
.Ss NetBSD/next68k files
.
.Bl -tag -width Pa
.
.It Pa /usr/mdec/boot
.Nx Ns /next68k
bootstrap.
.
.El
.
.Ss NetBSD/sparc64 files
.
.Bl -tag -width Pa
.
.It Pa /usr/mdec/bootblk
.Nx Ns /sparc64
primary bootstrap.
.
.It Pa /usr/mdec/ofwboot
.Nx Ns /sparc64
secondary bootstrap.
.
.It Pa /ofwboot
Installed copy of
.Nx Ns /sparc64
secondary bootstrap.
.
.El
.
.Sh EXAMPLES
.
.Ss Common
Verbosely install the Berkeley Fast File System primary bootstrap on to disk
.Ql sd0 :
.Pp
.Dl installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs
.Pp
Note: the
.Dq whole disk
partition
.Po
.Ql c
on some ports,
.Ql d
on others
.Pc
is used here, since the
.Ql a
partition
probably is already opened
.Po
mounted as
.Pa /
.Pc ,
so
.Nm
would not be able to access it.
.Pp
Remove the primary bootstrap from disk
.Ql sd1 :
.Pp
.Dl installboot -c /dev/rsd1c
.
.Ss NetBSD/amiga
Modify the command line to change the default from
.Ql "netbsd -ASn2"
to
.Ql "netbsd -S" :
.Bd -literal -offset indent
installboot -m amiga -o command="netbsd -S" /dev/rsd0a \e
    /usr/mdec/bootxx_ffsv1
.Ed
.
.Ss NetBSD/evbarm
Install the
\*(UB boot loader for a Pinebook into an image that will be written to
an
.Tn SDMMC
card:
.Pp
.Dl installboot -m evbarm -o board=pine64,pinebook arm64.img
.Pp
Install/update the
\*(UB boot loader for the current running system on the
.Tn eMMC
device
.Ql ld0
and display verbose information about the procedure:
.Pp
.Dl installboot -v /dev/rld0c
.Pp
Install a specific
\*(UB package for a BeagleBone Black into an image that will be written
to an
.Tn SDMMC
card:
.Bd -literal -offset indent
installboot -m evbarm -o board=ti,am335x-bone-black armv7.img \e
    /path/to/experimental/u-boot/package
.Ed
.
.Ss NetBSD/ews4800mips
Install the System V Boot File System primary bootstrap on to disk
.Ql sd0 ,
with the secondary bootstrap
.Pa /boot
already present in the SysVBFS partition on the disk:
.Pp
.Dl installboot /dev/rsd0p /usr/mdec/bootxx_bfs
.Pp
.Bd -ragged -offset indent-two -compact
.Em Note :
On
.Nx Ns /ews4800mips
the
.Ql p
partition is the
.Dq whole disk
.Pq i.e., raw
partition.
.Ed
.
.Ss NetBSD/i386 and NetBSD/amd64
Install new boot blocks on an existing FFSv2 mounted root file system on
.Ql wd0 ,
setting the timeout to five seconds, after installing an
.Tn MBR
bootcode and copying a new secondary bootstrap:
.Pp
.Dl fdisk -c /usr/mdec/mbr /dev/rwd0d
.Pp
.Bd -ragged -offset indent-two -compact
.Em Note :
See
.Xr fdisk 8
and
.Xr x86/mbr 8
for more details.
.Ed
.Pp
.Dl cp /usr/mdec/boot /boot
.Dl installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2
.Pp
.Bd -ragged -offset indent-two -compact
.Em Note :
Pre
.Nx 6.0
systems used FFSv1 file systems on these platforms; double check with
.Xr dumpfs 8
to be sure to use the correct secondary bootstrap.
.Ed
.Pp
Create a bootable
.Tn CD-ROM
with an ISO 9660 file system for an i386 system with a serial console:
.Bd -literal -offset indent
mkdir cdrom
cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd
cp /usr/mdec/boot cdrom/boot
cp /usr/mdec/bootxx_cd9660 bootxx
installboot -o console=com0,speed=19200 -m i386 -e bootxx
makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \e
    cdrom
.Ed
.
.Pp
Create a bootable floppy disk with an FFSv1
file system for a small custom kernel (note: bigger kernels needing
multiple disks are handled with the ustarfs file system):
.Pp
.Dl newfs -s 1440k /dev/rfd0a
.Pp
.Bd -ragged -offset indent-two -compact
.Em Note :
Ignore the warnings that
.Xr newfs 8
displays; it can not write a disklabel,
which is not a problem for a floppy disk.
.Ed
.
.Bd -literal -offset indent
mount /dev/fd0a /mnt
cp /usr/mdec/boot /mnt/boot
gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz
umount /mnt
installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1
.Ed
.
.Pp
Create a bootable
.Tn FAT
file system on
.Ql wd1a ,
which should have the same offset and size as a
.Tn FAT
primary partition
in the Master Boot Record
.Tn ( MBR ) :
.Pp
.Dl newfs_msdos -r 16 /dev/rwd1a
.Pp
.Bd -ragged -offset indent-two -compact
.Em Notes :
The
.Fl r Ic 16
is to reserve space for the primary bootstrap.
.Xr newfs_msdos 8
will display an
.Dq Tn MBR type
such as
.Ql 1 ,
.Ql 4 ,
or
.Ql 6 ;
the
.Tn MBR
partition type of the appropriate primary partition should be
changed to this value.
.Ed
.
.Bd -literal -offset indent
mount -t msdos /dev/wd1a /mnt
cp /usr/mdec/boot /mnt/boot
cp path/to/kernel /mnt/netbsd
umount /mnt
installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos
.Ed
.Pp
Make the existing
.Tn FAT16
filesystem on
.Ql sd0e
bootable.
This can be used to make
.Tn USB
memory bootable provided it has 512 byte
sectors and that the manufacturer correctly initialised the file system.
.Bd -literal -offset indent
mount -t msdos /dev/sd0e /mnt
cp /usr/mdec/boot /mnt/boot
cp path/to/kernel /mnt/netbsd
umount /mnt
installboot /dev/rsd0e /usr/mdec/bootxx_fat16
.Ed
.Pp
It may also be necessary to use
.Xr fdisk 8
to make the device itself bootable.
.
.Pp
Switch the existing installed bootstrap to use a serial console without
reinstalling or altering other options such as timeout.
.Pp
.Dl installboot -e -o console=com0 /dev/rwd0a
.
.Ss NetBSD/macppc
Note the
.Nm
utility is only required for macppc machines with OpenFirmware version 2
to boot.
OpenFirmware 3 cannot load bootblocks specified in the Apple partition
map.
.Pp
Install the Berkeley Fast File System primary bootstrap on to disk
.Ql wd0 :
.Pp
.Dl installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot
.Pp
The secondary
.Nx Ns /macppc
bootstrap is located in
.Pa /usr/mdec/ofwboot .
.Pp
The primary bootstrap requires the raw
.Pa ofwboot
for the secondary bootstrap, not
.Pa ofwboot.xcf ,
which is used for the OpenFirmware to load kernels.
.
.Ss NetBSD/next68k
Install the bootstrap on to disk
.Ql sd0 :
.Pp
.Dl installboot /dev/rsd0c /usr/mdec/boot
.
.Ss NetBSD/pmax
Install the Berkeley Fast File System primary bootstrap on to disk
.Ql sd0 :
.Pp
.Dl installboot /dev/rsd0c /usr/mdec/bootxx_ffs
.Pp
.Nx Ns /pmax
requires that this file system starts at block 0 of the disk.
.Pp
Install the ISO 9660 primary bootstrap in the file
.Pa /tmp/cd-image :
.Pp
.Dl installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660
.Pp
Make an ISO 9660 filesystem in the file
.Pa /tmp/cd-image
and install the ISO 9660 primary bootstrap in the filesystem, where the
source directory for the ISO 9660 filesystem contains a kernel, the
primary bootstrap
.Pa bootxx_cd9660
and the secondary bootstrap
.Pa boot.pmax :
.Bd -literal -offset indent
mkisofs -o /tmp/cd-image -a -l -v iso-source-dir
\&...
48 51 iso-source-dir/bootxx_cd9660
\&...
installboot -b $((48 * 4)) /tmp/cd-image /usr/mdec/bootxx_cd9660
.Ed
.
.Ss NetBSD/sparc
Install the Berkeley Fast File System primary bootstrap on to disk
.Ql sd0 ,
with the secondary bootstrap
.Pa /boot
already present:
.Pp
.Dl installboot /dev/rsd0c /usr/mdec/bootxx /boot
.
.Ss NetBSD/sparc64
Install the primary bootstrap on to disk
.Ql sd0 :
.Pp
.Dl installboot /dev/rsd0c /usr/mdec/bootblk
.Pp
The secondary
.Nx Ns /sparc64
bootstrap is located in
.Pa /usr/mdec/ofwboot .
.
.Ss NetBSD/sun2 and NetBSD/sun3
Install the Berkeley Fast File System primary bootstrap on to disk
.Ql sd0 ,
with the secondary bootstrap
.Pa /boot
already present:
.Pp
.Dl installboot /dev/rsd0c /usr/mdec/bootxx /boot
.
.Sh DIAGNOSTIC
.Ex -std
.
.Sh SEE ALSO
.Xr uname 3 ,
.Xr boot 8 ,
.Xr disklabel 8 ,
.Xr dumpfs 8 ,
.Xr fdisk 8 ,
.Xr gpt 8 ,
.Xr x86/mbr 8 ,
.Xr x86/pxeboot 8
.
.Sh HISTORY
This implementation of
.Nm
appeared in
.Nx 1.6 .
.
.Sh AUTHORS
.An -nosplit
The machine independent portion of this implementation of
.Nm
was written by
.An Luke Mewburn .
The following people contributed to the various machine dependent
back-ends:
.An Simon Burge
(pmax),
.An Chris Demetriou
(alpha),
.An Matthew Fredette
(sun2, sun3),
.An Matthew Green
(sparc64),
.An Ross Harvey
(alpha),
.An Michael Hitch
(amiga),
.An Paul Kranenburg
(sparc),
.An David Laight
(i386),
.An Christian Limpach
(next68k),
.An Luke Mewburn
(macppc),
.An Matt Thomas
(vax),
.An Izumi Tsutsui
(news68k, newsmips),
and
.An UCHIYAMA Yasushi
(ews4800mips).
.
.Sh BUGS
There are not currently primary bootstraps to support all file systems
types which are capable of being the root file system.
.Pp
If a disk has been converted from
.Tn FFS
to
.Tn RAID
without the contents of the disk erased, then the original
.Tn FFS
installation may be auto-detected instead of the
.Tn RAID
installation.
In this case, the
.Fl t Ic raid
option must be provided.
.
.Ss NetBSD/alpha
The
.Nx Ns /alpha
primary bootstrap program can only load the secondary bootstrap program
from file systems starting at the beginning
.Pq block 0
of disks.
Similarly, the secondary bootstrap program can only load kernels from
file systems starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems
.Pq e.g., ISO 9660
are able to accommodate larger ones.
.
.Ss NetBSD/hp300
The disk must have a boot partition large enough to hold the bootstrap code.
Currently the primary bootstrap must be a LIF format file.
.
.Ss NetBSD/i386 and NetBSD/amd64
The bootstrap must be installed in the
.Nx
partition that starts at the beginning of the
.Tn MBR
partition.
If that is a valid filesystem and contains the
.Pa /boot
program then it will be used as the root filesystem, otherwise the
.Ql a
partition will be booted.
.Pp
The size of primary bootstrap programs is restricted to 8KB, even
though some file systems
.Pq e.g., ISO 9660
are able to accommodate larger ones.
.
.Ss NetBSD/macppc
Due to restrictions in
.Nm
and the secondary bootstrap implementation, file systems where kernels exist
must start at the beginning of disks.
.Pp
Currently,
.Nm
doesn't recognize an existing Apple partition map on the disk
and always writes a faked map to make disks bootable.
.Pp
The
.Nx Ns /macppc
bootstrap program can't load kernels from FFSv2 partitions.
.
.Ss NetBSD/next68k
The size of bootstrap programs is restricted to the free space before
the file system at the beginning of the disk minus 8KB.
.
.Ss NetBSD/pmax
The
.Nx Ns /pmax
secondary bootstrap program can only load kernels from file
systems starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems
.Pq e.g., ISO 9660
are able to accommodate larger ones.
.
.Ss NetBSD/sun2 and NetBSD/sun3
The
.Nx Ns /sun2
and
.Nx Ns /sun3
secondary bootstrap program can only load kernels from file
systems starting at the beginning of disks.
.
.Ss NetBSD/vax
The
.Nx Ns /vax
secondary bootstrap program can only load kernels from file systems
starting at the beginning of disks.
.Pp
The size of primary bootstrap programs is restricted to 7.5KB, even
though some file systems
.Pq e.g., ISO 9660
are able to accommodate larger ones.