1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-21 11:13:30 +00:00
freebsd/sbin/sysinstall/mbr.h
Poul-Henning Kamp 9c354a29e7 Public apology:
I have walked all over Paul Richards code again, and severely lobotomized
some of his stuff, in order to cut some corners for the 2.0-Alpha release.
I belive that we can now manipulate fdisk and disklabel-stuff sufficiently
for the release to actually be produced.
It's not that I don't like Paul and his code, I just need something I
can kick out of the door RSN.

Sysinstall is now under absolute code-freeze, only Jordan has my permission
to commit to this code (stage0 & 5).  I would appreciate if everybody
else would finds problems in sysinstall send patches to me, and I will
commit them. THANKYOU.

The fdisk/disklabel editors are made in pure ncurses, and follow a model
"a`la spreadsheet".

There are some important functions which are missing still, and I would
appreciate if somebody would look at them.
The FDISK part needs a "whole-disk" option, and it needs a "rewrite
MBR-boot code" option.
The DISKLABEL part needs to be able to "import DOS-partition".
Both need a "HELP" function, (display a file "/HELP" using dialog is OK).

It seems to me like the wd.c and sd.c should reread the physical record
when a DIOCGDINFO is made, so that they can pick up changes in the
MBR-data.  Otherwise there will be a couple of weird cases where we
cannot avoid replicating code from the kernel.

If you want to play with this, look at src/release/Makefile.  You may need
to step back to version 1.38 of sys/i386/isa/fd.c to make "rootable"
floppies, it is not clear at this time if that indeed is the problem I
have been having.

Sleep well, my friends, and expect the real Alpha in 24H, if the tree is
still solid.
1994-11-01 10:10:43 +00:00

81 lines
2.3 KiB
C

/*
* Copyright (c) 1994, Paul Richards.
*
* All rights reserved.
*
* This software may be used, modified, copied, distributed, and
* sold, in both source and binary form provided that the above
* copyright and these terms are retained, verbatim, as the first
* lines of this file. Under no circumstances is the author
* responsible for the proper functioning of this software, nor does
* the author assume any responsibility for damages incurred with
* its use.
*/
#define MBRSIZE 512
#define MBR_MAGIC 0xAA55
#define ACTIVE 0x80
struct mbr
{
unsigned char bootcode[DOSPARTOFF];
struct dos_partition dospart[4];
unsigned short magic;
};
struct part_type
{
unsigned char type;
char *name;
};
#define PARTITION_TYPES \
{ \
{0x00, "Unused"} \
,{0x01, "Primary DOS with 12 bit FAT"} \
,{0x02, "XENIX / filesystem"} \
,{0x03, "XENIX /usr filesystem"} \
,{0x04, "Primary DOS with 16 bit FAT"} \
,{0x05, "Extended DOS"} \
,{0x06, "Primary 'big' DOS (> 32MB)"} \
,{0x07, "OS/2 HPFS, QNX or Advanced UNIX"} \
,{0x08, "AIX filesystem"} \
,{0x09, "AIX boot partition or Coherent"} \
,{0x0A, "OS/2 Boot Manager or OPUS"} \
,{0x10, "OPUS"} \
,{0x40, "VENIX 286"} \
,{0x50, "DM"} \
,{0x51, "DM"} \
,{0x52, "CP/M or Microport SysV/AT"} \
,{0x56, "GB"} \
,{0x61, "Speed"} \
,{0x63, "ISC UNIX, other System V/386, GNU HURD or Mach"} \
,{0x64, "Novell Netware 2.xx"} \
,{0x65, "Novell Netware 3.xx"} \
,{0x75, "PCIX"} \
,{0x80, "Minix 1.1 ... 1.4a"} \
,{0x81, "Minix 1.4b ... 1.5.10"} \
,{0x82, "Linux"} \
,{0x93, "Amoeba filesystem"} \
,{0x94, "Amoeba bad block table"} \
,{0xA5, "FreeBSD/NetBSD/386BSD"} \
,{0xB7, "BSDI BSD/386 filesystem"} \
,{0xB8, "BSDI BSD/386 swap"} \
,{0xDB, "Concurrent CPM or C.DOS or CTOS"} \
,{0xE1, "Speed"} \
,{0xE3, "Speed"} \
,{0xE4, "Speed"} \
,{0xF1, "Speed"} \
,{0xF2, "DOS 3.3+ Secondary"} \
,{0xF4, "Speed"} \
,{0xFF, "BBT (Bad Blocks Table)"} \
};
extern char *part_type(int);
extern int write_mbr(int, struct mbr *);
extern int read_mbr(int, struct mbr *);
extern void show_mbr(struct mbr *);
extern int clear_mbr(struct mbr *, char *);
extern void edit_mbr(struct mbr *, struct disklabel *);
extern int build_mbr(struct mbr *, char *, struct disklabel *);