Exemplo n.º 1
0
void runsyslinuximage(const char*cmd, long ipappend)
{
  unsigned int numfun = 0;
  char *ptr,*cmdline;

  getversion(NULL,&numfun);
  // Function 16h not supported Fall back to runcommand
  if (numfun < 0x16) runsyslinuxcmd(cmd);
  // Try the Run Kernel Image function
  // Split command line into
  strcpy(__com32.cs_bounce,cmd);
  ptr = __com32.cs_bounce;
  // serach for first space or end of string
  while ( (*ptr) && (*ptr != ' ')) ptr++;
  if (!*ptr) cmdline = ptr; // no command line
  else {
     *ptr++='\0'; // terminate kernal name
     cmdline = ptr+1;
     while (*cmdline != ' ') cmdline++; // find first non-space
  }
  // Now call the interrupt
  REG_BX(inreg) = OFFS(cmdline);
  REG_ES(inreg) = SEG(cmdline);
  REG_SI(inreg) = OFFS(__com32.cs_bounce);
  REG_DS(inreg) = SEG(__com32.cs_bounce);
  REG_EDX(inreg) = 0;

  __intcall(0x22,&inreg,&outreg); // If successful does not return
}
Exemplo n.º 2
0
int start_menu_mode(struct s_hardware *hardware, char *version_string)
{
    struct s_hdt_menu hdt_menu;

    memset(&hdt_menu, 0, sizeof(hdt_menu));

    /* Setup the menu system */
    setup_menu(version_string);

    /* Compute all submenus */
    compute_submenus(&hdt_menu, hardware);

    /* Compute the main menu */
    compute_main_menu(&hdt_menu, hardware);

#ifdef WITH_MENU_DISPLAY
    t_menuitem *curr;
    char cmd[160];

    if (!quiet)
	more_printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count);
    curr = showmenus(hdt_menu.main_menu.menu);
    /* When we exit the menu, do we have something to do? */
    if (curr) {
	/* When want to execute something */
	if (curr->action == OPT_RUN) {
	    /* Tweak, we want to switch to the cli */
	    if (!strncmp
		(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
		return HDT_RETURN_TO_CLI;
	    }
	    /* Tweak, we want to start the dump mode */
	    if (!strncmp
		(curr->data, HDT_DUMP, sizeof(HDT_DUMP))) {
		    dump(hardware);
	        return 0;
	    }
	    if (!strncmp
		(curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
		syslinux_reboot(1);
	    }
	    strcpy(cmd, curr->data);

	    /* Use specific syslinux call if needed */
	    if (issyslinux())
		runsyslinuxcmd(cmd);
	    else
		csprint(cmd, 0x07);
	    return 1;		// Should not happen when run from SYSLINUX
	}
    }
#endif
    return 0;
}
Exemplo n.º 3
0
int main(const int argc, const char *argv[])
{
    char version_string[256];
    static struct s_hardware hardware;

    snprintf(version_string, sizeof version_string, "%s %s (%s)",
	     PRODUCT_NAME, VERSION, CODENAME);

    /* Cleaning structures */
    init_hardware(&hardware);

    /* Detecting Syslinux version */
    detect_syslinux(&hardware);

    /* Detecting parameters */
    detect_parameters(argc, argv, &hardware);

    /* Opening the Syslinux console */
    init_console(&hardware);

    /* Detect hardware */
    detect_hardware(&hardware);

    /* Clear the screen and reset position of the cursor */
    clear_screen();
    printf("\033[1;1H");

    more_printf("%s\n", version_string);

    int return_code = 0;

    if (!menumode || automode)
	start_cli_mode(&hardware);
    else {
	return_code = start_menu_mode(&hardware, version_string);
	if (return_code == HDT_RETURN_TO_CLI)
	    start_cli_mode(&hardware);
    }

    /* Do we got request to do something at exit time ? */
    if (strlen(hardware.postexec)>0) {
	    more_printf("Executing postexec instructions : %s\n",hardware.postexec);
	    runsyslinuxcmd(hardware.postexec);
    }

    return return_code;
}