char *set_kernel(char *arg) { enum cl_kernels kern; int i, device = 0; char *nextptr; nextptr = strtok(arg, ","); if (nextptr == NULL) return "Invalid parameters for set kernel"; kern = select_kernel(nextptr); if (kern == KL_NONE) return "Invalid parameter to set_kernel"; gpus[device++].kernel = kern; if (kern >= KL_DARKCOIN) dm_mode = DM_BITCOIN; else if(kern >= KL_QUARKCOIN) dm_mode = DM_QUARKCOIN; else dm_mode = DM_LITECOIN; while ((nextptr = strtok(NULL, ",")) != NULL) { kern = select_kernel(nextptr); if (kern == KL_NONE) return "Invalid parameter to set_kernel"; gpus[device++].kernel = kern; } if (device == 1) { for (i = device; i < MAX_GPUDEVICES; i++) gpus[i].kernel = gpus[0].kernel; } return NULL; }
char *set_kernel(char *arg) { enum cl_kernels kern; int i, device = 0; char *nextptr; if (opt_scrypt) return "Cannot use sha256 kernel with scrypt"; nextptr = strtok(arg, ","); if (nextptr == NULL) return "Invalid parameters for set kernel"; kern = select_kernel(nextptr); if (kern == KL_NONE) return "Invalid parameter to set_kernel"; gpus[device++].kernel = kern; while ((nextptr = strtok(NULL, ",")) != NULL) { kern = select_kernel(nextptr); if (kern == KL_NONE) return "Invalid parameter to set_kernel"; gpus[device++].kernel = kern; } if (device == 1) { for (i = device; i < MAX_GPUDEVICES; i++) gpus[i].kernel = gpus[0].kernel; } return NULL; }
static INTN simple_choose(CHAR16 **argv, INTN argc, INTN index, CHAR16 *kname, CHAR16 *cmdline) { # define BOOT_IMG_STR L"BOOT_IMAGE=" CHAR16 buffer[CMDLINE_MAXLEN]; CHAR16 alt_buffer[CMDLINE_MAXLEN]; CHAR16 initrd_name[PATHNAME_MAXLEN]; CHAR16 vmcode_name[PATHNAME_MAXLEN]; CHAR16 args[CMDLINE_MAXLEN]; CHAR16 devname[PATHNAME_MAXLEN]; CHAR16 dpath[FILENAME_MAXLEN]; CHAR16 *slash_pos, *colon_pos, *backslash_pos; UINTN len; INTN ret; buffer[0] = alt_buffer[0] = CHAR_NULL; display_message(); restart: initrd_name[0] = vmcode_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL; /* reset per image loader options */ Memset(&elilo_opt.img_opt, 0, sizeof(elilo_opt.img_opt)); /* * check for alternate kernel image and params in EFI variable */ if (elilo_opt.alt_check && alternate_kernel(alt_buffer, sizeof(alt_buffer)) == 0) { argc = argify(alt_buffer,sizeof(alt_buffer), argv); alt_argv = argv; index = 0; args[0] = initrd_name[0] = vmcode_name[0] = 0; /* * don't check twice because the variable is deleted after * first access */ elilo_opt.alt_check = 0; } if (elilo_opt.prompt) { console_textmode(); ret = select_kernel(buffer, CMDLINE_MAXLEN); if (ret == -1) return -1; /* this function takes really the number of bytes ... */ argc = argify(buffer,sizeof(buffer), argv); index = 0; } /* * if we found an alternate choice and the user * did not force it manually, then use the alternate * option. */ if (alt_buffer[0] && buffer[0] == CHAR_NULL) { StrCpy(buffer, alt_buffer); } /* * First search for matching label in the config file * if options were specified on command line, they take * precedence over the ones in the config file * * if no match is found, the args and initrd arguments may * still be modified by global options in the config file. */ ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name, vmcode_name); /* * not found, so assume first argument is kernel name and * not label name */ if (ret == -1) { if ((index < argc) && argv[index]) StrCpy(kname, argv[index]); else StrCpy(kname, elilo_opt.default_kernel); } /* * no matter what happened for kname, if user specified * additional options, they override the ones in the * config file */ if (argc > 1+index) { /*StrCpy(args, argv[++index]);*/ while (++index < argc) { StrCat(args, L" "); StrCat(args, argv[index]); } } /* * if initrd specified on command line, it overrides * the one defined in config file, if any */ if (elilo_opt.initrd[0] == CHAR_NULL && initrd_name[0] != CHAR_NULL) { StrCpy(elilo_opt.initrd, initrd_name); } if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) { StrCpy(elilo_opt.vmcode, vmcode_name); } VERB_PRT(1, { Print(L"kernel is '%s'\n", kname); Print(L"arguments are '%s'\n", args); if (elilo_opt.initrd[0]) Print(L"initrd is '%s'\n", elilo_opt.initrd); if (elilo_opt.vmcode[0]) Print(L"vmm is '%s'\n", elilo_opt.vmcode); });