grub_machine_get_bootlocation (char **device, char **path)
{
char *bootpath;
- grub_ssize_t bootpath_size;
char *filename;
char *type;
- if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
- &bootpath_size)
- || bootpath_size <= 0)
- {
- /* Should never happen. */
- grub_printf ("/chosen/bootpath property missing!\n");
- return;
- }
-
- bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
+ bootpath = grub_ieee1275_get_boot_dev ();
if (! bootpath)
- {
- grub_print_error ();
- return;
- }
- grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
- (grub_size_t) bootpath_size + 1, 0);
- bootpath[bootpath_size] = '\0';
+ return;
/* Transform an OF device path to a GRUB path. */
return NULL;
}
+char *
+grub_ieee1275_get_boot_dev (void)
+{
+ char *bootpath;
+ grub_ssize_t bootpath_size;
+
+ if (grub_ieee1275_get_property_length (grub_ieee1275_chosen, "bootpath",
+ &bootpath_size)
+ || bootpath_size <= 0)
+ {
+ /* Should never happen. */
+ grub_printf ("/chosen/bootpath property missing!\n");
+ return NULL;
+ }
+
+ bootpath = (char *) grub_malloc ((grub_size_t) bootpath_size + 64);
+ if (! bootpath)
+ {
+ grub_print_error ();
+ return NULL;
+ }
+ grub_ieee1275_get_property (grub_ieee1275_chosen, "bootpath", bootpath,
+ (grub_size_t) bootpath_size + 1, 0);
+ bootpath[bootpath_size] = '\0';
+
+ return bootpath;
+}
void EXPORT_FUNC(grub_ieee1275_children_first) (const char *devpath,
struct grub_ieee1275_devalias *alias);
+char *EXPORT_FUNC(grub_ieee1275_get_boot_dev) (void);
+
#define FOR_IEEE1275_DEVALIASES(alias) for (grub_ieee1275_devalias_init_iterator (&(alias)); grub_ieee1275_devalias_next (&(alias));)
#define FOR_IEEE1275_DEVCHILDREN(devpath, alias) for (grub_ieee1275_children_first ((devpath), &(alias)); \