Commit Graph

255 Commits

Author SHA1 Message Date
dsl f2ccbd036f Don't treat -f and an invalid flag.
Report the hex value of unknown unsupported (for the specified arch) flags.
2008-03-06 21:05:27 +00:00
mrg ecc90aa046 make all sun2 use -O0 and move most of the hacks out into just 3 files. 2008-02-09 02:37:21 +00:00
tsutsui 4da2d6da3a Add a findstage2 function (which returns block numbers where
the secondary boot is stored to embed them into the primary bootxx)
for ext2fs.

Currently disabled because there is no primary boot block
which supports ext2fs, but it might help someone in some day.
2008-02-02 17:01:03 +00:00
itohy 9ef5327a26 Try to warn possibly unbootable conditions:
- no disklabel
 - no partition "a"
 - partition "a" exceeds 2GB boundary
2008-02-02 16:46:15 +00:00
itohy d87794fe47 Change be32toh to htobe32 where applicable. 2008-02-02 13:37:13 +00:00
itohy 347910d40e d_npartitions field of struct disklabel is 16bit, not 32bit. 2008-02-02 13:09:47 +00:00
dsl 0c7234ef6a Note here that -e can be used on the pxeboot_ia32.bin file.
(It is already mentioned on the pxeboot(8) page.)
2007-07-05 19:49:53 +00:00
christos 115d8ccfd7 Don't use __arraycount because this is a 700L, and toolz have messed up
includes.
2007-06-23 23:18:29 +00:00
dogcow a7e26eabfd unb0rk tools/ builds on systems that don't have __arraycount() defined. 2007-06-23 23:07:44 +00:00
christos 1d3b6feacb PR/36527: Greg A. Woods: installboot(8) doesn't allow for the valid
consdev=auto setting
2007-06-23 14:46:00 +00:00
dyoung 0bb998a3f7 Bring the example concerning a bootable ISO9660 for i386 up-to-date,
demonstrating the -e option.
2007-06-01 20:56:23 +00:00
wiz aa4aca15b3 Sort SEE ALSO. 2007-02-17 08:45:36 +00:00
dsl 486d411937 Add a -f (force) parameter to installboot(8).
If specified then checks on the disks BPB are not done, and any existing BPB
is deleted.
This is needed soince newfs(8) doesn't overwrite the BPB - which is basically
the FAT superblock.
Update documentation and add an example of using bootxx_fat16.
2007-02-15 22:23:11 +00:00
wiz c598f926c7 Drop trailing space. 2007-01-08 07:15:06 +00:00
dogcow bee2705c99 %d -> %ld, so that building on alpha doesn't fail. (also print more useful
errors - x bytes written, should be y.)
2007-01-07 04:16:57 +00:00
dsl 2e4f7d3057 Document bootxx_fat16 with a short description of why it differs from
bootxx_msdos.
2007-01-06 20:51:54 +00:00
dsl eacd963375 Support for non-512 byte media.
Automatically enable writes to the 'labelsector' if necessary.
Detect and recover from problems with the write-protected 'labelsector'
  stopping writes to nearby sectors when the non-raw disk device is used.
Support the installation of 512-byte pbr boot code (eg fatboot).
Verify that there is enough reserved space in the bpb (if not all zeros) to
avoid overwriting the start of FAT filesystems.
2007-01-06 10:21:24 +00:00
wiz 5c1e8d4638 Reword OF3 restrictions, ok tsutsui@.
Bump date.
2006-12-23 19:50:20 +00:00
wiz ace0a0e43c New sentence, new line. Improve English. 2006-12-23 07:47:15 +00:00
tsutsui a261787514 Add some macppc specific description. Closes PR port-macppc/34496 by myself. 2006-11-25 15:12:02 +00:00
he 2f5213da05 In order to avoid warnings (which is converted to error with -Werror)
about empty bodies in an if-statement, we need to make add some proprocessor
conditionals around these if statements.  FFS byte-swapping is sometimes
compiled out of install-media versions of this program.
2006-10-30 07:03:34 +00:00
christos d1a5b782c3 buf can never be NULL (jani at xeebioneurope dot de) 2006-10-23 19:44:32 +00:00
christos f80d108fb1 fix initializers 2006-10-22 21:06:19 +00:00
christos 6846f1da94 remove dead code. 2006-10-22 21:05:28 +00:00
christos 34fd379e33 Coverity CID 4160: Remove dead code. 2006-09-27 21:22:52 +00:00
wiz 1192b414ab Mark up a path with .Pa. 2006-09-24 13:39:36 +00:00
martin f1dbb9068a Add a note to explain 'c' (or 'd') partition usage in the common example. 2006-09-24 13:28:50 +00:00
bad 4f0a5e9849 Apply changes to ffs_find_disk_blocks_ufs1() from revision 1.19
to ffs_find_disk_blocks_ufs2() too.  Except for data types the
code in the two functions is the same.

