Commit Graph

88 Commits

Author SHA1 Message Date
Marcelo Araujo
793128cc2c Use nitems() from sys/param.h
Reviewed by:	jhb
MFC after:	3 weeks.
Differential Revision:	https://reviews.freebsd.org/D9941
2017-03-11 04:00:27 +00:00
John Baldwin
a6c9d35c23 Adjust previous fix to conform to the existing style in this file. 2016-01-14 15:49:24 +00:00
John Baldwin
32960dd10a Fix the precious change to check the pointer returned by malloc().
Submitted by:	luke <luke.tw@gmail.com>
Pointy hat to:	jhb
2015-12-18 17:52:08 +00:00
John Baldwin
b128c3c395 Exit cleanly if malloc() fails to allocate a buffer for a copy of the
current MBR.

PR:		205322
Submitted by:	Alexander Kuleshov <kuleshovmail@gmail.com>
MFC after:	1 week
2015-12-17 20:42:05 +00:00
Edward Tomasz Napierala
b8c19fd719 It's 2015, and some people are still trying to use fdisk and then
go asking what debug flags to set for GEOM to make it work.  Advice
them to use gpart(8) instead.

Something similar should probably done with disklabel,
but I need to rewrite the disklabel examples first.

Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3315
2015-09-02 14:08:43 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
c6db8143ed Convert usr.sbin to LIBADD
Reduce overlinking
2014-11-25 16:57:27 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Sergey Kandaurov
05d98029e9 Sweep man pages replacing ad -> ada.
Approved by:	re (blackend)
MFC after:	1 week
X-MFC note:	stable/9 only
2013-10-01 18:41:53 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Joel Dahl
c0cbd1c6f1 Remove superfluous paragraph macro. 2012-03-25 09:18:34 +00:00
Konstantin Belousov
5c95e6ff60 Be as explicit as possible when describing relation between the -m mask
argument and slices. Adjust example for the same reason.

Submitted by:	Valentin Nechayev <netch netch kiev ua>
MFC after:	3 days
2012-02-04 13:12:52 +00:00
John Baldwin
f9a0145857 Allow boot0cfg to force a PXE boot via boot0 on the next boot.
- Fix boot0 to check for PXE when using the pre-set setting for the
  preferred slice.
- Update boot0cfg to use slice 6 to select PXE.  Accept a 'pxe' argument
  instead of a number for the 's' option as a way to select PXE as well.

Submitted by:	Andrew Boyer  aboyer averesystems
MFC after:	2 weeks
2011-12-20 15:19:29 +00:00
Dimitry Andric
14fa6dc403 Use NO_WCAST_ALIGN for usr.sbin/boot0cfg; because this is only built for
x86, any alignment warnings can be safely ignored.

MFC after:	1 week
2011-12-17 19:33:26 +00:00
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