Lines Matching full:label
446 * when a label section completes. We deal with that by ending a label
458 * Describes a single label given in a pxe file.
462 * name - the name of the menu as given on the 'menu label' line.
463 * kernel - the path to the kernel file to use for this label.
464 * append - kernel command line to use when booting this label
465 * initrd - path to the initrd to use for this label.
466 * attempted - 0 if we haven't tried to boot this label, 1 if we have.
467 * localboot - 1 if this label specified 'localboot', 0 otherwise.
490 * default_label - the name of the default label, if any.
492 * booting the default label.
514 struct pxe_label *label; in label_create() local
516 label = malloc(sizeof(struct pxe_label)); in label_create()
518 if (!label) in label_create()
521 memset(label, 0, sizeof(struct pxe_label)); in label_create()
523 return label; in label_create()
534 static void label_destroy(struct pxe_label *label) in label_destroy() argument
536 if (label->name) in label_destroy()
537 free(label->name); in label_destroy()
539 if (label->kernel) in label_destroy()
540 free(label->kernel); in label_destroy()
542 if (label->append) in label_destroy()
543 free(label->append); in label_destroy()
545 if (label->initrd) in label_destroy()
546 free(label->initrd); in label_destroy()
548 if (label->fdt) in label_destroy()
549 free(label->fdt); in label_destroy()
551 if (label->fdtdir) in label_destroy()
552 free(label->fdtdir); in label_destroy()
554 free(label); in label_destroy()
558 * Print a label and its string members if they're defined.
565 struct pxe_label *label = data; in label_print() local
566 const char *c = label->menu ? label->menu : label->name; in label_print()
568 printf("%s:\t%s\n", label->num, c); in label_print()
572 * Boot a label that specified 'localboot'. This requires that the 'localcmd'
574 * command. If the label specified an 'append' line, its contents will be
580 static int label_localboot(struct pxe_label *label) in label_localboot() argument
589 if (label->append) { in label_localboot()
592 cli_simple_process_macros(label->append, bootargs); in label_localboot()
610 * If the label specifies an initrd file, it will be stored in the location
613 * If the label specifies an 'append' line, its contents will overwrite that
616 static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label) in label_boot() argument
627 label_print(label); in label_boot()
629 label->attempted = 1; in label_boot()
631 if (label->localboot) { in label_boot()
632 if (label->localboot_val >= 0) in label_boot()
633 label_localboot(label); in label_boot()
637 if (label->kernel == NULL) { in label_boot()
639 label->name); in label_boot()
643 if (label->initrd) { in label_boot()
644 if (get_relfile_envaddr(cmdtp, label->initrd, "ramdisk_addr_r") < 0) { in label_boot()
646 label->name); in label_boot()
656 if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) { in label_boot()
658 label->name); in label_boot()
662 if (label->ipappend & 0x1) { in label_boot()
669 if (label->ipappend & 0x2) { in label_boot()
678 if ((label->ipappend & 0x3) || label->append) { in label_boot()
682 if (strlen(label->append ?: "") + in label_boot()
685 strlen(label->append ?: ""), in label_boot()
690 if (label->append) in label_boot()
691 strncpy(bootargs, label->append, in label_boot()
708 * Scenario 1: If fdt_addr_r specified and "fdt" label is defined in in label_boot()
719 /* if fdt label is defined then get fdt from server */ in label_boot()
724 if (label->fdt) { in label_boot()
725 fdtfile = label->fdt; in label_boot()
726 } else if (label->fdtdir) { in label_boot()
748 len = strlen(label->fdtdir); in label_boot()
751 else if (label->fdtdir[len - 1] != '/') in label_boot()
756 len = strlen(label->fdtdir) + strlen(slash) + in label_boot()
766 label->fdtdir, slash, f1, f2, f3, f4); in label_boot()
775 label->name); in label_boot()
853 {"label", T_LABEL},
1157 * Handles parsing a 'menu line' when we're parsing a label.
1160 struct pxe_label *label) in parse_label_menu() argument
1172 cfg->default_label = strdup(label->name); in parse_label_menu()
1179 parse_sliteral(c, &label->menu); in parse_label_menu()
1192 * Parses a label and adds it to the list of labels for a menu.
1194 * A label ends when we either get to the end of a file, or
1204 struct pxe_label *label; in parse_label() local
1207 label = label_create(); in parse_label()
1208 if (!label) in parse_label()
1211 err = parse_sliteral(c, &label->name); in parse_label()
1213 printf("Expected label name: %.*s\n", (int)(*c - s), s); in parse_label()
1214 label_destroy(label); in parse_label()
1218 list_add_tail(&label->list, &cfg->labels); in parse_label()
1227 err = parse_label_menu(c, cfg, label); in parse_label()
1232 err = parse_sliteral(c, &label->kernel); in parse_label()
1236 err = parse_sliteral(c, &label->append); in parse_label()
1237 if (label->initrd) in parse_label()
1239 s = strstr(label->append, "initrd="); in parse_label()
1244 label->initrd = malloc(len + 1); in parse_label()
1245 strncpy(label->initrd, s, len); in parse_label()
1246 label->initrd[len] = '\0'; in parse_label()
1251 if (!label->initrd) in parse_label()
1252 err = parse_sliteral(c, &label->initrd); in parse_label()
1256 if (!label->fdt) in parse_label()
1257 err = parse_sliteral(c, &label->fdt); in parse_label()
1261 if (!label->fdtdir) in parse_label()
1262 err = parse_sliteral(c, &label->fdtdir); in parse_label()
1266 label->localboot = 1; in parse_label()
1267 err = parse_integer(c, &label->localboot_val); in parse_label()
1271 err = parse_integer(c, &label->ipappend); in parse_label()
1280 * of a label and whatever token this is, it's in parse_label()
1388 struct pxe_label *label; in destroy_pxe_menu() local
1397 label = list_entry(pos, struct pxe_label, list); in destroy_pxe_menu()
1399 label_destroy(label); in destroy_pxe_menu()
1447 struct pxe_label *label; in pxe_menu_to_menu() local
1464 label = list_entry(pos, struct pxe_label, list); in pxe_menu_to_menu()
1466 sprintf(label->num, "%d", i++); in pxe_menu_to_menu()
1467 if (menu_item_add(m, label->num, label) != 1) { in pxe_menu_to_menu()
1472 (strcmp(label->name, cfg->default_label) == 0)) in pxe_menu_to_menu()
1473 default_num = label->num; in pxe_menu_to_menu()
1478 * After we've created items for each label in the menu, set the in pxe_menu_to_menu()
1479 * menu's default label if one was specified. in pxe_menu_to_menu()
1502 struct pxe_label *label; in boot_unattempted_labels() local
1505 label = list_entry(pos, struct pxe_label, list); in boot_unattempted_labels()
1507 if (!label->attempted) in boot_unattempted_labels()
1508 label_boot(cmdtp, label); in boot_unattempted_labels()