From the original commit message:
    Add support for finding files on RAID partitions.  This allows us to
    add the block list of the 2nd stage boot loader to the 1st stage boot
    loader when the partition is a RAID partition.

Briefly tested under 3.x/i386.
2006-09-20 21:49:12 +00:00
wiz e41d3cdc7d Bump date for previous. 2006-09-03 00:24:05 +00:00
uwe 85f8b5b279 Mention landisk as supported. 2006-09-02 16:18:02 +00:00
uwe 973bc97b66 NetBSD/landisk support. 2006-09-01 21:47:21 +00:00
jdc f00029f865 Don't include <dev/raidframe/raidframevar.h> but define RF_PROTECTED_SECTORS
directly.

Including raidframevar.h needs several definitions adding to the compat
framework for the tools builds, which aren't needed here.

XXX It's probably sensible to split off the few defines from raidframevar.h
    into a separate header file.
2006-06-20 14:04:22 +00:00
jdc 373c752392 Add support for finding files on RAID partitions. This allows us to
add the block list of the 2nd stage boot loader to the 1st stage boot
loader when the partition is a RAID partition.  Tested on sparc.

Reviewed by gdt.
2006-06-20 05:37:24 +00:00
mrg 16efbf8575 don't do the -Wno-pointer-sign dance for host programs. 2006-05-12 01:18:25 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
christos 98a919c136 Coverity CID 55: Do things in a different order to appease coverity. 2006-04-22 19:57:04 +00:00
dsl 1ec8e10fce Coverty 7449: Change 'return (0)' to 'goto done' so we free(bootstrapbuf)
before exiting with error.
2006-03-18 11:08:19 +00:00
dogcow 4c1a82844d Since installboot is part of tools, and TIOCGWINSZ is not present on all
systems (PR/32878), make the window sizing stuff conditional.

