History log of /freebsd-10.0-release/usr.sbin/boot0cfg/boot0cfg.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 259065 07-Dec-2013 gjb

- Copy stable/10 (r259064) to releng/10.0 as part of the
10.0-RELEASE cycle.
- Update __FreeBSD_version [1]
- Set branch name to -RC1

[1] 10.0-CURRENT __FreeBSD_version value ended at '55', so
start releng/10.0 at '100' so the branch is started with
a value ending in zero.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 228738 20-Dec-2011 jhb

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


# 227876 23-Nov-2011 kevlo

Plug fd leaks


# 227297 07-Nov-2011 ae

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


# 227250 06-Nov-2011 ed

Mark global functions and/or variables in boot0cfg(8) static where possible.

This allows compilers and static analyzers to do more thorough analysis.


# 226714 25-Oct-2011 ae

Fix argument name. This fixes EINVAL when boot0cfg uses GEOM_PART'
control interface.

MFC after: 3 days


# 216229 06-Dec-2010 brucec

Revert r209469: it causes the rest of the function to be bypassed.

Reported by: ae


# 209469 23-Jun-2010 brucec

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)


# 189273 02-Mar-2009 marcel

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.


# 185579 03-Dec-2008 luigi

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


# 183487 30-Sep-2008 lulf

- Improve error message given on g_providername call failure.
- While there, make error messages consistent with the rest.

Approved by: kib (mentor)


# 182844 07-Sep-2008 lulf

- 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)


# 148036 15-Jul-2005 phk

Attempt gctl verb "write MBR" when updating.

This should solve the problem of modifying the MBR while running.


# 139011 18-Dec-2004 phk

Open device R/W for ioctl modifications.


# 135249 14-Sep-2004 tegge

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.


# 133077 03-Aug-2004 obrien

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.


# 129302 16-May-2004 stefanf

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


# 114601 03-May-2003 obrien

Use __FBSDID over rcsid[]. Protect copyright[] where needed.


# 108394 29-Dec-2002 phk

Use the new sector0 munging ioctls to make boot0cfg work under GEOM.


# 104272 01-Oct-2002 phk

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.


# 87643 11-Dec-2001 mikeh

WARNS=2 cleanup.

Submitted by: Maxime Henrion <mux@qualys.com>
MFC after: 2 weeks


# 74668 22-Mar-2001 iedowse

Add missing specification of the `-s' option to the usage line.

PR: bin/26004
Submitted by: ushida@msa.biglobe.ne.jp
Reviewed by: rnordier


# 64797 17-Aug-2000 dwmalone

Allow people to set the default boot slice with boot0cfg.

PR: 18923
Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
Reviewed by: jhb
Approved by: rnordier


# 63092 13-Jul-2000 jhb

- When we save the existing MBR to a file, check to see if the MBR we are
saving is boot0. If it is, use its version number so that we can grab
all of boot0 (1024 bytes with version 1.1 for example) when we save it
to a file via the 'f' option. Otherwise, we just save the first sector.
- Cleanup this code a bit by splitting some functionality out into separate
functions.

Suggested by: Patrick Bihan-Faou <patrick@mindstep.com> (1)


# 63034 12-Jul-2000 jhb

Update boot0cfg to handle the new boot0:
- Allow for boot0 to be more than one sector long. However, ensure that it
its length is a multiple of the sector length.
- Change the signatures used to determine a valid boot0 as some of the
signature code changed.
- Use the old signature to detect version 1.0 of boot0, otherwise read the
version number from boot0 itself.


# 50479 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48113 22-Jun-1999 rnordier

Check that we really have a boot0 mbr before treating it as one.

Suggested by: peter

Also add a few comments.


# 48074 21-Jun-1999 rnordier

Ensure that an update takes place when the -m option is used.


# 48038 19-Jun-1999 rnordier

Implement -m option to enable/disable slices.


# 44297 26-Feb-1999 rnordier

Finish implementing "setdrv" option. This is intended to be used
(with care) in those instances where boot0 is not passed the
correct drive number by the PC BIOS. (The symptoms are a
"F5 Drive 0" line, even though the current drive is drive 0.)


# 44207 22-Feb-1999 rnordier

Make various minor corrections.


# 44197 21-Feb-1999 rnordier

This commit was generated by cvs2svn to compensate for changes in r44196,
which included commits to RCS files with non-trunk default branches.


# 44196 21-Feb-1999 rnordier

Add boot0cfg: this installs/configures the `boot0' boot manager. A
CLI utility to do this has been requested by a few people.