Fixed another bunch of problems. I belive we are in a working shape now.
This commit is contained in:
parent
67e9c49975
commit
75c4377f4f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3991
@ -58,8 +58,9 @@ write_bootblocks(int fd, off_t offset, int bbsize)
|
||||
Fatal("Failed to write disklabel: %s\n", strerror(errno));
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
|
||||
Debug("Seeking to block %ld ", offset);
|
||||
Debug("Seeking to byte %ld ", (offset * avail_disklabels[inst_disk].d_secsize));
|
||||
if (lseek(fd, (offset * avail_disklabels[inst_disk].d_secsize), SEEK_SET) < 0) {
|
||||
sprintf(errmsg, "Couldn't seek to start of partition\n");
|
||||
return(-1);
|
||||
@ -69,8 +70,8 @@ write_bootblocks(int fd, off_t offset, int bbsize)
|
||||
return(-1);
|
||||
|
||||
if (write(fd, bootblocks, bbsize) != bbsize) {
|
||||
sprintf(errmsg, "Failed to write bootblocks (%p) %d %s\n",
|
||||
bootblocks,
|
||||
sprintf(errmsg, "Failed to write bootblocks (%p,%d) %d %s\n",
|
||||
bootblocks, bbsize,
|
||||
errno, strerror(errno)
|
||||
);
|
||||
return(-1);
|
||||
|
@ -25,4 +25,4 @@ int write_bootblocks(int, off_t, int);
|
||||
int build_bootblocks(struct disklabel *);
|
||||
int Mb_to_cylbdry(int, struct disklabel *);
|
||||
void default_disklabel(struct disklabel *, int, int);
|
||||
int disk_size(int);
|
||||
int disk_size(struct disklabel *);
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <dialog.h>
|
||||
#include "sysinstall.h"
|
||||
|
||||
int disk_size(struct disklabel *);
|
||||
int sectstoMb(int, int);
|
||||
|
||||
char *partname[MAXPARTITIONS] = {"a", "b", "c", "d", "e", "f", "g", "h"};
|
||||
@ -410,32 +409,38 @@ build_disklabel(struct disklabel *lbl)
|
||||
offset = lbl->d_partitions[2].p_offset;
|
||||
|
||||
for (i=0; i < MAXPARTITIONS; i++) {
|
||||
if (strlen(label_fields[i][MOUNTPOINTS].field)) {
|
||||
if (strlen(label_fields[i][MOUNTPOINTS].field) &&
|
||||
atoi(label_fields[i][UPARTSIZES].field)) {
|
||||
sprintf(scratch, "%s%s", avail_disknames[inst_disk], partname[i]);
|
||||
devicename[mounts] = StrAlloc(scratch);
|
||||
mountpoint[mounts] = StrAlloc(label_fields[i][MOUNTPOINTS].field);
|
||||
mounts++;
|
||||
nsects = Mbtosects(atoi(label_fields[i][UPARTSIZES].field),
|
||||
lbl->d_secsize);
|
||||
lbl->d_secsize);
|
||||
#if 0 /* Rounding the offset is at best wrong */
|
||||
nsects = rndtocylbdry(nsects, lbl->d_secpercyl);
|
||||
if(nsects) {
|
||||
offset = rndtocylbdry(offset, lbl->d_secpercyl);
|
||||
lbl->d_partitions[i].p_size = nsects;
|
||||
lbl->d_partitions[i].p_offset = offset;
|
||||
Debug("Part%d: %d sects, %d offset, %d end",
|
||||
i,nsects,offset,nsects+offset);
|
||||
offset += nsects;
|
||||
total_sects += nsects;
|
||||
lbl->d_partitions[i].p_fstype =
|
||||
getfstype(label_fields[i][FSTYPE].field);
|
||||
lbl->d_npartitions = i+1;
|
||||
} else {
|
||||
lbl->d_partitions[i].p_size = 0;
|
||||
lbl->d_partitions[i].p_offset = 0;
|
||||
lbl->d_partitions[i].p_fstype = 0;
|
||||
}
|
||||
offset = rndtocylbdry(offset, lbl->d_secpercyl);
|
||||
#endif
|
||||
lbl->d_partitions[i].p_size = nsects;
|
||||
lbl->d_partitions[i].p_offset = offset;
|
||||
offset += nsects;
|
||||
total_sects += nsects;
|
||||
lbl->d_partitions[i].p_fstype =
|
||||
getfstype(label_fields[i][FSTYPE].field);
|
||||
lbl->d_npartitions = i+1;
|
||||
} else if (i < 2 || i > 3) {
|
||||
lbl->d_partitions[i].p_size = 0;
|
||||
lbl->d_partitions[i].p_offset = 0;
|
||||
lbl->d_partitions[i].p_fstype = 0;
|
||||
}
|
||||
Debug("Part%d: %d sects, %d offset, %d end, %d type", i,
|
||||
lbl->d_partitions[i].p_size,
|
||||
lbl->d_partitions[i].p_offset,
|
||||
lbl->d_partitions[i].p_size+
|
||||
lbl->d_partitions[i].p_offset,
|
||||
lbl->d_partitions[i].p_fstype);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include "mbr.h"
|
||||
#include "sysinstall.h"
|
||||
#include "bootarea.h"
|
||||
|
||||
struct disklabel *avail_disklabels;
|
||||
int *avail_fds;
|
||||
@ -52,7 +53,6 @@ int dialog_active = 0;
|
||||
void exit_sysinstall();
|
||||
void exit_prompt();
|
||||
extern char *part_type(int);
|
||||
extern int disk_size(struct disklabel *);
|
||||
|
||||
char selection[30];
|
||||
char boot1[] = BOOT1;
|
||||
@ -326,8 +326,8 @@ stage1()
|
||||
if (write_mbr(avail_fds[inst_disk], mbr) == -1)
|
||||
Fatal(errmsg);
|
||||
if (write_bootblocks(avail_fds[inst_disk],
|
||||
mbr->dospart[inst_part].dp_start,
|
||||
avail_disklabels[inst_disk].d_bbsize) == -1)
|
||||
mbr->dospart[inst_part].dp_start,
|
||||
avail_disklabels[inst_disk].d_bbsize) == -1)
|
||||
Fatal(errmsg);
|
||||
|
||||
/* close all the open disks */
|
||||
|
Loading…
Reference in New Issue
Block a user