Commit Graph

21 Commits

Author SHA1 Message Date
dsl e0683ac0f3 Kill two more global variables, bsize (bios disk size) was never used
and bcylsize (bios cylinder size) can be calculated in the one place
it is needed.
The ask_sizemult() call will go once I decide what to to with the
(slightly useful) explanatory text about cylinder alignment.
2004-07-17 19:36:59 +00:00
christos 2fe9365746 Get rid of the EXTERN/INIT mess; fix so that we can process this with xstr(1).
Not worth processing though, since on the i386 we only save ~3K.
2004-06-06 06:06:59 +00:00
dsl d448a28e66 Fix mbr bootcode handling to ensure that the bootselect table is always
written into the correct place - even if the user decides not to update
the mbr code and has the old (pre layout change) code installed.
Tell the user that the mbr code needs updating if the new install uses
'all the disk' and teh old version had the bootselect code (otherwise you
get an empty menu).
Probably fixes PR install/25146
2004-04-25 21:55:18 +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
dsl 7f5beafa6b Sprinkle a load of consts, and change a few variable names.
Now compiles with WARNS=3.
2003-07-25 08:26:21 +00:00
dsl 0e919832bd Another pass of the rototiller. Mainly:
1) New MBR editor
2) Hierarchic timezone menu
2003-07-07 12:30:19 +00:00
dsl 08fc1c1957 A load of KNF changes, plus a couple of strnxxx => strlxxx my fingers did
on the way through.
2003-06-16 19:42:13 +00:00
dsl 17ae477780 Implement a limit on the size of / so that its guaranteed readable by the boot code.
Remove pointless 'len' parameter from read_mbr and write_mbr.
Make read_mbr initialise mbr if it can't be read (delete MD code).
Make i386 always ask at least once about the bootcode.
Move LIB_MOVE and LIB_COUNT from md.h to aout2elf.c
2003-06-14 12:58:45 +00:00
dsl 17f917ce63 Move definition of BOOTSEL to MD Makefile 2003-05-16 19:38:18 +00:00
dsl 3c476fffb6 Pull some code fragments from machine and language dependant files into mbr.c
Resynchronise amd64 with i386
2003-05-07 19:02:52 +00:00
dsl d5c9f83022 Use C structure mbr_sector_t instead of char[] for 'mbr'.
(I hope the edits for the ports I can't build are right!)
i386/amd64 pick up a minor change to the md_read_bootcode which
might preseve the bootselect config.
2003-05-07 10:20:18 +00:00
christos 2d7e213ded pass lint[pass1] 2003-01-10 20:00:27 +00:00
mrg 8da46e6897 de-__P()-ify 2000-12-22 10:12:12 +00:00
fvdl d25150d087 Don't try to convert the CHS values if not needed. Add extra flag
to write_mbr to for this.
1999-07-10 23:07:15 +00:00
cgd a640bc7014 copyright notice typo fixups, as noticed in PR#7248. This software
was developed, not develooped.
1999-06-20 06:08:13 +00:00
fvdl 337300d376 Change partition type if we're installing into an old 386bsd partition.
Check if there's no active partition after MBR editing.
Ask for own MBR to be installed if we're booting from out of CHS range.
Ask for bootselector to be installed if > 1 OS, and configure it.
1999-05-02 13:07:15 +00:00
simonb e8f5904d9e Move prototype for disp_cur_part() from defs.h to mbr.h. 1999-04-05 06:59:36 +00:00
fvdl a5d73e00eb Rework the MBR code, and some of the labelling code.
* Use structures, not 2-dimensional arrays..
	* Use the DIOCGDEFLABEL ioctl to get the disk information,
	  to avoid confusion with (older) labels.
	* Don't ever call fdisk for partitioning. This was the
	  source of much confusion.
	* For the i386, use the BIOS geometry information passed by
	  the bootblocks.

Lots of things left to do, but it's a start.
1999-03-31 00:44:48 +00:00
rvb a3d43525ee Fix BIOS GEOMETRY menu 1998-07-21 14:53:36 +00:00
mrg d1b0d1b602 KNF. 1998-06-20 13:05:48 +00:00
jonathan 1483395dbe Move DOS BIOS-geometry and MBR-handling code to MI code for powerpc, arc:
* Split bios geometry and MBR partition editing code formerly in
    arch/i386/{md,fdisk}.c to mbr.c in mi  directory.
  * Leave /sbin/fdisk parsing/handling code in separate file,
    we may want to change it later. move to mi directory.
  * Create mbr.h with declarations for MBR/BIOS-geomotry code.
    #include "mbr.h" in  i386 md.h.
  * Use symbolic names for 386bsd and new NetBSD partition IDs.

Handle MBRs with both 386bsd and NetBSD partitions less stupidly.
1998-02-24 05:36:03 +00:00