]> git.ozlabs.org Git - petitboot/blob - ui/ncurses/nc-boot-editor.c
discover/grub2: Allow to separate the --id argument using a space char
[petitboot] / ui / ncurses / nc-boot-editor.c
1 /*
2  *  Copyright (C) 2009 Sony Computer Entertainment Inc.
3  *  Copyright 2009 Sony Corp.
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; version 2 of the License.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #if defined(HAVE_CONFIG_H)
20 #include "config.h"
21 #endif
22
23 #include <assert.h>
24 #include <string.h>
25
26 #include "log/log.h"
27 #include "talloc/talloc.h"
28 #include "i18n/i18n.h"
29 #include "nc-boot-editor.h"
30 #include "nc-widgets.h"
31
32 struct boot_editor {
33         struct nc_scr           scr;
34         struct cui              *cui;
35         void                    *data;
36         struct pmenu_item       *item;
37         enum {
38                 STATE_EDIT,
39                 STATE_CANCEL,
40                 STATE_SAVE,
41                 STATE_HELP,
42         }                       state;
43         void                    (*on_exit)(struct cui *cui,
44                                         struct pmenu_item *item,
45                                         struct pb_boot_data *bd);
46         bool                    need_redraw;
47         bool                    need_update;
48
49         int                     label_x;
50         int                     field_x;
51         int                     scroll_y;
52
53         WINDOW                  *pad;
54         struct nc_widgetset     *widgetset;
55         struct {
56                 struct nc_widget_label          *device_l;
57                 struct nc_widget_select         *device_f;
58                 struct nc_widget_label          *image_l;
59                 struct nc_widget_textbox        *image_f;
60                 struct nc_widget_label          *initrd_l;
61                 struct nc_widget_textbox        *initrd_f;
62                 struct nc_widget_label          *dtb_l;
63                 struct nc_widget_textbox        *dtb_f;
64                 struct nc_widget_label          *args_l;
65                 struct nc_widget_textbox        *args_f;
66                 struct nc_widget_label          *args_sig_file_l;
67                 struct nc_widget_textbox        *args_sig_file_f;
68                 struct nc_widget_button         *ok_b;
69                 struct nc_widget_button         *help_b;
70                 struct nc_widget_button         *cancel_b;
71         } widgets;
72
73         const char              *selected_device;
74         char                    *image;
75         char                    *initrd;
76         char                    *dtb;
77         char                    *args;
78         char                    *args_sig_file;
79
80         bool                    use_signature_files;
81 };
82
83 extern const struct help_text boot_editor_help_text;
84
85 static struct boot_editor *boot_editor_from_scr(struct nc_scr *scr)
86 {
87         struct boot_editor *boot_editor;
88
89         assert(scr->sig == pb_boot_editor_sig);
90         boot_editor = (struct boot_editor *)
91                 ((char *)scr - (size_t)&((struct boot_editor *)0)->scr);
92         assert(boot_editor->scr.sig == pb_boot_editor_sig);
93         return boot_editor;
94 }
95
96 static void pad_refresh(struct boot_editor *boot_editor)
97 {
98         int y, x, rows, cols;
99
100         getmaxyx(boot_editor->scr.sub_ncw, rows, cols);
101         getbegyx(boot_editor->scr.sub_ncw, y, x);
102
103         prefresh(boot_editor->pad, boot_editor->scroll_y, 0,
104                         y, x, rows, cols);
105 }
106
107 static struct boot_editor *boot_editor_from_arg(void *arg)
108 {
109         struct boot_editor *boot_editor = arg;
110
111         assert(boot_editor->scr.sig == pb_boot_editor_sig);
112         return boot_editor;
113 }
114
115 static int boot_editor_post(struct nc_scr *scr)
116 {
117         struct boot_editor *boot_editor = boot_editor_from_scr(scr);
118
119         if (boot_editor->need_update) {
120                 boot_editor_update(boot_editor, boot_editor->cui->sysinfo);
121                 boot_editor->need_update = false;
122         } else {
123                 widgetset_post(boot_editor->widgetset);
124         }
125
126         nc_scr_frame_draw(scr);
127         if (boot_editor->need_redraw) {
128                 redrawwin(scr->main_ncw);
129                 boot_editor->need_redraw = false;
130         }
131         wrefresh(boot_editor->scr.main_ncw);
132         pad_refresh(boot_editor);
133         return 0;
134 }
135
136 static int boot_editor_unpost(struct nc_scr *scr)
137 {
138         widgetset_unpost(boot_editor_from_scr(scr)->widgetset);
139         return 0;
140 }
141
142 struct nc_scr *boot_editor_scr(struct boot_editor *boot_editor)
143 {
144         return &boot_editor->scr;
145 }
146
147 static void boot_editor_resize(struct nc_scr *scr)
148 {
149         /* FIXME: forms can't be resized, need to recreate here */
150         boot_editor_unpost(scr);
151         boot_editor_post(scr);
152 }
153
154 static char *conditional_prefix(struct pb_boot_data *ctx,
155                 const char *prefix, const char *value)
156 {
157         const char *sep;
158
159         if (!value || !*value)
160                 return NULL;
161
162         sep = "";
163         if (!prefix)
164                 prefix = "";
165         else if ((prefix[strlen(prefix) - 1] != '/') &&
166                                 (value[0] != '/'))
167                 sep = "/";
168
169         return talloc_asprintf(ctx, "%s%s%s", prefix, sep, value);
170 }
171
172 static struct pb_boot_data *boot_editor_prepare_data(
173                 struct boot_editor *boot_editor)
174 {
175         struct pb_boot_data *bd;
176         char *s, *prefix;
177         int idx;
178
179         bd = talloc(boot_editor, struct pb_boot_data);
180
181         if (!bd)
182                 return NULL;
183
184         idx = widget_select_get_value(boot_editor->widgets.device_f);
185         if (idx == -1 || (unsigned int)idx >
186                         boot_editor->cui->sysinfo->n_blockdevs)
187                 prefix = NULL;
188         else
189                 prefix = boot_editor->cui->sysinfo->blockdevs[idx]->mountpoint;
190
191         s = widget_textbox_get_value(boot_editor->widgets.image_f);
192         bd->image = conditional_prefix(bd, prefix, s);
193         if (!bd->image) {
194                 talloc_free(bd);
195                 return NULL;
196         }
197
198         s = widget_textbox_get_value(boot_editor->widgets.initrd_f);
199         bd->initrd = conditional_prefix(bd, prefix, s);
200
201         s = widget_textbox_get_value(boot_editor->widgets.dtb_f);
202         bd->dtb = conditional_prefix(bd, prefix, s);
203
204         s = widget_textbox_get_value(boot_editor->widgets.args_f);
205         bd->args = *s ? talloc_strdup(bd, s) : NULL;
206
207         if (boot_editor->use_signature_files) {
208                 s = widget_textbox_get_value(
209                         boot_editor->widgets.args_sig_file_f);
210                 bd->args_sig_file = conditional_prefix(bd, prefix, s);
211         }
212         else {
213                 bd->args_sig_file = NULL;
214         }
215
216         return bd;
217 }
218
219 /**
220  * boot_editor_process_key - Process a user keystroke.
221  *
222  * Called from the cui via the scr:process_key method.
223  */
224
225 static void boot_editor_process_key(struct nc_scr *scr, int key)
226 {
227         struct boot_editor *boot_editor = boot_editor_from_scr(scr);
228         struct pmenu_item *item;
229         struct pb_boot_data *bd;
230         bool handled;
231
232         handled = widgetset_process_key(boot_editor->widgetset, key);
233         if (handled)
234                 pad_refresh(boot_editor);
235
236         else if (key == 'x' || key == 27)
237                 boot_editor->state = STATE_CANCEL;
238
239         else if (key == 'h')
240                 boot_editor->state = STATE_HELP;
241
242         item = NULL;
243         bd = NULL;
244
245         switch (boot_editor->state) {
246         case STATE_SAVE:
247                 item = boot_editor->item;
248                 bd = boot_editor_prepare_data(boot_editor);
249                 if (!bd) {
250                         /* Incomplete entry */
251                         boot_editor->state = STATE_EDIT;
252                         break;
253                 }
254                 /* fall through */
255         case STATE_CANCEL:
256                 boot_editor->on_exit(boot_editor->cui, item, bd);
257                 break;
258         case STATE_HELP:
259                 boot_editor->state = STATE_EDIT;
260                 boot_editor->need_redraw = true;
261                 cui_show_help(boot_editor->cui, _("Boot Option Editor"),
262                                 &boot_editor_help_text);
263                 break;
264         default:
265                 break;
266         }
267 }
268
269 /**
270  * boot_editor_destructor - The talloc destructor for a boot_editor.
271  */
272
273 static int boot_editor_destructor(void *arg)
274 {
275         struct boot_editor *boot_editor = boot_editor_from_arg(arg);
276         boot_editor->scr.sig = pb_removed_sig;
277         if (boot_editor->pad)
278                 delwin(boot_editor->pad);
279         return 0;
280 }
281
282 static void ok_click(void *arg)
283 {
284         struct boot_editor *boot_editor = arg;
285         boot_editor->state = STATE_SAVE;
286 }
287
288 static void help_click(void *arg)
289 {
290         struct boot_editor *boot_editor = arg;
291         boot_editor->state = STATE_HELP;
292 }
293
294 static void cancel_click(void *arg)
295 {
296         struct boot_editor *boot_editor = arg;
297         boot_editor->state = STATE_CANCEL;
298 }
299
300 static int layout_pair(struct boot_editor *boot_editor, int y,
301                 struct nc_widget_label *label,
302                 struct nc_widget_textbox *field)
303 {
304         struct nc_widget *label_w = widget_label_base(label);
305         struct nc_widget *field_w = widget_textbox_base(field);
306         widget_move(label_w, y, boot_editor->label_x);
307         widget_move(field_w, y, boot_editor->field_x);
308         return max(widget_height(label_w), widget_height(field_w));
309 }
310
311 static int pad_height(int blockdevs_height)
312 {
313         return 10 + (2 * blockdevs_height);
314 }
315
316 static void boot_editor_layout_widgets(struct boot_editor *boot_editor)
317 {
318         struct nc_widget *wf, *wl;
319         int y = 1;
320
321         wl = widget_label_base(boot_editor->widgets.device_l);
322         wf = widget_select_base(boot_editor->widgets.device_f);
323         widget_move(wl, y, boot_editor->label_x);
324         widget_move(wf, y, boot_editor->field_x);
325
326         y += widget_height(wf) + 1;
327
328
329         y += layout_pair(boot_editor, y, boot_editor->widgets.image_l,
330                                          boot_editor->widgets.image_f);
331
332         y += layout_pair(boot_editor, y, boot_editor->widgets.initrd_l,
333                                          boot_editor->widgets.initrd_f);
334
335         y += layout_pair(boot_editor, y, boot_editor->widgets.dtb_l,
336                                          boot_editor->widgets.dtb_f);
337
338         y += layout_pair(boot_editor, y, boot_editor->widgets.args_l,
339                                          boot_editor->widgets.args_f);
340
341         if (boot_editor->use_signature_files) {
342                 y += layout_pair(boot_editor, y,
343                                         boot_editor->widgets.args_sig_file_l,
344                                         boot_editor->widgets.args_sig_file_f);
345         }
346
347
348         y++;
349         widget_move(widget_button_base(boot_editor->widgets.ok_b), y,
350                     boot_editor->field_x);
351         widget_move(widget_button_base(boot_editor->widgets.help_b), y,
352                     boot_editor->field_x + 14);
353         widget_move(widget_button_base(boot_editor->widgets.cancel_b), y,
354                     boot_editor->field_x + 28);
355 }
356
357 static void boot_editor_widget_focus(struct nc_widget *widget, void *arg)
358 {
359         struct boot_editor *boot_editor = arg;
360         int w_y, s_max;
361
362         w_y = widget_y(widget) + widget_focus_y(widget);
363         s_max = getmaxy(boot_editor->scr.sub_ncw) - 1;
364
365         if (w_y < boot_editor->scroll_y)
366                 boot_editor->scroll_y = w_y;
367
368         else if (w_y + boot_editor->scroll_y + 1 > s_max)
369                 boot_editor->scroll_y = 1 + w_y - s_max;
370
371         else
372                 return;
373
374         pad_refresh(boot_editor);
375 }
376
377 static void boot_editor_device_select_change(void *arg, int idx)
378 {
379         struct boot_editor *boot_editor = arg;
380         if (idx == -1)
381                 boot_editor->selected_device = NULL;
382         else
383                 boot_editor->selected_device =
384                         boot_editor->cui->sysinfo->blockdevs[idx]->name;
385 }
386
387 static void boot_editor_populate_device_select(struct boot_editor *boot_editor,
388                 const struct system_info *sysinfo)
389 {
390         struct nc_widget_select *select = boot_editor->widgets.device_f;
391         unsigned int i;
392         bool selected;
393
394         widget_select_drop_options(select);
395
396         for (i = 0; sysinfo && i < sysinfo->n_blockdevs; i++) {
397                 struct blockdev_info *bd_info = sysinfo->blockdevs[i];
398                 const char *name;
399
400                 name = talloc_asprintf(boot_editor, "%s [%s]",
401                                 bd_info->name, bd_info->uuid);
402                 selected = boot_editor->selected_device &&
403                                 !strcmp(bd_info->name,
404                                                 boot_editor->selected_device);
405
406                 widget_select_add_option(select, i, name, selected);
407         }
408
409         /* If we're editing an existing option, the paths will be fully-
410          * resolved. In this case, we want the manual device pre-selected.
411          * However, we only do this if the widget hasn't been manually
412          * changed. */
413         selected = !boot_editor->selected_device;
414
415         widget_select_add_option(select, -1, _("Specify paths/URLs manually"),
416                         selected);
417 }
418
419 static bool path_on_device(struct blockdev_info *bd_info,
420                 const char *path)
421 {
422         int len;
423
424         if (!bd_info->mountpoint)
425                 return false;
426
427         len = strlen(bd_info->mountpoint);
428         if (strncmp(bd_info->mountpoint, path, len))
429                 return false;
430
431         /* if the mountpoint doesn't have a trailing slash, ensure that
432          * the path starts with one (so we don't match a "/mnt/sda1/foo" path
433          * on a "/mnt/sda" mountpoint) */
434         return bd_info->mountpoint[len-1] == '/' || path[len] == '/';
435 }
436
437
438 static void boot_editor_find_device(struct boot_editor *boot_editor,
439                 struct pb_boot_data *bd, const struct system_info *sysinfo)
440 {
441         struct blockdev_info *bd_info, *tmp;
442         unsigned int i, len;
443
444         if (!sysinfo || !sysinfo->n_blockdevs)
445                 return;
446
447         /* find the device for our boot image, by finding the longest
448          * matching blockdev's mountpoint */
449         for (len = 0, i = 0, bd_info = NULL; i < sysinfo->n_blockdevs; i++) {
450                 tmp = sysinfo->blockdevs[i];
451                 if (!path_on_device(tmp, bd->image))
452                         continue;
453                 if (strlen(tmp->mountpoint) <= len)
454                         continue;
455                 bd_info = tmp;
456                 len = strlen(tmp->mountpoint);
457         }
458
459         if (!bd_info)
460                 return;
461
462         /* ensure that other paths are on this device */
463         if (bd->initrd && !path_on_device(bd_info, bd->initrd))
464                 return;
465
466         if (bd->dtb && !path_on_device(bd_info, bd->dtb))
467                 return;
468
469         if (boot_editor->use_signature_files)
470                 if (bd->args_sig_file && !path_on_device(bd_info,
471                         bd->args_sig_file))
472                         return;
473
474         /* ok, we match; preselect the device option, and remove the common
475          * prefix */
476         boot_editor->selected_device = bd_info->name;
477         boot_editor->image += len;
478
479         if (boot_editor->initrd)
480                 boot_editor->initrd += len;
481         if (boot_editor->dtb)
482                 boot_editor->dtb += len;
483         if (boot_editor->use_signature_files)
484                 if (boot_editor->args_sig_file)
485                         boot_editor->args_sig_file += len;
486 }
487
488 static void boot_editor_setup_widgets(struct boot_editor *boot_editor,
489                 const struct system_info *sysinfo)
490 {
491         struct nc_widgetset *set = boot_editor->widgetset;
492         int field_size;
493
494         field_size = COLS - 1 - boot_editor->field_x;
495
496         boot_editor->widgets.device_l = widget_new_label(set, 0, 0,
497                         _("Device:"));
498         boot_editor->widgets.device_f = widget_new_select(set, 0, 0,
499                                                 field_size);
500         widget_select_on_change(boot_editor->widgets.device_f,
501                         boot_editor_device_select_change, boot_editor);
502
503         boot_editor_populate_device_select(boot_editor, sysinfo);
504
505         boot_editor->widgets.image_l = widget_new_label(set, 0, 0,
506                         _("Kernel:"));
507         boot_editor->widgets.image_f = widget_new_textbox(set, 0, 0,
508                                                 field_size, boot_editor->image);
509
510         boot_editor->widgets.initrd_l = widget_new_label(set, 0, 0,
511                         _("Initrd:"));
512         boot_editor->widgets.initrd_f = widget_new_textbox(set, 0, 0,
513                                                 field_size,
514                                                 boot_editor->initrd);
515
516         boot_editor->widgets.dtb_l = widget_new_label(set, 0, 0,
517                         _("Device tree:"));
518         boot_editor->widgets.dtb_f = widget_new_textbox(set, 0, 0,
519                                                 field_size, boot_editor->dtb);
520
521         boot_editor->widgets.args_l = widget_new_label(set, 0, 0,
522                         _("Boot arguments:"));
523         boot_editor->widgets.args_f = widget_new_textbox(set, 0, 0,
524                                         field_size, boot_editor->args);
525
526         if (boot_editor->use_signature_files) {
527                 boot_editor->widgets.args_sig_file_l = widget_new_label(set,
528                                 0, 0, _("Argument signature file:"));
529                 boot_editor->widgets.args_sig_file_f = widget_new_textbox(set,
530                                 0, 0, field_size, boot_editor->args_sig_file);
531         }
532         else {
533                 boot_editor->widgets.args_sig_file_l = NULL;
534                 boot_editor->widgets.args_sig_file_f = NULL;
535         }
536
537         boot_editor->widgets.ok_b = widget_new_button(set, 0, 0, 10,
538                                         _("OK"), ok_click, boot_editor);
539         boot_editor->widgets.help_b = widget_new_button(set, 0, 0, 10,
540                                         _("Help"), help_click, boot_editor);
541         boot_editor->widgets.cancel_b = widget_new_button(set, 0, 0, 10,
542                                         _("Cancel"), cancel_click, boot_editor);
543 }
544
545 static void boot_editor_draw(struct boot_editor *boot_editor,
546                 const struct system_info *sysinfo)
547 {
548         bool repost = false;
549         int height;
550
551         height = pad_height(sysinfo ? sysinfo->n_blockdevs : 0);
552
553         if (!boot_editor->pad || getmaxy(boot_editor->pad) < height) {
554                 if (boot_editor->pad)
555                         delwin(boot_editor->pad);
556                 boot_editor->pad = newpad(height, COLS);
557         }
558
559         if (boot_editor->widgetset) {
560                 widgetset_unpost(boot_editor->widgetset);
561                 talloc_free(boot_editor->widgetset);
562                 repost = true;
563         }
564
565         boot_editor->widgetset = widgetset_create(boot_editor,
566                         boot_editor->scr.main_ncw,
567                         boot_editor->pad);
568         widgetset_set_widget_focus(boot_editor->widgetset,
569                         boot_editor_widget_focus, boot_editor);
570
571         boot_editor_setup_widgets(boot_editor, sysinfo);
572         boot_editor_layout_widgets(boot_editor);
573
574         if (repost)
575                 widgetset_post(boot_editor->widgetset);
576 }
577
578 void boot_editor_update(struct boot_editor *boot_editor,
579                 const struct system_info *sysinfo)
580 {
581         const char *str;
582
583         if (boot_editor->cui->current != boot_editor_scr(boot_editor)) {
584                 boot_editor->need_update = true;
585                 return;
586         }
587
588         str = widget_textbox_get_value(boot_editor->widgets.image_f);
589         if (str) {
590                 talloc_free(boot_editor->image);
591                 boot_editor->image = talloc_strdup(boot_editor, str);
592         }
593
594         str = widget_textbox_get_value(boot_editor->widgets.initrd_f);
595         if (str) {
596                 talloc_free(boot_editor->initrd);
597                 boot_editor->initrd = talloc_strdup(boot_editor, str);
598         }
599
600         str = widget_textbox_get_value(boot_editor->widgets.dtb_f);
601         if (str) {
602                 talloc_free(boot_editor->dtb);
603                 boot_editor->dtb = talloc_strdup(boot_editor, str);
604         }
605
606         str = widget_textbox_get_value(boot_editor->widgets.args_f);
607         if (str) {
608                 talloc_free(boot_editor->args);
609                 boot_editor->args = talloc_strdup(boot_editor, str);
610         }
611
612         if (boot_editor->use_signature_files) {
613                 str = widget_textbox_get_value(boot_editor->widgets.args_sig_file_f);
614                 if (str) {
615                         talloc_free(boot_editor->args_sig_file);
616                         boot_editor->args_sig_file = talloc_strdup(boot_editor, str);
617                 }
618         }
619
620         boot_editor_draw(boot_editor, sysinfo);
621         pad_refresh(boot_editor);
622 }
623
624 struct boot_editor *boot_editor_init(struct cui *cui,
625                 struct pmenu_item *item,
626                 const struct system_info *sysinfo,
627                 void (*on_exit)(struct cui *cui,
628                                 struct pmenu_item *item,
629                                 struct pb_boot_data *bd))
630 {
631         struct boot_editor *boot_editor;
632         int ncols1, ncols2, ncols3;
633
634         boot_editor = talloc_zero(cui, struct boot_editor);
635
636         if (!boot_editor)
637                 return NULL;
638
639 #if defined(SIGNED_BOOT)
640 #if !defined(HARD_LOCKDOWN)
641         if (access(LOCKDOWN_FILE, F_OK) == -1)
642                 boot_editor->use_signature_files = false;
643         else
644 #endif
645                 boot_editor->use_signature_files = true;
646 #else
647         boot_editor->use_signature_files = false;
648 #endif
649
650         talloc_set_destructor(boot_editor, boot_editor_destructor);
651         boot_editor->cui = cui;
652         boot_editor->item = item;
653         boot_editor->on_exit = on_exit;
654         boot_editor->state = STATE_EDIT;
655         boot_editor->need_redraw = false;
656         boot_editor->need_update = false;
657
658         ncols1 = strncols(_("Device tree:"));
659         ncols2 = strncols(_("Boot arguments:"));
660         if (boot_editor->use_signature_files)
661                 ncols3 = strncols(_("Argument signature file:"));
662         else
663                 ncols3 = 0;
664
665         boot_editor->label_x = 1;
666         boot_editor->field_x = 2 + max(max(ncols1, ncols2), ncols3);
667
668         nc_scr_init(&boot_editor->scr, pb_boot_editor_sig, 0,
669                         cui, boot_editor_process_key,
670                 boot_editor_post, boot_editor_unpost, boot_editor_resize);
671
672         boot_editor->scr.frame.ltitle = talloc_strdup(boot_editor,
673                         _("Petitboot Option Editor"));
674         boot_editor->scr.frame.rtitle = NULL;
675         boot_editor->scr.frame.help = talloc_strdup(boot_editor,
676                         _("tab=next, shift+tab=previous, x=exit, h=help"));
677         nc_scr_frame_draw(&boot_editor->scr);
678
679         if (item) {
680                 struct pb_boot_data *bd = cod_from_item(item)->bd;
681                 boot_editor->image = talloc_strdup(boot_editor, bd->image);
682                 boot_editor->initrd = talloc_strdup(boot_editor, bd->initrd);
683                 boot_editor->dtb = talloc_strdup(boot_editor, bd->dtb);
684                 boot_editor->args = talloc_strdup(boot_editor, bd->args);
685                 if (boot_editor->use_signature_files)
686                         boot_editor->args_sig_file = talloc_strdup(boot_editor,
687                                         bd->args_sig_file);
688                 else
689                         boot_editor->args_sig_file = talloc_strdup(boot_editor,
690                                         "");
691                 boot_editor_find_device(boot_editor, bd, sysinfo);
692         }
693
694         boot_editor_draw(boot_editor, sysinfo);
695         wrefresh(boot_editor->scr.main_ncw);
696
697         return boot_editor;
698 }