Commit Graph

66 Commits

Author SHA1 Message Date
Kevin Lo
de028133d4 Plug fd leaks 2011-11-23 10:27:18 +00:00
Andrey V. Elsukov
2a9cd9b3a1 Remove a note about disabling of GEOM protection mechanism.
boot0cfg should work without such hack.

MFC after:	3 days
2011-11-07 09:29:10 +00:00
Andrey V. Elsukov
7411f128dd Reorganize write_mbr() function to be able write bootcode with different
ways. Improve error reporting and also fix indenting.
Now we are trying to write bootcode:
 1. Directly to provider (if we can open it for writing);
 2. Via GEOM_PART (if it is available);
 3. Via GEOM_MBR.

MFC after:	2 weeks
2011-11-07 09:21:18 +00:00
Andrey V. Elsukov
395a625c6d Add reference to gpart(8).
MFC after:	3 days
2011-11-06 20:42:32 +00:00
Ed Schouten
e052b60b87 Mark global functions and/or variables in boot0cfg(8) static where possible.
This allows compilers and static analyzers to do more thorough analysis.
2011-11-06 19:01:35 +00:00
Andrey V. Elsukov
9f772ce219 Fix argument name. This fixes EINVAL when boot0cfg uses GEOM_PART'
control interface.

MFC after:	3 days
2011-10-25 04:15:45 +00:00
Rebecca Cran
20016815e5 Revert r209469: it causes the rest of the function to be bypassed.
Reported by: ae
2010-12-06 11:37:24 +00:00
Rebecca Cran
fdf78c2272 If a device can't be opened, don't keep going but display the error
returned from open() and quit.

PR: bin/81035
Submitted by: Peter Schuller <peter.schuller at infidyne.com>
Approved by: rrs (mentor)
2010-06-23 14:28:08 +00:00
Ruslan Ermilov
c59ee18a21 Fixed static linkage. 2010-02-26 09:41:16 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Marcel Moolenaar
a565cc2897 Write the MBR by using the bootcode verb of the gpart class.
The "write MBR" verb is kept for backward compatibility, but
the DIOCSMBR ioctl has been removed.
2009-03-02 04:35:52 +00:00
Luigi Rizzo
789a82a6db Extend the geom-related info and put in the NOTE section, not
in BUGS, as this is a feature.

Bump the date, as it was forgotten in previous commits and the
page has had significant changes recently
2009-01-13 21:55:39 +00:00
Luigi Rizzo
ae3096705c Another, hopefully final set of changes to boot0 and boot0cfg.
boot0.S changes:

+ import a patch from Christoph Mallon to rearrange the various
  print functions and save another couple of bytes;

+ implement the suggestion in PR 70531 to enable booting from
  any valid partition because even the extended partitions that
  were previously in our kill list may contain a valid boot loader.
  This simplifies the code and saves some bytes;

+ followwing up PR 127764, implement conditional code to preserve
  the 'Volume ID' which might be used by other OS (NT, XP, Vista)
  and is located at offset 0x1b8. This requires a relocation of the
  parameter block within the boot sector -- there is no other
  possible workaround.
  To address this, boot0cfg has been updated to handle both
  versions of the boot code;

+ slightly rearrange the strings printed in the menus to make
  the code buildable with all options. Given the tight memory
  budget, this means that with certain options we need to
  shrink or remove certain labels.

and especially:

	make -DVOLUME_LABEL -DPXE the default options.

  This means that the newly built boot0 block will preserve the
  Volume ID, and has the (hidden) option F6 to boot from INT18/PXE.
  I think the extra functionality is well worth the change.

  The most visible difference here is that the 'Default: ' string
  now becomes 'Boot: ' (it can be reverted to the old value
  but then we need to nuke 1/2 partition name or entries to
  make up for the extra room).

boot0cfg changes:

+ modify the code to recognise the new boot0 structure (with the
  relocated options block to make room for the Volume id).

+ add two options, '-i xxxx-xxxx' to set the volume ID, -e c
  to modify the character printed in case of bad input

PR:		127764 70531
Submitted by:	Christoph Mallon (portions)
MFC after:	4 weeks
2008-12-03 14:53:59 +00:00
Ulf Lilleengen
bd5add5884 - Improve error message given on g_providername call failure.
- While there, make error messages consistent with the rest.

Approved by:	kib (mentor)
2008-09-30 07:18:49 +00:00
Ulf Lilleengen
b31e5ae243 - Make use of the new and g_device_path utility function in libgeom to avoid
duplication of code in fdisk and boot0cfg. Also make use of g_providername to
  fix an issue with fdisk and boot0cfg not using the correct provider when
  writing the MBR.

Reviewed by:	phk
Approved by:	pjd (mentor)
2008-09-07 13:58:35 +00:00
Pav Lucistnik
448f9bb6c1 "-b /boot/mbr" is redundant, /boot/mbr is the default boot code for fdisk(8).
Pointed out by:	ru
2007-06-07 07:43:04 +00:00
Pav Lucistnik
3022d78f56 - Revert previous revision, it was incorrect
- Add an example using fdisk instead

