Module Name: src Committed By: martin Date: Sat Jun 22 10:57:11 UTC 2024
Modified Files: src/distrib/hp300/cdroms/installcd [netbsd-10]: Makefile src/sys/arch/hp300/dev [netbsd-10]: dcm.c dcmreg.h diofbreg.h diofbvar.h dma.c dnkbd.c dvbox.c frodoreg.h hpib.c mcclock_frodo.c rbox.c rboxreg.h rtc.c sti_sgc.c topcatreg.h src/sys/arch/hp300/hp300 [netbsd-10]: autoconf.c machdep.c trap.c src/sys/arch/hp300/include [netbsd-10]: bus.h cpu.h src/sys/arch/hp300/stand [netbsd-10]: Makefile.buildboot src/sys/arch/hp300/stand/common [netbsd-10]: clock.c conf.c conf.h devopen.c hil.c ite_dumb.c ite_sti.c machdep.c netio.c prf.c rd.c scsi.c scsireg.h scsivar.h sd.c src/sys/arch/hp300/stand/inst [netbsd-10]: Makefile inst.c src/sys/arch/hp300/stand/mkboot [netbsd-10]: Makefile mkboot.c src/sys/arch/hp300/stand/uboot [netbsd-10]: Makefile src/sys/fs/cd9660 [netbsd-10]: cd9660_extern.h cd9660_util.c src/sys/sys [netbsd-10]: bootblock.h src/tools [netbsd-10]: Makefile.nbincludes src/usr.sbin/installboot [netbsd-10]: Makefile fstypes.c installboot.8 installboot.h src/usr.sbin/installboot/arch [netbsd-10]: hp300.c Added Files: src/usr.sbin/installboot [netbsd-10]: cd9660.c Removed Files: src/sys/arch/hp300/stand/mkboot [netbsd-10]: volhdr.h Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.8.1 src/distrib/hp300/cdroms/installcd/Makefile cvs rdiff -u -r1.90 -r1.90.4.1 src/sys/arch/hp300/dev/dcm.c cvs rdiff -u -r1.10 -r1.10.58.1 src/sys/arch/hp300/dev/dcmreg.h cvs rdiff -u -r1.3 -r1.3.90.1 src/sys/arch/hp300/dev/diofbreg.h \ src/sys/arch/hp300/dev/dvbox.c src/sys/arch/hp300/dev/rbox.c cvs rdiff -u -r1.3.90.1 -r1.3.90.2 src/sys/arch/hp300/dev/diofbvar.h cvs rdiff -u -r1.44 -r1.44.4.1 src/sys/arch/hp300/dev/dma.c cvs rdiff -u -r1.13 -r1.13.6.1 src/sys/arch/hp300/dev/dnkbd.c cvs rdiff -u -r1.5 -r1.5.58.1 src/sys/arch/hp300/dev/frodoreg.h cvs rdiff -u -r1.44 -r1.44.6.1 src/sys/arch/hp300/dev/hpib.c cvs rdiff -u -r1.1 -r1.1.68.1 src/sys/arch/hp300/dev/mcclock_frodo.c cvs rdiff -u -r1.2 -r1.2.90.1 src/sys/arch/hp300/dev/rboxreg.h cvs rdiff -u -r1.21 -r1.21.58.1 src/sys/arch/hp300/dev/rtc.c cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/arch/hp300/dev/sti_sgc.c cvs rdiff -u -r1.2.90.1 -r1.2.90.2 src/sys/arch/hp300/dev/topcatreg.h cvs rdiff -u -r1.110.6.1 -r1.110.6.2 src/sys/arch/hp300/hp300/autoconf.c cvs rdiff -u -r1.237 -r1.237.2.1 src/sys/arch/hp300/hp300/machdep.c cvs rdiff -u -r1.155 -r1.155.4.1 src/sys/arch/hp300/hp300/trap.c cvs rdiff -u -r1.22 -r1.22.18.1 src/sys/arch/hp300/include/bus.h cvs rdiff -u -r1.72 -r1.72.26.1 src/sys/arch/hp300/include/cpu.h cvs rdiff -u -r1.37 -r1.37.10.1 src/sys/arch/hp300/stand/Makefile.buildboot cvs rdiff -u -r1.13 -r1.13.50.1 src/sys/arch/hp300/stand/common/clock.c cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/hp300/stand/common/conf.c cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/hp300/stand/common/conf.h cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/hp300/stand/common/devopen.c cvs rdiff -u -r1.14 -r1.14.86.1 src/sys/arch/hp300/stand/common/hil.c cvs rdiff -u -r1.1 -r1.1.92.1 src/sys/arch/hp300/stand/common/ite_dumb.c cvs rdiff -u -r1.1 -r1.1.68.1 src/sys/arch/hp300/stand/common/ite_sti.c cvs rdiff -u -r1.15 -r1.15.86.1 src/sys/arch/hp300/stand/common/machdep.c cvs rdiff -u -r1.18 -r1.18.16.1 src/sys/arch/hp300/stand/common/netio.c cvs rdiff -u -r1.5 -r1.5.196.1 src/sys/arch/hp300/stand/common/prf.c cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/arch/hp300/stand/common/rd.c cvs rdiff -u -r1.11 -r1.11.60.1 src/sys/arch/hp300/stand/common/scsi.c cvs rdiff -u -r1.4 -r1.4.48.1 src/sys/arch/hp300/stand/common/scsireg.h cvs rdiff -u -r1.4 -r1.4.196.1 src/sys/arch/hp300/stand/common/scsivar.h cvs rdiff -u -r1.11 -r1.11.84.1 src/sys/arch/hp300/stand/common/sd.c cvs rdiff -u -r1.10.26.1 -r1.10.26.2 src/sys/arch/hp300/stand/inst/Makefile cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/arch/hp300/stand/inst/inst.c cvs rdiff -u -r1.11 -r1.11.196.1 src/sys/arch/hp300/stand/mkboot/Makefile cvs rdiff -u -r1.11 -r1.11.50.1 src/sys/arch/hp300/stand/mkboot/mkboot.c cvs rdiff -u -r1.5 -r0 src/sys/arch/hp300/stand/mkboot/volhdr.h cvs rdiff -u -r1.10.2.1 -r1.10.2.2 src/sys/arch/hp300/stand/uboot/Makefile cvs rdiff -u -r1.27 -r1.27.30.1 src/sys/fs/cd9660/cd9660_extern.h cvs rdiff -u -r1.14 -r1.14.48.1 src/sys/fs/cd9660/cd9660_util.c cvs rdiff -u -r1.58 -r1.58.40.1 src/sys/sys/bootblock.h cvs rdiff -u -r1.5 -r1.5.24.1 src/tools/Makefile.nbincludes cvs rdiff -u -r1.56 -r1.56.6.1 src/usr.sbin/installboot/Makefile cvs rdiff -u -r0 -r1.2.2.2 src/usr.sbin/installboot/cd9660.c cvs rdiff -u -r1.13 -r1.13.56.1 src/usr.sbin/installboot/fstypes.c cvs rdiff -u -r1.105 -r1.105.2.1 src/usr.sbin/installboot/installboot.8 cvs rdiff -u -r1.43 -r1.43.2.1 src/usr.sbin/installboot/installboot.h cvs rdiff -u -r1.17 -r1.17.2.1 src/usr.sbin/installboot/arch/hp300.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/hp300/cdroms/installcd/Makefile diff -u src/distrib/hp300/cdroms/installcd/Makefile:1.3 src/distrib/hp300/cdroms/installcd/Makefile:1.3.8.1 --- src/distrib/hp300/cdroms/installcd/Makefile:1.3 Mon Sep 23 13:42:32 2019 +++ src/distrib/hp300/cdroms/installcd/Makefile Sat Jun 22 10:57:11 2024 @@ -1,6 +1,20 @@ -# $NetBSD: Makefile,v 1.3 2019/09/23 13:42:32 christos Exp $ +# $NetBSD: Makefile,v 1.3.8.1 2024/06/22 10:57:11 martin Exp $ CDBASE= hp300cd # gives ${CDBASE}.iso CDRELEASE= true # include $RELEASEDIR/$RELEASEMACHINEDIR CDRELEASE_NODEBUG= true +CDKERNELS= netbsd-RAMDISK.gz netbsd +CDINSTKERNEL= ../../instkernel + +SYS_UBOOT= SYS_UBOOT +BOOTDIR= ${DESTDIR}/usr/mdec/rbootd + +# make the CD bootable +prepare_md_post: + ${INSTALL} ${COPY} -m 0644 ${BOOTDIR}/${SYS_UBOOT} cdrom + +image_md_post: + ${TOOL_INSTALLBOOT} -m ${MACHINE} \ + ${CDIMAGE} ${BOOTDIR}/${SYS_UBOOT} /${SYS_UBOOT} + .include "${.CURDIR}/../../../common/Makefile.bootcd" Index: src/sys/arch/hp300/dev/dcm.c diff -u src/sys/arch/hp300/dev/dcm.c:1.90 src/sys/arch/hp300/dev/dcm.c:1.90.4.1 --- src/sys/arch/hp300/dev/dcm.c:1.90 Sun Apr 10 09:50:45 2022 +++ src/sys/arch/hp300/dev/dcm.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dcm.c,v 1.90 2022/04/10 09:50:45 andvar Exp $ */ +/* $NetBSD: dcm.c,v 1.90.4.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.90 2022/04/10 09:50:45 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.90.4.1 2024/06/22 10:57:10 martin Exp $"); #include "opt_kgdb.h" @@ -302,7 +302,7 @@ CFATTACH_DECL_NEW(dcm, sizeof(struct dcm static struct dcmdevice *dcm_cn = NULL; /* pointer to hardware */ static int dcmconsinit; /* has been initialized */ #if 0 -static int dcm_lastcnpri = CN_DEAD; /* XXX last priority */ +static int dcm_lastcnpri = CN_DEAD; /* XXX last priority */ #endif static struct consdev dcm_cons = { Index: src/sys/arch/hp300/dev/dcmreg.h diff -u src/sys/arch/hp300/dev/dcmreg.h:1.10 src/sys/arch/hp300/dev/dcmreg.h:1.10.58.1 --- src/sys/arch/hp300/dev/dcmreg.h:1.10 Thu May 22 16:30:40 2014 +++ src/sys/arch/hp300/dev/dcmreg.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dcmreg.h,v 1.10 2014/05/22 16:30:40 dholland Exp $ */ +/* $NetBSD: dcmreg.h,v 1.10.58.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -196,7 +196,7 @@ struct dcmpreg { #define BR_50 0x01 #define BR_75 0x02 #define BR_110 0x03 -#define BR_134 0x04 +#define BR_134 0x04 #define BR_150 0x05 #define BR_300 0x06 #define BR_600 0x07 Index: src/sys/arch/hp300/dev/diofbreg.h diff -u src/sys/arch/hp300/dev/diofbreg.h:1.3 src/sys/arch/hp300/dev/diofbreg.h:1.3.90.1 --- src/sys/arch/hp300/dev/diofbreg.h:1.3 Sat Feb 12 16:40:29 2011 +++ src/sys/arch/hp300/dev/diofbreg.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: diofbreg.h,v 1.3 2011/02/12 16:40:29 tsutsui Exp $ */ +/* $NetBSD: diofbreg.h,v 1.3.90.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: diofbreg.h,v 1.3 2007/01/07 15:13:52 miod Exp $ */ /* @@ -65,7 +65,7 @@ struct diofbreg { uint8_t :8; uint8_t id; /* id and reset register 0x01 */ - uint8_t sec_interrupt; /* secondary interrupt register 0x02 */ + uint8_t sec_interrupt; /* secondary interrupt register 0x02 */ uint8_t interrupt; /* interrupt register 0x03 */ uint8_t :8; uint8_t fbwmsb; /* frame buffer width MSB 0x05 */ Index: src/sys/arch/hp300/dev/dvbox.c diff -u src/sys/arch/hp300/dev/dvbox.c:1.3 src/sys/arch/hp300/dev/dvbox.c:1.3.90.1 --- src/sys/arch/hp300/dev/dvbox.c:1.3 Fri Feb 18 19:15:43 2011 +++ src/sys/arch/hp300/dev/dvbox.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dvbox.c,v 1.3 2011/02/18 19:15:43 tsutsui Exp $ */ +/* $NetBSD: dvbox.c,v 1.3.90.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: dvbox.c,v 1.13 2006/08/11 18:33:13 miod Exp $ */ /* @@ -278,7 +278,7 @@ dvbox_restore(struct diofb *fb) volatile struct dvboxfb *db = (struct dvboxfb *)fb->regkva; u_int i; - db->regs.id = 0x80; + db->regs.id = 0x80; DELAY(100); db->regs.interrupt = 0x04; @@ -329,7 +329,7 @@ dvbox_restore(struct diofb *fb) */ db->regs.interrupt = 0x04; db->drive = 0x10; - db->rep_rule = DVBOX_DUALROP(RR_COPY); + db->rep_rule = DVBOX_DUALROP(RR_COPY); db->opwen = 0x01; db->fbwen = 0x0; db->fold = 0x01; Index: src/sys/arch/hp300/dev/rbox.c diff -u src/sys/arch/hp300/dev/rbox.c:1.3 src/sys/arch/hp300/dev/rbox.c:1.3.90.1 --- src/sys/arch/hp300/dev/rbox.c:1.3 Fri Feb 18 19:15:43 2011 +++ src/sys/arch/hp300/dev/rbox.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: rbox.c,v 1.3 2011/02/18 19:15:43 tsutsui Exp $ */ +/* $NetBSD: rbox.c,v 1.3.90.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: rbox.c,v 1.14 2006/08/11 18:33:13 miod Exp $ */ /* @@ -323,7 +323,7 @@ rbox_restore(struct diofb *fb) CM2GRN(fb)[0x01].value = 0xFF; CM2BLU(fb)[0x01].value = 0xFF; - rb->blink = 0x00; + rb->blink = 0x00; rb->write_enable = 0x01; rb->opwen = 0x00; Index: src/sys/arch/hp300/dev/diofbvar.h diff -u src/sys/arch/hp300/dev/diofbvar.h:1.3.90.1 src/sys/arch/hp300/dev/diofbvar.h:1.3.90.2 --- src/sys/arch/hp300/dev/diofbvar.h:1.3.90.1 Thu May 16 12:27:50 2024 +++ src/sys/arch/hp300/dev/diofbvar.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: diofbvar.h,v 1.3.90.1 2024/05/16 12:27:50 martin Exp $ */ +/* $NetBSD: diofbvar.h,v 1.3.90.2 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: diofbvar.h,v 1.10 2006/08/11 18:33:13 miod Exp $ */ /* @@ -115,7 +115,7 @@ struct diofb { #define RR_COPY 0x3 #define RR_XOR 0x6 #define RR_INVERT 0xa -#define RR_COPYINVERTED 0xc +#define RR_COPYINVERTED 0xc void diofb_cnattach(struct diofb *); void diofb_end_attach(device_t, struct wsdisplay_accessops *, struct diofb *, Index: src/sys/arch/hp300/dev/dma.c diff -u src/sys/arch/hp300/dev/dma.c:1.44 src/sys/arch/hp300/dev/dma.c:1.44.4.1 --- src/sys/arch/hp300/dev/dma.c:1.44 Mon Sep 6 20:55:08 2021 +++ src/sys/arch/hp300/dev/dma.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dma.c,v 1.44 2021/09/06 20:55:08 andvar Exp $ */ +/* $NetBSD: dma.c,v 1.44.4.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include "opt_m68k_arch.h" #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.44 2021/09/06 20:55:08 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dma.c,v 1.44.4.1 2024/06/22 10:57:10 martin Exp $"); #include <machine/hp300spu.h> /* XXX param.h includes cpu.h */ @@ -601,7 +601,7 @@ dmaintr(void *arg) if (dmadebug & DDB_IO) { if (((dmadebug&DDB_WORD) && (dc->dm_cmd&DMA_WORD)) || ((dmadebug&DDB_LWORD) && (dc->dm_cmd&DMA_LWORD))) - printf("dmaintr: flags %x unit %d stat %x " + printf("dmaintr: flags %x unit %d stat %x " "next %d\n", dc->dm_flags, i, stat, dc->dm_cur + 1); } Index: src/sys/arch/hp300/dev/dnkbd.c diff -u src/sys/arch/hp300/dev/dnkbd.c:1.13 src/sys/arch/hp300/dev/dnkbd.c:1.13.6.1 --- src/sys/arch/hp300/dev/dnkbd.c:1.13 Sat Aug 7 16:18:53 2021 +++ src/sys/arch/hp300/dev/dnkbd.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: dnkbd.c,v 1.13 2021/08/07 16:18:53 thorpej Exp $ */ +/* $NetBSD: dnkbd.c,v 1.13.6.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: dnkbd.c,v 1.17 2009/07/23 21:05:56 blambert Exp $ */ /* @@ -51,7 +51,7 @@ * * 0x00 go to cooked mode. * 0x01 go to 'raw' (scancode) mode. - * 0x12,0x21 status report as <id1>\r<id2>\r<model>\r followed by 0xff + * 0x12,0x21 status report as <id1>\r<id2>\r<model>\r followed by 0xff * and then the cooked/raw status. * 0x21,0x81 beep on * 0x21,0x82 beep off Index: src/sys/arch/hp300/dev/frodoreg.h diff -u src/sys/arch/hp300/dev/frodoreg.h:1.5 src/sys/arch/hp300/dev/frodoreg.h:1.5.58.1 --- src/sys/arch/hp300/dev/frodoreg.h:1.5 Sat Apr 19 05:37:54 2014 +++ src/sys/arch/hp300/dev/frodoreg.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: frodoreg.h,v 1.5 2014/04/19 05:37:54 tsutsui Exp $ */ +/* $NetBSD: frodoreg.h,v 1.5.58.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1997 Michael Smith. All rights reserved. @@ -81,7 +81,7 @@ /* manipulate interrupt registers */ #define FRODO_GETMASK(sc) \ - ((FRODO_READ((sc), FRODO_PIC_MU) << 8) | \ + ((FRODO_READ((sc), FRODO_PIC_MU) << 8) | \ FRODO_READ((sc), FRODO_PIC_ML)) #define FRODO_SETMASK(sc, val) do { \ FRODO_WRITE((sc), FRODO_PIC_MU, ((val) >> 8) & 0xff); \ Index: src/sys/arch/hp300/dev/hpib.c diff -u src/sys/arch/hp300/dev/hpib.c:1.44 src/sys/arch/hp300/dev/hpib.c:1.44.6.1 --- src/sys/arch/hp300/dev/hpib.c:1.44 Sat Aug 7 16:18:53 2021 +++ src/sys/arch/hp300/dev/hpib.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hpib.c,v 1.44 2021/08/07 16:18:53 thorpej Exp $ */ +/* $NetBSD: hpib.c,v 1.44.6.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.44 2021/08/07 16:18:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.44.6.1 2024/06/22 10:57:10 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -117,7 +117,7 @@ int hpibdmathresh = 3; /* byte count bey * a device is attached to the system! * * * We nevertheless probe the whole (slave, punit) tuple space, since - * drivers for devices with a unique ID know exactly where to attach; + * drivers for devices with a unique ID know exactly where to attach; * and we disallow ``star'' locators for other drivers. */ Index: src/sys/arch/hp300/dev/mcclock_frodo.c diff -u src/sys/arch/hp300/dev/mcclock_frodo.c:1.1 src/sys/arch/hp300/dev/mcclock_frodo.c:1.1.68.1 --- src/sys/arch/hp300/dev/mcclock_frodo.c:1.1 Sat Apr 19 05:37:54 2014 +++ src/sys/arch/hp300/dev/mcclock_frodo.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mcclock_frodo.c,v 1.1 2014/04/19 05:37:54 tsutsui Exp $ */ +/* $NetBSD: mcclock_frodo.c,v 1.1.68.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 2014 Izumi Tsutsui. All rights reserved. * @@ -24,7 +24,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mcclock_frodo.c,v 1.1 2014/04/19 05:37:54 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcclock_frodo.c,v 1.1.68.1 2024/06/22 10:57:10 martin Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -97,7 +97,7 @@ mcclock_frodo_attach(device_t parent, de mcclock_frodo_write(sc, MC_REGB, MC_REGB_BINARY | MC_REGB_24HR); /* make sure to start the 32.768kHz OSC */ - mcclock_frodo_write(sc, MC_REGA, + mcclock_frodo_write(sc, MC_REGA, (mcclock_frodo_read(sc, MC_REGA) & ~MC_REGA_DVMASK) | MC_BASE_32_KHz); } Index: src/sys/arch/hp300/dev/rboxreg.h diff -u src/sys/arch/hp300/dev/rboxreg.h:1.2 src/sys/arch/hp300/dev/rboxreg.h:1.2.90.1 --- src/sys/arch/hp300/dev/rboxreg.h:1.2 Sat Feb 12 16:40:29 2011 +++ src/sys/arch/hp300/dev/rboxreg.h Sat Jun 22 10:57:10 2024 @@ -1,5 +1,5 @@ /* $OpenBSD: rboxreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */ -/* $NetBSD: rboxreg.h,v 1.2 2011/02/12 16:40:29 tsutsui Exp $ */ +/* $NetBSD: rboxreg.h,v 1.2.90.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -70,7 +70,7 @@ struct rboxfb { uint8_t filler3[0x405b - 0x4048]; uint8_t scanbusy; /* scan converteris active 0x405B */ uint8_t filler3b[0x4083 - 0x405c]; - uint8_t video_enable; /* drive vid. refresh bus 0x4083 */ + uint8_t video_enable; /* drive vid. refresh bus 0x4083 */ uint8_t filler4[3]; uint8_t display_enable; /* enable the display 0x4087 */ uint8_t filler5[8]; Index: src/sys/arch/hp300/dev/rtc.c diff -u src/sys/arch/hp300/dev/rtc.c:1.21 src/sys/arch/hp300/dev/rtc.c:1.21.58.1 --- src/sys/arch/hp300/dev/rtc.c:1.21 Sat Apr 19 05:37:54 2014 +++ src/sys/arch/hp300/dev/rtc.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: rtc.c,v 1.21 2014/04/19 05:37:54 tsutsui Exp $ */ +/* $NetBSD: rtc.c,v 1.21.58.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.21 2014/04/19 05:37:54 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.21.58.1 2024/06/22 10:57:10 martin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -140,7 +140,7 @@ rtc_gettime_ymdhms(todr_chip_handle_t ha read_okay = false; } -#define rtc_to_decimal(a,b) (rtc_registers[a] * 10 + rtc_registers[b]) +#define rtc_to_decimal(a,b) (rtc_registers[a] * 10 + rtc_registers[b]) dt->dt_sec = rtc_to_decimal(1, 0); dt->dt_min = rtc_to_decimal(3, 2); Index: src/sys/arch/hp300/dev/sti_sgc.c diff -u src/sys/arch/hp300/dev/sti_sgc.c:1.7 src/sys/arch/hp300/dev/sti_sgc.c:1.7.4.1 --- src/sys/arch/hp300/dev/sti_sgc.c:1.7 Sun Jul 3 11:30:48 2022 +++ src/sys/arch/hp300/dev/sti_sgc.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sti_sgc.c,v 1.7 2022/07/03 11:30:48 andvar Exp $ */ +/* $NetBSD: sti_sgc.c,v 1.7.4.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: sti_sgc.c,v 1.14 2007/05/26 00:36:03 krw Exp $ */ /* @@ -27,7 +27,7 @@ * */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.7 2022/07/03 11:30:48 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sti_sgc.c,v 1.7.4.1 2024/06/22 10:57:10 martin Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -55,7 +55,7 @@ struct sti_sgc_softc { * 425e EVRX specific hardware */ /* - * EVRX RAMDAC (Bt458) is found at offset 0x060000 from SGC bus PA and + * EVRX RAMDAC (Bt458) is found at offset 0x060000 from SGC bus PA and * offset 0x040000 length 0x1c0000 is mapped in MI sti via ROM region 2 */ #define STI_EVRX_REGNO2OFFSET 0x020000 Index: src/sys/arch/hp300/dev/topcatreg.h diff -u src/sys/arch/hp300/dev/topcatreg.h:1.2.90.1 src/sys/arch/hp300/dev/topcatreg.h:1.2.90.2 --- src/sys/arch/hp300/dev/topcatreg.h:1.2.90.1 Thu May 16 12:27:50 2024 +++ src/sys/arch/hp300/dev/topcatreg.h Sat Jun 22 10:57:10 2024 @@ -1,5 +1,5 @@ /* $OpenBSD: topcatreg.h,v 1.2 2005/01/24 21:36:39 miod Exp $ */ -/* $NetBSD: topcatreg.h,v 1.2.90.1 2024/05/16 12:27:50 martin Exp $ */ +/* $NetBSD: topcatreg.h,v 1.2.90.2 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -64,15 +64,15 @@ struct tcboxfb { uint8_t f3[0x4080-0x404c-1]; uint8_t nblank; /* display enable planes 0x4080 */ uint8_t f4[0x4088-0x4080-1]; - uint8_t wen; /* write enable plane 0x4088 */ + uint8_t wen; /* write enable plane 0x4088 */ uint8_t f5[0x408c-0x4088-1]; uint8_t ren; /* read enable plane 0x408c */ uint8_t f6[0x4090-0x408c-1]; uint8_t fben; /* frame buffer write enable 0x4090 */ uint8_t f7[0x409c-0x4090-1]; - uint8_t wmove; /* start window move 0x409c */ + uint8_t wmove; /* start window move 0x409c */ uint8_t f8[0x40a0-0x409c-1]; - uint8_t blink; /* enable blink planes 0x40a0 */ + uint8_t blink; /* enable blink planes 0x40a0 */ uint8_t f9[0x40a8-0x40a0-1]; uint8_t altframe; /* enable alternate frame 0x40a8 */ uint8_t f10[0x40ac-0x40a8-1]; @@ -82,13 +82,13 @@ struct tcboxfb { uint8_t f12[0x40ef-0x40ea-1]; uint8_t wmrr; /* move replacement rule 0x40ef */ uint8_t f13[0x40f2-0x40ef-1]; - uint16_t source_x; /* source x pixel # 0x40f2 */ + uint16_t source_x; /* source x pixel # 0x40f2 */ uint8_t f14[0x40f6-0x40f2-2]; - uint16_t source_y; /* source y pixel # 0x40f6 */ + uint16_t source_y; /* source y pixel # 0x40f6 */ uint8_t f15[0x40fa-0x40f6-2]; - uint16_t dest_x; /* dest x pixel # 0x40fa */ + uint16_t dest_x; /* dest x pixel # 0x40fa */ uint8_t f16[0x40fe -0x40fa-2]; - uint16_t dest_y; /* dest y pixel # 0x40fe */ + uint16_t dest_y; /* dest y pixel # 0x40fe */ uint8_t f17[0x4102-0x40fe -2]; uint16_t wwidth; /* block mover pixel width 0x4102 */ uint8_t f18[0x4106-0x4102-2]; @@ -107,11 +107,11 @@ struct tcboxfb { uint8_t f22[0x6002-0x4800-2]; uint16_t cmap_busy; /* Color Ram busy 0x6002 */ uint8_t f23[0x60b2-0x6002-2]; - uint16_t rdata; /* color map red data 0x60b2 */ + uint16_t rdata; /* color map red data 0x60b2 */ uint16_t gdata; /* color map green data 0x60b4 */ - uint16_t bdata; /* color map blue data 0x60b6 */ - uint16_t cindex; /* color map index 0x60b8 */ + uint16_t bdata; /* color map blue data 0x60b6 */ + uint16_t cindex; /* color map index 0x60b8 */ uint16_t plane_mask; /* plane mask select 0x60ba */ uint8_t f24[0x60f0-0x60ba-2]; - uint16_t strobe; /* color map trigger 0x60f0 */ + uint16_t strobe; /* color map trigger 0x60f0 */ }; Index: src/sys/arch/hp300/hp300/autoconf.c diff -u src/sys/arch/hp300/hp300/autoconf.c:1.110.6.1 src/sys/arch/hp300/hp300/autoconf.c:1.110.6.2 --- src/sys/arch/hp300/hp300/autoconf.c:1.110.6.1 Mon Jun 17 16:41:50 2024 +++ src/sys/arch/hp300/hp300/autoconf.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: autoconf.c,v 1.110.6.1 2024/06/17 16:41:50 martin Exp $ */ +/* $NetBSD: autoconf.c,v 1.110.6.2 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 2002 The NetBSD Foundation, Inc. @@ -88,7 +88,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.110.6.1 2024/06/17 16:41:50 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.110.6.2 2024/06/22 10:57:10 martin Exp $"); #include "dvbox.h" #include "gbox.h" @@ -222,7 +222,7 @@ struct dev_data { int dd_punit; /* and punit... */ }; typedef LIST_HEAD(, dev_data) ddlist_t; -static ddlist_t dev_data_list; /* all dev_datas */ +static ddlist_t dev_data_list; /* all dev_datas */ static ddlist_t dev_data_list_hpib; /* hpib controller dev_datas */ static ddlist_t dev_data_list_scsi; /* scsi controller dev_datas */ @@ -429,7 +429,8 @@ device_register(device_t dev, void *aux) goto linkup; } - if (device_is_a(dev, "sd")) { + if (device_is_a(dev, "sd") || + device_is_a(dev, "cd")) { struct scsipibus_attach_args *sa = aux; dd->dd_slave = sa->sa_periph->periph_target; @@ -477,8 +478,8 @@ findbootdev(void) punit = B_UNIT(bootdev); part = B_PARTITION(bootdev); - scsiboot = (type == 4); /* sd major */ - hpibboot = (type == 0 || type == 2); /* ct/rd major */ + scsiboot = (type == 4); /* sd or cd */ + hpibboot = (type == 0 || type == 2); /* ct/rd */ netboot = (type == 6); /* le - special */ /* @@ -538,7 +539,9 @@ findbootdev(void) /* * Sanity check. */ - if ((type == 4 && !device_is_a(booted_device, "sd"))) { + if (type == 4 && + !device_is_a(booted_device, "sd") && + !device_is_a(booted_device, "cd")) { printf("WARNING: boot device/type mismatch!\n"); printf("device = %s, type = %d\n", device_xname(booted_device), type); @@ -604,15 +607,15 @@ setbootdev(void) int type, ctlr; /* - * Note our magic numbers for type: + * Note our magic numbers for type shared with the BOOTROM: * * 0 == ct * 2 == rd - * 4 == sd + * 4 == sd or cd * 6 == le * - * All are bdevsw major numbers, except for le, which - * is just special. + * All are bdevsw major numbers, except for le and cd. + * le is just special. cd is treated as sd by the BOOTROM. * * We can't mount root on a tape, so we ignore those. */ @@ -638,6 +641,8 @@ setbootdev(void) type = 2; else if (device_is_a(root_device, "sd")) type = 4; + else if (device_is_a(root_device, "cd")) + type = 4; /* not a major, but for MAKEBOOTDEV() */ else if (device_is_a(root_device, "md")) goto out; else { @@ -670,7 +675,7 @@ setbootdev(void) } } break; - case 4: /* sd */ + case 4: /* sd or cd */ /* * "sd" -> "scsibus" -> "spc" */ Index: src/sys/arch/hp300/hp300/machdep.c diff -u src/sys/arch/hp300/hp300/machdep.c:1.237 src/sys/arch/hp300/hp300/machdep.c:1.237.2.1 --- src/sys/arch/hp300/hp300/machdep.c:1.237 Sun Oct 16 15:20:59 2022 +++ src/sys/arch/hp300/hp300/machdep.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.237 2022/10/16 15:20:59 tsutsui Exp $ */ +/* $NetBSD: machdep.c,v 1.237.2.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.237 2022/10/16 15:20:59 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.237.2.1 2024/06/22 10:57:10 martin Exp $"); #include "opt_ddb.h" #include "opt_compat_netbsd.h" @@ -371,7 +371,7 @@ static void identifycpu(void) { const char *t, *cpu, *s, *mmu; - int i; + int i; char fpu[64], cache[64]; /* Index: src/sys/arch/hp300/hp300/trap.c diff -u src/sys/arch/hp300/hp300/trap.c:1.155 src/sys/arch/hp300/hp300/trap.c:1.155.4.1 --- src/sys/arch/hp300/hp300/trap.c:1.155 Sat Sep 25 19:16:31 2021 +++ src/sys/arch/hp300/hp300/trap.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.155 2021/09/25 19:16:31 tsutsui Exp $ */ +/* $NetBSD: trap.c,v 1.155.4.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -39,7 +39,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.155 2021/09/25 19:16:31 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.155.4.1 2024/06/22 10:57:10 martin Exp $"); #include "opt_ddb.h" #include "opt_execfmt.h" @@ -548,8 +548,8 @@ trap(struct frame *fp, int type, u_int c #endif /* * It is only a kernel address space fault iff: - * 1. (type & T_USER) == 0 and - * 2. pcb_onfault not set or + * 1. (type & T_USER) == 0 and + * 2. pcb_onfault not set or * 3. pcb_onfault set but supervisor space data fault * The last can occur during an exec() copyin where the * argument space is lazy-allocated. Index: src/sys/arch/hp300/include/bus.h diff -u src/sys/arch/hp300/include/bus.h:1.22 src/sys/arch/hp300/include/bus.h:1.22.18.1 --- src/sys/arch/hp300/include/bus.h:1.22 Sun Mar 7 10:01:08 2021 +++ src/sys/arch/hp300/include/bus.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bus.h,v 1.22 2021/03/07 10:01:08 skrll Exp $ */ +/* $NetBSD: bus.h,v 1.22.18.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -756,5 +756,5 @@ __HP300_copy_region_N(4) * There is no bus_dma(9)'fied bus drivers on this port. */ #define __HAVE_NO_BUS_DMA - + #endif /* _HP300_BUS_H_ */ Index: src/sys/arch/hp300/include/cpu.h diff -u src/sys/arch/hp300/include/cpu.h:1.72 src/sys/arch/hp300/include/cpu.h:1.72.26.1 --- src/sys/arch/hp300/include/cpu.h:1.72 Sat Nov 23 19:40:35 2019 +++ src/sys/arch/hp300/include/cpu.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.72 2019/11/23 19:40:35 ad Exp $ */ +/* $NetBSD: cpu.h,v 1.72.26.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -89,7 +89,7 @@ struct clockframe { * or after the current trap/syscall if in system mode. */ #define cpu_need_resched(ci,l,flags) do { \ - __USE(flags); \ + __USE(flags); \ aston(); \ } while (/*CONSTCOND*/0) Index: src/sys/arch/hp300/stand/Makefile.buildboot diff -u src/sys/arch/hp300/stand/Makefile.buildboot:1.37 src/sys/arch/hp300/stand/Makefile.buildboot:1.37.10.1 --- src/sys/arch/hp300/stand/Makefile.buildboot:1.37 Fri Jul 9 17:44:28 2021 +++ src/sys/arch/hp300/stand/Makefile.buildboot Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.buildboot,v 1.37 2021/07/09 17:44:28 tsutsui Exp $ +# $NetBSD: Makefile.buildboot,v 1.37.10.1 2024/06/22 10:57:10 martin Exp $ # RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long RELOC= FFF00000 @@ -7,7 +7,7 @@ S= ${.CURDIR}/../../../.. .PATH: ${.CURDIR}/../common -PROG= ${PROGAOUT}.lif +PROG= ${PROGELF}.lif WARNS?= 1 SRCS= ${COMMONSOURCE} ${DRIVERSOURCE} ${PROGSOURCE} @@ -15,7 +15,7 @@ NOMAN= # defined STRIPFLAG= BINMODE= 444 -CLEANFILES+= ${PROGAOUT} +CLEANFILES+= ${PROGELF} CPPFLAGS+= -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -I${.OBJDIR} CPPFLAGS+= -Wno-main @@ -29,10 +29,14 @@ LIBC= LIBCRTBEGIN= LIBCRTEND= -${PROG}: ${PROGAOUT} - ${OBJCOPY} --output-target=binary ${PROGAOUT} ${PROGAOUT}.bin - ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${PROGAOUT}.bin ${PROG} - rm -f ${PROGAOUT}.bin +.if ${MKREPRO_TIMESTAMP:Uno} != "no" +HP300MKBOOT_TIMESTAMP=-t "${MKREPRO_TIMESTAMP}" +.endif + +${PROG}: ${PROGELF} + ${OBJCOPY} --output-target=binary ${PROGELF} ${PROGELF}.bin + ${TOOL_HP300MKBOOT} -l 0x${RELOC} ${HP300MKBOOT_TIMESTAMP} ${PROGELF}.bin ${PROG} + rm -f ${PROGELF}.bin .include "${S}/conf/newvers_stand.mk" @@ -78,8 +82,8 @@ SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" .include "${S}/lib/libsa/Makefile.inc" LIBSA= ${SALIB} -${PROGAOUT}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} - ${LD} -N -Ttext ${RELOC} -e begin -o ${PROGAOUT} \ +${PROGELF}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} + ${LD} -N -Ttext ${RELOC} -e begin -o ${PROGELF} \ ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} - @${SIZE} ${PROGAOUT} - @echo ${PROGAOUT} total size should not exceed 1044480 bytes + @${SIZE} ${PROGELF} + @echo ${PROGELF} total size should not exceed 1044480 bytes Index: src/sys/arch/hp300/stand/common/clock.c diff -u src/sys/arch/hp300/stand/common/clock.c:1.13 src/sys/arch/hp300/stand/common/clock.c:1.13.50.1 --- src/sys/arch/hp300/stand/common/clock.c:1.13 Mon Nov 17 02:15:48 2014 +++ src/sys/arch/hp300/stand/common/clock.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: clock.c,v 1.13 2014/11/17 02:15:48 christos Exp $ */ +/* $NetBSD: clock.c,v 1.13.50.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -145,7 +145,7 @@ clock_to_gmt(satime_t *timbuf) for (i = 1; i < month; i++) tmp += days_in_month(i); - + tmp += (day - 1); tmp = ((tmp * 24 + hour) * 60 + min) * 60 + sec; Index: src/sys/arch/hp300/stand/common/conf.c diff -u src/sys/arch/hp300/stand/common/conf.c:1.14 src/sys/arch/hp300/stand/common/conf.c:1.14.2.1 --- src/sys/arch/hp300/stand/common/conf.c:1.14 Sun Dec 11 07:39:30 2022 +++ src/sys/arch/hp300/stand/common/conf.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: conf.c,v 1.14 2022/12/11 07:39:30 tsutsui Exp $ */ +/* $NetBSD: conf.c,v 1.14.2.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -41,6 +41,7 @@ #include <lib/libsa/stand.h> #include <lib/libsa/nfs.h> #include <lib/libsa/ufs.h> +#include <lib/libsa/cd9660.h> #include <hp300/stand/common/conf.h> #include <hp300/stand/common/rawfs.h> @@ -138,13 +139,16 @@ int npunit = __arraycount(punitsw); * Filesystem configuration */ struct fs_ops file_system_rawfs[1] = { FS_OPS(rawfs) }; -struct fs_ops file_system_ufs[NFSYS_UFS] = { +struct fs_ops file_system_ufs[NFSYS_FS] = { FS_OPS(ffsv1), #ifdef SUPPORT_UFS2 FS_OPS(ffsv2), #endif +#ifdef SUPPORT_CD + FS_OPS(cd9660), +#endif }; struct fs_ops file_system_nfs[1] = { FS_OPS(nfs) }; -struct fs_ops file_system[NFSYS_UFS]; +struct fs_ops file_system[NFSYS_FS]; int nfsys = 1; /* default value; should be overrieded */ Index: src/sys/arch/hp300/stand/common/conf.h diff -u src/sys/arch/hp300/stand/common/conf.h:1.3 src/sys/arch/hp300/stand/common/conf.h:1.3.2.1 --- src/sys/arch/hp300/stand/common/conf.h:1.3 Sun Dec 11 07:39:30 2022 +++ src/sys/arch/hp300/stand/common/conf.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: conf.h,v 1.3 2022/12/11 07:39:30 tsutsui Exp $ */ +/* $NetBSD: conf.h,v 1.3.2.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -53,10 +53,16 @@ int sdopen(struct open_file *, ...); int sdclose(struct open_file *); #endif #ifdef SUPPORT_UFS2 -#define NFSYS_UFS 2 +#define NFSYS_UFS2 1 #else -#define NFSYS_UFS 1 +#define NFSYS_UFS2 0 #endif +#ifdef SUPPORT_CD +#define NFSYS_CD9660 1 +#else +#define NFSYS_CD9660 0 +#endif +#define NFSYS_FS (1 + NFSYS_UFS2 + NFSYS_CD9660) #ifdef SUPPORT_ETHERNET extern struct netif_driver le_driver; @@ -72,5 +78,5 @@ extern struct punitsw punitsw[]; extern int npunit; extern struct fs_ops file_system_rawfs[1]; -extern struct fs_ops file_system_ufs[NFSYS_UFS]; +extern struct fs_ops file_system_ufs[NFSYS_FS]; extern struct fs_ops file_system_nfs[1]; Index: src/sys/arch/hp300/stand/common/devopen.c diff -u src/sys/arch/hp300/stand/common/devopen.c:1.13 src/sys/arch/hp300/stand/common/devopen.c:1.13.2.1 --- src/sys/arch/hp300/stand/common/devopen.c:1.13 Sun Dec 11 07:39:30 2022 +++ src/sys/arch/hp300/stand/common/devopen.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: devopen.c,v 1.13 2022/12/11 07:39:30 tsutsui Exp $ */ +/* $NetBSD: devopen.c,v 1.13.2.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ /*- * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -43,7 +43,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE @@ -87,7 +87,7 @@ devlookup(const char *d, int len) { struct devsw *dp = devsw; int i; - + for (i = 0; i < ndevs; i++, dp++) { if (dp->dv_name && strncmp(dp->dv_name, d, len) == 0) { /* @@ -105,7 +105,7 @@ devlookup(const char *d, int len) case 4: /* sd */ memcpy(file_system, file_system_ufs, sizeof(file_system_ufs)); - nfsys = NFSYS_UFS; + nfsys = NFSYS_FS; break; case 6: /* le */ @@ -194,7 +194,7 @@ devparse(const char *fname, int *dev, in /* isolate device */ for (s = (char *)fname; *s != ':' && !isdigit(*s); s++) continue; - + /* lookup device and get index */ if ((*dev = devlookup(fname, s - fname)) < 0) goto baddev; @@ -206,11 +206,11 @@ devparse(const char *fname, int *dev, in *ctlr = temp % 8; for (; isdigit(*s); s++) continue; - + /* translate partition */ if (!ispart(*s)) goto bad; - + *part = *s++ - 'a'; if (*s != ':') goto bad; @@ -220,16 +220,16 @@ devparse(const char *fname, int *dev, in /* no device present */ else *file = (char *)fname; - + /* return the remaining unparsed part as the file to boot */ return 0; - + bad: usage(); baddev: return -1; -} +} int @@ -263,8 +263,8 @@ devopen(struct open_file *f, const char case 4: /* sd */ memcpy(file_system, file_system_ufs, sizeof(file_system_ufs)); - nfsys = NFSYS_UFS; - break; + nfsys = NFSYS_FS; + break; case 6: /* le */ memcpy(file_system, file_system_nfs, @@ -279,7 +279,7 @@ devopen(struct open_file *f, const char } dp = &devsw[dev]; - + if (!dp->dv_open) return ENODEV; Index: src/sys/arch/hp300/stand/common/hil.c diff -u src/sys/arch/hp300/stand/common/hil.c:1.14 src/sys/arch/hp300/stand/common/hil.c:1.14.86.1 --- src/sys/arch/hp300/stand/common/hil.c:1.14 Tue Feb 8 20:20:14 2011 +++ src/sys/arch/hp300/stand/common/hil.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hil.c,v 1.14 2011/02/08 20:20:14 rmind Exp $ */ +/* $NetBSD: hil.c,v 1.14.86.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -89,9 +89,9 @@ * Supports only unshifted, shifted and control keys. */ char hil_us_keymap[] = { - '\0', '`', '\\', ESC, '\0', DEL, '\0', '\0', - '\n', '\t', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\n', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '`', '\\', ESC, '\0', DEL, '\0', '\0', + '\n', '\t', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\n', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\t', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\b', '\0', @@ -147,9 +147,9 @@ char hil_us_ctrlmap[] = { #ifdef UK_KEYBOARD char hil_uk_keymap[] = { - '\0', '`', '<', ESC, '\0', DEL, '\0', '\0', - '\n', '\t', '\0', '\0', '\0', '\0', '\0', '\0', - '\0', '\n', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '`', '<', ESC, '\0', DEL, '\0', '\0', + '\n', '\t', '\0', '\0', '\0', '\0', '\0', '\0', + '\0', '\n', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\t', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\b', '\0', Index: src/sys/arch/hp300/stand/common/ite_dumb.c diff -u src/sys/arch/hp300/stand/common/ite_dumb.c:1.1 src/sys/arch/hp300/stand/common/ite_dumb.c:1.1.92.1 --- src/sys/arch/hp300/stand/common/ite_dumb.c:1.1 Sat Feb 12 05:08:41 2011 +++ src/sys/arch/hp300/stand/common/ite_dumb.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ite_dumb.c,v 1.1 2011/02/12 05:08:41 tsutsui Exp $ */ +/* $NetBSD: ite_dumb.c,v 1.1.92.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 2011 Izumi Tsutsui. All rights reserved. @@ -187,7 +187,7 @@ dumb_putc(struct ite_data *ip, int c, in uint8_t *pc; uint32_t *pc32; uint32_t *fontp; - + pc = (uint8_t *)ip->fbbase + ((ip->ftheight * ip->cursory) * ip->fbwidth) + ip->ftwidth * ip->cursorx; Index: src/sys/arch/hp300/stand/common/ite_sti.c diff -u src/sys/arch/hp300/stand/common/ite_sti.c:1.1 src/sys/arch/hp300/stand/common/ite_sti.c:1.1.68.1 --- src/sys/arch/hp300/stand/common/ite_sti.c:1.1 Sun Apr 13 15:45:27 2014 +++ src/sys/arch/hp300/stand/common/ite_sti.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: ite_sti.c,v 1.1 2014/04/13 15:45:27 tsutsui Exp $ */ +/* $NetBSD: ite_sti.c,v 1.1.68.1 2024/06/22 10:57:10 martin Exp $ */ /* $OpenBSD: ite_sti.c,v 1.2 2011/08/18 20:02:58 miod Exp $ */ /* * Copyright (c) 2006, 2011, Miodrag Vallat @@ -66,7 +66,7 @@ void sti_init(int); void sti_inqcfg(struct sti_inqconfout *); void sti_iteinit_common(struct ite_data *); -#if 0 /* not yet */ +#if 0 /* not yet */ /* kinda similar to sti_dio_probe() */ int sti_dio_probe(struct ite_data *ip) Index: src/sys/arch/hp300/stand/common/machdep.c diff -u src/sys/arch/hp300/stand/common/machdep.c:1.15 src/sys/arch/hp300/stand/common/machdep.c:1.15.86.1 --- src/sys/arch/hp300/stand/common/machdep.c:1.15 Tue Feb 8 20:20:14 2011 +++ src/sys/arch/hp300/stand/common/machdep.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.15 2011/02/08 20:20:14 rmind Exp $ */ +/* $NetBSD: machdep.c,v 1.15.86.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -122,12 +122,12 @@ trap(struct trapframe *fp) fp->tf_format, fp->tf_format, fp->tf_sr, fp->tf_pc); printf("dregs: %x %x %x %x %x %x %x %x\n", fp->tf_regs[0], fp->tf_regs[1], - fp->tf_regs[2], fp->tf_regs[3], + fp->tf_regs[2], fp->tf_regs[3], fp->tf_regs[4], fp->tf_regs[5], fp->tf_regs[6], fp->tf_regs[7]); printf("aregs: %x %x %x %x %x %x %x %x\n", fp->tf_regs[8], fp->tf_regs[9], - fp->tf_regs[10], fp->tf_regs[11], + fp->tf_regs[10], fp->tf_regs[11], fp->tf_regs[12], fp->tf_regs[13], fp->tf_regs[14], fp->tf_regs[15]); Index: src/sys/arch/hp300/stand/common/netio.c diff -u src/sys/arch/hp300/stand/common/netio.c:1.18 src/sys/arch/hp300/stand/common/netio.c:1.18.16.1 --- src/sys/arch/hp300/stand/common/netio.c:1.18 Mon Apr 12 03:55:40 2021 +++ src/sys/arch/hp300/stand/common/netio.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: netio.c,v 1.18 2021/04/12 03:55:40 mrg Exp $ */ +/* $NetBSD: netio.c,v 1.18.16.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -112,7 +112,7 @@ netopen(struct open_file *f, ...) va_list ap; char *devname; int error = 0; - + va_start(ap, f); devname = va_arg(ap, char *); va_end(ap); @@ -173,7 +173,7 @@ netmountroot(struct open_file *f, char * get_my_netmask: printf("My netmask? "); - memset(input_line, 0, sizeof(input_line)); + memset(input_line, 0, sizeof(input_line)); kgets(input_line, sizeof(input_line)); if ((netmask = inet_addr(input_line)) == htonl(INADDR_NONE)) { @@ -183,7 +183,7 @@ netmountroot(struct open_file *f, char * get_my_gateway: printf("My gateway? "); - memset(input_line, 0, sizeof(input_line)); + memset(input_line, 0, sizeof(input_line)); kgets(input_line, sizeof(input_line)); if ((gateip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) { @@ -193,7 +193,7 @@ netmountroot(struct open_file *f, char * get_server_ip: printf("Server IP address? "); - memset(input_line, 0, sizeof(input_line)); + memset(input_line, 0, sizeof(input_line)); kgets(input_line, sizeof(input_line)); if ((rootip.s_addr = inet_addr(input_line)) == htonl(INADDR_NONE)) { @@ -203,7 +203,7 @@ netmountroot(struct open_file *f, char * get_server_path: printf("Server path? "); - memset(rootpath, 0, sizeof(rootpath)); + memset(rootpath, 0, sizeof(rootpath)); kgets(rootpath, sizeof(rootpath)); if (rootpath[0] == '\0' || rootpath[0] == '\n') goto get_server_path; Index: src/sys/arch/hp300/stand/common/prf.c diff -u src/sys/arch/hp300/stand/common/prf.c:1.5 src/sys/arch/hp300/stand/common/prf.c:1.5.196.1 --- src/sys/arch/hp300/stand/common/prf.c:1.5 Sun Dec 11 12:17:19 2005 +++ src/sys/arch/hp300/stand/common/prf.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: prf.c,v 1.5 2005/12/11 12:17:19 christos Exp $ */ +/* $NetBSD: prf.c,v 1.5.196.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -57,7 +57,7 @@ tgetchar(void) if ((c = cngetc()) == 0) return 0; - + if (c == '\r') c = '\n'; else if (c == ('c'&037)) { Index: src/sys/arch/hp300/stand/common/rd.c diff -u src/sys/arch/hp300/stand/common/rd.c:1.15 src/sys/arch/hp300/stand/common/rd.c:1.15.2.1 --- src/sys/arch/hp300/stand/common/rd.c:1.15 Fri Nov 25 13:06:27 2022 +++ src/sys/arch/hp300/stand/common/rd.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.15 2022/11/25 13:06:27 tsutsui Exp $ */ +/* $NetBSD: rd.c,v 1.15.2.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -235,7 +235,7 @@ rdgetinfo(struct rd_softc *rs) printf("rdgetinfo: rdstrategy error %d\n", err); return 0; } - + msg = getdisklabel(io_buf, lp); if (msg) { printf("rd(%d,%d,%d): WARNING: %s\n", Index: src/sys/arch/hp300/stand/common/scsi.c diff -u src/sys/arch/hp300/stand/common/scsi.c:1.11 src/sys/arch/hp300/stand/common/scsi.c:1.11.60.1 --- src/sys/arch/hp300/stand/common/scsi.c:1.11 Thu Jan 2 17:43:32 2014 +++ src/sys/arch/hp300/stand/common/scsi.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: scsi.c,v 1.11 2014/01/02 17:43:32 tsutsui Exp $ */ +/* $NetBSD: scsi.c,v 1.11.60.1 2024/06/22 10:57:10 martin Exp $ */ /* * This is reported to fix some odd failures when disklabeling @@ -82,7 +82,7 @@ scsiinit(void) struct scsi_softc *hs; int i; static int waitset = 0; - + i = 0; for (hw = sc_table; i < NSCSI && hw < &sc_table[MAXCTLRS]; hw++) { if (!HW_ISSCSI(hw)) @@ -400,6 +400,19 @@ scsi_read_capacity(int ctlr, int slave, DATA_IN_PHASE); } +#ifdef SUPPORT_CD +int +scsi_inquiry(int ctlr, int slave, uint8_t *buf, unsigned int len) +{ + struct scsi_softc *hs = &scsi_softc[ctlr]; + static struct scsi_cdb6 cdb = { CMD_INQUIRY }; + + cdb.len = len; + return scsiicmd(hs, slave, (uint8_t *)&cdb, sizeof(cdb), buf, len, + DATA_IN_PHASE); +} +#endif + int scsi_tt_read(int ctlr, int slave, uint8_t *buf, u_int len, daddr_t blk, u_int nblk) Index: src/sys/arch/hp300/stand/common/scsireg.h diff -u src/sys/arch/hp300/stand/common/scsireg.h:1.4 src/sys/arch/hp300/stand/common/scsireg.h:1.4.48.1 --- src/sys/arch/hp300/stand/common/scsireg.h:1.4 Mon Sep 7 03:49:45 2015 +++ src/sys/arch/hp300/stand/common/scsireg.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: scsireg.h,v 1.4 2015/09/07 03:49:45 dholland Exp $ */ +/* $NetBSD: scsireg.h,v 1.4.48.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1990, 1993 @@ -274,6 +274,9 @@ struct scsi_xsense { /* inquiry data */ struct scsi_inquiry { u_char type; +#define SID_TYPE 0x1f +#define T_DIRECT 0x00 +#define T_CDROM 0x05 u_char qual; u_char version; u_char rsvd; @@ -319,7 +322,7 @@ struct scsi_modesel_hdr { u_int number_blocks :24; u_int rsvd3 : 8; u_int block_length :24; -}; +}; struct scsi_modesense_hdr { u_char len; @@ -331,14 +334,14 @@ struct scsi_modesense_hdr { u_int number_blocks :24; u_int rsvd2 : 8; u_int block_length :24; -}; +}; /* * Mode Select / Mode sense "pages" */ /* - * Page One - Error Recovery Parameters + * Page One - Error Recovery Parameters */ struct scsi_err_recovery { u_char page_savable : 1; /* save parameters */ @@ -406,7 +409,7 @@ struct scsi_format { }; /* - * Page Four - Rigid Disk Drive Geometry Parameters + * Page Four - Rigid Disk Drive Geometry Parameters */ struct scsi_geometry { u_char page_savable : 1; /* save parameters */ Index: src/sys/arch/hp300/stand/common/scsivar.h diff -u src/sys/arch/hp300/stand/common/scsivar.h:1.4 src/sys/arch/hp300/stand/common/scsivar.h:1.4.196.1 --- src/sys/arch/hp300/stand/common/scsivar.h:1.4 Sun Dec 11 12:17:19 2005 +++ src/sys/arch/hp300/stand/common/scsivar.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: scsivar.h,v 1.4 2005/12/11 12:17:19 christos Exp $ */ +/* $NetBSD: scsivar.h,v 1.4.196.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -52,5 +52,6 @@ void scsiabort(struct scsi_softc *, vola int scsi_test_unit_rdy(int, int); int scsi_request_sense(int, int, u_char *, unsigned int); int scsi_read_capacity(int, int, u_char *, unsigned int); +int scsi_inquiry(int, int, u_char *, unsigned int); int scsi_tt_read(int, int, u_char *, u_int, daddr_t, u_int); int scsi_tt_write(int, int, u_char *, u_int, daddr_t, u_int); Index: src/sys/arch/hp300/stand/common/sd.c diff -u src/sys/arch/hp300/stand/common/sd.c:1.11 src/sys/arch/hp300/stand/common/sd.c:1.11.84.1 --- src/sys/arch/hp300/stand/common/sd.c:1.11 Sun Jul 17 20:54:40 2011 +++ src/sys/arch/hp300/stand/common/sd.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.11 2011/07/17 20:54:40 joerg Exp $ */ +/* $NetBSD: sd.c,v 1.11.84.1 2024/06/22 10:57:10 martin Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -67,6 +67,9 @@ struct sd_softc { char sc_alive; short sc_blkshift; struct sdminilabel sc_pinfo; +#ifdef SUPPORT_CD + uint8_t sc_type; +#endif }; #define SDRETRY 2 @@ -82,6 +85,9 @@ sdinit(int ctlr, int unit) { struct sd_softc *ss = &sd_softc[ctlr][unit]; u_char stat; +#ifdef SUPPORT_CD + struct scsi_inquiry inqbuf; +#endif int capbuf[2]; stat = scsi_test_unit_rdy(ctlr, unit); @@ -97,6 +103,20 @@ sdinit(int ctlr, int unit) return 0; } } +#ifdef SUPPORT_CD + /* + * try to get the disk type. + */ + memset(&inqbuf, 0, sizeof(inqbuf)); + stat = scsi_inquiry(ctlr, unit, (u_char *)&inqbuf, sizeof(inqbuf)); + if (stat == 0) { + /* to fake a disklabel on CD-ROM */ + ss->sc_type = inqbuf.type & SID_TYPE; + } else { + /* assume a disk by default */ + ss->sc_type = T_DIRECT; + } +#endif /* * try to get the drive block size. */ @@ -138,14 +158,25 @@ sdgetinfo(struct sd_softc *ss) printf("sdgetinfo: sdstrategy error %d\n", err); return 0; } - + msg = getdisklabel(io_buf, lp); if (msg) { - printf("sd(%d,%d,%d): WARNING: %s\n", - ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg); - pi->npart = 3; - pi->offset[0] = pi->offset[1] = -1; - pi->offset[2] = 0; +#ifdef SUPPORT_CD + if (ss->sc_type == T_CDROM) { + /* assume a whole disk region is ISO9660 */ + pi->npart = 3; + pi->offset[0] = 0; + pi->offset[1] = -1; + pi->offset[2] = 0; + } else +#endif + { + printf("sd(%d,%d,%d): WARNING: %s\n", + ss->sc_ctlr, ss->sc_unit, ss->sc_part, msg); + pi->npart = 3; + pi->offset[0] = pi->offset[1] = -1; + pi->offset[2] = 0; + } } else { pi->npart = lp->d_npartitions; for (i = 0; i < pi->npart; i++) @@ -173,7 +204,7 @@ sdopen(struct open_file *f, ...) printf("sdopen: ctlr=%d unit=%d part=%d\n", ctlr, unit, part); #endif - + if (ctlr >= NSCSI || scsialive(ctlr) == 0) return EADAPT; if (unit >= NSD) @@ -252,6 +283,6 @@ retry: goto retry; } *rsize = size; - + return 0; } Index: src/sys/arch/hp300/stand/inst/Makefile diff -u src/sys/arch/hp300/stand/inst/Makefile:1.10.26.1 src/sys/arch/hp300/stand/inst/Makefile:1.10.26.2 --- src/sys/arch/hp300/stand/inst/Makefile:1.10.26.1 Sat May 11 14:38:40 2024 +++ src/sys/arch/hp300/stand/inst/Makefile Sat Jun 22 10:57:11 2024 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.10.26.1 2024/05/11 14:38:40 martin Exp $ +# $NetBSD: Makefile,v 1.10.26.2 2024/06/22 10:57:11 martin Exp $ -PROGAOUT= inst +PROGELF= inst PROGSOURCE= inst.c NEWVERSWHAT= "Miniroot Installer" Index: src/sys/arch/hp300/stand/inst/inst.c diff -u src/sys/arch/hp300/stand/inst/inst.c:1.24 src/sys/arch/hp300/stand/inst/inst.c:1.24.2.1 --- src/sys/arch/hp300/stand/inst/inst.c:1.24 Sun Dec 11 06:20:07 2022 +++ src/sys/arch/hp300/stand/inst/inst.c Sat Jun 22 10:57:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: inst.c,v 1.24 2022/12/11 06:20:07 tsutsui Exp $ */ +/* $NetBSD: inst.c,v 1.24.2.1 2024/06/22 10:57:11 martin Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: + * must display the following acknowledgement: * This product includes software developed at Ludd, University of * Lule}, Sweden and its contributors. * 4. The name of the author may not be used to endorse or promote products Index: src/sys/arch/hp300/stand/mkboot/Makefile diff -u src/sys/arch/hp300/stand/mkboot/Makefile:1.11 src/sys/arch/hp300/stand/mkboot/Makefile:1.11.196.1 --- src/sys/arch/hp300/stand/mkboot/Makefile:1.11 Sun Dec 11 12:17:23 2005 +++ src/sys/arch/hp300/stand/mkboot/Makefile Sat Jun 22 10:57:11 2024 @@ -1,5 +1,6 @@ -# $NetBSD: Makefile,v 1.11 2005/12/11 12:17:23 christos Exp $ +# $NetBSD: Makefile,v 1.11.196.1 2024/06/22 10:57:11 martin Exp $ +WARNS=5 NOMAN= # defined PROG= mkboot Index: src/sys/arch/hp300/stand/mkboot/mkboot.c diff -u src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11 src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11.50.1 --- src/sys/arch/hp300/stand/mkboot/mkboot.c:1.11 Sat Oct 11 05:33:25 2014 +++ src/sys/arch/hp300/stand/mkboot/mkboot.c Sat Jun 22 10:57:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $ */ +/* $NetBSD: mkboot.c,v 1.11.50.1 2024/06/22 10:57:11 martin Exp $ */ /* * Copyright (c) 1990, 1993 @@ -38,57 +38,70 @@ #include <sys/cdefs.h> #ifndef lint -__COPYRIGHT( -"@(#) Copyright (c) 1990, 1993\n\ - The Regents of the University of California. All rights reserved.\n"); +__COPYRIGHT("@(#) Copyright (c) 1990, 1993\ +The Regents of the University of California. All rights reserved."); #endif /* not lint */ #ifndef lint #ifdef notdef static char sccsid[] = "@(#)mkboot.c 7.2 (Berkeley) 12/16/90"; #endif -__RCSID("$NetBSD: mkboot.c,v 1.11 2014/10/11 05:33:25 dholland Exp $"); +__RCSID("$NetBSD: mkboot.c,v 1.11.50.1 2024/06/22 10:57:11 martin Exp $"); #endif /* not lint */ #include <sys/param.h> #include <sys/file.h> #include <sys/stat.h> -#ifndef HAVE_NBTOOL_CONFIG_H +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#include "../../sys/sys/bootblock.h" +#else +#include <sys/bootblock.h> #include <sys/endian.h> #endif #include <time.h> #include <ctype.h> +#include <err.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include "volhdr.h" - #define LIF_NUMDIR 8 #define LIF_VOLSTART 0 -#define LIF_VOLSIZE sizeof(struct lifvol) +#define LIF_VOLSIZE sizeof(struct hp300_lifvol) #define LIF_DIRSTART 512 -#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) +#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct hp300_lifdir)) #define LIF_FILESTART 8192 -#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE) -#define lifstob(s) ((s) * SECTSIZE) +#define btolifs(b) (((b) + (HP300_SECTSIZE - 1)) / HP300_SECTSIZE) +#define lifstob(s) ((s) * HP300_SECTSIZE) -int lpflag; -int loadpoint; -struct load ld; -struct lifvol lifv; -struct lifdir lifd[LIF_NUMDIR]; +#define bintobcd(bin) ((((bin) / 10) << 4) | ((bin) % 10)) + +static uint32_t loadpoint = ULONG_MAX; +static struct hp300_load ld; +static struct hp300_lifvol lifv; +static struct hp300_lifdir lifd[LIF_NUMDIR]; +static time_t repro_epoch = 0; int main(int, char **); -void bcddate(char *, char *); -char *lifname(char *); -int putfile(char *, int); -void usage(void); + +static void bcddate(char *, char *); +static char *lifname(char *); +static size_t putfile(char *, int); +static void usage(void); + +#ifndef __CTASSERT +#define __CTASSERT(X) +#endif + +#define CLEAR(a, b, c) \ +__CTASSERT(sizeof(b) - 1 == c); \ +memcpy((a), (b), (c)) /* * Old Format: @@ -109,153 +122,154 @@ void usage(void); int main(int argc, char **argv) { - char *n1, *n2, *n3; - int n, to; - int count; - - --argc; - ++argv; - if (argc == 0) - usage(); - if (!strcmp(argv[0], "-l")) { - argv++; - argc--; - if (argc == 0) + char *name1, *name2, *name3; + int to, ch; + uint32_t count, nsec; + + while ((ch = getopt(argc, argv, "l:t:")) != -1) + switch (ch) { + case 'l': + loadpoint = strtoul(optarg, NULL, 0); + break; + case 't': + repro_epoch = (time_t)atoll(optarg); + break; + default: usage(); - sscanf(argv[0], "0x%x", &loadpoint); - lpflag++; - argv++; - argc--; - } - if (!lpflag || argc == 0) + } + + argc -= optind; + argv += optind; + if (loadpoint == ULONG_MAX || argc == 0) usage(); - n1 = argv[0]; + name1 = argv[0]; argv++; argc--; if (argc == 0) usage(); if (argc > 1) { - n2 = argv[0]; + name2 = argv[0]; argv++; argc--; if (argc > 1) { - n3 = argv[0]; + name3 = argv[0]; argv++; argc--; } else - n3 = NULL; + name3 = NULL; } else - n2 = n3 = NULL; + name2 = name3 = NULL; + + if ((to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644)) == -1) + err(1, "Can't open `%s'", argv[0]); - to = open(argv[0], O_WRONLY | O_TRUNC | O_CREAT, 0644); - if (to < 0) { - perror("open"); - exit(1); - } /* clear possibly unused directory entries */ - strncpy(lifd[1].dir_name, " ", 10); - lifd[1].dir_type = htobe16(-1); + CLEAR(lifd[1].dir_name, " ", sizeof(lifd[1].dir_name)); + lifd[1].dir_type = htobe16(0xFFFF); lifd[1].dir_addr = htobe32(0); lifd[1].dir_length = htobe32(0); - lifd[1].dir_flag = htobe16(0xFF); + lifd[1].dir_flag = htobe16(0x00FF); lifd[1].dir_exec = htobe32(0); lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1]; + /* record volume info */ - lifv.vol_id = htobe16(VOL_ID); - strncpy(lifv.vol_label, "BOOT43", 6); + lifv.vol_id = htobe16(HP300_VOL_ID); + CLEAR(lifv.vol_label, "BOOT43", sizeof(lifv.vol_label)); lifv.vol_addr = htobe32(btolifs(LIF_DIRSTART)); - lifv.vol_oct = htobe16(VOL_OCT); + lifv.vol_oct = htobe16(HP300_VOL_OCT); lifv.vol_dirsize = htobe32(btolifs(LIF_DIRSIZE)); lifv.vol_version = htobe16(1); + /* output bootfile one */ lseek(to, LIF_FILESTART, SEEK_SET); - count = putfile(n1, to); - n = btolifs(count); - strcpy(lifd[0].dir_name, lifname(n1)); - lifd[0].dir_type = htobe16(DIR_TYPE); + count = putfile(name1, to); + nsec = btolifs(count); + strcpy(lifd[0].dir_name, lifname(name1)); + lifd[0].dir_type = htobe16(HP300_DIR_TYPE); lifd[0].dir_addr = htobe32(btolifs(LIF_FILESTART)); - lifd[0].dir_length = htobe32(n); - bcddate(n1, lifd[0].dir_toc); - lifd[0].dir_flag = htobe16(DIR_FLAG); + lifd[0].dir_length = htobe32(nsec); + bcddate(name1, lifd[0].dir_toc); + lifd[0].dir_flag = htobe16(HP300_DIR_FLAG); lifd[0].dir_exec = htobe32(loadpoint); lifv.vol_length = htobe32(be32toh(lifd[0].dir_addr) + - be32toh(lifd[0].dir_length)); + be32toh(lifd[0].dir_length)); + /* if there is an optional second boot program, output it */ - if (n2) { - lseek(to, LIF_FILESTART+lifstob(n), SEEK_SET); - count = putfile(n2, to); - n = btolifs(count); - strcpy(lifd[1].dir_name, lifname(n2)); - lifd[1].dir_type = htobe16(DIR_TYPE); + if (name2 != NULL) { + lseek(to, LIF_FILESTART + lifstob(nsec), SEEK_SET); + count = putfile(name2, to); + nsec = btolifs(count); + strcpy(lifd[1].dir_name, lifname(name2)); + lifd[1].dir_type = htobe16(HP300_DIR_TYPE); lifd[1].dir_addr = htobe32(lifv.vol_length); - lifd[1].dir_length = htobe32(n); - bcddate(n2, lifd[1].dir_toc); - lifd[1].dir_flag = htobe16(DIR_FLAG); + lifd[1].dir_length = htobe32(nsec); + bcddate(name2, lifd[1].dir_toc); + lifd[1].dir_flag = htobe16(HP300_DIR_FLAG); lifd[1].dir_exec = htobe32(loadpoint); lifv.vol_length = htobe32(be32toh(lifd[1].dir_addr) + - be32toh(lifd[1].dir_length)); + be32toh(lifd[1].dir_length)); } + /* ditto for three */ - if (n3) { - lseek(to, LIF_FILESTART+lifstob(lifd[0].dir_length+n), - SEEK_SET); - count = putfile(n3, to); - n = btolifs(count); - strcpy(lifd[2].dir_name, lifname(n3)); - lifd[2].dir_type = htobe16(DIR_TYPE); + if (name3 != NULL) { + lseek(to, LIF_FILESTART + lifstob(lifd[0].dir_length + nsec), + SEEK_SET); + count = putfile(name3, to); + nsec = btolifs(count); + strcpy(lifd[2].dir_name, lifname(name3)); + lifd[2].dir_type = htobe16(HP300_DIR_TYPE); lifd[2].dir_addr = htobe32(lifv.vol_length); - lifd[2].dir_length = htobe32(n); - bcddate(n3, lifd[2].dir_toc); - lifd[2].dir_flag = htobe16(DIR_FLAG); + lifd[2].dir_length = htobe32(nsec); + bcddate(name3, lifd[2].dir_toc); + lifd[2].dir_flag = htobe16(HP300_DIR_FLAG); lifd[2].dir_exec = htobe32(loadpoint); lifv.vol_length = htobe32(be32toh(lifd[2].dir_addr) + - be32toh(lifd[2].dir_length)); + be32toh(lifd[2].dir_length)); } + /* output volume/directory header info */ lseek(to, LIF_VOLSTART, SEEK_SET); write(to, &lifv, LIF_VOLSIZE); lseek(to, LIF_DIRSTART, SEEK_SET); write(to, lifd, LIF_DIRSIZE); - exit(0); + + return EXIT_SUCCESS; } -int +static size_t putfile(char *from, int to) { int fd; struct stat statb; - int nr; void *bp; - if ((fd = open(from, 0)) < 0) { - printf("error: unable to open file %s\n", from); - exit(1); - } + if ((fd = open(from, 0)) < 0) + err(EXIT_FAILURE, "Unable to open file `%s'", from); fstat(fd, &statb); ld.address = htobe32(loadpoint); ld.count = htobe32(statb.st_size); - bp = malloc(statb.st_size); - if ((nr = read(fd, bp, statb.st_size)) < 0) { - printf("error: reading from file %s\n", from); - exit(1); - } + if ((bp = malloc(statb.st_size)) == NULL) + err(EXIT_FAILURE, "Can't allocate buffer"); + if (read(fd, bp, statb.st_size) < 0) + err(EXIT_FAILURE, "Error reading from file `%s'", from); (void)close(fd); write(to, &ld, sizeof(ld)); write(to, bp, statb.st_size); free(bp); - return (statb.st_size + sizeof(ld)); + + return statb.st_size + sizeof(ld); } -void +static void usage(void) { - fprintf(stderr, - "usage: mkboot -l loadpoint prog1 [ prog2 ] outfile\n"); - exit(1); + fprintf(stderr, "Usage: %s -l <loadpoint> [-t <timestamp>] prog1 " + "[ prog2 ] outfile\n", getprogname()); + exit(EXIT_FAILURE); } -char * +static char * lifname(char *str) { static char lname[10] = "SYS_XXXXX"; @@ -265,37 +279,36 @@ lifname(char *str) if ((cp = strrchr(str, '/')) != NULL) str = ++cp; for (i = 4; i < 9; i++) { - if (islower(*str)) - lname[i] = toupper(*str); - else if (isalnum(*str) || *str == '_') + if (islower((unsigned char)*str)) + lname[i] = toupper((unsigned char)*str); + else if (isalnum((unsigned char)*str) || *str == '_') lname[i] = *str; else break; str++; } - for ( ; i < 10; i++) + for (; i < 10; i++) lname[i] = '\0'; - return(lname); + + return lname; } -void +static void bcddate(char *name, char *toc) { struct stat statb; struct tm *tm; - stat(name, &statb); - tm = localtime(&statb.st_ctime); - *toc = ((tm->tm_mon+1) / 10) << 4; - *toc++ |= (tm->tm_mon+1) % 10; - *toc = (tm->tm_mday / 10) << 4; - *toc++ |= tm->tm_mday % 10; - *toc = (tm->tm_year / 10) << 4; - *toc++ |= tm->tm_year % 10; - *toc = (tm->tm_hour / 10) << 4; - *toc++ |= tm->tm_hour % 10; - *toc = (tm->tm_min / 10) << 4; - *toc++ |= tm->tm_min % 10; - *toc = (tm->tm_sec / 10) << 4; - *toc |= tm->tm_sec % 10; + if (repro_epoch != 0) + tm = gmtime(&repro_epoch); + else { + stat(name, &statb); + tm = localtime(&statb.st_ctime); + } + *toc++ = bintobcd(tm->tm_mon + 1); + *toc++ = bintobcd(tm->tm_mday); + *toc++ = bintobcd(tm->tm_year); + *toc++ = bintobcd(tm->tm_hour); + *toc++ = bintobcd(tm->tm_min); + *toc = bintobcd(tm->tm_sec); } Index: src/sys/arch/hp300/stand/uboot/Makefile diff -u src/sys/arch/hp300/stand/uboot/Makefile:1.10.2.1 src/sys/arch/hp300/stand/uboot/Makefile:1.10.2.2 --- src/sys/arch/hp300/stand/uboot/Makefile:1.10.2.1 Sat May 11 14:38:40 2024 +++ src/sys/arch/hp300/stand/uboot/Makefile Sat Jun 22 10:57:11 2024 @@ -1,11 +1,12 @@ -# $NetBSD: Makefile,v 1.10.2.1 2024/05/11 14:38:40 martin Exp $ +# $NetBSD: Makefile,v 1.10.2.2 2024/06/22 10:57:11 martin Exp $ -PROGAOUT= uboot +PROGELF= uboot PROGSOURCE= uboot.c tgets.c NEWVERSWHAT= "Primary Boot" CPPFLAGS+= -DSUPPORT_ETHERNET -DSUPPORT_TAPE -DSUPPORT_DISK CPPFLAGS+= -DSUPPORT_UFS2 +CPPFLAGS+= -DSUPPORT_CD LINKS= ${BINDIR}/${PROG} ${BINDIR}/rdboot LINKS+= ${BINDIR}/${PROG} ${BINDIR}/bootrd Index: src/sys/fs/cd9660/cd9660_extern.h diff -u src/sys/fs/cd9660/cd9660_extern.h:1.27 src/sys/fs/cd9660/cd9660_extern.h:1.27.30.1 --- src/sys/fs/cd9660/cd9660_extern.h:1.27 Wed Aug 22 01:05:23 2018 +++ src/sys/fs/cd9660/cd9660_extern.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_extern.h,v 1.27 2018/08/22 01:05:23 msaitoh Exp $ */ +/* $NetBSD: cd9660_extern.h,v 1.27.30.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1994 @@ -100,10 +100,11 @@ extern int (**cd9660_vnodeop_p)(void *); extern int (**cd9660_specop_p)(void *); extern int (**cd9660_fifoop_p)(void *); +ino_t isodirino(struct iso_directory_record *, struct iso_mnt *); +#endif /* _KERNEL */ + int isochar(const u_char *, const u_char *, int, u_int16_t *); int isofncmp(const u_char *, size_t, const u_char *, size_t, int); void isofntrans(const u_char *, int, u_char *, u_short *, int, int, int, int); -ino_t isodirino(struct iso_directory_record *, struct iso_mnt *); -#endif /* _KERNEL */ #endif /* _ISOFS_CD9660_CD9660_EXTERN_H_ */ Index: src/sys/fs/cd9660/cd9660_util.c diff -u src/sys/fs/cd9660/cd9660_util.c:1.14 src/sys/fs/cd9660/cd9660_util.c:1.14.48.1 --- src/sys/fs/cd9660/cd9660_util.c:1.14 Wed Mar 9 20:18:17 2016 +++ src/sys/fs/cd9660/cd9660_util.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_util.c,v 1.14 2016/03/09 20:18:17 christos Exp $ */ +/* $NetBSD: cd9660_util.c,v 1.14.48.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 1994 @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #ifdef _KERNEL -__KERNEL_RCSID(0, "$NetBSD: cd9660_util.c,v 1.14 2016/03/09 20:18:17 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd9660_util.c,v 1.14.48.1 2024/06/22 10:57:10 martin Exp $"); #else /* used by macppc_installboot */ #if HAVE_NBTOOL_CONFIG_H @@ -63,14 +63,14 @@ __KERNEL_RCSID(0, "$NetBSD: cd9660_util. #include <assert.h> #include <dirent.h> #define KASSERT(x) assert(x) /* XXX for <fs/unicode.h> */ + +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include <sys/endian.h> /* for le16dec(9) etc. in iso.h */ +#endif #endif #include <fs/cd9660/iso.h> -#ifdef _KERNEL #include <fs/cd9660/cd9660_extern.h> -#else -static int isochar(const u_char *, const u_char *, int, uint16_t *); -#endif #include <fs/unicode.h> Index: src/sys/sys/bootblock.h diff -u src/sys/sys/bootblock.h:1.58 src/sys/sys/bootblock.h:1.58.40.1 --- src/sys/sys/bootblock.h:1.58 Sat Apr 29 00:05:35 2017 +++ src/sys/sys/bootblock.h Sat Jun 22 10:57:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: bootblock.h,v 1.58 2017/04/29 00:05:35 nonaka Exp $ */ +/* $NetBSD: bootblock.h,v 1.58.40.1 2024/06/22 10:57:11 martin Exp $ */ /*- * Copyright (c) 2002-2004 The NetBSD Foundation, Inc. @@ -949,41 +949,41 @@ struct apple_blockzeroblock { /* volume header for "LIF" format volumes */ struct hp300_lifvol { - int16_t vol_id; - char vol_label[6]; - int32_t vol_addr; - int16_t vol_oct; - int16_t vol_dummy; - int32_t vol_dirsize; - int16_t vol_version; - int16_t vol_zero; - int32_t vol_huh1; - int32_t vol_huh2; - int32_t vol_length; + uint16_t vol_id; + char vol_label[6]; + uint32_t vol_addr; + uint16_t vol_oct; + uint16_t vol_dummy; + uint32_t vol_dirsize; + uint16_t vol_version; + uint16_t vol_zero; + uint32_t vol_huh1; + uint32_t vol_huh2; + uint32_t vol_length; }; /* LIF directory entry format */ struct hp300_lifdir { - char dir_name[10]; - int16_t dir_type; - int32_t dir_addr; - int32_t dir_length; - char dir_toc[6]; - int16_t dir_flag; - int32_t dir_exec; + char dir_name[10]; + uint16_t dir_type; + uint32_t dir_addr; + uint32_t dir_length; + char dir_toc[6]; + uint16_t dir_flag; + uint32_t dir_exec; }; /* load header for boot rom */ struct hp300_load { - int32_t address; - int32_t count; + uint32_t address; + uint32_t count; }; -#define HP300_VOL_ID -32768 +#define HP300_VOL_ID 0x8000 /* always $8000 */ #define HP300_VOL_OCT 4096 -#define HP300_DIR_TYPE -5822 -#define HP300_DIR_FLAG 0x8001 /* dont ask me! */ +#define HP300_DIR_TYPE 0xe942 /* "SYS9k Series 9000" */ +#define HP300_DIR_FLAG 0x8001 /* don't ask me! */ #define HP300_SECTSIZE 256 Index: src/tools/Makefile.nbincludes diff -u src/tools/Makefile.nbincludes:1.5 src/tools/Makefile.nbincludes:1.5.24.1 --- src/tools/Makefile.nbincludes:1.5 Wed Sep 14 00:41:04 2016 +++ src/tools/Makefile.nbincludes Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.nbincludes,v 1.5 2016/09/14 00:41:04 christos Exp $ +# $NetBSD: Makefile.nbincludes,v 1.5.24.1 2024/06/22 10:57:10 martin Exp $ # NOxxx definitions are copied from Makefile.host, and are # required before .include <bsd.own.mk>. The include of bsd.own.mk @@ -15,12 +15,15 @@ _ARCHDIR= ${.CURDIR}/../../sys/arch _INCDIR= ${.CURDIR}/../../include _SYSDIR= ${.CURDIR}/../../sys/sys _UFSDIR= ${.CURDIR}/../../sys/ufs +_FSDIR:= ${.CURDIR}/../../sys/fs _SUBDIR!= cd ${_ARCHDIR} && ${MAKE} -V SUBDIR .if make(depend) || make(all) || make(dependall) || make(install) # There's no need to run these commands for "make cleandir" or "make obj", # and TOOL_SED will not yet have been built. _UFS_INCS!= cd ${_UFSDIR} && find ffs ufs -name '*.h' +_FS_INCS!= cd ${_FSDIR} && find cd9660 -name '*.h' +_FS_INCS+= unicode.h _ARCH_INCS!= ${TOOL_SED} -e 's/^\#.*//' ${.CURDIR}/../headerlist .endif @@ -43,6 +46,8 @@ beforedepend: ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/sys ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/ufs + ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/fs + ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/fs/cd9660 cd ${_ARCHDIR} && \ ${TOOL_PAX} -s /include\\/// -rw ${_ARCH_INCS} \ ${TOOLDIR}/include/nbinclude @@ -52,5 +57,7 @@ beforedepend: ${TOOL_PAX} -rw ${_SYSINCS} ${TOOLDIR}/include/nbinclude/sys cd ${_UFSDIR} && \ ${TOOL_PAX} -rw ${_UFS_INCS} ${TOOLDIR}/include/nbinclude/ufs + cd ${_FSDIR} && \ + ${TOOL_PAX} -rw ${_FS_INCS} ${TOOLDIR}/include/nbinclude/fs cd ${TOOLDIR}/include/nbinclude && rm -f machine && \ ${HOST_INSTALL_SYMLINK} ${MACHINE} machine Index: src/usr.sbin/installboot/Makefile diff -u src/usr.sbin/installboot/Makefile:1.56 src/usr.sbin/installboot/Makefile:1.56.6.1 --- src/usr.sbin/installboot/Makefile:1.56 Sun Sep 6 07:20:31 2020 +++ src/usr.sbin/installboot/Makefile Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.56 2020/09/06 07:20:31 mrg Exp $ +# $NetBSD: Makefile,v 1.56.6.1 2024/06/22 10:57:10 martin Exp $ # .include <bsd.own.mk> @@ -69,9 +69,31 @@ SRCS+= ffs_bswap.c #SRCS+= ext2fs.c ext2fs_bswap.c .endif +.if !empty(ARCH_FILES:C/(hp300|macppc)/cd9660/:Mcd9660.c) && \ + !defined(SMALLPROG) +CPPFLAGS+= -DSUPPORT_CD9660 +SRCS+= cd9660.c cd9660_util.c + +.if !make(obj) && !make(clean) && !make(cleandir) +.BEGIN: + -rm -rf fs + ${HOST_INSTALL_DIR} fs + ${HOST_INSTALL_DIR} fs/cd9660 + ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/unicode.h fs + ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/cd9660/iso.h fs/cd9660 + ${HOST_LN} -s ${NETBSDSRCDIR}/sys/fs/cd9660/cd9660_extern.h fs/cd9660 +.endif + +cleandir distclean: cleaninc + +cleaninc: + -rm -rf fs +.endif + UFSSRC= ${NETBSDSRCDIR}/sys/ufs +CD9660SRC= ${NETBSDSRCDIR}/sys/fs/cd9660 CPPFLAGS+= -I${.CURDIR} -I. -.PATH: ${.CURDIR}/arch ${UFSSRC}/ffs ${UFSSRC}/ext2fs +.PATH: ${.CURDIR}/arch ${UFSSRC}/ffs ${UFSSRC}/ext2fs ${CD9660SRC} .if !defined(HOSTPROGNAME) .for f in i386 macppc Index: src/usr.sbin/installboot/fstypes.c diff -u src/usr.sbin/installboot/fstypes.c:1.13 src/usr.sbin/installboot/fstypes.c:1.13.56.1 --- src/usr.sbin/installboot/fstypes.c:1.13 Thu Jan 14 16:27:49 2010 +++ src/usr.sbin/installboot/fstypes.c Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: fstypes.c,v 1.13 2010/01/14 16:27:49 tsutsui Exp $ */ +/* $NetBSD: fstypes.c,v 1.13.56.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(__lint) -__RCSID("$NetBSD: fstypes.c,v 1.13 2010/01/14 16:27:49 tsutsui Exp $"); +__RCSID("$NetBSD: fstypes.c,v 1.13.56.1 2024/06/22 10:57:10 martin Exp $"); #endif /* !__lint */ #include <sys/types.h> @@ -48,11 +48,33 @@ __RCSID("$NetBSD: fstypes.c,v 1.13 2010/ struct ib_fs fstypes[] = { #ifndef NO_STAGE2 - { .name = "ffs", .match = ffs_match, .findstage2 = ffs_findstage2 }, - { .name = "raid", .match = raid_match, .findstage2 = ffs_findstage2 }, - { .name = "raw", .match = raw_match, .findstage2 = raw_findstage2 }, + { + .name = "ffs", + .match = ffs_match, + .findstage2 = ffs_findstage2 + }, + { + .name = "raid", + .match = raid_match, + .findstage2 = ffs_findstage2 + }, +#ifdef SUPPORT_CD9660 + { + .name = "cd9660", + .match = cd9660_match, + .findstage2 = cd9660_findstage2 + }, #endif - { .name = NULL, } + /* raw_match() always matches, so raw should be at the end. */ + { + .name = "raw", + .match = raw_match, + .findstage2 = raw_findstage2 + }, +#endif + { + .name = NULL + } }; #ifndef NO_STAGE2 Index: src/usr.sbin/installboot/installboot.8 diff -u src/usr.sbin/installboot/installboot.8:1.105 src/usr.sbin/installboot/installboot.8:1.105.2.1 --- src/usr.sbin/installboot/installboot.8:1.105 Fri Aug 19 00:50:08 2022 +++ src/usr.sbin/installboot/installboot.8 Sat Jun 22 10:57:10 2024 @@ -1,6 +1,6 @@ -.\" $NetBSD: installboot.8,v 1.105 2022/08/19 00:50:08 riastradh Exp $ +.\" $NetBSD: installboot.8,v 1.105.2.1 2024/06/22 10:57:10 martin Exp $ .\" -.\" Copyright (c) 2002-2019 The NetBSD Foundation, Inc. +.\" Copyright (c) 2002-2023 The NetBSD Foundation, Inc. .\" All rights reserved. .\" .\" This code is derived from software contributed to The NetBSD Foundation @@ -27,7 +27,12 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd December 5, 2021 +. +.\" Prevent accidental hyphenation after the hyphen in "U-Boot" +.\" Usage: \*(UB +.ds UB U\(hyBoot +. +.Dd May 19, 2024 .Dt INSTALLBOOT 8 .Os .Sh NAME @@ -73,7 +78,7 @@ into .Ar filesystem , or disable an existing bootstrap in .Ar filesystem . -.Ss Traditional Nx boot +.Ss Traditional NetBSD boot Generally, .Nx disk bootstrap software consists of two parts: a @@ -86,7 +91,10 @@ and a bootstrap program that usually resides as an ordinary file in the file system. .Pp When booting, the primary bootstrap program is loaded and invoked by -the machine's PROM or BIOS. +the machine's +.Tn PROM +or +.Tn BIOS . After receiving control of the system it loads and runs the secondary bootstrap program, which in turn loads and runs the kernel. The secondary bootstrap may allow control over various boot parameters @@ -95,18 +103,23 @@ passed to the kernel. Perform the following steps to make a file system bootable: .Bl -enum .It -Copy the secondary bootstrap (usually -.Pa /usr/mdec/boot. Ns Sy MACHINE +Copy the secondary bootstrap +.Po +usually +.Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^ or -.Pa /usr/mdec/boot ) +.Pa /usr/mdec/boot +.Pc to the root directory of the target file system. . .It Use .Nm to install the primary bootstrap program -(usually -.Pa /usr/mdec/bootxx_ Ns Sy FSTYPE ) +.Po +usually +.Pa /usr/mdec/bootxx_ Ns Aq Ar FSTYPE\^ +.Pc into .Ar filesystem . .Pp @@ -142,44 +155,63 @@ information to Information about known boards and their requirements is loaded from a database at run-time. Sometimes these platforms also require the use of 3rd-party boot loader -software, such as -.Sy U-Boot . +software, such as \*(UB. To support these platforms, .Nm scans known locations for these 3rd-party boot loader packages for database overlays that contain additional board-specific boot loader installation information in a file called -.Sq installboot.plist . +.Pa installboot.plist . .Pp The following platforms have this requirement and utilize this database overlay feature: .Sy evbarm . .Ss UEFI boot -On platforms that boot with UEFI, there is a single boot loader in the -EFI system partition at -.Pa EFI/boot/boot Ns Va ARCH Ns Pa .efi +On platforms that boot with +.Tn UEFI , +there is a single boot loader in the +.Tn EFI +system partition at +.Pa EFI/boot/boot Ns Ao Ar ARCH\^ Ac Ns Pa .efi where -.Va ARCH -is the UEFI name for the architecture, such as -.Li ia32 Pq Nx Ns /i386 , -.Li x64 Pq Nx Ns /amd64 , +.Ar ARCH +is the +.Tn UEFI +name for the architecture, such as +.Li ia32 +.Pq Nx Ns /i386 , +.Li x64 +.Pq Nx Ns /amd64 , or -.Li aa64 Pq Nx Ns /aarch64 . +.Li aa64 +.Pq Nx Ns /aarch64 . .Pp .Nm -is not needed for UEFI boot. -However, it may be used on a platform that supports UEFI boot to make a +is not needed for +.Tn UEFI +boot. +However, it may be used on a platform that supports +.Tn UEFI +boot to make a hybrid image that can be booted .Em either -with UEFI boot or with, e.g., BIOS or U-Boot. -Hybrid images may also require a special GPT for BIOS boot; see +with +.Tn UEFI +boot or with, e.g., +.Tn BIOS +or \*(UB. +Hybrid images may also require a special +.Tn GPT +for +.Tn BIOS +boot; see .Xr gpt 8 . .Ss Options The options and arguments recognized by .Nm are as follows: . -.Bl -tag -width "optionsxxx" +.Bl -tag -width Fl . .It Fl B Ar s2bno When hard-coding the blocks of @@ -194,9 +226,11 @@ by examining .Ar filesystem . If this option is supplied, .Ar secondary -should refer to an actual secondary bootstrap (rather than the -file name of the one present in -.Ar filesystem ) +should refer to an actual secondary bootstrap +.Po +rather than the file name of the one present in +.Ar filesystem +.Pc so that its size can be determined. . .It Fl b Ar s1bno @@ -206,7 +240,11 @@ at block number .Ar s1bno instead of the default location for the machine and file system type. .Sy [ alpha , -.Sy i386/amd64 (bootxx_fat16 only) , +.Sy i386/amd64 +.Po +.Pa bootxx_fat16 +only +.Pc , .Sy pmax , .Sy vax ] . @@ -215,7 +253,9 @@ Clear (remove) any existing bootstrap in . .It Fl e Edit the options of an existing bootstrap. -This can be used to change the options in bootxx_xxxfs files, +This can be used to change the options in +.Pa bootxx_ Ns Aq Ar FSTYPE\^ +files, raw disk partitions, and the .Pa pxeboot_ia32.bin file. @@ -238,30 +278,30 @@ as the target machine type. The default machine is determined from .Xr uname 3 and then -.Ev MACHINE . -The following machines are currently supported by -.Nm : +.Ev MACHINE +environment variable. +The following machines are currently supported: .Bd -ragged -offset indent -.Sy alpha , -.Sy amd64 , -.Sy amiga , -.Sy evbarm , -.Sy ews4800mips , -.Sy hp300 , -.Sy hppa , -.Sy i386 , -.Sy landisk , -.Sy macppc , -.Sy news68k , -.Sy newsmips , -.Sy next68k , -.Sy pmax , -.Sy sparc , -.Sy sparc64 , -.Sy sun2 , -.Sy sun3 , -.Sy vax , -.Sy x68k +.Ic alpha , +.Ic amd64 , +.Ic amiga , +.Ic evbarm , +.Ic ews4800mips , +.Ic hp300 , +.Ic hppa , +.Ic i386 , +.Ic landisk , +.Ic macppc , +.Ic news68k , +.Ic newsmips , +.Ic next68k , +.Ic pmax , +.Ic sparc , +.Ic sparc64 , +.Ic sun2 , +.Ic sun3 , +.Ic vax , +.Ic x68k .Ed . . @@ -274,17 +314,18 @@ Machine specific .Nm options, comma separated. .Pp -Supported options are (with the machines for they are valid in brackets): +Supported options are +.Pq with the machines for they are valid in brackets : . -.Bl -tag -offset indent -width alphasum +.Bl -tag -width Ic . -.It Sy alphasum +.It Ic alphasum .Sy [ alpha ] Recalculate and restore the Alpha checksum. This is the default for .Nx Ns /alpha . . -.It Sy append +.It Ic append .Sy [ alpha , .Sy pmax , .Sy vax ] @@ -294,7 +335,7 @@ to the end of .Ar filesystem , which must be a regular file in this case. . -.It Sy board=<board name> +.It Ic board Ns Op Ns Li = Ns Ar type .Sy [ evbarm ] Specify the board type used to determine the correct boot loader image and installation procedure. @@ -303,55 +344,71 @@ If omitted, will attempt to guess the board type based on system information if run natively. . -.It Sy bootconf +.It Ic bootconf .Sy [ amd64 , .Sy i386 ] (Don't) read a -.Dq boot.cfg +.Pa boot.cfg file. . -.It Sy command=<boot command> +.It Ic command Ns Li = Ns Ar commandline .Sy [ amiga ] Modify the default boot command line. . -.It Sy console=<console name> +.It Ic console Ns Li = Ns Ar name .Sy [ amd64 , .Sy i386 ] -Set the console device, <console name> must be one of: -pc, com0, com1, com2, com3, com0kbd, com1kbd, com2kbd, com3kbd or auto. +Set the console device. +.Ar name +must be one of: +.Ic pc , +.Ic com0 , +.Ic com1 , +.Ic com2 , +.Ic com3 , +.Ic com0kbd , +.Ic com1kbd , +.Ic com2kbd , +.Ic com3kbd , +or +.Ic auto . . -.It Sy dtb=/path/to/dtb/file +.It Ic dtb Ns Li = Ns Ar dtbfile .Sy [ evbarm ] Attempt to determine the board type from information in the device tree blob file at -.Pa /path/to/dtb/file . +.Ar dtbfile . If both -.Sy board +.Ic board and -.Sy dtb +.Ic dtb options are specified, -.Sy board +.Ic board takes precendence. . -.It Sy ioaddr=<ioaddr> +.It Ic ioaddr Ns Li = Ns Ar ioaddr .Sy [ amd64 , .Sy i386 ] Set the IO address to be used for the console serial port. -Defaults to the IO address used by the system BIOS for the specified port. +Defaults to the IO address used by the system +.Tn BIOS +for the specified port. . -.It Sy keymap=<keymap> +.It Ic keymap Ns Li = Ns Ar keymap .Sy [ amd64 , .Sy i386 ] Set a boot time keyboard translation map. -Each character in <keymap> will be replaced by the one following it. +Each character in +.Ar keymap +will be replaced by the one following it. For example, an argument of -.Dq zyz +.Li zyz would swap the lowercase letters -.Sq y +.Aq y and -.Sq z . +.Aq z . . -.It Sy media=<media type> +.It Ic media Ns Li = Ns Ar type .Sy [ evbarm ] Some boards require a different boot loader binary and/or installation procedure depending on what type of media will be used to boot the system. @@ -359,31 +416,35 @@ For such boards, this option is required usage message that lists the valid media types for the board. For boards that do not require special media handling, this option is not allowed. -Common values: sdmmc, emmc, usb. +Common values: +.Ic sdmmc , +.Ic emmc , +.Ic usb . . -.It Sy modules +.It Ic modules .Sy [ amd64 , .Sy i386 ] (Don't) load kernel modules. . -.It Sy password=<password> +.It Ic password Ns Li = Ns Ar password .Sy [ amd64 , .Sy i386 ] Set the password which must be entered before the boot menu can be accessed. . -.It Sy resetvideo +.It Ic resetvideo .Sy [ amd64 , .Sy i386 ] Reset the video before booting. . -.It Sy speed=<baud rate> +.It Ic speed Ns Li = Ns Ar baud .Sy [ amd64 , .Sy i386 ] Set the baud rate for the serial console. If a value of zero is specified, then the current baud rate (set by the -BIOS) will be used. +.Tn BIOS ) +will be used. . -.It Sy sunsum +.It Ic sunsum .Sy [ alpha , .Sy pmax , .Sy vax ] @@ -395,7 +456,7 @@ The existing .Nx Ns /sparc disklabel should use no more than 4 partitions. . -.It Sy timeout=<seconds> +.It Ic timeout Ns Li = Ns Ar seconds .Sy [ amd64 , .Sy i386 ] Set the timeout before the automatic boot begins to the given number of seconds. @@ -407,22 +468,25 @@ Use as the type of .Ar filesystem . The default operation is to attempt to auto-detect this setting. -The following file system types are currently supported by -.Nm : +The following file system types are currently supported by: . -.Bl -tag -offset indent -width raid +.Bl -tag -width Ic . -.It Sy ffs +.It Ic ffs .Bx Fast File System. . -.It Sy raid +.It Ic raid Mirrored RAIDframe File System. . -.It Sy raw -.Sq Raw +.It Ic cd9660 +ISO 9660 File System. +. +.It Ic raw +.Dq Raw image. -Note: if a platform needs to hard-code the block offset of the secondary +.Em Note : +if a platform needs to hard-code the block offset of the secondary bootstrap, it cannot be searched for on this file system type, and must be provided with .Fl B Ar s2bno . @@ -431,19 +495,17 @@ be provided with .It Fl u Ar U-Boot-paths .Ar U-Boot-paths is a colon-separated list of search paths to scan for -.Sy U-Boot -packages with -.Nm installboot +\*(UB packages with +.Nm installation overlays. If multiple overlays are found, overlays from paths closer to the front of the list take precedence. -If not specified, environment variable +If not specified, environment variable .Ev INSTALLBOOT_UBOOT_PATHS is used if defined; otherwise, the default path is .Pa /usr/pkg/share/u-boot . This option is only used on platforms that support -using -.Sy U-Boot . +using \*(UB. . .It Fl v Verbose operation. @@ -476,7 +538,7 @@ Most systems require to be in the .Dq root directory of the file system, so the leading -.Dq Pa / +.Ql / is not necessary on .Ar secondary . .Pp @@ -501,29 +563,21 @@ These are: .It sun3 Ta ffs, raw .El .El -.Pp -.Nm -exits 0 on success, and >0 if an error occurs. . .Sh ENVIRONMENT -.Nm -uses the following environment variables: -. -.Bl -tag -width "MACHINE" +.Bl -tag -width Ev . .It Ev INSTALLBOOT_UBOOT_PATHS A colon-separated list of search paths to scan for -.Sy U-Boot -packages with -.Nm installboot +\*(UB packages with +.Nm installation overlays. If multiple overlays are found, overlays from paths closer to the front of the list take precedence. If not specified, the default path is .Pa /usr/pkg/share/u-boot . This environment variable is only used on platforms that support -using -.Sy U-Boot . +using \*(UB. . .It Ev MACHINE Default value for @@ -537,29 +591,32 @@ overriding the result from Most .Nx ports will contain variations of the following files: -.Bl -tag -width /usr/mdec/bootxx_ustarfs +.Bl -tag -width Pa . -.It Pa /usr/mdec/bootxx_ Ns Sy FSTYPE +.It Pa /usr/mdec/bootxx_ Ns Aq Ar FSTYPE\^ Primary bootstrap for file system type -.Sy FSTYPE . +.Ar FSTYPE . Installed into the bootstrap area of the file system by .Nm . . .It Pa /usr/mdec/bootxx_fat16 -Primary bootstrap for MS-DOS +Primary bootstrap for +.Tn MS-DOS .Sy FAT16 file systems. This differs from -.Nm bootxx_msdos +.Pa bootxx_msdos in that it doesn't require the filesystem to have been initialised with any -.Ql reserved sectors . +.Dq reserved sectors . It also uses the information in the -.Ql Boot Parameter Block +.Dq Boot Parameter Block to get the media and filesystem properties. The -.Ql hidden sectors -field of the BPB must be the offset of the partition in the disk. +.Dq hidden sectors +field of the +.Tn BPB +must be the offset of the partition in the disk. This can be set using the .Fl b Ar s1bno option. @@ -568,24 +625,27 @@ option. Primary bootstrap for .Sy FFSv1 file systems -(the -.Ql traditional +.Po +the +.Dq traditional file system prior to -.Nx 6.0 ) . +.Nx 6.0 +.Pc . Use .Xr dumpfs 8 -to confirm the file system format is -.Sy FFSv1 . +to confirm the file system format is FFSv1. . .It Pa /usr/mdec/bootxx_ffsv2 Primary bootstrap for .Sy FFSv2 -file systems (the default file system for some platforms as of -.Nx 6.0 ) . +file systems +.Po +the default file system for some platforms as of +.Nx 6.0 +.Pc . Use .Xr dumpfs 8 -to confirm the file system format is -.Sy FFSv2 . +to confirm the file system format is FFSv2. . .It Pa /usr/mdec/bootxx_lfsv1 Primary bootstrap for @@ -596,10 +656,11 @@ file systems. Primary bootstrap for .Sy LFSv2 file systems -(the default LFS version). +.Pq the default Tn LFS version . . .It Pa /usr/mdec/bootxx_msdos -Primary bootstrap for MS-DOS +Primary bootstrap for +.Tn MS-DOS .Sy FAT file systems. . @@ -609,77 +670,78 @@ Primary bootstrap for boot images. This is used by various install media. . -.It Pa /usr/mdec/boot. Ns Sy MACHINE +.It Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^ Secondary bootstrap for machine type -.Sy MACHINE . +.Ar MACHINE . This should be installed into the file system before .Nm is run. . .It Pa /usr/mdec/boot Synonym for -.Pa /usr/mdec/boot. Ns Sy MACHINE +.Pa /usr/mdec/boot. Ns Aq Ar MACHINE\^ . -.It Pa /boot. Ns Sy MACHINE +.It Pa /boot. Ns Aq Ar MACHINE\^ Installed copy of secondary bootstrap for machine type -.Sy MACHINE . +.Ar MACHINE . . .It Pa /boot Installed copy of secondary bootstrap. Searched for by the primary bootstrap if -.Pa /boot. Ns Sy MACHINE +.Pa /boot. Ns Aq Ar MACHINE\^ is not found. . .El . -.Ss Nx Ns /evbarm files +.Ss NetBSD/evbarm files The .Nx Ns /evbarm -platform covers a wide variety of board types, many of which use -.Sy U-Boot . +platform covers a wide variety of board types, many of which use \*(UB. Running .Nm with no options will display a list of known boards. Using the verbose option will also display information about which -.Sy U-Boot -package needs to be installed to support that board, and if the required -.Sy U-Boot -package is installed, the path at which it is located. -.Bl -tag -width /usr/pkg/share/u-boot +\*(UB package needs to be installed to support that board, +and if the required \*(UB package is installed, +the path at which it is located. +.Bl -tag -width Pa .It Pa /usr/pkg/share/u-boot The default location scanned for -.Sy U-Boot -packages with installation overlays. +\*(UB packages with installation overlays. .It Pa /usr/share/installboot/evbarm/boards.plist Base board database, used to provide information about which -.Sy U-Boot -package is required for a given board. +\*(UB package is required for a given board. .El . -.Ss Nx Ns /evbmips files +.Ss NetBSD/evbmips files . The .Nx Ns /evbmips -bootstrap files currently only apply to the SBMIPS kernels for the -SiByte/Broadcom BCM1250 and BCM1480 CPUs. -.Bl -tag -width /usr/mdec/sbmips/bootxx_cd9660 +bootstrap files currently only apply to the +.Tn SBMIPS +kernels for the +SiByte/Broadcom +.Tn BCM1250 +and +.Tn BCM1480 +CPUs. +.Bl -tag -width Pa . .It Pa /usr/mdec/sbmips/boot .Nx Ns /evbmips -secondary bootstrap for -.Sy FFSv1 , -.Sy FFSv2 , -.Sy LFSv1 , -and -.Sy LFSv2 . +secondary bootstrap for FFSv1, FFSv2, LFSv1, and LFSv2. .It Pa /usr/mdec/sbmips/bootxx_cd9660 -SBMIPS primary bootstrap for ISO 9660 file system. +.Tn SBMIPS +primary bootstrap for ISO 9660 file system. .It Pa /usr/mdec/sbmips/bootxx_ffs -SBMIPS primary bootstrap for FFSv1 and FFSv2 file system. +.Tn SBMIPS +primary bootstrap for FFSv1 and FFSv2 file system. .It Pa /usr/mdec/sbmips/bootxx_lfs -SBMIPS primary bootstrap for LFSv1 and LFSv2 file system. +.Tn SBMIPS +primary bootstrap for LFSv1 and LFSv2 file system. .It Pa /usr/mdec/sbmips/netboot -SBMIPS primary bootstrap for network root. +.Tn SBMIPS +primary bootstrap for network root. .Pp Note that .Nm @@ -687,18 +749,13 @@ does not currently support evbmips direc . .El . -.Ss Nx Ns /hppa files +.Ss NetBSD/hppa files . -.Bl -tag -width /usr/mdec/bootxx_ustarfs +.Bl -tag -width Pa . .It Pa /usr/mdec/xxboot .Nx Ns /hppa -primary bootstrap for -.Sy FFSv1 , -.Sy FFSv2 , -.Sy LFSv1 , -and -.Sy LFSv2 . +primary bootstrap for FFSv1, FFSv2, LFSv1, and LFSv2. .It Pa /usr/mdec/cdboot .Nx Ns /hppa primary bootstrap for ISO 9660 file system. @@ -708,9 +765,9 @@ Synonym for . .El . -.Ss Nx Ns /macppc files +.Ss NetBSD/macppc files . -.Bl -tag -width /usr/mdec/bootxx_ustarfs +.Bl -tag -width Pa . .It Pa /usr/mdec/bootxx .Nx Ns /macppc @@ -727,9 +784,9 @@ secondary bootstrap. . .El . -.Ss Nx Ns /next68k files +.Ss NetBSD/next68k files . -.Bl -tag -width /usr/mdec/bootxx_ustarfs +.Bl -tag -width Pa . .It Pa /usr/mdec/boot .Nx Ns /next68k @@ -737,9 +794,9 @@ bootstrap. . .El . -.Ss Nx Ns /sparc64 files +.Ss NetBSD/sparc64 files . -.Bl -tag -width /usr/mdec/bootxx_ustarfs +.Bl -tag -width Pa . .It Pa /usr/mdec/bootblk .Nx Ns /sparc64 @@ -758,72 +815,106 @@ secondary bootstrap. . .Sh EXAMPLES . -.Ss common +.Ss Common Verbosely install the Berkeley Fast File System primary bootstrap on to disk -.Sq sd0 : -.Dl Ic installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs +.Ql sd0 : +.Pp +.Dl installboot -v /dev/rsd0c /usr/mdec/bootxx_ffs +.Pp Note: the .Dq whole disk -partition (c on some ports, d on others) is used here, since the a partition -probably is already opened (mounted as -.Pa / ) , +partition +.Po +.Ql c +on some ports, +.Ql d +on others +.Pc +is used here, since the +.Ql a +partition +probably is already opened +.Po +mounted as +.Pa / +.Pc , so .Nm would not be able to access it. .Pp Remove the primary bootstrap from disk -.Sq sd1 : -.Dl Ic installboot -c /dev/rsd1c +.Ql sd1 : +.Pp +.Dl installboot -c /dev/rsd1c . -.Ss Nx Ns /amiga -Modify the command line to change the default from "netbsd -ASn2" to -"netbsd -S": -.Dl Ic installboot -m amiga -o command="netbsd -S" /dev/rsd0a /usr/mdec/bootxx_ffsv1 +.Ss NetBSD/amiga +Modify the command line to change the default from +.Ql "netbsd -ASn2" +to +.Ql "netbsd -S" : +.Bd -literal -offset indent +installboot -m amiga -o command="netbsd -S" /dev/rsd0a \e + /usr/mdec/bootxx_ffsv1 +.Ed . -.Ss Nx Ns /evbarm +.Ss NetBSD/evbarm Install the -.Sy U-Boot -boot loader for a Pinebook into an image that will be written to -an SDMMC card: -.Dl Ic installboot -m evbarm -o board=pine64,pinebook arm64.img -.Pp -Install / update the -.Sy U-Boot -boot loader for the current running system on the eMMC device -.Sq ld0 +\*(UB boot loader for a Pinebook into an image that will be written to +an +.Tn SDMMC +card: +.Pp +.Dl installboot -m evbarm -o board=pine64,pinebook arm64.img +.Pp +Install/update the +\*(UB boot loader for the current running system on the +.Tn eMMC +device +.Ql ld0 and display verbose information about the procedure: -.Dl Ic installboot -v /dev/rld0c +.Pp +.Dl installboot -v /dev/rld0c .Pp Install a specific -.Sy U-Boot -package for a BeagleBone Black into an image that will be written -to an SDMMC card: -.Dl Ic installboot -m evbarm -o board=ti,am335x-bone-black armv7.img \ - /path/to/experimental/u-boot/package +\*(UB package for a BeagleBone Black into an image that will be written +to an +.Tn SDMMC +card: +.Bd -literal -offset indent +installboot -m evbarm -o board=ti,am335x-bone-black armv7.img \e + /path/to/experimental/u-boot/package +.Ed . -.Ss Nx Ns /ews4800mips +.Ss NetBSD/ews4800mips Install the System V Boot File System primary bootstrap on to disk -.Sq sd0 , +.Ql sd0 , with the secondary bootstrap -.Sq Pa /boot +.Pa /boot already present in the SysVBFS partition on the disk: -.Dl Ic installboot /dev/rsd0p /usr/mdec/bootxx_bfs +.Pp +.Dl installboot /dev/rsd0p /usr/mdec/bootxx_bfs +.Pp .Bd -ragged -offset indent-two -compact .Em Note : On .Nx Ns /ews4800mips -the p partition is the +the +.Ql p +partition is the .Dq whole disk -(i.e., raw) partition. +.Pq i.e., raw +partition. .Ed -.Ss Nx Ns /i386 and Nx Ns /amd64 -Install new boot blocks on an existing -.Sy FFSv2 -mounted root file system on -.Sq wd0 , -setting the timeout to five seconds, after installing an MBR bootcode and -copying a new secondary bootstrap: -.Dl Ic fdisk -c /usr/mdec/mbr /dev/rwd0d +. +.Ss NetBSD/i386 and NetBSD/amd64 +Install new boot blocks on an existing FFSv2 mounted root file system on +.Ql wd0 , +setting the timeout to five seconds, after installing an +.Tn MBR +bootcode and copying a new secondary bootstrap: +.Pp +.Dl fdisk -c /usr/mdec/mbr /dev/rwd0d +.Pp .Bd -ragged -offset indent-two -compact .Em Note : See @@ -832,34 +923,39 @@ and .Xr x86/mbr 8 for more details. .Ed -.Dl Ic cp /usr/mdec/boot /boot -.Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2 +.Pp +.Dl cp /usr/mdec/boot /boot +.Dl installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2 +.Pp .Bd -ragged -offset indent-two -compact .Em Note : Pre .Nx 6.0 -systems used -.Sy FFSv1 -file systems on these platforms; double check with +systems used FFSv1 file systems on these platforms; double check with .Xr dumpfs 8 to be sure to use the correct secondary bootstrap. .Ed .Pp -Create a bootable CD-ROM with an ISO 9660 -file system for an i386 system with a serial console: -.Dl Ic mkdir cdrom -.Dl Ic cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd -.Dl Ic cp /usr/mdec/boot cdrom/boot -.Dl Ic cp /usr/mdec/bootxx_cd9660 bootxx -.Dl Ic installboot -o console=com0,speed=19200 -m i386 -e bootxx -.Dl Ic makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \ - cdrom +Create a bootable +.Tn CD-ROM +with an ISO 9660 file system for an i386 system with a serial console: +.Bd -literal -offset indent +mkdir cdrom +cp sys/arch/i386/compile/mykernel/netbsd cdrom/netbsd +cp /usr/mdec/boot cdrom/boot +cp /usr/mdec/bootxx_cd9660 bootxx +installboot -o console=com0,speed=19200 -m i386 -e bootxx +makefs -t cd9660 -o 'bootimage=i386;bootxx,no-emul-boot' boot.iso \e + cdrom +.Ed . .Pp Create a bootable floppy disk with an FFSv1 file system for a small custom kernel (note: bigger kernels needing multiple disks are handled with the ustarfs file system): -.Dl Ic newfs -s 1440k /dev/rfd0a +.Pp +.Dl newfs -s 1440k /dev/rfd0a +.Pp .Bd -ragged -offset indent-two -compact .Em Note : Ignore the warnings that @@ -867,59 +963,83 @@ Ignore the warnings that displays; it can not write a disklabel, which is not a problem for a floppy disk. .Ed -.Dl Ic mount /dev/fd0a /mnt -.Dl Ic cp /usr/mdec/boot /mnt/boot -.Dl Ic gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz -.Dl Ic umount /mnt -.Dl Ic installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1 +. +.Bd -literal -offset indent +mount /dev/fd0a /mnt +cp /usr/mdec/boot /mnt/boot +gzip -9 < sys/arch/i386/compile/mykernel/netbsd > /mnt/netbsd.gz +umount /mnt +installboot -v /dev/rfd0a /usr/mdec/bootxx_ffsv1 +.Ed . .Pp -Create a bootable FAT file system on -.Sq wd1a , -which should have the same offset and size as a FAT primary partition -in the Master Boot Record (MBR): -.Dl Ic newfs_msdos -r 16 /dev/rwd1a +Create a bootable +.Tn FAT +file system on +.Ql wd1a , +which should have the same offset and size as a +.Tn FAT +primary partition +in the Master Boot Record +.Tn ( MBR ) : +.Pp +.Dl newfs_msdos -r 16 /dev/rwd1a +.Pp .Bd -ragged -offset indent-two -compact .Em Notes : The -.Fl r Ar 16 +.Fl r Ic 16 is to reserve space for the primary bootstrap. .Xr newfs_msdos 8 will display an -.Dq MBR type +.Dq Tn MBR type such as .Ql 1 , .Ql 4 , or .Ql 6 ; -the MBR partition type of the appropriate primary partition should be +the +.Tn MBR +partition type of the appropriate primary partition should be changed to this value. .Ed -.Dl Ic mount -t msdos /dev/wd1a /mnt -.Dl Ic cp /usr/mdec/boot /mnt/boot -.Dl Ic cp path/to/kernel /mnt/netbsd -.Dl Ic umount /mnt -.Dl Ic installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos +. +.Bd -literal -offset indent +mount -t msdos /dev/wd1a /mnt +cp /usr/mdec/boot /mnt/boot +cp path/to/kernel /mnt/netbsd +umount /mnt +installboot -t raw /dev/rwd1a /usr/mdec/bootxx_msdos +.Ed .Pp -Make the existing FAT16 filesystem on -.Sq sd0e +Make the existing +.Tn FAT16 +filesystem on +.Ql sd0e bootable. -This can be used to make USB memory bootable provided it has 512 byte +This can be used to make +.Tn USB +memory bootable provided it has 512 byte sectors and that the manufacturer correctly initialised the file system. -.Dl Ic mount -t msdos /dev/sd0e /mnt -.Dl Ic cp /usr/mdec/boot /mnt/boot -.Dl Ic cp path/to/kernel /mnt/netbsd -.Dl Ic umount /mnt -.Dl Ic installboot /dev/rsd0e /usr/mdec/bootxx_fat16 +.Bd -literal -offset indent +mount -t msdos /dev/sd0e /mnt +cp /usr/mdec/boot /mnt/boot +cp path/to/kernel /mnt/netbsd +umount /mnt +installboot /dev/rsd0e /usr/mdec/bootxx_fat16 +.Ed +.Pp It may also be necessary to use -.Nm fdisk +.Xr fdisk 8 to make the device itself bootable. . .Pp Switch the existing installed bootstrap to use a serial console without reinstalling or altering other options such as timeout. -.Dl Ic installboot -e -o console=com0 /dev/rwd0a -.Ss Nx Ns /macppc +.Pp +.Dl installboot -e -o console=com0 /dev/rwd0a +. +.Ss NetBSD/macppc Note the .Nm utility is only required for macppc machines with OpenFirmware version 2 @@ -928,8 +1048,9 @@ OpenFirmware 3 cannot load bootblocks sp map. .Pp Install the Berkeley Fast File System primary bootstrap on to disk -.Sq wd0 : -.Dl Ic installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot +.Ql wd0 : +.Pp +.Dl installboot /dev/rwd0c /usr/mdec/bootxx /ofwboot .Pp The secondary .Nx Ns /macppc @@ -941,22 +1062,26 @@ The primary bootstrap requires the raw for the secondary bootstrap, not .Pa ofwboot.xcf , which is used for the OpenFirmware to load kernels. -.Ss Nx Ns /next68k +. +.Ss NetBSD/next68k Install the bootstrap on to disk -.Sq sd0 : -.Dl Ic installboot /dev/rsd0c /usr/mdec/boot +.Ql sd0 : +.Pp +.Dl installboot /dev/rsd0c /usr/mdec/boot . -.Ss Nx Ns /pmax +.Ss NetBSD/pmax Install the Berkeley Fast File System primary bootstrap on to disk -.Sq sd0 : -.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx_ffs +.Ql sd0 : +.Pp +.Dl installboot /dev/rsd0c /usr/mdec/bootxx_ffs .Pp .Nx Ns /pmax requires that this file system starts at block 0 of the disk. .Pp Install the ISO 9660 primary bootstrap in the file .Pa /tmp/cd-image : -.Dl Ic installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660 +.Pp +.Dl installboot -m pmax /tmp/cd-image /usr/mdec/bootxx_cd9660 .Pp Make an ISO 9660 filesystem in the file .Pa /tmp/cd-image @@ -966,37 +1091,57 @@ primary bootstrap .Pa bootxx_cd9660 and the secondary bootstrap .Pa boot.pmax : -.Dl Ic mkisofs -o /tmp/cd-image -a -l -v iso-source-dir -.Dl ... -.Dl 48 51 iso-source-dir/bootxx_cd9660 -.Dl ... -.Dl Ic installboot -b `expr 48 \e* 4` /tmp/cd-image /usr/mdec/bootxx_cd9660 +.Bd -literal -offset indent +mkisofs -o /tmp/cd-image -a -l -v iso-source-dir +\&... +48 51 iso-source-dir/bootxx_cd9660 +\&... +installboot -b $((48 * 4)) /tmp/cd-image /usr/mdec/bootxx_cd9660 +.Ed . -.Ss Nx Ns /sparc +.Ss NetBSD/sparc Install the Berkeley Fast File System primary bootstrap on to disk -.Sq sd0 , +.Ql sd0 , with the secondary bootstrap -.Sq Pa /boot +.Pa /boot already present: -.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot +.Pp +.Dl installboot /dev/rsd0c /usr/mdec/bootxx /boot . -.Ss Nx Ns /sparc64 +.Ss NetBSD/sparc64 Install the primary bootstrap on to disk -.Sq sd0 : -.Dl Ic installboot /dev/rsd0c /usr/mdec/bootblk +.Ql sd0 : +.Pp +.Dl installboot /dev/rsd0c /usr/mdec/bootblk .Pp The secondary .Nx Ns /sparc64 bootstrap is located in .Pa /usr/mdec/ofwboot . . -.Ss Nx Ns /sun2 and Nx Ns /sun3 +.Ss NetBSD/sun2 and NetBSD/sun3 Install the Berkeley Fast File System primary bootstrap on to disk -.Sq sd0 , +.Ql sd0 , with the secondary bootstrap -.Sq Pa /boot +.Pa /boot already present: -.Dl Ic installboot /dev/rsd0c /usr/mdec/bootxx /boot +.Pp +.Dl installboot /dev/rsd0c /usr/mdec/bootxx /boot +. +.Ss NetBSD/vax +Install the Berkeley Fast File System primary bootstrap on to disk +.Ql ra0 : +.Pp +.Dl installboot /dev/rra0c /usr/mdec/raboot +.Pp +The primary bootstrap works with FFSv1 and FFSv2 file systems. +The secondary +.Nx Ns /vax +bootstrap is located in +.Pa /usr/mdec/boot . +. +.Sh DIAGNOSTIC +.Ex -std . .Sh SEE ALSO .Xr uname 3 , @@ -1055,49 +1200,55 @@ There are not currently primary bootstra types which are capable of being the root file system. .Pp If a disk has been converted from -.Sy FFS +.Tn FFS to -.Sy RAID +.Tn RAID without the contents of the disk erased, then the original -.Sy FFS +.Tn FFS installation may be auto-detected instead of the -.Sy RAID +.Tn RAID installation. In this case, the -.Fl t Ar raid +.Fl t Ic raid option must be provided. . -.Ss Nx Ns /alpha +.Ss NetBSD/alpha The .Nx Ns /alpha primary bootstrap program can only load the secondary bootstrap program -from file systems starting at the beginning (block 0) of disks. +from file systems starting at the beginning +.Pq block 0 +of disks. Similarly, the secondary bootstrap program can only load kernels from file systems starting at the beginning of disks. .Pp The size of primary bootstrap programs is restricted to 7.5KB, even -though some file systems (e.g., ISO 9660) are able to accommodate larger -ones. +though some file systems +.Pq e.g., ISO 9660 +are able to accommodate larger ones. . -.Ss Nx Ns /hp300 +.Ss NetBSD/hp300 The disk must have a boot partition large enough to hold the bootstrap code. Currently the primary bootstrap must be a LIF format file. . -.Ss Nx Ns /i386 and Nx Ns /amd64 +.Ss NetBSD/i386 and NetBSD/amd64 The bootstrap must be installed in the .Nx -partition that starts at the beginning of the mbr partition. +partition that starts at the beginning of the +.Tn MBR +partition. If that is a valid filesystem and contains the .Pa /boot program then it will be used as the root filesystem, otherwise the -.Sq a +.Ql a partition will be booted. .Pp The size of primary bootstrap programs is restricted to 8KB, even -though some file systems (e.g., ISO 9660) are able to accommodate larger -ones. +though some file systems +.Pq e.g., ISO 9660 +are able to accommodate larger ones. . -.Ss Nx Ns /macppc +.Ss NetBSD/macppc Due to restrictions in .Nm and the secondary bootstrap implementation, file systems where kernels exist @@ -1110,24 +1261,24 @@ and always writes a faked map to make di .Pp The .Nx Ns /macppc -bootstrap program can't load kernels from -.Sy FFSv2 -partitions. -.Ss Nx Ns /next68k +bootstrap program can't load kernels from FFSv2 partitions. +. +.Ss NetBSD/next68k The size of bootstrap programs is restricted to the free space before the file system at the beginning of the disk minus 8KB. . -.Ss Nx Ns /pmax +.Ss NetBSD/pmax The .Nx Ns /pmax secondary bootstrap program can only load kernels from file systems starting at the beginning of disks. .Pp The size of primary bootstrap programs is restricted to 7.5KB, even -though some file systems (e.g., ISO 9660) are able to accommodate larger -ones. +though some file systems +.Pq e.g., ISO 9660 +are able to accommodate larger ones. . -.Ss Nx Ns /sun2 and Nx Ns /sun3 +.Ss NetBSD/sun2 and NetBSD/sun3 The .Nx Ns /sun2 and @@ -1135,12 +1286,13 @@ and secondary bootstrap program can only load kernels from file systems starting at the beginning of disks. . -.Ss Nx Ns /vax +.Ss NetBSD/vax The .Nx Ns /vax secondary bootstrap program can only load kernels from file systems starting at the beginning of disks. .Pp The size of primary bootstrap programs is restricted to 7.5KB, even -though some file systems (e.g., ISO 9660) are able to accommodate larger -ones. +though some file systems +.Pq e.g., ISO 9660 +are able to accommodate larger ones. Index: src/usr.sbin/installboot/installboot.h diff -u src/usr.sbin/installboot/installboot.h:1.43 src/usr.sbin/installboot/installboot.h:1.43.2.1 --- src/usr.sbin/installboot/installboot.h:1.43 Sun Jul 10 19:28:00 2022 +++ src/usr.sbin/installboot/installboot.h Sat Jun 22 10:57:10 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.h,v 1.43 2022/07/10 19:28:00 brook Exp $ */ +/* $NetBSD: installboot.h,v 1.43.2.1 2024/06/22 10:57:10 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -171,15 +171,23 @@ int shared_bbinfo_clearboot(ib_params * int shared_bbinfo_setboot(ib_params *, struct bbinfo_params *, int (*)(ib_params *, struct bbinfo_params *, uint8_t *)); - /* fstypes.c */ -int hardcode_stage2(ib_params *, uint32_t *, ib_block *); + /* cd9660.c */ +int cd9660_match(ib_params *); +int cd9660_findstage2(ib_params *, uint32_t *, ib_block *); + + /* ext2fs.c */ +int ext2fs_match(ib_params *); +int ext2fs_findstage2(ib_params *, uint32_t *, ib_block *); + + /* ffs.c */ int ffs_match(ib_params *); int ffs_findstage2(ib_params *, uint32_t *, ib_block *); int raid_match(ib_params *); + + /* fstypes.c */ +int hardcode_stage2(ib_params *, uint32_t *, ib_block *); int raw_match(ib_params *); int raw_findstage2(ib_params *, uint32_t *, ib_block *); -int ext2fs_match(ib_params *); -int ext2fs_findstage2(ib_params *, uint32_t *, ib_block *); /* machines.c */ extern struct ib_mach ib_mach_alpha; Index: src/usr.sbin/installboot/arch/hp300.c diff -u src/usr.sbin/installboot/arch/hp300.c:1.17 src/usr.sbin/installboot/arch/hp300.c:1.17.2.1 --- src/usr.sbin/installboot/arch/hp300.c:1.17 Sun Dec 5 05:01:50 2021 +++ src/usr.sbin/installboot/arch/hp300.c Sat Jun 22 10:57:11 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: hp300.c,v 1.17 2021/12/05 05:01:50 msaitoh Exp $ */ +/* $NetBSD: hp300.c,v 1.17.2.1 2024/06/22 10:57:11 martin Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include <sys/cdefs.h> #if !defined(__lint) -__RCSID("$NetBSD: hp300.c,v 1.17 2021/12/05 05:01:50 msaitoh Exp $"); +__RCSID("$NetBSD: hp300.c,v 1.17.2.1 2024/06/22 10:57:11 martin Exp $"); #endif /* !__lint */ /* We need the target disklabel.h, not the hosts one..... */ @@ -62,6 +62,9 @@ __RCSID("$NetBSD: hp300.c,v 1.17 2021/12 #include "installboot.h" +#define HP300_MAXBLOCKS 1 /* Only contiguous blocks are expected. */ +#define LIF_VOLDIRSIZE 1024 /* size of LIF volume header and directory */ + static int hp300_setboot(ib_params *); struct ib_mach ib_mach_hp300 = { @@ -77,6 +80,7 @@ hp300_setboot(ib_params *params) { int retval; uint8_t *bootstrap; + size_t bootstrap_size; ssize_t rv; struct partition *boot; struct hp300_lifdir *lifdir; @@ -84,6 +88,10 @@ hp300_setboot(ib_params *params) int i; unsigned int secsize = HP300_SECTSIZE; uint64_t boot_size, boot_offset; +#ifdef SUPPORT_CD9660 + uint32_t nblk; + ib_block *blocks; +#endif struct disklabel *label; assert(params != NULL); @@ -101,6 +109,64 @@ hp300_setboot(ib_params *params) goto done; } +#ifdef SUPPORT_CD9660 + if (params->stage2 != NULL) { + /* + * Use contiguous blocks of SYS_BOOT in the target filesystem + * (assuming ISO9660) for a LIF directory entry used + * by BOOTROM on bootstrap. + */ + if (strcmp(params->fstype->name, "cd9660") != 0) { + warn("Target filesystem `%s' is unexpected", + params->fstype->name); + } + + if (S_ISREG(params->fsstat.st_mode)) { + if (fsync(params->fsfd) == -1) + warn("Synchronising file system `%s'", + params->filesystem); + } else { + /* Don't allow real file systems for sanity */ + warnx("`%s' must be a regular file to append " + "a bootstrap", params->filesystem); + goto done; + } + + /* Allocate space for our block list. */ + nblk = HP300_MAXBLOCKS; + blocks = malloc(sizeof(*blocks) * nblk); + if (blocks == NULL) { + warn("Allocating %lu bytes for block list", + (unsigned long)sizeof(*blocks) * nblk); + goto done; + } + + /* Check the block of for the SYS_UBOOT in the target fs */ + if (!params->fstype->findstage2(params, &nblk, blocks)) + goto done; + + if (nblk == 0) { + warnx("Secondary bootstrap `%s' is empty", + params->stage2); + goto done; + } else if (nblk > 1) { + warnx("Secondary bootstrap `%s' doesn't have " + "contiguous blocks", params->stage2); + goto done; + } + + boot_offset = blocks[0].block * params->fstype->blocksize; + /* need to read only LIF volume and directories */ + bootstrap_size = LIF_VOLDIRSIZE; + + if ((params->flags & IB_VERBOSE) != 0) { + printf("Bootstrap `%s' found at offset %lu in `%s'\n", + params->stage2, (unsigned long)boot_offset, + params->filesystem); + } + + } else +#endif if (params->flags & IB_APPEND) { if (!S_ISREG(params->fsstat.st_mode)) { warnx( @@ -157,21 +223,38 @@ hp300_setboot(ib_params *params) } } - bootstrap = mmap(NULL, params->s1stat.st_size, PROT_READ | PROT_WRITE, - MAP_PRIVATE, params->s1fd, 0); - if (bootstrap == MAP_FAILED) { - warn("mmapping `%s'", params->stage1); - goto done; +#ifdef SUPPORT_CD9660 + if (params->stage2 != NULL) { + /* Use bootstrap file in the target filesystem. */ + bootstrap = mmap(NULL, bootstrap_size, + PROT_READ | PROT_WRITE, MAP_PRIVATE, params->fsfd, + boot_offset); + if (bootstrap == MAP_FAILED) { + warn("mmapping `%s'", params->filesystem); + goto done; + } + } else +#endif + { + /* Use bootstrap specified as stage1. */ + bootstrap_size = params->s1stat.st_size; + bootstrap = mmap(NULL, bootstrap_size, + PROT_READ | PROT_WRITE, MAP_PRIVATE, params->s1fd, 0); + if (bootstrap == MAP_FAILED) { + warn("mmapping `%s'", params->stage1); + goto done; + } } /* Relocate files, sanity check LIF directory on the way */ lifdir = (void *)(bootstrap + HP300_SECTSIZE * 2); for (i = 0; i < 8; lifdir++, i++) { - int32_t addr = be32toh(lifdir->dir_addr); - int32_t limit = (params->s1stat.st_size - 1) / HP300_SECTSIZE + 1; - int32_t end = addr + be32toh(lifdir->dir_length); + uint32_t addr = be32toh(lifdir->dir_addr); + uint32_t limit = (params->s1stat.st_size - 1) / HP300_SECTSIZE + + 1; + uint32_t end = addr + be32toh(lifdir->dir_length); if (end > limit) { - warnx("LIF entry %d larger (%d %d) than LIF file", + warnx("LIF entry %d larger (%u %u) than LIF file", i, end, limit); goto done; } @@ -186,8 +269,8 @@ hp300_setboot(ib_params *params) } /* Write LIF volume header and directory to sectors 0 and 1 */ - rv = pwrite(params->fsfd, bootstrap, 1024, 0); - if (rv != 1024) { + rv = pwrite(params->fsfd, bootstrap, LIF_VOLDIRSIZE, 0); + if (rv != LIF_VOLDIRSIZE) { if (rv == -1) warn("Writing `%s'", params->filesystem); else @@ -195,6 +278,17 @@ hp300_setboot(ib_params *params) goto done; } +#ifdef SUPPORT_CD9660 + if (params->stage2 != NULL) { + /* + * Bootstrap in the target filesystem is used. + * No need to write bootstrap to BOOT partition. + */ + retval = 1; + goto done; + } +#endif + /* Write files to BOOT partition */ offset = boot_offset <= HP300_SECTSIZE * 16 ? HP300_SECTSIZE * 16 : 0; i = roundup(params->s1stat.st_size, secsize) - offset; @@ -215,6 +309,6 @@ hp300_setboot(ib_params *params) if (label != NULL) free(label); if (bootstrap != MAP_FAILED) - munmap(bootstrap, params->s1stat.st_size); + munmap(bootstrap, bootstrap_size); return retval; } Added files: Index: src/usr.sbin/installboot/cd9660.c diff -u /dev/null src/usr.sbin/installboot/cd9660.c:1.2.2.2 --- /dev/null Sat Jun 22 10:57:12 2024 +++ src/usr.sbin/installboot/cd9660.c Sat Jun 22 10:57:10 2024 @@ -0,0 +1,237 @@ +/* $NetBSD: cd9660.c,v 1.2.2.2 2024/06/22 10:57:10 martin Exp $ */ + +/*- + * Copyright (c) 2005 Izumi Tsutsui. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if HAVE_NBTOOL_CONFIG_H +#include "nbtool_config.h" +#endif + +#include <sys/cdefs.h> +#if defined(__RCSID) && !defined(__lint) +__RCSID("$NetBSD: cd9660.c,v 1.2.2.2 2024/06/22 10:57:10 martin Exp $"); +#endif /* !__lint */ + +#include <sys/param.h> + +#if !HAVE_NBTOOL_CONFIG_H +#include <sys/mount.h> +#endif +#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H +#include <sys/endian.h> +#endif + +#include <assert.h> +#include <err.h> +#include <errno.h> +#include <fcntl.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <dirent.h> + +#include <fs/cd9660/iso.h> +#include <fs/cd9660/cd9660_extern.h> + +#include "installboot.h" + +#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#define MAXLEN 16 + + +int +cd9660_match(ib_params *params) +{ + int rv, blocksize; + struct iso_primary_descriptor ipd; + + assert(params != NULL); + assert(params->fstype != NULL); + assert(params->fsfd != -1); + + rv = pread(params->fsfd, &ipd, sizeof(ipd), + ISO_DEFAULT_BLOCK_SIZE * 16); + if (rv == -1) { + warn("Reading primary descriptor in `%s'", params->filesystem); + return 0; + } else if (rv != sizeof(ipd)) { + warnx("Reading primary descriptor in `%s': short read", + params->filesystem); + return 0; + } + + if (ipd.type[0] != ISO_VD_PRIMARY || + strncmp(ipd.id, ISO_STANDARD_ID, sizeof(ipd.id)) != 0 || + ipd.version[0] != 1) { + warnx("Filesystem `%s' is not ISO9660 format", + params->filesystem); + return 0; + } + + blocksize = isonum_723((u_char *)ipd.logical_block_size); + if (blocksize != ISO_DEFAULT_BLOCK_SIZE) { + warnx("Invalid blocksize %d in `%s'", + blocksize, params->filesystem); + return 0; + } + + params->fstype->blocksize = blocksize; + params->fstype->needswap = 0; + + return 1; +} + +int +cd9660_findstage2(ib_params *params, uint32_t *maxblk, ib_block *blocks) +{ + uint8_t buf[ISO_DEFAULT_BLOCK_SIZE]; + char name[ISO_MAXNAMLEN]; + char *stage2; + off_t loc; + int rv, blocksize, found; + u_int i; + struct iso_primary_descriptor ipd; + struct iso_directory_record *idr; + + assert(params != NULL); + assert(params->stage2 != NULL); + assert(maxblk != NULL); + assert(blocks != NULL); + +#if 0 + if (params->flags & IB_STAGE2START) + return hardcode_stage2(params, maxblk, blocks); +#endif + + /* The secondary bootstrap must be clearly in /. */ + strlcpy(name, params->stage2, ISO_MAXNAMLEN); + stage2 = name; + if (stage2[0] == '/') + stage2++; + if (strchr(stage2, '/') != NULL) { + warnx("The secondary bootstrap `%s' must be in / " + "on filesystem `%s'", params->stage2, params->filesystem); + return 0; + } + if (strchr(stage2, '.') == NULL) { + /* + * XXX should fix isofncmp()? + */ + strlcat(name, ".", ISO_MAXNAMLEN); + } + + rv = pread(params->fsfd, &ipd, sizeof(ipd), + ISO_DEFAULT_BLOCK_SIZE * 16); + if (rv == -1) { + warn("Reading primary descriptor in `%s'", params->filesystem); + return 0; + } else if (rv != sizeof(ipd)) { + warnx("Reading primary descriptor in `%s': short read", + params->filesystem); + return 0; + } + blocksize = isonum_723((u_char *)ipd.logical_block_size); + + idr = (void *)ipd.root_directory_record; + loc = (off_t)isonum_733(idr->extent) * blocksize; + rv = pread(params->fsfd, buf, blocksize, loc); + if (rv == -1) { + warn("Reading root directory record in `%s'", + params->filesystem); + return 0; + } else if (rv != sizeof(ipd)) { + warnx("Reading root directory record in `%s': short read", + params->filesystem); + return 0; + } + + found = 0; + for (i = 0; i < blocksize - sizeof(struct iso_directory_record); + i += (u_char)idr->length[0]) { + idr = (void *)&buf[i]; + +#ifdef DEBUG + printf("i = %d, idr->length[0] = %3d\n", + i, (u_char)idr->length[0]); +#endif + /* check end of entries */ + if (idr->length[0] == 0) { +#ifdef DEBUG + printf("end of entries\n"); +#endif + break; + } + + if (idr->flags[0] & 2) { + /* skip directory entries */ +#ifdef DEBUG + printf("skip directory entry\n"); +#endif + continue; + } + if (idr->name_len[0] == 1 && + (idr->name[0] == 0 || idr->name[0] == 1)) { + /* skip "." and ".." */ +#ifdef DEBUG + printf("skip dot dot\n"); +#endif + continue; + } +#ifdef DEBUG + { + int j; + + printf("filename:"); + for (j = 0; j < isonum_711(idr->name_len); j++) + printf("%c", idr->name[j]); + printf("\n"); + } +#endif + if (isofncmp((u_char *)stage2, strlen(stage2), + (u_char *)idr->name, + isonum_711((u_char *)idr->name_len), 0) == 0) { + found = 1; + /* ISO filesystem always has contiguous file blocks */ + blocks[0].block = (int64_t)isonum_733(idr->extent); + blocks[0].blocksize = + roundup(isonum_733(idr->size), blocksize); + *maxblk = 1; +#ifdef DEBUG + printf("block = %ld, blocksize = %ld\n", + (long)blocks[0].block, blocks[0].blocksize); +#endif + break; + } + } + + if (found == 0) { + warnx("Can't find secondary bootstrap `%s' in filesystem `%s'", + params->stage2, params->filesystem); + return 0; + } + + return 1; +}