Home | History | Annotate | Download | only in installboot
History log of /src/usr.sbin/installboot/fstypes.c
RevisionDateAuthorComments
 1.14  19-May-2024  tsutsui 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.13  14-Jan-2010  tsutsui branches: 1.13.56;
Remove if defined(__RCSID) around __RCSID() macro.
#include "nbtool_config.h" is enough for tools.
 1.12  07-Jan-2010  tsutsui 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  28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10  22-Oct-2006  christos branches: 1.10.16;
fix initializers
 1.9  20-Jun-2006  jdc Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition. Tested on sparc.

Reviewed by gdt.
 1.8  18-Feb-2006  dsl The fstypes table is only needed for adding 'stage2' bootstraps on some
platforms. Compile out the code if NO_STAGE2 is defined.
 1.7  20-Jun-2004  jmc branches: 1.7.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.6  27-Jul-2003  lukem branches: 1.6.2;
rcsid
 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
 1.3  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.2  30-Apr-2002  lukem implement "raw" file system type. this can be used when the primary
bootstrap is being installed at a particular block offset and the underlying
filesystem doesn't matter (e.g, alpha ustarboot in ustar floppies)
 1.1  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.6.2.1  22-Jun-2004  tron Pull up revision 1.7 (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.7.2.1  09-Nov-2006  tron Pull up following revision(s) (requested by bad in ticket #1524):
usr.sbin/installboot/installboot.8: revision 1.54 via patch
usr.sbin/installboot/installboot.h: revision 1.31
usr.sbin/installboot/fstypes.c: revision 1.9
usr.sbin/installboot/ffs.c: revision 1.19
Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition. Tested on sparc.
Reviewed by gdt.
 1.10.16.1  18-May-2008  yamt sync with head.
 1.13.56.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.

RSS XML Feed