Project

General

Profile

Bug #2674 ยป installer-gpt.patch

pascii, 12/28/2015 02:44 PM

View differences:

etc/defaults/uuids
#
a19d880f-05fc-4d3b-a006-743f0f84911e "Linux Raid"
0657fd6d-a4ab-43c4-84e5-0933c84b4f4f "Linux Swap"
0fc63daf-8483-4772-8e79-3d69d8477de4 "Linux Filesystem Data"
e6d6d379-f507-44c2-a23c-238f2a3df928 "Linux LVM"
48465300-0000-11aa-aa11-00306543ecac "Apple HFS"
share/installer/cmdnames.conf
DISKLABEL64=sbin/disklabel64
DUMPON=sbin/dumpon
FDISK=sbin/fdisk
GPT=sbin/gpt
HAMMER=sbin/hammer
IFCONFIG=sbin/ifconfig
MOUNT=sbin/mount
usr.sbin/installer/dfuibe_installer/flow.c
slice_get_number(storage_get_selected_slice(a->s)),
slice_get_desc(storage_get_selected_slice(a->s)),
disk_get_desc(storage_get_selected_disk(a->s)))) {
if (!format_slice(a)) {
if (disk_get_gptsliced(storage_get_selected_disk(a->s))) {
inform(a->c, _("You must set the type of this GPT partition"
" to DragonFly Label64 yourself if not already done."
" Also, GPT booting is not supported yet."));
state = state_ask_fs;
} else if (!format_slice(a)) {
inform(a->c, _("Primary partition #%d was "
"not correctly formatted, and may "
"now be in an inconsistent state. "
usr.sbin/installer/libinstaller/diskutil.c
d->desc = NULL;
d->serno = NULL;
d->we_formatted = 0;
d->gpt_sliced = 0;
d->capacity = 0;
d->cylinders = -1; /* -1 indicates "we don't know" */
......
}
void
disk_set_gptsliced(struct disk *d, int gptsliced)
{
d->gpt_sliced = gptsliced;
}
int
disk_get_gptsliced(const struct disk *d)
{
return(d->gpt_sliced);
}
void
disk_set_geometry(struct disk *d, int cyl, int hd, int sec)
{
d->cylinders = cyl;
......
*/
struct slice *
slice_new(struct disk *d, int number, int type, int flags,
unsigned long start, unsigned long size)
unsigned long start, unsigned long size, char *desc)
{
struct slice *s;
const char *sysid_desc = NULL;
......
s->start = start;
s->size = size;
for (i = 0; ; i++) {
if (part_types[i].type == type) {
sysid_desc = part_types[i].name;
break;
if (disk_get_gptsliced(d)) {
sysid_desc = strdup(desc);
} else {
for (i = 0; ; i++) {
if (part_types[i].type == type) {
sysid_desc = part_types[i].name;
break;
}
if (part_types[i].type == 255)
break;
}
if (sysid_desc == NULL) {
snprintf(unknown, 256, "??? Unknown, sysid = %d", type);
sysid_desc = unknown;
}
if (part_types[i].type == 255)
break;
}
if (sysid_desc == NULL) {
snprintf(unknown, 256, "??? Unknown, sysid = %d", type);
sysid_desc = unknown;
}
asprintf(&s->desc, "%ldM - %ldM: %s",
usr.sbin/installer/libinstaller/diskutil.h
int sectors; /* (sectors per track) */
long capacity; /* capacity in megabytes */
int we_formatted; /* did we format it ourselves? */
int gpt_sliced; /* slices are of gpt type */
};
struct slice {
......
struct slice *disk_slice_first(const struct disk *);
void disk_set_formatted(struct disk *, int);
int disk_get_formatted(const struct disk *);
void disk_set_gptsliced(struct disk *, int);
int disk_get_gptsliced(const struct disk *);
void disk_set_geometry(struct disk *, int, int, int);
void disk_get_geometry(const struct disk *, int *, int *, int *);
struct slice *slice_new(struct disk *, int, int, int,
unsigned long, unsigned long);
unsigned long, unsigned long, char *);
struct slice *slice_find(const struct disk *, int);
struct slice *slice_next(const struct slice *);
int slice_get_number(const struct slice *);
usr.sbin/installer/libinstaller/survey.c
#include <sys/types.h>
#include <sys/sysctl.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
......
a->os_root, cmd_name(a, "ECHO"), a->tmp);
command_set_log_mode(cmd, COMMAND_LOG_SILENT);
/*
* Probe the disk with gpt.
*/
cmd = command_add(cmds, "%s%s '@GPT_SLICES' >>%ssurvey.txt",
a->os_root, cmd_name(a, "ECHO"), a->tmp);
command_set_log_mode(cmd, COMMAND_LOG_SILENT);
cmd = command_add(cmds, "%s%s show %s 2>/dev/null >>%ssurvey.txt || %s%s '' >>%ssurvey.txt",
a->os_root, cmd_name(a, "GPT"),
disk,
a->tmp,
a->os_root, cmd_name(a, "ECHO"),
a->tmp);
cmd = command_add(cmds, "%s%s '@END' >>%ssurvey.txt",
a->os_root, cmd_name(a, "ECHO"), a->tmp);
command_set_log_mode(cmd, COMMAND_LOG_SILENT);
aura_dict_next(di);
}
......
fprintfo(log, "| Found slice #%d, sysid %d, "
"start %ld, size %ld\n", sliceno, type, start, size);
*/
slice_new(d, sliceno, type, flags, start, size);
if (type == 0xee)
disk_set_gptsliced(d, 1);
else if (!disk_get_gptsliced(d))
slice_new(d, sliceno, type, flags, start, size, NULL);
}
}
}
} else if (strcmp(line, "@GPT_SLICES") == 0) {
/*
* start size index contents
* 0 1 - PMBR
* 1 1 - Pri GPT header
* 2 32 - Pri GPT table
* 34 2014 -
* 2048 974848 0 GPT part - EFI System
*/
while (d != NULL && strcmp(line, "@END") != 0 && fgets_chomp(line, 255, f)) {
if (strstr(line, "start") && strstr(line, "contents")) {
/* ignore it */
} else if (disk_get_gptsliced(d)) {
char *s = line;
unsigned long start, size;
int sliceno;
start = strtoul(s, &s, 10);
if (!s || !start) continue;
size = strtoul(s, &s, 10);
if (!s || !size) continue;
while (isspace(*s)) s++;
if (!isdigit(*s)) continue;
sliceno = (int)strtol(s, &s, 10);
if (!s) continue;
while (isspace(*s)) s++;
if (!strncmp(s, "GPT part - ", 11)) s += 11;
slice_new(d, sliceno, 0, 0, start, size, s);
}
}
}
}
    (1-1/1)