int do_cmd_boot_load(int boot_id, int device_flag) { int ret = -1; //struct termio sav; #if 0 if (boot_id == -1 && check_cdrom() && device_flag == IDE) { ioctl (STDIN, CBREAK, &sav); ret=do_cmd_menu_list(CDROM, "/dev/iso9660/usb0"); ioctl (STDIN, TCSETAF, &sav); } else if (boot_id == -1 && check_ide() && device_flag == CDROM) { ioctl(STDIN, CBREAK, &sav); ret = do_cmd_menu_list(IDE, "(wd0,0)"); ioctl(STDIN, TCSETAF, &sav); } else #endif { //printf("do_cmd_menu_list\n"); if (boot_id < menus_num) { vga_available = 0; ret = boot_load(boot_id); if (ret <0 ) { vga_available = 1; //printf("The kernel entry is wrong!\nPlease check the kernel entry in boot.cfg file!\n"); //getchar(); } return ret; } } return ret; }
int lst_parse_entry(easyflash_cart_t * cart, const char *buf_in) { int res = -1; char *filename = NULL; char *menuname = NULL; char *typestr = NULL; lst_type_t type = LST_TYPE_NORMAL; char *buf = strdup(buf_in); filename = strtok(buf, LST_SEP_CHAR "\r\n"); menuname = strtok(NULL, LST_SEP_CHAR "\r\n"); if (menuname != NULL) { typestr = strtok(NULL, "\r\n"); if ((typestr != NULL) && (typestr[1] != 0)) { util_error("too long type!"); goto fail; } } if (typestr != NULL) { for (type = LST_TYPE_NORMAL; type < LST_TYPE_NUM; ++type) { if (lst_type_char[type] == typestr[0]) { break; } } if (type == LST_TYPE_NUM) { util_error("invalid type '%c'!", typestr[0]); goto fail; } } switch (type) { case LST_TYPE_NORMAL: case LST_TYPE_HIDDEN: case LST_TYPE_ALIGN64K: res = main_flash_add_file(cart, filename, menuname, type == LST_TYPE_HIDDEN, type == LST_TYPE_ALIGN64K, 0); break; case LST_TYPE_EAPI: res = eapi_load(cart, filename) || eapi_inject(cart, 1); break; case LST_TYPE_BOOTO: case LST_TYPE_BOOTN: res = boot_load(cart, filename, type == LST_TYPE_BOOTO); break; case LST_TYPE_LOADERO: case LST_TYPE_LOADERN: res = loader_load(cart, filename, type == LST_TYPE_LOADERO); break; default: break; } free(buf); return res; fail: free(buf); return -1; }