Esempio n. 1
0
void
grub_machine_init (void)
{
  int ver;

  /* First of all - establish connection with U-Boot */
  ver = grub_uboot_api_init ();
  if (!ver)
    {
      /* Don't even have a console to log errors to... */
      grub_exit ();
    }
  else if (ver > API_SIG_VERSION)
    {
      /* Try to print an error message */
      grub_uboot_puts ("invalid U-Boot API version\n");
    }

  /* Initialize the console so that GRUB can display messages.  */
  grub_console_init_early ();

  /* Enumerate memory and initialize the memory management system. */
  grub_uboot_mm_init ();

  /* Should be earlier but it needs memalign.  */
#ifdef __arm__
  grub_arm_enable_caches_mmu ();
#endif

  grub_dprintf ("init", "__bss_start: %p\n", __bss_start);
  grub_dprintf ("init", "_end: %p\n", _end);
  grub_dprintf ("init", "grub_modbase: %p\n", (void *) grub_modbase);
  grub_dprintf ("init", "grub_modules_get_end(): %p\n",
		(void *) grub_modules_get_end ());

  /* Initialise full terminfo support */
  grub_console_init_lately ();

  /* Enumerate uboot devices */
  grub_uboot_probe_hardware ();

  /* Initialise timer */
#ifdef __arm__
  if (grub_uboot_get_machine_type () == GRUB_ARM_MACHINE_TYPE_RASPBERRY_PI)
    {
      grub_install_get_time_ms (rpi_timer_ms);
    }
  else
#endif
    {
      timer_start = grub_uboot_get_timer (0);
      grub_install_get_time_ms (uboot_timer_ms);
    }

  /* Initialize  */
  grub_ubootdisk_init ();
}
Esempio n. 2
0
void
grub_machine_init (void)
{
  char args[256];
  grub_ssize_t actual;

  grub_ieee1275_init ();

  grub_console_init_early ();
#ifdef __i386__
  grub_get_extended_memory ();
#endif
  grub_claim_heap ();
  grub_console_init_lately ();
  grub_ofdisk_init ();

  /* Process commandline.  */
  if (grub_ieee1275_get_property (grub_ieee1275_chosen, "bootargs", &args,
				  sizeof args, &actual) == 0
      && actual > 1)
    {
      int i = 0;

      while (i < actual)
	{
	  char *command = &args[i];
	  char *end;
	  char *val;

	  end = grub_strchr (command, ';');
	  if (end == 0)
	    i = actual; /* No more commands after this one.  */
	  else
	    {
	      *end = '\0';
	      i += end - command + 1;
	      while (grub_isspace(args[i]))
		i++;
	    }

	  /* Process command.  */
	  val = grub_strchr (command, '=');
	  if (val)
	    {
	      *val = '\0';
	      grub_env_set (command, val + 1);
	    }
	}
    }

  grub_install_get_time_ms (ieee1275_get_time_ms);
}
Esempio n. 3
0
void
grub_machine_init (void)
{
  grub_modbase = ALIGN_UP((grub_addr_t) _end 
			  + GRUB_KERNEL_MACHINE_MOD_GAP,
			  GRUB_KERNEL_MACHINE_MOD_ALIGN);
  grub_ieee1275_init ();

  grub_console_init_early ();
  grub_claim_heap ();
  grub_console_init_lately ();
  grub_ofdisk_init ();

  grub_parse_cmdline ();

#ifdef __i386__
  grub_tsc_init ();
#else
  grub_install_get_time_ms (grub_rtc_get_time_ms);
#endif
}