45
46
static struct mem_region mem_regions[MAX_REGIONS];
46
47
static int num_regions;
49
make_install_device (void)
49
void (*grub_pc_net_config) (char **device, char **path);
52
* return the real time in ticks, of which there are about
58
struct grub_bios_int_registers regs;
61
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
62
grub_bios_interrupt (0x1a, ®s);
64
return (regs.ecx << 16) | (regs.edx & 0xffff);
68
grub_machine_get_bootlocation (char **device, char **path)
71
grub_uint8_t boot_drive, dos_part, bsd_part;
73
boot_drive = (grub_boot_device >> 24);
74
dos_part = (grub_boot_device >> 16);
75
bsd_part = (grub_boot_device >> 8);
77
/* No hardcoded root partition - make it from the boot drive and the
78
partition number encoded at the install time. */
79
if (boot_drive == GRUB_BOOT_MACHINE_PXE_DL)
81
if (grub_pc_net_config)
82
grub_pc_net_config (device, path);
51
86
/* XXX: This should be enough. */
52
char dev[100], *ptr = dev;
54
if (grub_prefix[0] != '(')
56
/* No hardcoded root partition - make it from the boot drive and the
57
partition number encoded at the install time. */
58
if (grub_boot_drive == GRUB_BOOT_MACHINE_PXE_DL)
60
grub_strcpy (dev, "(pxe");
61
ptr += sizeof ("(pxe") - 1;
65
grub_snprintf (dev, sizeof (dev),
66
"(%cd%u", (grub_boot_drive & 0x80) ? 'h' : 'f',
67
grub_boot_drive & 0x7f);
68
ptr += grub_strlen (ptr);
70
if (grub_install_dos_part >= 0)
71
grub_snprintf (ptr, sizeof (dev) - (ptr - dev),
72
",%u", grub_install_dos_part + 1);
73
ptr += grub_strlen (ptr);
75
if (grub_install_bsd_part >= 0)
76
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ",%u",
77
grub_install_bsd_part + 1);
78
ptr += grub_strlen (ptr);
81
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix);
82
grub_strcpy (grub_prefix, dev);
84
else if (grub_prefix[1] == ',' || grub_prefix[1] == ')')
86
/* We have a prefix, but still need to fill in the boot drive. */
87
grub_snprintf (dev, sizeof (dev),
88
"(%cd%u%s", (grub_boot_drive & 0x80) ? 'h' : 'f',
89
grub_boot_drive & 0x7f, grub_prefix + 1);
90
grub_strcpy (grub_prefix, dev);
88
*device = grub_malloc (DEV_SIZE);
90
grub_snprintf (*device, DEV_SIZE,
91
"%cd%u", (boot_drive & 0x80) ? 'h' : 'f',
93
ptr += grub_strlen (ptr);
96
grub_snprintf (ptr, DEV_SIZE - (ptr - *device),
98
ptr += grub_strlen (ptr);
100
if (bsd_part != 0xff)
101
grub_snprintf (ptr, DEV_SIZE - (ptr - *device), ",%u",
103
ptr += grub_strlen (ptr);
96
107
/* Add a memory region. */