Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bsdinstall/partedit/partedit_x86.c
Show All 22 Lines | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <libgeom.h> | |||||
#include <string.h> | #include <string.h> | ||||
#include <stdlib.h> | |||||
#include "partedit.h" | #include "partedit.h" | ||||
static const char * | static const char * | ||||
x86_bootmethod(void) | x86_bootmethod(void) | ||||
{ | { | ||||
static char fw[255] = ""; | static char fw[255] = ""; | ||||
size_t len = sizeof(fw); | size_t len = sizeof(fw); | ||||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | if (strcmp(part_type, "GPT") == 0) { | ||||
else | else | ||||
return ("/boot/gptboot"); | return ("/boot/gptboot"); | ||||
} | } | ||||
/* No partcode except for GPT */ | /* No partcode except for GPT */ | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
void | |||||
apply_workaround(struct gmesh *mesh) | |||||
{ | |||||
struct gclass *classp; | |||||
struct ggeom *gp; | |||||
struct gconfig *gc; | |||||
const char *scheme = NULL, *modified = NULL; | |||||
int workaround_lenovo, workaround_gptactive; | |||||
workaround_lenovo = system("bsdinstall workaround_lenovo"); | |||||
workaround_gptactive = system("bsdinstall workaround_gptactive"); | |||||
LIST_FOREACH(classp, &mesh->lg_class, lg_class) { | |||||
if (strcmp(classp->lg_name, "PART") == 0) | |||||
break; | |||||
} | |||||
if (strcmp(classp->lg_name, "PART") != 0) { | |||||
return; | |||||
} | |||||
LIST_FOREACH(gp, &classp->lg_geom, lg_geom) { | |||||
LIST_FOREACH(gc, &gp->lg_config, lg_config) { | |||||
if (strcmp(gc->lg_name, "scheme") == 0) { | |||||
scheme = gc->lg_val; | |||||
} else if (strcmp(gc->lg_name, "modified") == 0) { | |||||
modified = gc->lg_val; | |||||
} | |||||
} | |||||
if (scheme && strcmp(scheme, "GPT") == 0 && | |||||
modified && strcmp(modified, "true") == 0) { | |||||
if (workaround_lenovo != 0) | |||||
gpart_set_root(gp->lg_name, "lenovofix"); | |||||
if (workaround_gptactive != 0) | |||||
gpart_set_root(gp->lg_name, "active"); | |||||
} | |||||
} | |||||
} |