Home | History | Annotate | only in /src/usr.sbin/installboot/arch
History log of /src/usr.sbin/installboot/arch
RevisionDateAuthorComments
 1.22 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.21 14-Aug-2011  christos branches: 1.21.42;
fix various gcc-4.5 warnings
 1.20 26-Oct-2009  tsutsui A checksum value in alpha boot block is stored in little endian,
so use le64toh() to print it on the host tool.
While here, use consistent (unsignd long long) casts on printing it.
 1.19 05-Apr-2009  lukem fix sign-compare issues
 1.18 28-Apr-2008  martin branches: 1.18.8;
Remove clause 3 and 4 from TNF licenses
 1.17 18-Mar-2006  dsl branches: 1.17.18;
Coverty 7449: Change 'return (0)' to 'goto done' so we free(bootstrapbuf)
before exiting with error.
 1.16 18-Feb-2006  dsl Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.15 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.14 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.13 20-Jul-2002  grant sweep of errx/warnx, remove unnecessary trailing \n
 1.12 31-May-2002  matt Use to htobe16, not htons
 1.11 15-May-2002  lukem branches: 1.11.2;
- add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.10 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.9 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.8 30-Apr-2002  lukem display sector start & count in decimal rather than hex
 1.7 25-Apr-2002  tv HAVE_CONFIG_Hize. Also get *_boot.h from "../../sys/" when HAVE_CONFIG_H,
rather than creating more stubs.
 1.6 19-Apr-2002  lukem - Add code from Matt Fredette <fredette@theory.lcs.mit.edu> to implement
fstype checking, and back-end "ffs" support.
- Consistently use at least uint32_t for blocknumbers (vs. int / long / ...)
- Consistently use uintXX_t instead of u_intXX_t.
- Move various duplicated prototypes into "installboot.h"
 1.5 12-Apr-2002  lukem - support optional secondary bootstrap arg for install (unused by
existing backends, but future ones need it)
- use "bootstrap" instead of "boot block" in various messages where appropriate
- rename some members of ib_params
 1.4 11-Apr-2002  lukem check size of reading bootblock against the correct size...
 1.3 04-Apr-2002  mrg LP64isms. also, be sure to use <string.h> if we use memset or memcpy.
 1.2 04-Apr-2002  lukem don't pull in <dev/sun/disklabel.h> just for SUN_DKMAGIC; instead,
provide local copy of that #define.
 1.1 03-Apr-2002  lukem Add support for alpha, based on {vax,pmax}.c and
