1994-10-15 15:34:49 +01:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
1995-04-17 11:19:31 +01:00
|
|
|
#define TITLE "FreeBSD 2.0-950418-SNAP Install"
|
1994-10-20 07:08:19 +01:00
|
|
|
|
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
|
|
|
#define MAX_NO_DISKS 10
|
|
|
|
#define MAX_NO_FS 30
|
|
|
|
#define MAXFS MAX_NO_FS
|
|
|
|
|
1994-12-27 23:26:59 +00:00
|
|
|
#define BBSIZE 8192 /* Actually in ufs/ffs/fs.h I think */
|
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
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <ncurses.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <dialog.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/dkbad.h>
|
|
|
|
#include <sys/disklabel.h>
|
1994-10-20 07:08:19 +01:00
|
|
|
|
1994-10-17 08:13:13 +01:00
|
|
|
#define SCRATCHSIZE 1024
|
1994-10-18 08:56:34 +01:00
|
|
|
#define ERRMSGSIZE 256
|
1994-11-02 08:15:46 +00:00
|
|
|
#define DEFROOTSIZE 18
|
1994-10-21 06:36:43 +01:00
|
|
|
#define DEFSWAPSIZE 16
|
1994-10-26 04:09:19 +00:00
|
|
|
#define DEFUSRSIZE 80
|
|
|
|
#define DEFFSIZE 1024
|
|
|
|
#define DEFFRAG 8
|
1994-10-17 08:13:13 +01:00
|
|
|
|
1994-10-15 15:34:49 +01:00
|
|
|
#define BOOT_MAGIC 0xAA55
|
|
|
|
#define ACTIVE 0x80
|
|
|
|
|
1994-11-06 04:10:13 +00:00
|
|
|
#define COPYRIGHT_FILE "/COPYRIGHT"
|
|
|
|
#define README_FILE "/README"
|
|
|
|
#define HELPME_FILE "/DISKSPACE.FAQ"
|
1994-11-12 20:34:18 +00:00
|
|
|
#define TROUBLE_FILE "/TROUBLESHOOTING"
|
1994-11-06 04:10:13 +00:00
|
|
|
#define RELNOTES_FILE "/RELNOTES.FreeBSD"
|
1994-10-20 03:51:55 +01:00
|
|
|
|
1994-10-20 07:08:19 +01:00
|
|
|
#ifndef EXTERN
|
|
|
|
# define EXTERN extern
|
|
|
|
#endif
|
|
|
|
|
1995-02-13 06:52:16 +00:00
|
|
|
extern unsigned char boot0[];
|
|
|
|
extern unsigned char boot1[];
|
|
|
|
extern unsigned char boot2[];
|
|
|
|
|
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
|
|
|
/* All this "disk" stuff */
|
|
|
|
EXTERN int Ndisk;
|
|
|
|
EXTERN struct disklabel *Dlbl[MAX_NO_DISKS];
|
|
|
|
EXTERN char *Dname[MAX_NO_DISKS];
|
|
|
|
EXTERN int Dfd[MAX_NO_DISKS];
|
|
|
|
|
|
|
|
EXTERN int MP[MAX_NO_DISKS][MAXPARTITIONS];
|
|
|
|
|
|
|
|
/* All this "filesystem" stuff */
|
|
|
|
EXTERN int Nfs;
|
|
|
|
EXTERN char *Fname[MAX_NO_FS+1];
|
|
|
|
EXTERN char *Fmount[MAX_NO_FS+1];
|
|
|
|
EXTERN char *Ftype[MAX_NO_FS+1];
|
1994-12-27 23:26:59 +00:00
|
|
|
EXTERN int Faction[MAX_NO_FS+1];
|
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
|
|
|
EXTERN u_long Fsize[MAX_NO_FS+1];
|
|
|
|
|
1994-10-20 07:08:19 +01:00
|
|
|
EXTERN int dialog_active;
|
1994-10-28 15:19:57 +00:00
|
|
|
EXTERN char selection[];
|
1994-10-29 10:01:40 +00:00
|
|
|
EXTERN int debug_fd;
|
1994-12-27 23:26:59 +00:00
|
|
|
EXTERN int dialog_active;
|
|
|
|
EXTERN int fixit;
|
1994-10-20 07:08:19 +01:00
|
|
|
|
1995-02-13 06:52:16 +00:00
|
|
|
EXTERN int on_serial;
|
|
|
|
EXTERN int on_cdrom;
|
|
|
|
EXTERN int cpio_fd;
|
|
|
|
|
1994-12-27 23:26:59 +00:00
|
|
|
extern int no_disks;
|
|
|
|
extern int inst_disk;
|
1994-10-18 08:56:34 +01:00
|
|
|
extern unsigned char *scratch;
|
|
|
|
extern unsigned char *errmsg;
|
|
|
|
extern u_short dkcksum(struct disklabel *);
|
1994-10-20 03:51:55 +01:00
|
|
|
|
1994-10-20 07:08:19 +01:00
|
|
|
/* utils.c */
|
1994-10-29 10:01:40 +00:00
|
|
|
void Abort __P((void));
|
|
|
|
void ExitSysinstall __P((void));
|
1994-10-20 03:51:55 +01:00
|
|
|
void TellEm __P((char *fmt, ...));
|
1994-10-29 10:01:40 +00:00
|
|
|
void Debug __P((char *fmt, ...));
|
1994-10-20 03:51:55 +01:00
|
|
|
void stage0 __P((void));
|
|
|
|
void *Malloc __P((size_t size));
|
1994-10-20 07:08:19 +01:00
|
|
|
char *StrAlloc __P((char *str));
|
|
|
|
void Fatal __P((char *fmt, ...));
|
1994-10-21 19:08:33 +01:00
|
|
|
void AskAbort __P((char *fmt, ...));
|
1994-10-26 02:53:15 +00:00
|
|
|
void MountUfs __P((char *device, char *mountpoint, int do_mkdir,int flags));
|
1995-01-14 10:31:29 +00:00
|
|
|
void Mkdir __P((char *path, int die));
|
1994-11-02 06:19:53 +00:00
|
|
|
void Link __P((char *from, char *to));
|
1994-10-26 02:53:15 +00:00
|
|
|
void CopyFile __P((char *p1, char *p2));
|
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
|
|
|
u_long PartMb(struct disklabel *lbl,int part);
|
1994-11-05 03:34:22 +00:00
|
|
|
char * SetMount __P((int disk, int part, char *path));
|
|
|
|
void CleanMount __P((int disk, int part));
|
1994-12-27 23:26:59 +00:00
|
|
|
void enable_label __P((int fd));
|
|
|
|
void disable_label __P((int fd));
|
1994-10-21 03:14:54 +01:00
|
|
|
|
|
|
|
/* exec.c */
|
|
|
|
int exec __P((int magic, char *cmd, char *args, ...));
|
|
|
|
#define EXEC_MAXARG 100
|
1994-10-20 07:08:19 +01:00
|
|
|
|
|
|
|
/* stage0.c */
|
|
|
|
void stage0 __P((void));
|
|
|
|
|
|
|
|
/* stage1.c */
|
1994-11-12 05:40:28 +00:00
|
|
|
int stage1 __P((void));
|
1994-10-20 07:08:19 +01:00
|
|
|
|
|
|
|
/* stage2.c */
|
|
|
|
void stage2 __P((void));
|
|
|
|
|
|
|
|
/* stage3.c */
|
|
|
|
void stage3 __P((void));
|
1994-10-20 03:51:55 +01:00
|
|
|
|
1994-10-26 02:53:15 +00:00
|
|
|
/* stage5.c */
|
|
|
|
void stage5 __P((void));
|
|
|
|
|
1994-10-20 07:08:19 +01:00
|
|
|
/* termcap.c */
|
|
|
|
int set_termcap __P((void));
|
1994-10-26 02:53:15 +00:00
|
|
|
|
|
|
|
/* makedevs.c */
|
|
|
|
int makedevs __P((void));
|
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
|
|
|
|
1994-11-05 03:34:22 +00:00
|
|
|
/* ourcurses.c */
|
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
|
|
|
int AskEm __P((WINDOW *w,char *prompt, char *answer, int len));
|
1994-11-05 03:34:22 +00:00
|
|
|
void ShowFile __P((char *filename, char *header));
|
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
|
|
|
|
1994-11-18 18:13:13 +00:00
|
|
|
/* mbr.c */
|
1994-12-27 23:26:59 +00:00
|
|
|
int build_bootblocks __P((int dfd,struct disklabel *label,struct dos_partition *dospart));
|
|
|
|
void Fdisk __P((void));
|
1995-02-13 06:52:16 +00:00
|
|
|
void read_dospart __P((int, struct dos_partition *));
|
1994-12-27 23:26:59 +00:00
|
|
|
|
|
|
|
/* label.c */
|
|
|
|
void DiskLabel __P((void));
|