Pointed out by:	ru
Submitted by:	Warren Block <wblock@wonkity.com>
MFC after:	3 days
2007-06-06 21:28:50 +00:00
Pav Lucistnik
2e032d8d80 Document /boot/mbr (non-interactive boot block)
PR:		doc/111840
Submitted by:	Warren Block <wblock@wonkity.com>
MFC after:	1 week
2007-05-12 10:40:20 +00:00
Poul-Henning Kamp
dfa5ad9421 Attempt gctl verb "write MBR" when updating.
This should solve the problem of modifying the MBR while running.
2005-07-15 08:04:32 +00:00
Scott Long
338465d521 Document how to make boot0cfg work on mounted disks. 2005-04-07 20:04:55 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Poul-Henning Kamp
5679e1ac37 Open device R/W for ioctl modifications. 2004-12-18 11:04:10 +00:00
Tor Egge
03234cabb7 Correct polarity of packet mode bit.
Problem discovered when 'boot0cfg -B -v -o packet -s 2 ad4' turned off
packet mode while reporting it as being enabled.
2004-09-14 21:58:30 +00:00
Tor Egge
49e5f5521d boot0 defaults to packet mode. 2004-09-14 21:48:25 +00:00
David E. O'Brien
3d862ddd11 Enable packet mode by default. Disk drives have gotten so large now,
it is often the case the partition one wants to boot is above cylinder 1023.
2004-08-03 15:20:55 +00:00
Ruslan Ermilov
2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
Poul-Henning Kamp
7196870cbb Document boot0sio and note that it requires modem handshake to work. 2004-06-17 12:01:25 +00:00
Ruslan Ermilov
68c4cb5dd7 Spelling nit. 2004-06-04 19:22:20 +00:00
Stefan Farfeleder
a752604477 Remove spurious semicolons. Outside of functions they are actually errors but
GCC doesn't warn about them without -pedantic.

Approved by:	das (mentor)
PR:		56649
Reviewed by:	md5
2004-05-16 22:08:17 +00:00
Ruslan Ermilov
959d6c24f6 Get rid of duplicates. 2003-09-14 13:41:59 +00:00
David E. O'Brien
b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
John Baldwin
4a87a5eecd Add an example of how to use the -m option that clarifies how the bits in
the mask correspond to slice numbers.  Also, clarify the description of the
existing example.

Requested by:	Larry Rosenman <ler@lerctr.org>
2003-04-15 21:03:19 +00:00
David E. O'Brien
052238b16c style.Makefile(5) 2003-04-04 17:49:21 +00:00
Poul-Henning Kamp
23db6b2998 Use the new sector0 munging ioctls to make boot0cfg work under GEOM. 2002-12-29 15:01:58 +00:00
Poul-Henning Kamp
3bb24c35f2 Split MBR and PC98 on-disk sliceformats out from disklabel.h, step 1:
Peter had repocopied sys/disklabel.h to sys/diskpc98.h and sys/diskmbr.h.

These two new copies are still intact copies of disklabel.h and
therefore protected by #ifndef _SYS_DISKLABEL_H_ so #including them
in programs which already include <sys.disklabel.h> is currently a
no-op.

This commit adds a number of such #includes.

Once I have verified that I have fixed all the places which need fixing,
I will commit the updated versions of the three #include files.

Sponsored by:   DARPA & NAI Labs.
2002-10-01 07:24:55 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Ian Dowse
90432ad793 Remove references to the update/noupdate flag from the description
and examples of the "-s" option, since these two features operate
completely independently of each other.

Reviewed by:	obrien
2002-05-28 17:53:52 +00:00
David E. O'Brien
12b51ad055 The man page is VERY WRONG about using "-o noupdate" with -s.
So fix it, and add an example using -s.
2002-05-25 01:46:44 +00:00
Daniel Harris
35213a76a9 Trivial language fixes.
PR:		38015
Submitted by:	Chris Pepper <pepper@mail.rockefeller.edu>
2002-05-14 21:09:05 +00:00
Mike Heffner
50483cb4b4 WARNS=2 cleanup.
Submitted by:	Maxime Henrion <mux@qualys.com>
MFC after:	2 weeks
2001-12-11 06:44:29 +00:00
Ruslan Ermilov
d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Ruslan Ermilov
753d686d34 mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
Robert Nordier
816aa3c0b5 Unset MAINTAINER. 2001-07-21 14:32:47 +00:00
Ruslan Ermilov
504dd5eab0 fdisk(8): document the default for -b, add xref to boot0cfg(8).
boot0cfg(8): add FILES section.

Reviewed by:	rnordier
2001-07-18 07:12:46 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ian Dowse
bae528bab5 Add missing specification of the `-s' option to the usage line.
PR:		bin/26004
Submitted by:	ushida@msa.biglobe.ne.jp
Reviewed by:	rnordier
2001-03-22 22:55:13 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Ruslan Ermilov
e97407b4f2 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 20:10:44 +00:00
Ben Smithurst
76a06f8483 remove trailing periods from SEE ALSO. 2000-11-15 17:27:54 +00:00