sys/arch/alpha/stand/installboot.
XXX: not fully tested yet.
 1.11.2.1 31-May-2002  tv Pull up revision 1.12 (requested by matt in ticket #105):
Use to htobe16, not htons
 1.17.18.1 18-May-2008  yamt sync with head.
 1.18.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.21.42.1 10-Jun-2019  christos Sync with HEAD
 1.10 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.9 05-Jun-2015  mlelstv branches: 1.9.16;
Compute bootloader checksum correctly also on little endian systems.
 1.8 14-Jun-2013  msaitoh branches: 1.8.6;
Remove trailng whitespaces.
 1.7 14-Jan-2010  tsutsui branches: 1.7.6; 1.7.12;
Remove if defined(__RCSID) around __RCSID() macro.
#include "nbtool_config.h" is enough for tools.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 18-Feb-2006  dsl branches: 1.5.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.4 02-Jun-2005  lukem Don't try to use an uninitialized variable.
Detected with gcc -Wuninitialized.
 1.3 20-Jun-2004  jmc branches: 1.3.2;
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.2 15-Apr-2003  dsl branches: 1.2.2;
Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.1 15-Jan-2003  mhitch Add support for amiga.
 1.2.2.1 22-Jun-2004  tron Pull up revision 1.3 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.3.2.1 15-Jun-2005  snj Pull up revision 1.4 (requested by lukem in ticket #411):
Don't try to use an uninitialized variable.
Detected with gcc -Wuninitialized.
 1.5.18.1 18-May-2008  yamt sync with head.
 1.7.12.1 23-Jun-2013  tls resync from head
 1.7.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.6.1 16-Jul-2015  snj Pull up following revision(s) (requested by mlelstv in ticket #844):
usr.sbin/installboot/Makefile: revisions 1.49, 1.50
usr.sbin/installboot/installboot.c: revisions 1.37, 1.38
usr.sbin/installboot/arch/amiga.c: revision 1.9
Support wedge names.
--
Can't use getfsspecname (and thus wedge names) while building tools.
--
Linking against libutil is not appropiate for tools.
--
Compute bootloader checksum correctly also on little endian systems.
 1.9.16.1 10-Jun-2019  christos Sync with HEAD
 1.3 22-May-2024  tsutsui Remove no-op emips stuff.

It seems blindly copied and modified from pmax, but emips bootloader
can be specified by "Ml40x_2ace.plx" config file on the Giano simulator.
(not sure what on the real Xilinx ML401 board, but maybe hardcoded)
 1.2 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.1 26-Jan-2011  pooka branches: 1.1.2; 1.1.46;
Add support for the Extensible MIPS ("eMIPS") platform. The
NetBSD/emips port runs on Xilinx and Beecube FPGA systems and the
Giano system simulator.

eMIPS is a platform developed at Microsoft Research for researching
reconfigurable computing. eMIPS allows dynamic loading and scheduling
of application-specific circuits for the purpose of accelerating
computations based on the current workload.

NetBSD eMIPS support for NetBSD 4.x was written at Microsoft Research
by Alessandro Forin and Neil Pittman. Microsoft Corporation has
donated full copyright to The NetBSD Foundation.

Platform support for eMIPS is the first part of Microsoft's
contribution. The second part includes the hardware accelerator
framework and will be proposed on tech-kern soon.
 1.1.46.1 10-Jun-2019  christos Sync with HEAD
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 26-Jan-2011  bouyer file emips.c was added on branch bouyer-quota2 on 2011-02-08 16:20:15 +0000
 1.1 07-May-2019  thorpej branches: 1.1.2;
Add installboot(8) support for evbarm (and, in the future, other evb*)
boards that use u-boot. A known board database lists boards and their
respective u-boot packages. u-boot packages are discovered at run-time
(in /usr/pkg/share/u-boot, by default). These packages contain board
database overlays that describe u-boot installation procedure that's
specific for that board.

Support this as a native tool and as a host tool. The native tool
will attempt to determine the running board type using OpenFirmware
calls. Host tool and native tool alike may also specify a board type
directly using the "-o board=xxx option" or have installboot(8) determine
the board type from a device tree blob using "-o dtb=/path/to/board.dtb".
A "-o media=xxx" option is provided for boards that have different u-boot
binaries and/or installation procedures for different media types (e.g.
SDMMC, eMMC, or USB).

This is trivial to extend to other evb* platforms that use u-boot, even if
they don't use FDT for autoconfiguration.
 1.1.2.2 10-Jun-2019  christos Sync with HEAD
 1.1.2.1 07-May-2019  christos file evbarm.c was added on branch phil-wifi on 2019-06-10 22:10:30 +0000
 1.1 21-Jun-2020  thorpej Add evbmips support for u-boot handling.
 1.3 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.2 18-Feb-2006  dsl branches: 1.2.84;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.1 29-Dec-2005  tsutsui Add ews4800mips support.
 1.2.84.1 10-Jun-2019  christos Sync with HEAD
 1.22 05-Apr-2025  tsutsui Replace unnecessary pointer arith with array for readability.
 1.21 05-Apr-2025  tsutsui Cleanup hp300 LIF bootblock definitions.

- move LIF value definitions from MD mkboot to MI <sys/bootblock.h>
to share them between mkboot and MI installboot(8)
- rename variables and use proper macros for readability
- misc KNF
 1.20 30-Mar-2025  tsutsui Always read LIF volume/directory from stage1 even on cd9660 stage2 case.

mmap(2) against the bootstrap file in the target cd9660 could fail
because the sector size of ISO9660 is 2048 so each file could be
allocated at an offset not pagesize (4096 or 8192) aligned.

This could fail if stage1 (specified via "primary" arg on command line)
and stage2 (on the target filesystem) files are different, but
in "build.sh iso-image" case they are always identical.

The problem (build failures in auotomated builds for hp300 on Linux)
was reported by Jan-Benedict Glaw.

Should also be pulled up to netbsd-10.
 1.19 19-May-2024  tsutsui branches: 1.19.2;
Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.
 1.18 11-May-2024  tsutsui Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.

https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html
> Use proper signedness for the LIF file system data structures.

mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.
 1.17 05-Dec-2021  msaitoh branches: 1.17.2;
s/maping/mapping/
 1.16 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.15 14-Jun-2013  msaitoh branches: 1.15.28;
Remove trailng whitespaces.
 1.14 03-May-2013  matt Make this build with the disk label change.
 1.13 10-Feb-2011  tsutsui branches: 1.13.4; 1.13.10;
Fix botch in previous revision. Sorry for a stupid change.
 1.12 07-Jan-2010  tsutsui branches: 1.12.2;
Add a sectorsize parameter member in struct ib_params and use it
where sector size (disk block size) is required, instead of
DEV_BSIZE constant which means device I/O block size.

"Looks reasonable" from dholland@, and fixes tools installboot(8)
on Cygwin where DEV_BSIZE != 512 as mentioned in PR toolchain/42555.
 1.11 05-Apr-2009  lukem fix sign-compare issues
 1.10 28-Apr-2008  martin branches: 1.10.8;
Remove clause 3 and 4 from TNF licenses
 1.9 02-Feb-2008  itohy branches: 1.9.4;
Change be32toh to htobe32 where applicable.
 1.8 02-Feb-2008  itohy d_npartitions field of struct disklabel is 16bit, not 32bit.
 1.7 18-Feb-2006  dsl branches: 1.7.10;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.6 12-Jun-2005  dyoung Oops, straggler: #include <nbinclude/sys/disklabel.h> if we're
building a host-tool.

XXX In hp300_setboot, quiet -Wunitialized: initialize secsize to
XXX HP300_SECTSIZE. Is this correct?
 1.5 12-Jun-2005  dyoung For portability, use 'unsigned int' instead of 'uint'.
 1.4 13-Nov-2003  dsl roundup() write of hp300 boot code to a multiplr of the disk sector size.
and re-instate the hp300 code - seems to work.
 1.3 10-Nov-2003  dsl Ensure we use the target disklabel.h, not the host one.
Read the disklabel directly from sector 2 instead of using DIOCGDINFO.
Expect the label to be big-endian.
Support -o append for real files.
 1.2 08-Nov-2003  uwe Don't use PRId64 in a host tool. Not all systems have the PRI*
macros (e.g. FreeBSD 4.x). Cast to long long int instead.
 1.1 08-Nov-2003  dsl First cut of hp300 installboot, seems to DTRT on i386.
Maybe this code ought to know how to add a file to the LIF filesystem.
 1.7.10.1 23-Mar-2008  matt sync with HEAD
 1.9.4.1 18-May-2008  yamt sync with head.
 1.10.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.12.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.13.10.1 23-Jun-2013  tls resync from head
 1.13.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.28.1 10-Jun-2019  christos Sync with HEAD
 1.17.2.2 12-Apr-2025  martin Pull up following revision(s) (requested by tsutsui in ticket #1088):

usr.sbin/installboot/arch/hp300.c: revision 1.20

Always read LIF volume/directory from stage1 even on cd9660 stage2 case.
mmap(2) against the bootstrap file in the target cd9660 could fail
because the sector size of ISO9660 is 2048 so each file could be
allocated at an offset not pagesize (4096 or 8192) aligned.

This could fail if stage1 (specified via "primary" arg on command line)
and stage2 (on the target filesystem) files are different, but
in "build.sh iso-image" case they are always identical.

The problem (build failures in auotomated builds for hp300 on Linux)
was reported by Jan-Benedict Glaw.
 1.17.2.1 22-Jun-2024  martin Pull up following revision(s) (requested by tsutsui in ticket #722):

sys/fs/cd9660/cd9660_util.c: revision 1.16
sys/arch/hp300/stand/common/clock.c: revision 1.14
sys/arch/hp300/stand/common/scsireg.h: revision 1.5
sys/arch/hp300/stand/common/scsireg.h: revision 1.6
sys/arch/hp300/stand/Makefile.buildboot: revision 1.38
sys/arch/hp300/include/bus.h: revision 1.23
sys/arch/hp300/stand/Makefile.buildboot: revision 1.39
sys/arch/hp300/stand/common/sd.c: revision 1.12
sys/arch/hp300/stand/common/prf.c: revision 1.6
sys/arch/hp300/stand/common/sd.c: revision 1.13
usr.sbin/installboot/installboot.8: revision 1.106
usr.sbin/installboot/Makefile: revision 1.59
sys/arch/hp300/stand/common/devopen.c: revision 1.14
usr.sbin/installboot/installboot.8: revision 1.107
sys/arch/hp300/stand/common/ite_dumb.c: revision 1.2
sys/arch/hp300/stand/common/devopen.c: revision 1.15
usr.sbin/installboot/installboot.8: revision 1.108
sys/fs/cd9660/cd9660_extern.h: revision 1.29
usr.sbin/installboot/installboot.8: revision 1.109
tools/Makefile.nbincludes: revision 1.11 (patch)
sys/arch/hp300/dev/rboxreg.h: revision 1.3
sys/arch/hp300/stand/common/scsivar.h: revision 1.5
sys/arch/hp300/dev/dnkbd.c: revision 1.14
sys/arch/hp300/hp300/trap.c: revision 1.156
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.12
sys/arch/hp300/dev/frodoreg.h: revision 1.6
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.13
sys/arch/hp300/stand/common/ite_sti.c: revision 1.2
sys/arch/hp300/stand/common/hil.c: revision 1.15
usr.sbin/installboot/arch/hp300.c: revision 1.18
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.14
sys/arch/hp300/dev/rbox.c: revision 1.4
usr.sbin/installboot/arch/hp300.c: revision 1.19
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.15
sys/sys/bootblock.h: revision 1.59
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.16
usr.sbin/installboot/installboot.h: revision 1.44
sys/arch/hp300/stand/mkboot/volhdr.h: file removal
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.17
sys/arch/hp300/dev/hpib.c: revision 1.45
usr.sbin/installboot/installboot.h: revision 1.45
usr.sbin/installboot/cd9660.c: revision 1.1
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.18
sys/arch/hp300/dev/topcatreg.h: revision 1.3
usr.sbin/installboot/cd9660.c: revision 1.2
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.19
sys/arch/hp300/stand/inst/inst.c: revision 1.25
sys/arch/hp300/stand/uboot/Makefile: revision 1.12
sys/arch/hp300/dev/dvbox.c: revision 1.4
sys/arch/hp300/dev/dma.c: revision 1.45
sys/arch/hp300/stand/uboot/Makefile: revision 1.13
sys/arch/hp300/stand/common/rd.c: revision 1.16
sys/arch/hp300/stand/inst/Makefile: revision 1.12
distrib/hp300/cdroms/installcd/Makefile: revision 1.4
sys/arch/hp300/stand/mkboot/volhdr.h: revision 1.6
sys/arch/hp300/stand/common/machdep.c: revision 1.16
usr.sbin/installboot/fstypes.c: revision 1.14
sys/arch/hp300/hp300/machdep.c: revision 1.238
sys/arch/hp300/include/cpu.h: revision 1.73
sys/arch/hp300/dev/diofbreg.h: revision 1.4
sys/arch/hp300/stand/common/scsi.c: revision 1.12
sys/arch/hp300/stand/common/netio.c: revision 1.19
sys/arch/hp300/stand/common/scsi.c: revision 1.13
sys/arch/hp300/dev/sti_sgc.c: revision 1.8
sys/arch/hp300/dev/rtc.c: revision 1.22
sys/arch/hp300/stand/mkboot/mkboot.c: revision 1.20
sys/arch/hp300/stand/common/conf.h: revision 1.4
sys/arch/hp300/hp300/autoconf.c: revision 1.111
sys/arch/hp300/stand/common/conf.c: revision 1.15
sys/arch/hp300/stand/mkboot/Makefile: revision 1.12
sys/arch/hp300/stand/mkboot/Makefile: revision 1.13
sys/arch/hp300/hp300/autoconf.c: revision 1.114
sys/arch/hp300/dev/dcmreg.h: revision 1.11
sys/arch/hp300/dev/diofbvar.h: revision 1.4
sys/arch/hp300/dev/dcm.c: revision 1.91
sys/fs/cd9660/cd9660_util.c: revision 1.15
sys/arch/hp300/dev/mcclock_frodo.c: revision 1.2

TAB/space cleanup.

installboot(8): formatting improvements

Use Ar foo instead of <foo>; this is mdoc.

Other formatting tweaks.
installboot(8): fix up markup

Don't overuse .Sy - when everything is highlighted, nothing is. Use
.Ic for options &c to get correct PostScript output (both are bold in
plain text).

Use Aq Ar inside .Pa, as both Pa and Ar are rendered as underscored
text in plain text output, and the distinction is lost.

Don't set examples in bold, but give them .Pp space around - they are
much easier to read this way.

Use consistent -width in FILES.
document how to use installboot on netbsd/vax.

PR/57909: Jan-Benedict Glaw: Don't include (build) timestamp when doing a
reproducible build
fix usage string, improve error handling.
add missing chunk for repro-build. fix gcc warnings.
avoid stringop truncation, fix copyright string to prevent assembler warnings.

Fix build as a tool (Jan-Benedict Glaw)

Fix integer overflow of strtol(3) for "loadpoint" address on ILP32 hosts.

This strtol(3) was introduced in rev 1.12 for PR/57909 after netbsd-10,
but it returns LONG_MAX (0x7FFFFFFF) for 0xFFF00000 on ILP32 hosts and
the wrong loadpoint causes "NOT ENOUGH MEMORY" error by the BOOTROMs
on loading uboot.lif on (at least) my 9000/360 and 9000/425t.

Misc cosmetic changes for mostly readability.
- KNF and add some newlines per blocks
- define and use proper bintobcd() macro
- make local functions and variables static

The same uboot.lif binaries are generated.

Rename ${PROGAOUT} -> ${PROGELF} to reflect reality.
Use proper signedness for the LIF file system data structures.

Ancient 4.3BSD used short and int for location, file size, file type,
and addresses etc. but all of them should be unsigned.

Also rename several variables and add comments for readability.
The LIF file system info can be found in "The HPDir Project" page:
https://www.hp9845.net/9845/projects/hpdir/
The same uboot.lif binaries are generated.

Add a preliminary CD boot support to uboot for preparation of PR/54455.
Briefly tested on mame, but not enalbed yet.

Recognize SCSI CD-ROM devices as a booted device properly.

Necessary for PR port-hp300/54455, to boot an md root root RAMDISK

kernel from CD-ROM without "WARNING: can't find match for bootdev:"
prompt.

Sync with src/sys/arch/hp300/stand/mkboot/volhdr.h rev 1.6.
https://mail-index.netbsd.org/source-changes/2024/05/07/msg151195.html

Use proper signedness for the LIF file system data structures.
mkboot should use this MI <sys/bootblock.h> and volhdr.h should
be removed soon.

Use MI <sys/bootblock.h> to refer LIF filesystem structures.
This should have been done when LIF definitions were initially added
to <sys/bootblock.h> for MI installboot(8).

Enable SUPPORT_CD on uboot.

Make cd9660_util.c usable in userland tools like installboot(8).

This was partially done for src/distrib/cdrom/macppc_installboot,
but more strict prototypes are necessary for native binary builds.

Install cd9660 related system headers for tools installboot(8) builds.

Reorder function prototypes per source files.

Add cd9660 support to search a bootloader file in the target file system.

Also add CD boot support for hp300, using a bootloader file in cd9660 fs.
This is a tool's part to close PR/54455.

HP 9000/300 machines read LIF directory entry allocated after
the LIF volume header at the top of the boot disk during bootstrap,
and a bootstrap file must be contiguously allocated on the disk
due to limitation of the LIF specification.

Current NetBSD/hp300's bootloader is larger than ~80KB so we have
to prepare a special 'boot' partition for FFS (that has only 8KB (ffsv1)
or 32KB (ffsv2) spaces) disks to put such a large bootloader.

On the other hand, on ISO9660 fs all files are allocated contiguously
so we can specify a bootloader file in the target ISO9660 directly
in the LIF directory entry.

Note we can simply use the existing "append" option to create bootable
CD ISO for hp300, but it looks some emulators (at leaset MAME) reject
such non-standard ISO files, i.e. with an appended bootloader file at
the end of the image.

Put a RAMDISK kernel and SYS_UBOOT into hp300 installcd to make it bootable.

This should finally close PR/54455.

Fix tools build errors on Cygwin.

Appease warnings on building tools/installboot on Cygwin.
 1.19.2.1 02-Aug-2025  perseant Sync with HEAD
 1.7 24-Feb-2014  skrll Rename NetBSD/hp700 to NetBSD/hppa.

Unfortunately our VCS isn't very helpful here.
 1.6 14-Jun-2013  msaitoh Remove trailng whitespaces.
 1.5 09-Jan-2012  skrll branches: 1.5.6;
Make it an error for the partition to exceed the PDC limit.

Inspired by PR/45742
 1.4 28-Apr-2008  martin branches: 1.4.4;
Remove clause 3 and 4 from TNF licenses
 1.3 02-Feb-2008  itohy branches: 1.3.4;
Try to warn possibly unbootable conditions:
- no disklabel
- no partition "a"
- partition "a" exceeds 2GB boundary
 1.2 18-Feb-2006  dsl branches: 1.2.10;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.1 14-May-2005  chs add hp700 support.
 1.2.10.1 23-Mar-2008  matt sync with HEAD
 1.3.4.1 18-May-2008  yamt sync with head.
 1.4.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.4.1 17-Apr-2012  yamt sync with head
 1.5.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.1 23-Jun-2013  tls resync from head
 1.2 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.1 24-Feb-2014  skrll branches: 1.1.4; 1.1.8; 1.1.30;
Rename NetBSD/hp700 to NetBSD/hppa.

Unfortunately our VCS isn't very helpful here.
 1.1.30.1 10-Jun-2019  christos Sync with HEAD
 1.1.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 24-Feb-2014  tls file hppa.c was added on branch tls-maxphys on 2014-08-20 00:05:08 +0000
 1.1.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.1 24-Feb-2014  yamt file hppa.c was added on branch yamt-pagecache on 2014-05-22 11:43:04 +0000
 1.44 11-Jul-2025  andvar Fix various typos, mainly in comments and log/error messages.
 1.43 05-Dec-2021  msaitoh branches: 1.43.4;
s/filesytem/filesystem/ in comment.
 1.42 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.41 23-Jun-2018  kamil branches: 1.41.2;
Fix integer overflow in installboot(8)

Add a sanity check of the disk_buf first three bytes. The original code on
a disk with nul bytes was causing integer overflow and thus calling the
memcmp(3) functin in is_zero() with enormous length.

Verity that the 0th byte is JMP, 1th a signed byte >=9 to prevent overflow
and 2th byte NOP.

Add a comment explaining the check.

Detected with MKSANITIZER and ASan.
 1.40 14-Jun-2013  msaitoh branches: 1.40.20; 1.40.26;
Remove trailng whitespaces.
 1.39 06-Apr-2012  gson branches: 1.39.2;
When printing the list of valid console names, don't treat the consoles[]
array as NULL terminated, because it's not.
 1.38 10-Mar-2012  dsl Some FAT16 filesystems don't have 'hidden sectors' correctly set to
the offset of the filesystem on the disk.
Let '-b s1blk' be used to fix the value.
 1.37 14-Aug-2011  christos branches: 1.37.2;
fix various gcc-4.5 warnings
 1.36 17-Jan-2010  drochner Invert the flag bits to control module loading: rename
LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF.
This way, the default value (0) wired into old bootxx_* and installed
to file systems remains valid and we avoid problems on partial updates.
 1.35 14-Jan-2010  drochner On i386/amd64, define two flag bits in the boot parameters which control
whether modules are loaded and whether boot.cfg is evaluated, and
set both to "off" per default in the PXE bootloader.
Extend "installboot" to toggle the bits.
This way, pxeboot works with existing dhcp server setups (and as
described in the manpage) out of the box. Also, boot.cfg reading
involves a stat() call which is horribly inefficient with the
TFTP pseudo file system.
 1.34 23-Dec-2009  mbalmer Fix typo in comments, no code change.
 1.33 07-May-2009  lukem refer to FFSv1 instead of UFSv1
 1.32 05-Apr-2009  lukem fix sign-compare issues
 1.31 18-Feb-2009  christos CID 4393: plug memory leak.
 1.30 28-Apr-2008  martin branches: 1.30.8;
Remove clause 3 and 4 from TNF licenses
 1.29 06-Mar-2008  dsl branches: 1.29.2;
Add a large warning about the possible side effect of using '-f'.
 1.28 23-Jun-2007  christos branches: 1.28.4; 1.28.8;
Don't use __arraycount because this is a 700L, and toolz have messed up
includes.
 1.27 23-Jun-2007  dogcow unb0rk tools/ builds on systems that don't have __arraycount() defined.
 1.26 23-Jun-2007  christos PR/36527: Greg A. Woods: installboot(8) doesn't allow for the valid
consdev=auto setting
 1.25 15-Feb-2007  dsl Add a -f (force) parameter to installboot(8).
If specified then checks on the disks BPB are not done, and any existing BPB
is deleted.
This is needed soince newfs(8) doesn't overwrite the BPB - which is basically
the FAT superblock.
Update documentation and add an example of using bootxx_fat16.
 1.24 07-Jan-2007  dogcow %d -> %ld, so that building on alpha doesn't fail. (also print more useful
errors - x bytes written, should be y.)
 1.23 06-Jan-2007  dsl Support for non-512 byte media.
Automatically enable writes to the 'labelsector' if necessary.
Detect and recover from problems with the write-protected 'labelsector'
stopping writes to nearby sectors when the non-raw disk device is used.
Support the installation of 512-byte pbr boot code (eg fatboot).
Verify that there is enough reserved space in the bpb (if not all zeros) to
avoid overwriting the start of FAT filesystems.
 1.22 18-Feb-2006  dsl Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.21 30-Jan-2006  dsl Fix the detection of the bootstrap magic number when run on big-endian systems.
Correct another typo.
 1.20 24-Jan-2006  dsl Fix spelling mistake in message
 1.19 11-Nov-2005  dsl Add a -e (edit) option to allow the bootstrap options of an installed
bootstrap or a file containing such a bootstrap to be changed/displayed.
In particular this will (soon) let you modify the parameters for pxeboot.
 1.18 16-Aug-2004  yamt revert a part of the previous. (uint -> u_int)
to make tools/installboot compile again.
 1.17 15-Aug-2004  dsl Add an option to set bp_consaddr (serial console IO port address)
Only complain about small patch area if we would write something non-zero there.
 1.16 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.15 14-Mar-2004  lukem branches: 1.15.2;
fix a typo in a comment, and expand the description of x86_boot_params.
 1.14 13-Mar-2004  dsl Add a -o keymap=zyz option that will set the boot keymap.
If a character in the map is typed, it gets replaced by the one following.
 1.13 27-Oct-2003  lukem fix typo in comment
 1.12 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.11 14-Oct-2003  lukem Instead of requiring that the BPB is always the FAT32 one, check the
first three bytes to determine how much of the BPB to preserve.
Supported values:
eb 3c 90 FAT16 BPB
eb 58 90 FAT32 BPB
(anything else) don't preserve any BPB

This is because the BPB is generally only the FAT16 one except in the
bootxx_msdos case, where it's the larger FAT32 one.
 1.10 10-Oct-2003  lukem Fix compile error on powerpc. Noted by Juergen Hannken-Illjes in private mail.
 1.9 08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.8 06-Oct-2003  lukem Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in
<sys/bootblock.h>
(CONSDEV_ should be converted as well, but that's more intrusive...)
 1.7 04-Jul-2003  dsl Add some htole32() for host endianness independance
 1.6 08-May-2003  petrov Format fixes.
 1.5 18-Apr-2003  bjh21 Use <md5.h> rather than <sys/md5.h>. This is what the man page tells us to
do, and is required for cross-compiling since libnbcompat doesn't provide
<sys/md5.h>.
 1.4 16-Apr-2003  briggs Protect use of __RCSID() with a check to ensure that it's defined.
Suggested by Ian Lance Taylor on tech-userlevel@ to help cross-compilation
on Red Hat 7.3.
 1.3 15-Apr-2003  dsl Use htole32 so host endianness independant
 1.2 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.1 09-Apr-2003  dsl Add support for 'new' format i386 bootxx code
 1.15.2.1 22-Jun-2004  tron Pull up revision 1.16 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.28.8.1 24-Mar-2008  keiichi sync with head.
 1.28.4.1 23-Mar-2008  matt sync with HEAD
 1.29.2.1 18-May-2008  yamt sync with head.
 1.30.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.37.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.2.1 17-Apr-2012  yamt sync with head
 1.39.2.1 23-Jun-2013  tls resync from head
 1.40.26.1 25-Jun-2018  pgoyette Sync with HEAD
 1.40.20.1 24-Jun-2018  martin Pull up following revision(s) (requested by kamil in ticket #898):

usr.sbin/installboot/arch/i386.c: revision 1.41

Fix integer overflow in installboot(8)
Add a sanity check of the disk_buf first three bytes. The original code on
a disk with nul bytes was causing integer overflow and thus calling the
memcmp(3) functin in is_zero() with enormous length.
Verity that the 0th byte is JMP, 1th a signed byte >= 9 to prevent overflow
and 2th byte NOP.

Add a comment explaining the check.

Detected with MKSANITIZER and ASan.
 1.41.2.1 10-Jun-2019  christos Sync with HEAD
 1.43.4.1 02-Aug-2025  perseant Sync with HEAD
 1.9 11-May-2024  andvar s/boostrap/bootstrap/ in comment, warning message and documentation.
 1.8 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.7 17-Jul-2017  christos branches: 1.7.2; 1.7.6;
don't complain if the mbr was all 0's.
 1.6 19-Oct-2013  christos move all the unused code inside #if 0
 1.5 07-May-2009  lukem branches: 1.5.6; 1.5.12;
refer to FFSv1 instead of UFSv1
 1.4 05-Apr-2009  lukem fix sign-compare issues
 1.3 28-Apr-2008  martin branches: 1.3.8;
Remove clause 3 and 4 from TNF licenses
 1.2 27-Sep-2006  christos branches: 1.2.16;
Coverity CID 4160: Remove dead code.
 1.1 01-Sep-2006  uwe NetBSD/landisk support.
 1.2.16.1 18-May-2008  yamt sync with head.
 1.3.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.5.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.6.1 10-Jun-2019  christos Sync with HEAD
 1.7.2.2 17-Jul-2017  christos 3356330
 1.7.2.1 17-Jul-2017  christos file landisk.c was added on branch perseant-stdc-iso10646 on 2017-07-17 18:43:46 +0000
 1.12 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.11 24-May-2008  tsutsui branches: 1.11.60;
Try DIOCWLABEL ioctl only if write op fails with EROFS
because the ioctl is required and valid only for raw devices.
 1.10 09-May-2008  tsutsui Use DIOCWLABEL ioctl before writing block 0 which might be
protected by (now MI) bounds_check_with_label(9).
Fixes a problem on sysinst mentioned in PR port-macppc/38016.
 1.9 28-Apr-2008  martin branches: 1.9.2;
Remove clause 3 and 4 from TNF licenses
 1.8 18-Feb-2006  dsl branches: 1.8.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.7 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.6 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.5 20-May-2002  lukem - use uint8_t instead of char for boot block blobs
- bbinfo_params:
- replace "int littleendian" with "bbinfo_endian endian"
- add comments
- shared_bbinfo_clearboot():
- add callback method to shared_bbinfo_clearboot()
- don't clear from 0..headeroffset; use a callback to do that
- add news68k and newsmips support.
From Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>, with a rework by me to
take advantage of the new shared_bbinfo_clearboot() callback.
(XXX: untested yet)
 1.4 16-May-2002  lukem Set pmBootSize of the block 2 applepartmapentry ("NetBSD Partition")
to roundup(size-of-bootxx, 512) instead of hardcoding it to 1024.

(Gets the new boot floppy working slightly further - still broken tho)
 1.3 15-May-2002  lukem ensure that members of apple_drvr_map and apple_part_map_entry are big endian
 1.2 15-May-2002  lukem add setboot callback to write the Apple partition map
 1.1 15-May-2002  lukem bootblock.h:
- unify sparc_bbinfo (1064 bytes, with 256 block entries)
and sun68k_bbinfo (296 byte, with 64 block entries)
into shared_bbinfo (512 bytes, with 118 block entries),
which will be also shared by future bbinfo-using platforms
(including macppc)
- add datestamp to *_BBINFO_MAGIC strings, to prevent installboot vs
bootxx version skew.
- add macppc support

*/bootxx.c:
- migrate to new shared_bbinfo structure

installboot:
- add macppc support (still needs applepartmap support and testing)
- improve and add some more warnings & errors to installboot
- implement shared_bbinfo_clearboot() and shared_bbinfo_setboot(), which
perform the majority of the work for bbinfo-using back-ends
(rather than replicating that across multiple back-ends).
 1.8.18.2 04-Jun-2008  yamt sync with head
 1.8.18.1 18-May-2008  yamt sync with head.
 1.9.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.11.60.1 10-Jun-2019  christos Sync with HEAD
 1.8 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.7 28-Apr-2008  martin branches: 1.7.62;
Remove clause 3 and 4 from TNF licenses
 1.6 18-Feb-2006  dsl branches: 1.6.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.5 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.4 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.3 21-May-2002  tsutsui NEWS_BOOT_BLOCK_OFFSET is now changed to 0, so use NEWS_BOOT_BLOCK_BLOCKSIZE
to allocate buffer to read LABELSECTOR.
 1.2 21-May-2002  lukem I made a mistake when converting Izumi Tsutsui's back-end to the shared
bbinfo.c module; news* boot blocks occupy all of the first 16 sectors,
with a jump instruction to skip the label at bytes 64..511.
Replace news_clearboot() and news_setboot() callbacks with common
news_copydisklable() callback, and set bbinfo_params->offset to
NEWS_BOOT_BLOCK_OFFSET (which is now 0), and ->headeroffset to 0.

(Thanks to Izumi for picking this up; the perils of working on code at 2am)
 1.1 20-May-2002  lukem - use uint8_t instead of char for boot block blobs
- bbinfo_params:
- replace "int littleendian" with "bbinfo_endian endian"
- add comments
- shared_bbinfo_clearboot():
- add callback method to shared_bbinfo_clearboot()
- don't clear from 0..headeroffset; use a callback to do that
- add news68k and newsmips support.
From Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>, with a rework by me to
take advantage of the new shared_bbinfo_clearboot() callback.
(XXX: untested yet)
 1.6.18.1 18-May-2008  yamt sync with head.
 1.7.62.1 10-Jun-2019  christos Sync with HEAD
 1.10 14-Feb-2023  andvar s/programm/program/ and s/suuport/support/ in comments and message.
 1.9 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.8 14-Jun-2013  msaitoh branches: 1.8.28;
Remove trailng whitespaces.
 1.7 07-Jan-2010  tsutsui branches: 1.7.6; 1.7.12;
Add a sectorsize parameter member in struct ib_params and use it
where sector size (disk block size) is required, instead of
DEV_BSIZE constant which means device I/O block size.

"Looks reasonable" from dholland@, and fixes tools installboot(8)
on Cygwin where DEV_BSIZE != 512 as mentioned in PR toolchain/42555.
 1.6 05-Apr-2009  lukem fix sign-compare issues
 1.5 28-Apr-2008  martin branches: 1.5.8;
Remove clause 3 and 4 from TNF licenses
 1.4 18-Feb-2006  dsl branches: 1.4.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.3 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.2 27-Oct-2003  lukem branches: 1.2.2;
minor consistency tweaks
 1.1 27-Oct-2003  cl add next68k support to installboot
 1.2.2.1 22-Jun-2004  tron Pull up revision 1.3 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.4.18.1 18-May-2008  yamt sync with head.
 1.5.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.7.12.1 23-Jun-2013  tls resync from head
 1.7.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.28.1 10-Jun-2019  christos Sync with HEAD
 1.16 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.15 21-Oct-2013  christos branches: 1.15.26;
XXX: gcc initialize a variable
 1.14 05-Apr-2009  lukem branches: 1.14.6; 1.14.12;
fix sign-compare issues
 1.13 28-Apr-2008  martin branches: 1.13.8;
Remove clause 3 and 4 from TNF licenses
 1.12 18-Feb-2006  dsl branches: 1.12.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.11 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.10 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.9 15-May-2002  lukem - add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.8 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.7 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.6 30-Apr-2002  lukem display sector start & count in decimal rather than hex
 1.5 25-Apr-2002  tv HAVE_CONFIG_Hize. Also get *_boot.h from "../../sys/" when HAVE_CONFIG_H,
rather than creating more stubs.
 1.4 19-Apr-2002  lukem - Add code from Matt Fredette <fredette@theory.lcs.mit.edu> to implement
fstype checking, and back-end "ffs" support.
- Consistently use at least uint32_t for blocknumbers (vs. int / long / ...)
- Consistently use uintXX_t instead of u_intXX_t.
- Move various duplicated prototypes into "installboot.h"
 1.3 12-Apr-2002  lukem - support optional secondary bootstrap arg for install (unused by
existing backends, but future ones need it)
- use "bootstrap" instead of "boot block" in various messages where appropriate
- rename some members of ib_params
 1.2 09-Apr-2002  thorpej Need <string.h> for memcmp().
 1.1 03-Apr-2002  lukem Migrate MD files to arch/ subdir. Suggested by Hubert Feyrer.
 1.12.18.1 18-May-2008  yamt sync with head.
 1.13.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.14.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.26.1 10-Jun-2019  christos Sync with HEAD
 1.1 05-Oct-2025  thorpej Add riscv.
 1.12 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.11 28-Apr-2008  martin branches: 1.11.62;
Remove clause 3 and 4 from TNF licenses
 1.10 18-Feb-2006  dsl branches: 1.10.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.9 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.8 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.7 20-May-2002  lukem - use uint8_t instead of char for boot block blobs
- bbinfo_params:
- replace "int littleendian" with "bbinfo_endian endian"
- add comments
- shared_bbinfo_clearboot():
- add callback method to shared_bbinfo_clearboot()
- don't clear from 0..headeroffset; use a callback to do that
- add news68k and newsmips support.
From Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>, with a rework by me to
take advantage of the new shared_bbinfo_clearboot() callback.
(XXX: untested yet)
 1.6 15-May-2002  lukem add missing prototype for static function
 1.5 15-May-2002  lukem bootblock.h:
- unify sparc_bbinfo (1064 bytes, with 256 block entries)
and sun68k_bbinfo (296 byte, with 64 block entries)
into shared_bbinfo (512 bytes, with 118 block entries),
which will be also shared by future bbinfo-using platforms
(including macppc)
- add datestamp to *_BBINFO_MAGIC strings, to prevent installboot vs
bootxx version skew.
- add macppc support

*/bootxx.c:
- migrate to new shared_bbinfo structure

installboot:
- add macppc support (still needs applepartmap support and testing)
- improve and add some more warnings & errors to installboot
- implement shared_bbinfo_clearboot() and shared_bbinfo_setboot(), which
perform the majority of the work for bbinfo-using back-ends
(rather than replicating that across multiple back-ends).
 1.4 15-May-2002  lukem - add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.3 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.2 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.1 06-May-2002  pk Add sparc module.
 1.10.18.1 18-May-2008  yamt sync with head.
 1.11.62.1 10-Jun-2019  christos Sync with HEAD
 1.19 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.18 14-Jan-2010  tsutsui branches: 1.18.46;
Remove if defined(__RCSID) around __RCSID() macro.
#include "nbtool_config.h" is enough for tools.
 1.17 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.16 28-Apr-2008  martin branches: 1.16.2;
Remove clause 3 and 4 from TNF licenses
 1.15 18-Feb-2006  dsl branches: 1.15.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.14 20-Jun-2004  jmc Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).

Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.

Fixes PR's: PR#17762 PR#25944
 1.13 15-May-2002  lukem branches: 1.13.4;
- add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.12 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.11 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.10 30-Apr-2002  lukem display sector start & count in decimal rather than hex
 1.9 22-Apr-2002  lukem formatting consistency frobs
 1.8 19-Apr-2002  lukem - Add code from Matt Fredette <fredette@theory.lcs.mit.edu> to implement
fstype checking, and back-end "ffs" support.
- Consistently use at least uint32_t for blocknumbers (vs. int / long / ...)
- Consistently use uintXX_t instead of u_intXX_t.
- Move various duplicated prototypes into "installboot.h"
 1.7 17-Apr-2002  fredette Small fix to a warning message that was displaying the wrong filename.
 1.6 12-Apr-2002  lukem - support optional secondary bootstrap arg for install (unused by
existing backends, but future ones need it)
- use "bootstrap" instead of "boot block" in various messages where appropriate
- rename some members of ib_params
 1.5 11-Apr-2002  lukem - add no_parseopt(), no_setboot() and no_clearboot() methods for back-ends
to use when they don't support a particular method
- don't automatically generate machines.c anymore
- add entries for i386 (temporarily unsupported) and shark
(permanently unsupported)
 1.4 04-Apr-2002  mrg be sure to pad the bootblock.
 1.3 04-Apr-2002  mrg clean up a bit, use fewer magic numbers.
 1.2 04-Apr-2002  mrg LP64isms. also, be sure to use <string.h> if we use memset or memcpy.
 1.1 04-Apr-2002  lukem Add sparc64 back-end, contributed by Matthew Green.
 1.13.4.1 22-Jun-2004  tron Pull up revision 1.14 (requested by jmc in ticket #527):
Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to
only use POSIX code in all places (or when reasonable test w. configure and
provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86
NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
 1.15.18.2 04-Jun-2008  yamt sync with head
 1.15.18.1 18-May-2008  yamt sync with head.
 1.16.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.46.1 10-Jun-2019  christos Sync with HEAD
 1.22 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.21 28-Apr-2008  martin branches: 1.21.62;
Remove clause 3 and 4 from TNF licenses
 1.20 18-Feb-2006  dsl branches: 1.20.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.19 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.18 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.17 20-May-2002  lukem - use uint8_t instead of char for boot block blobs
- bbinfo_params:
- replace "int littleendian" with "bbinfo_endian endian"
- add comments
- shared_bbinfo_clearboot():
- add callback method to shared_bbinfo_clearboot()
- don't clear from 0..headeroffset; use a callback to do that
- add news68k and newsmips support.
From Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>, with a rework by me to
take advantage of the new shared_bbinfo_clearboot() callback.
(XXX: untested yet)
 1.16 15-May-2002  lukem bootblock.h:
- unify sparc_bbinfo (1064 bytes, with 256 block entries)
and sun68k_bbinfo (296 byte, with 64 block entries)
into shared_bbinfo (512 bytes, with 118 block entries),
which will be also shared by future bbinfo-using platforms
(including macppc)
- add datestamp to *_BBINFO_MAGIC strings, to prevent installboot vs
bootxx version skew.
- add macppc support

*/bootxx.c:
- migrate to new shared_bbinfo structure

installboot:
- add macppc support (still needs applepartmap support and testing)
- improve and add some more warnings & errors to installboot
- implement shared_bbinfo_clearboot() and shared_bbinfo_setboot(), which
perform the majority of the work for bbinfo-using back-ends
(rather than replicating that across multiple back-ends).
 1.15 15-May-2002  lukem - add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.14 14-May-2002  lukem `-b bno' isn't supported. (sync with similar fix in arch/sparc.c)
 1.13 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.12 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.11 06-May-2002  lukem s/bootinfo.h/bootblock.h/
 1.10 06-May-2002  lukem add missing "sys/". noted by Martti Kuparinen <martti.kuparinen@iki.fi>
 1.9 06-May-2002  lukem replace <dev/sun/sun_boot.h> with <sys/bootinfo.h>
 1.8 06-May-2002  lukem - sanity check bbi_block_count determined from bbinfo
- use warnx() instead of warn() in a couple of places
 1.7 30-Apr-2002  lukem display sector start & count in decimal rather than hex
 1.6 29-Apr-2002  lukem consistently use sizeof(bb) instead of SUN68K_BOOT_BLOCK_MAX_SIZE
 1.5 25-Apr-2002  tv HAVE_CONFIG_Hize. Also get *_boot.h from "../../sys/" when HAVE_CONFIG_H,
rather than creating more stubs.
 1.4 24-Apr-2002  lukem convert from "sun68k_bbinfo.h" to <dev/sun/sun_boot.h>
 1.3 22-Apr-2002  bjh21 When printf'ing a size_t, cast it to unsigned long and use a %lu format.
This gets rid of a warning when compiling for ARM.
 1.2 22-Apr-2002  fredette Install the compatability symlink for sun2.
In the sun68k handler, add some sync()s to make sure we
get a coherent picture of the filesystem. Maybe should
be in the MI filesystem code?
 1.1 22-Apr-2002  lukem Add sun2 backend from Matthew Fredette.
(Implemented with "sun68k.c" as it should eventually support "sun3" as well.)
 1.20.18.1 18-May-2008  yamt sync with head.
 1.21.62.1 10-Jun-2019  christos Sync with HEAD
 1.20 24-Jan-2022  andvar s/begining/beginning/ in comments and messages.
 1.19 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.18 13-Nov-2014  christos branches: 1.18.16;
Use VAX_LABELOFFSET here; It needs to be the machine-specific one. Thanks
to gcc-4.8 for discovering the bug and to Atari for having a LABELOFFSET of
516 > 512 :-)
XXX: Perhaps we should put all those constants in <sys/bootblock.h> instead
of spreading them around.
 1.17 16-Jun-2013  martin branches: 1.17.6;
In the tool build <nbinclude/vax/disklabel.h> is enough.
 1.16 03-May-2013  matt Make this build with the disk label change.
 1.15 04-Apr-2013  martin Provide an empty __CTASSERT() for toolbuilds
 1.14 04-Apr-2013  martin Fix installboot for VAX, as discussed on port-vax. Problem pointed out
by Jonny Billquist, thanks to Marl Pizzolato for patiently explaining
the various ways of booting a vax to me.
Now VAX 780 can boot directly from VMB.EXE again.
 1.13 05-Apr-2009  lukem branches: 1.13.6; 1.13.8; 1.13.12;
fix sign-compare issues
 1.12 28-Apr-2008  martin branches: 1.12.6; 1.12.8;
Remove clause 3 and 4 from TNF licenses
 1.11 18-Feb-2006  dsl branches: 1.11.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.10 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.9 15-Apr-2003  dsl Change the way -o options are parsed, now done in MI code with a check after
all the options have been processed that they are supported my the
specific system.
Add i386 MD options (console, password, speed and timeout)
(Approved by christos and lukem)
 1.8 15-May-2002  lukem - add fsstat (fstat(2) on fsfd) and s1stat (fstat(2) on s1fd) in ib_params,
and use instead of replicating the effort in various locations
- if filesystem is not a regular file, use sync(2) instead of fsync(2)
after the bootstrap has been written
- move <sys/stat.h> and <stdint.h> into "installboot.h"
 1.7 14-May-2002  lukem pull in <sys/bootblock.h> in "installboot.h" instead of in arch/*.c
(and remove <dev/dec/dec_boot.h>, since <sys/bootblock.h> has that stuff now)
 1.6 14-May-2002  lukem user visible stuff:
- add `-B s2bno', to provide the starting block for the secondary bootstrap.
intended for use on platforms where the blocks of the stage2 bootstrap
are hardcoded into the stage1 bootstrap (currently: sparc, sun2)
- don't support `-b s1bno' for sparc or sun2, since the primary is always
at a fixed location on the disk.
- if `filesystem' is a regular file, use fsync(2) instead of sync(2)

code changes:
- add hardcode_stage2(), which uses -B s2bno and the size of the
provided secondary bootstrap (as an actual file, not as part of the
`filesystem' argument) to provide a sequential list of blocks from s2bno,
each block being the appropriate file system size (from
params->fstype->blocksize)
- add blocksize and needswap run-time parameters to ib_fs
- in *_match(), set params->fstype->blocksize to the underlying block size
(8KB for raw), and params->fstype->needswap as appropriate
- rename IB_STARTBLOCK to IB_STAGE1START, and add IB_STAGE2START
- use hardcode_stage2() to implement raw_findstage2() and IB_STAGE2BLOCK
support for ffs_findstage2()
- improve some comments, add some prototypes, ...
 1.5 30-Apr-2002  lukem display sector start & count in decimal rather than hex
 1.4 25-Apr-2002  tv HAVE_CONFIG_Hize. Also get *_boot.h from "../../sys/" when HAVE_CONFIG_H,
rather than creating more stubs.
 1.3 19-Apr-2002  lukem - Add code from Matt Fredette <fredette@theory.lcs.mit.edu> to implement
fstype checking, and back-end "ffs" support.
- Consistently use at least uint32_t for blocknumbers (vs. int / long / ...)
- Consistently use uintXX_t instead of u_intXX_t.
- Move various duplicated prototypes into "installboot.h"
 1.2 12-Apr-2002  lukem - support optional secondary bootstrap arg for install (unused by
existing backends, but future ones need it)
- use "bootstrap" instead of "boot block" in various messages where appropriate
- rename some members of ib_params
 1.1 03-Apr-2002  lukem Migrate MD files to arch/ subdir. Suggested by Hubert Feyrer.
 1.11.18.1 18-May-2008  yamt sync with head.
 1.12.8.1 13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.12.6.3 17-Jun-2013  msaitoh Fix compile error (requested by martin in ticket #1856):
usr.sbin/installboot/arch/vax.c rev. 1.17

In the tool build <nbinclude/vax/disklabel.h> is enough.
 1.12.6.2 14-Jun-2013  msaitoh Pull up following revision(s) (requested by martin in ticket #1856):
sys/sys/bootblock.h rev. 1.55
usr.sbin/installboot/arch/vax.c rev. 1.16
Adapt to new vax primary bootstrap layout.
Don't include host's disklabel.h.
 1.12.6.1 12-Jun-2013  msaitoh Pull up following revision(s) (requested by martin in ticket #1856):
sys/arch/vax/boot/xxboot/start.S: revision 1.5
sys/sys/bootblock.h: revision 1.55
sys/sys/disklabel.h: revision 1.113
usr.sbin/installboot/arch/vax.c: revision 1.14-1.15
Rearrange primary bootstrap slightly to free up all space between the disk
label and the uVAX rom boot parameter block.
Calculate the disklabel size (for asm code) dynamically based on MAXPARTITIONS.
Adapt to new vax primary bootstrap layout.
Fix installboot for VAX, as discussed on port-vax. Problem pointed out
by Jonny Billquist, thanks to Marl Pizzolato for patiently explaining
the various ways of booting a vax to me.
Now VAX 780 can boot directly from VMB.EXE again.
Provide an empty __CTASSERT() for toolbuilds
 1.13.12.1 23-Jun-2013  tls resync from head
 1.13.8.2 17-Jun-2013  msaitoh Fix compile error (requested by martin in ticket #865):
usr.sbin/installboot/arch/vax.c rev. 1.16-1.17

Don't include host's disklabel.h.
 1.13.8.1 20-Apr-2013  bouyer Pull up following revision(s) (requested by martin in ticket #865):
sys/arch/vax/include/disklabel.h: revision 1.7
sys/arch/vax/boot/xxboot/start.S: revision 1.5
sys/sys/bootblock.h: revision 1.55
sys/sys/disklabel.h: revision 1.113
usr.sbin/installboot/arch/vax.c: revision 1.14
usr.sbin/installboot/arch/vax.c: revision 1.15
sys/kern/sys_generic.c: revision 1.129
Revert VAX MAXPARTITION bump to 16, adjusting it to 12 instead. Fix bootblocks
and installboot for VAX 780 and other machines booting via VMB.EXE.
 1.13.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.6.1 14-Dec-2014  martin Pull up following revision(s) (requested by tsutsui in ticket #323):
usr.sbin/installboot/arch/vax.c: revision 1.18
Use VAX_LABELOFFSET here; It needs to be the machine-specific one. Thanks
to gcc-4.8 for discovering the bug and to Atari for having a LABELOFFSET of
516 > 512 :-)
XXX: Perhaps we should put all those constants in <sys/bootblock.h> instead
of spreading them around.
 1.18.16.1 10-Jun-2019  christos Sync with HEAD
 1.5 07-May-2019  thorpej Use designated initializers for struct ib_mach.
 1.4 28-Apr-2008  martin branches: 1.4.62;
Remove clause 3 and 4 from TNF licenses
 1.3 18-Feb-2006  dsl branches: 1.3.18;
Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
 1.2 27-Oct-2003  lukem Overhaul how `build.sh tools' are used:

* Rename "config.h" to "nbtool_config.h" and
HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
This makes in more obvious in the source when we're using
tools/compat/config.h versus "standard autoconf" config.h

* Consistently move the inclusion of nbtool_config.h to before
<sys/cdefs.h> so that the former can provide __RCSID() (et al),
and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
to the top of the source files (for the general case).
 1.1 02-Jun-2002  isaki Add x68k stuff.
 1.3.18.1 18-May-2008  yamt sync with head.
 1.4.62.1 10-Jun-2019  christos Sync with HEAD

RSS XML Feed