Also, fix formatting of 'supported file system types are' line.
2006-02-22 07:10:26 +00:00
dsl 959e130a7f Changes to allow support for a reduced set of architectures.
In particular if SMALLPROG is set (eg for installation crunched ramdiskbin)
only build for the current MACHINE.
2006-02-18 14:54:53 +00:00
dsl 2fdbc8bd5f The fstypes table is only needed for adding 'stage2' bootstraps on some
platforms.  Compile out the code if NO_STAGE2 is defined.
2006-02-18 12:45:15 +00:00
dsl 200e1792a1 Define the ib_mach_xxx entries here in a way that will allocate them into
the bss if the MD file isn't linked into the installboot image.
2006-02-18 12:43:36 +00:00
dsl b22a0afa5c Ignore entre is in the 'machines' table that have no name.
Use terminal with to break line of machine names.
2006-02-18 12:42:26 +00:00
dsl 8c767ff592 Remove support for byteswapped file systems if NO_FFS_SWAP is defined.
For SAMLLPROG builds.
2006-02-18 12:39:38 +00:00
dsl 13b9ae1e99 Best to declare these structures 'extern' ... 2006-02-18 11:01:51 +00:00
dsl cce659e230 Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
2006-02-18 10:08:07 +00:00
dsl 16ca1f6da7 Fix the detection of the bootstrap magic number when run on big-endian systems.
Correct another typo.
2006-01-30 21:15:37 +00:00
dsl 6c51ef9cb5 Fix spelling mistake in message 2006-01-24 18:35:18 +00:00
wiz 1a0cee1a1d Replace NetBSD with Nx. 2006-01-13 17:45:36 +00:00
tsutsui 4930ad54bc Note about ews4800mips. 2006-01-13 15:37:26 +00:00
tsutsui 3b1ef5e593 Add ews4800mips support. 2005-12-29 15:32:20 +00:00
jmmv e7ab8d7413 Installing the primary bootstrap requires two arguments, so ensure they are
present.  Otherwise, an assertion is triggered (and core is dumped) in the
MD setboot code (just try 'installboot /dev/fd0a' on, e.g., i386).
2005-12-26 13:30:25 +00:00
lukem 8dfe8b4d24 Update copyright years.
Whitespace tweaks.
2005-11-14 00:04:34 +00:00
wiz 43f9ef503c It is not 2006 yet. Fix typo. Uppercase BIOS. 2005-11-12 16:44:07 +00:00
dsl e0e1f6caed Don't try to determine the type of the target filesystem unless a second
stage bootstrap is specified.  It is only needed when we need to copy the
sector numbers of the second stage into the first stage.
Document that a configured baud rate of zero will cause the baud rate set by
the bios to be used.
2005-11-12 09:35:31 +00:00
wiz f72297cc7e Sync usage with man page (sort options). 2005-11-11 21:24:01 +00:00
wiz d1115a4c84 Keeps in SYNOPSIS are not necessary any longer, groff is smart enough nowadays.
Sort options and option descriptions.
2005-11-11 21:22:18 +00:00
dsl 8c893c964a Add a -e (edit) option to allow the bootstrap options of an installed
bootstrap or a file containing such a bootstrap to be changed/displayed.
In particular this will (soon) let you modify the parameters for pxeboot.
2005-11-11 21:09:50 +00:00
thorpej 327a57156c Use the real field name (d_fileno instead of d_ino). 2005-10-23 16:12:02 +00:00
dyoung d51694ecef Add single quotes to escape a semicolon in the makefs(8) argument
list.  Pointed out by Hubert Feyrer.
2005-10-10 05:41:28 +00:00
wiz 42a77e996d Punctuation nits; bump date for previous. 2005-10-06 10:43:45 +00:00
dyoung 92b3793d65 Add an example of using installboot(8) and makefs(8) with bootxx_cd9660
to create a bootable CD-ROM for an i386 host with a serial console.
2005-10-06 08:42:12 +00:00
christos c4ee9f6d2e 64 bit inode changes 2005-08-19 02:07:18 +00:00
hannken 5b2600ba63 Add option `ioaddr=<ioaddr>' to amd64. Already noted in man page.
Approved by: Frank van der Linden <fvdl@netbsd.org>
2005-07-16 10:43:00 +00:00
isaki 723dc0caf2 Use errx() rather than err() where appropriate. 2005-07-10 07:12:13 +00:00
dyoung 00218a63cc Oops, straggler: #include <nbinclude/sys/disklabel.h> if we're
building a host-tool.

XXX In hp300_setboot, quiet -Wunitialized: initialize secsize to
XXX HP300_SECTSIZE.  Is this correct?
2005-06-12 21:38:12 +00:00
dyoung dba4661556 Build hp300 support into installboot(8). 2005-06-12 20:25:26 +00:00
dyoung a039894d70 For portability, use 'unsigned int' instead of 'uint'. 2005-06-12 20:21:20 +00:00
he 0590642883 Initialize a local variable (bbinfop) to appease -Wuninitialized.
Marked with XXXGCC for sparc64 (found while compiling for it).

Reviewed by lukem.
2005-06-07 13:49:31 +00:00
chs 7bbdd188e1 appease gcc -Wuninitialized on hp700. 2005-06-05 19:08:28 +00:00
wiz 51a21e357b Add hp700 to supported list. Bump date. 2005-06-03 20:22:45 +00:00
lukem 1363df60c1 Don't try to use an uninitialized variable.
Detected with gcc -Wuninitialized.
2005-06-02 05:10:22 +00:00
chs 2438f5c3ad add hp700 support. 2005-05-14 14:46:21 +00:00
yamt b012ef443f revert a part of the previous. (uint -> u_int)
to make tools/installboot compile again.
2004-08-16 05:57:52 +00:00
dsl 0b10fdb3b8 Add an option to set bp_consaddr (serial console IO port address)
Only complain about small patch area if we would write something non-zero there.
2004-08-15 22:00:12 +00:00
wiz 9eb2f51613 Document amd64; from Nicolas Joly in PR 26026. 2004-06-25 15:08:45 +00:00
jmc b2f782612f Completely rework how tools/compat is done. Purge all uses/references to
_NETBSD_SOURCE as this makes cross building from older/newer versions of
NetBSD harder, not easier (and also makes the resulting tools 'different')

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

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

Fixes PR's: PR#17762 PR#25944
2004-06-20 22:20:14 +00:00
dsl 43d718b987 When searching for the superblock, don't pick an ffsv1 superblock from the
location where we expect to find an ffsv2 superblock.
It could be the first alternate for a ffsv1 filesystem with 64k blocks.
Fixes part of PR kern/24809
2004-03-21 21:18:40 +00:00
lukem 709e718d29 fix a typo in a comment, and expand the description of x86_boot_params. 2004-03-14 23:05:47 +00:00
wiz 46d960757a Add example to keymap description. Use more macros. Bump date. 2004-03-13 23:43:45 +00:00
dsl 7b024ef69c Add a -o keymap=zyz option that will set the boot keymap.
If a character in the map is typed, it gets replaced by the one following.
2004-03-13 22:51:50 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
wiz 2f701eb7e9 Use Xr instead of Ic when suitable; NetBSD -> .Nx; add comma;
use Dq for a string.
2003-11-26 09:02:52 +00:00
lukem f6d3e09d47 Provide an example for making a bootable FAT file system, and improve
some of the other examples.
2003-11-26 08:10:37 +00:00
lukem 6b429c1c8a Disable hp300 support (again).
This code is not to be reenabled again until it is fixed to my satisfaction
(as a member of core and the person who ends up dealing with most of
the host tool build bugs)
2003-11-14 12:08:59 +00:00
dsl d7d05c9ee2 roundup() write of hp300 boot code to a multiplr of the disk sector size.
and re-instate the hp300 code - seems to work.
2003-11-13 08:19:43 +00:00
dsl c948aa4152 Ensure we use the target disklabel.h, not the host one.
Read the disklabel directly from sector 2 instead of using DIOCGDINFO.
Expect the label to be big-endian.
Support -o append for real files.
2003-11-10 10:48:30 +00:00
fvdl 8452757ae8 Comment out hp300 references. 2003-11-10 09:19:03 +00:00
fvdl b770006d3b Disable the hp300 for now. 2003-11-10 09:14:58 +00:00
uwe 57f9d3f327 Don't use PRId64 in a host tool. Not all systems have the PRI*
macros (e.g. FreeBSD 4.x).  Cast to long long int instead.
2003-11-08 22:39:07 +00:00
dsl 6bf8729bd1 First cut of hp300 installboot, seems to DTRT on i386.
Maybe this code ought to know how to add a file to the LIF filesystem.
2003-11-08 16:44:35 +00:00
perry 4d9c2f6d8f Clean up the i386 examples somewhat, adding an example of upgrading
the boot blocks on the existing mounted root file system, and
eliminating references to bootxx_ufs.

I referenced the a partition even though most other ports seem to
reference the c partition. I don't know if that's the most correct
way to do it, but it seems to work for me and no one can tell me what
the canonical method is. I'd let someone else fix the man page but no
one seemed to want to and it really needed the example.
2003-11-02 16:04:31 +00:00
mrg 00b48119d0 XXX: build mdsetimage.c / installboot/ffs.c with -O0 on sun2 as GCC3
barfs on these for now.
2003-10-28 08:21:26 +00:00
wiz 3122f2a2f2 Grammar fixes in previous; use Nx in one place;
sort examples; replace < and > with \*[Lt] and \*[Gt] respectively.
Bump date for previous.
2003-10-28 00:26:17 +00:00
lukem f4f2cda6de minor consistency tweaks 2003-10-27 22:38:39 +00:00
lukem c176c56887 fix typo in comment 2003-10-27 22:29:59 +00:00
cl e05d95b990 add next68k support to installboot 2003-10-27 16:51:05 +00:00
lukem 171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

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

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

This is because the BPB is generally only the FAT16 one except in the
bootxx_msdos case, where it's the larger FAT32 one.
2003-10-14 09:46:43 +00:00
lukem 58e13fba70 Fix compile error on powerpc. Noted by Juergen Hannken-Illjes in private mail. 2003-10-10 01:50:47 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

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

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

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

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

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

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

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

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

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

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


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00