Beispiel #1
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int main(int argc, char **argv)
{
  int menu_index;
  const union syslinux_derivative_info *sdi;

  openconsole(&dev_stdcon_r, &dev_stdcon_w);

  lowmem_buf = __com32.cs_bounce;
  lowmem_buf_size = __com32.cs_bounce_size;

  sdi = syslinux_derivative_info();

  gfx_config.sector_shift = sdi->disk.sector_shift;
  gfx_config.boot_drive = sdi->disk.drive_number;

  if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
    gfx_config.sector_shift = 11;
    gfx_config.boot_drive = 0;
  }

  gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;

  if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
    gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
  }

  gfx_config.bootloader = 1;
  gfx_config.sysconfig_size = sizeof gfx_config;
  gfx_config.bootloader_seg = 0;	// apparently not needed

  save_buf_size = lowmem_buf_size;
  save_buf = malloc(save_buf_size);

  if(argc < 2) {
    printf("Usage: gfxboot.c32 bootlogo_file [message_file]\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(read_config_file()) {
    printf("Error reading config file\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(gfx_init(argv[1])) {
    printf("Error setting up gfxboot\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  gfx_menu_init();

  for(;;) {
    menu_index = gfx_input();

    // abort gfx, return to text mode prompt
    if(menu_index == -1) {
      gfx_done();
      break;
    }

    // does not return if it succeeds
    boot(menu_index);
  }

  if(argc > 2) show_message(argv[2]);

  return 0;
}
Beispiel #2
0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int main(int argc, char **argv)
{
  int menu_index;
  const union syslinux_derivative_info *sdi;
  char working_dir[256];

  openconsole(&dev_stdcon_r, &dev_stdcon_w);

  lowmem_buf = lmalloc(LOWMEM_BUF_SIZE);
  if (!lowmem_buf) {
    printf("Could not allocate memory.\n");
    return 1;
  }

  sdi = syslinux_derivative_info();

  gfx_config.sector_shift = sdi->disk.sector_shift;
  gfx_config.boot_drive = sdi->disk.drive_number;

  if(sdi->c.filesystem == SYSLINUX_FS_PXELINUX) {
    gfx_config.sector_shift = 11;
    gfx_config.boot_drive = 0;
  }

  gfx_config.media_type = gfx_config.boot_drive < 0x80 ? 1 : 0;

  if(sdi->c.filesystem == SYSLINUX_FS_ISOLINUX) {
    gfx_config.media_type = sdi->iso.cd_mode ? 0 : 2;
  }

  gfx_config.bootloader = 1;
  gfx_config.sysconfig_size = sizeof gfx_config;
  gfx_config.bootloader_seg = 0;	// apparently not needed

  if(argc < 2) {
    printf("Usage: gfxboot.c32 bootlogo_file [message_file]\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(read_config_file("~")) {
    printf("Error reading config file\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  if(getcwd(working_dir, sizeof working_dir)) {
    gfx_config.gfxboot_cwd = (uint32_t) working_dir;
  }

  if(gfx_init(argv[1])) {
    printf("Error setting up gfxboot\n");
    if(argc > 2) show_message(argv[2]);

    return 0;
  }

  gfx_menu_init();

  for(;;) {
    menu_index = gfx_input();

    // abort gfx, return to text mode prompt
    if(menu_index == -1) {
      gfx_done();
      break;
    }

    // does not return if it succeeds
    boot(menu_index);
  }

  if(argc > 2) show_message(argv[2]);

  return 0;
}