Hello community, here is the log from the commit of package powerpc-utils checked in at Tue Sep 11 21:33:05 CEST 2007. -------- --- arch/ppc/powerpc-utils/powerpc-utils.changes 2007-08-29 11:39:52.000000000 +0200 +++ /mounts/work_src_done/STABLE/powerpc-utils/powerpc-utils.changes 2007-09-11 08:59:35.658655000 +0200 @@ -1,0 +2,5 @@ +Tue Sep 11 08:59:01 CEST 2007 - sassmann@suse.de + +- rework of petitboot patches + +------------------------------------------------------------------- Old: ---- petitboot.boot-game-os.patch petitboot.change-resolution.patch petitboot.cleanup.patch petitboot.cmdline-editor.patch petitboot.debug-cleanup.patch petitboot.editor-enhancement.patch petitboot.focus-disappear-on-switch-fix.patch petitboot.kboot-parser.patch petitboot.loading-screen.patch petitboot.root-dev-ram.patch petitboot.timeout-from-config.patch petitboot.yaboot-parser.patch ps3av-debug.patch New: ---- petitboot.boot-screen.patch petitboot.editor.patch petitboot.parsers.patch petitboot.pb_log.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerpc-utils.spec ++++++ --- /var/tmp/diff_new_pack.b27302/_old 2007-09-11 21:32:40.000000000 +0200 +++ /var/tmp/diff_new_pack.b27302/_new 2007-09-11 21:32:40.000000000 +0200 @@ -17,7 +17,7 @@ Obsoletes: ppc64-utils Provides: ppc64-utils Version: 1.0.0 -Release: 200704280176 +Release: 200704280182 License: IBM Public License URL: http://powerpc-utils.ozlabs.org/ Group: System/Management @@ -44,20 +44,11 @@ Patch5: powerpc-utils.nvram.short-write.patch Patch6: powerpc-utils.ofpathname.flat-device-tree.patch Patch10: libtwin.key-up-down.patch -Patch20: petitboot.root-dev-ram.patch -Patch21: petitboot.kboot-parser.patch -Patch22: petitboot.yaboot-parser.patch -Patch23: petitboot.change-resolution.patch -Patch25: petitboot.add-timeout.patch -Patch27: petitboot.loading-screen.patch -Patch28: petitboot.boot-game-os.patch -Patch29: petitboot.debug-cleanup.patch -Patch30: petitboot.cmdline-editor.patch -Patch31: petitboot.focus-disappear-on-switch-fix.patch -Patch32: ps3av-debug.patch -Patch33: petitboot.cleanup.patch -Patch34: petitboot.editor-enhancement.patch -Patch35: petitboot.timeout-from-config.patch +Patch21: petitboot.pb_log.patch +Patch22: petitboot.parsers.patch +Patch23: petitboot.add-timeout.patch +Patch24: petitboot.boot-screen.patch +Patch25: petitboot.editor.patch %define build_kernel 1 %description @@ -86,20 +77,11 @@ cd powerpc-utils-papr-%{papr_version} cd .. %patch10 -p1 -%patch20 -p1 %patch21 -p1 %patch22 -p1 %patch23 -p1 +%patch24 -p1 %patch25 -p1 -%patch27 -p1 -%patch28 -p1 -%patch29 -p1 -%patch30 -p1 -%patch31 -p1 -#%patch32 -p1 -%patch33 -p1 -%patch34 -p1 -%patch35 -p1 %build # workaround for using gcc41 to build @@ -208,6 +190,8 @@ %config %attr (755,root,root) /etc/init.d/ibmvscsis.sh %changelog +* Tue Sep 11 2007 - sassmann@suse.de +- rework of petitboot patches * Tue Aug 28 2007 - sassmann@suse.de - added ps3 network shutdown patch (ps3-gelic-fix-ifup-hangup.diff) ++++++ petitboot.add-timeout.patch ++++++ ++++ 636 lines (skipped) ++++ between arch/ppc/powerpc-utils/petitboot.add-timeout.patch ++++ and /mounts/work_src_done/STABLE/powerpc-utils/petitboot.add-timeout.patch ++++++ petitboot.boot-screen.patch ++++++ Index: powerpc-utils-1.0.0/petitboot-0.0.1/petitboot.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/petitboot.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/petitboot.c @@ -528,8 +528,15 @@ static void pboot_choose_option(void) pboot_device_t *dev = pboot_devices[pboot_dev_sel]; pboot_option_t *opt = &dev->options[pboot_rpane->focus_curindex]; - LOG("Selected device %s\n", opt->title); + /* destroy windows to clear screen for boot logo */ + twin_window_destroy(pboot_rpane->window); + twin_window_destroy(pboot_lpane->window); + twin_window_destroy(pboot_spane->window); + + pboot_make_background("loading.jpg"); + + LOG("Booting selected option %s\n", opt->title); /* Give user feedback, make sure errors and panics will be seen */ pboot_exec_option(opt->data); } @@ -1115,14 +1122,18 @@ int pboot_remove_device(const char *dev_ return TWIN_TRUE; } -static void pboot_make_background(void) +void pboot_make_background(const char *background) { twin_pixmap_t *filepic, *scaledpic; - const char *background_path; + char background_path[512]; + /* Set background pixmap */ LOG("loading background..."); - background_path = artwork_pathname("background.jpg"); + strcpy(background_path, PKG_SHARE_DIR); + strcat(background_path, "/artwork/"); + strcat(background_path, background); + filepic = twin_jpeg_to_pixmap(background_path, TWIN_ARGB32); LOG("%s\n", filepic ? "ok" : "failed"); @@ -1247,7 +1258,7 @@ int main(int argc, char **argv) #endif /* Set background pixmap */ - pboot_make_background(); + pboot_make_background("background.jpg"); /* Init more stuffs */ pboot_create_lpane(); Index: powerpc-utils-1.0.0/petitboot-0.0.1/petitboot.h =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/petitboot.h +++ powerpc-utils-1.0.0/petitboot-0.0.1/petitboot.h @@ -18,3 +18,4 @@ void pboot_exec_option(void *data); void pboot_message(const char *message); void pboot_set_lfocus(int index); void pboot_set_device_select(int sel, int force); +void pboot_make_background(const char *background); ++++++ petitboot.cmdline-editor.patch -> petitboot.editor.patch ++++++ --- arch/ppc/powerpc-utils/petitboot.cmdline-editor.patch 2007-08-29 11:39:52.000000000 +0200 +++ /mounts/work_src_done/STABLE/powerpc-utils/petitboot.editor.patch 2007-09-11 08:59:36.134245000 +0200 @@ -2,58 +2,92 @@ =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/petitboot.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/petitboot.c -@@ -19,6 +19,8 @@ +@@ -86,7 +86,7 @@ static twin_fbdev_t *pboot_fbdev; + #define EDIT_KERNEL 1 + #define EDIT_INITRD 2 + #define EDIT_BOOTARGS 3 +-#define EDIT_BUF_SIZE 1024 ++#define EDIT_BUF_SIZE 4096 - #include "petitboot.h" - #include "petitboot-paths.h" -+#include "devices/message.h" -+ - - #ifdef _USE_X11 - #include <libtwin/twin_x11.h> -@@ -34,7 +36,7 @@ static int select_rpane_on_startup; - - - #define PBOOT_INITIAL_MESSAGE \ -- "keys: 0=auto 1=720p 2=1080i 3=1080p del=GameOS" -+ "keys: c=changeres e=edit del=GameOS ESC=quit" + #define DEFAULT_TIMER_TIMEOUT 20000. - #define PBOOT_LEFT_PANE_SIZE 160 - #define PBOOT_LEFT_PANE_COLOR 0x80000000 -@@ -86,6 +88,11 @@ static int select_rpane_on_startup; - #define PBOOT_STATUS_TEXT_SIZE (16 * TWIN_FIXED_ONE) - #define PBOOT_STATUS_TEXT_COLOR 0xff000000 +@@ -537,16 +537,330 @@ static void pboot_choose_option(void) + pboot_make_background("loading.jpg"); -+#define EDIT_KERNEL 1 -+#define EDIT_INITRD 2 -+#define EDIT_BOOTARGS 3 -+#define EDIT_BUF_SIZE 1024 + LOG("Booting selected option %s\n", opt->title); + - typedef struct _pboot_option pboot_option_t; - typedef struct _pboot_device pboot_device_t; - -@@ -519,6 +526,213 @@ static void pboot_choose_option(void) + /* Give user feedback, make sure errors and panics will be seen */ pboot_exec_option(opt->data); } -+static unsigned char keycodes[128] = { -+0, 0, '1', '2', '3', '4', '5', '6', '7', '8', /* 0 - 9 */ -+'9', '0', '-', '=', 0, 0, 'q', 'w', 'e', 'r', /* 10 - 19 */ -+'t', 'y', 'u', 'i', 'o', 'p', 0, 0, 0, 0, /* 20 - 29 */ -+'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ':', /* 30 - 39 */ -+'\"', 0, 0, 0, 'z', 'x', 'c', 'v', 'b', 'n', /* 40 - 49 */ -+'m', ',', '.', '/', 0, 0, 0, ' ', 0, 0, /* 50 - 59 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */ -+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ -+0, 0, 0, 0, 0, 0, 0, 0 /* 120 - 127 */ +-static twin_bool_t pboot_rpane_event (twin_window_t *window, ++static unsigned char keycodes_std[128] = { ++0, 0, '1', '2', '3', '4', '5', '6', '7', '8', /* 0 - 9 */ ++'9', '0', '-', '=', 0, 0, 'q', 'w', 'e', 'r', /* 10 - 19 */ ++'t', 'y', 'u', 'i', 'o', 'p', '[', ']', 0, 0, /* 20 - 29 */ ++'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 30 - 39 */ ++'\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 40 - 49 */ ++'m', ',', '.', '/', 0, 0, 0, ' ', 0, 0, /* 50 - 59 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ ++0, 0, 0, 0, 0, 0, 0, 0 /* 120 - 127 */ ++}; ++ ++static unsigned char keycodes_shift[128] = { ++0, 0, '!','@', '#', '$', '%', '^', '&', '*', /* 0 - 9 */ ++'(', ')', '_', '+', 0, 0, 'Q', 'W', 'E', 'R', /* 10 - 19 */ ++'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 0, 0, /* 20 - 29 */ ++'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* 30 - 39 */ ++'\"', '~', 0, '|', 'Z', 'X', 'C', 'V', 'B', 'N', /* 40 - 49 */ ++'M', '<', '>', '?', 0, 0, 0, ' ', 0, 0, /* 50 - 59 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ ++0, 0, 0, 0, 0, 0, 0, 0 /* 120 - 127 */ +}; + -+static char pboot_edit_buf[EDIT_BUF_SIZE]; -+static int edit_in_progress; ++static unsigned char keycodes_ctrl[128] = { ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10 - 19 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30 - 39 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 49 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50 - 59 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ ++0, 0, 0, 0, 0, 0, 0, 0 /* 120 - 127 */ ++}; ++ ++static unsigned char keycodes_alt[128] = { ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 10 - 19 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 30 - 39 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 40 - 49 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 50 - 59 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 60 - 69 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 70 - 79 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80 - 89 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 90 - 99 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 100 - 109 */ ++0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 110 - 119 */ ++0, 0, 0, 0, 0, 0, 0, 0 /* 120 - 127 */ ++}; ++ ++static unsigned char* keycodes = keycodes_std; ++static int edit_ctrl_pressed; ++static int edit_alt_pressed; + +int choose_edit_option (int option_attr) +{ @@ -71,19 +105,19 @@ + + switch (option_attr) { + case EDIT_KERNEL: -+ pboot_message(option->boot_image_file); + strncpy(pboot_edit_buf, option->boot_image_file, + strlen(option->boot_image_file)); ++ pboot_message(pboot_edit_buf); + break; + case EDIT_INITRD: -+ pboot_message(option->initrd_file); + strncpy(pboot_edit_buf, option->initrd_file, + strlen(option->initrd_file)); ++ pboot_message(pboot_edit_buf); + break; + case EDIT_BOOTARGS: -+ pboot_message(option->boot_args); + strncpy(pboot_edit_buf, option->boot_args, + strlen(option->boot_args)); ++ pboot_message(pboot_edit_buf); + break; + default: + edit_in_progress = 0; @@ -92,19 +126,38 @@ + return 0; +} + -+int edit_option(char key) ++int edit_delete_last_word() +{ -+ unsigned int text_len; -+ text_len = strlen(pboot_edit_buf); -+ if (text_len > 1022) ++ char *buf; ++ int pos; ++ ++ pos = strlen(pboot_edit_buf); ++ if (pos == 0) + return -1; + -+ pboot_edit_buf[text_len] = key; -+ pboot_edit_buf[text_len+1] = '\0'; ++ buf = &pboot_edit_buf[pos]; ++ while (*buf != ' ' && pos > 0) { ++ pos--; ++ buf--; ++ } ++ *buf = '\0'; + pboot_message(pboot_edit_buf); + return 0; +} + ++int edit_option(char key) ++{ ++ unsigned int text_len; ++ text_len = strlen(pboot_edit_buf); ++ if (text_len < EDIT_BUF_SIZE) { ++ pboot_edit_buf[text_len] = key; ++ pboot_edit_buf[text_len+1] = '\0'; ++ pboot_message(pboot_edit_buf); ++ return 0; ++ } else ++ return -1; ++} ++ +int save_edit_option(char *new_opt) +{ + pboot_device_t *dev; @@ -131,9 +184,6 @@ + return 0; +} + -+static twin_bool_t pboot_rpane_event (twin_window_t *window, -+ twin_event_t *event); -+ +static twin_bool_t pboot_edit_event (twin_window_t *window, + twin_event_t *event) +{ @@ -149,9 +199,9 @@ + case KEY_ENTER: + save_edit_option(pboot_edit_buf); + edit_in_progress = 0; -+ memset(pboot_edit_buf,0,EDIT_BUF_SIZE); ++ memset(pboot_edit_buf, 0, EDIT_BUF_SIZE); + pboot_rpane->window->event = pboot_rpane_event; -+ pboot_message("keys: c=changeres e=edit del=GameOS ESC=quit"); ++ pboot_message("keys: c=resolution e=edit del=GameOS ESC=quit"); + return TWIN_TRUE; + case KEY_BACKSPACE: + if( strlen(pboot_edit_buf) ) { @@ -159,8 +209,46 @@ + pboot_message(pboot_edit_buf); + } + return TWIN_TRUE; ++ case KEY_RIGHTSHIFT: ++ case KEY_LEFTSHIFT: ++ keycodes = keycodes_shift; ++ return TWIN_TRUE; ++ case KEY_LEFTCTRL: ++ case KEY_RIGHTCTRL: ++ keycodes = keycodes_ctrl; ++ edit_ctrl_pressed = 1; ++ return TWIN_TRUE; ++ case KEY_LEFTALT: ++ case KEY_RIGHTALT: ++ keycodes = keycodes_alt; ++ edit_ctrl_pressed = 1; ++ return TWIN_TRUE; ++ case KEY_W: ++ if(edit_ctrl_pressed) { ++ edit_delete_last_word(); ++ return TWIN_TRUE; ++ } + default: + edit_option(keycodes[event->u.key.key]); ++ return TWIN_TRUE; ++ } ++ case TwinEventKeyUp: ++ switch(event->u.key.key) { ++ case KEY_RIGHTSHIFT: ++ case KEY_LEFTSHIFT: ++ keycodes = keycodes_std; ++ return TWIN_TRUE; ++ case KEY_LEFTALT: ++ case KEY_RIGHTALT: ++ edit_alt_pressed = 0; ++ keycodes = keycodes_std; ++ return TWIN_TRUE; ++ case KEY_LEFTCTRL: ++ case KEY_RIGHTCTRL: ++ edit_ctrl_pressed = 0; ++ keycodes = keycodes_std; ++ return TWIN_TRUE; ++ default: + break; + } + default: @@ -188,6 +276,7 @@ + choose_edit_option(EDIT_INITRD); + pboot_rpane->window->event = pboot_edit_event; + return TWIN_TRUE; ++ case KEY_E: + case KEY_3: + choose_edit_option(EDIT_BOOTARGS); + pboot_rpane->window->event = pboot_edit_event; @@ -243,14 +332,22 @@ + return TWIN_FALSE; +} + - static twin_bool_t pboot_rpane_event (twin_window_t *window, ++twin_bool_t pboot_rpane_event (twin_window_t *window, twin_event_t *event) { -@@ -550,10 +764,25 @@ static twin_bool_t pboot_rpane_event (tw + /* reset right focus after timeout interrupt */ + pboot_rpane->focus_box.right = pboot_rpane->window->pixmap->width - + 2 * PBOOT_RIGHT_FOCUS_XOFF; ++ ++ + /* filter out all mouse events */ + switch(event->kind) { + case TwinEventEnter: +@@ -570,10 +884,25 @@ static twin_bool_t pboot_rpane_event (tw pboot_set_rfocus(pboot_rpane->focus_curindex + 1); return TWIN_TRUE; case KEY_LEFT: -+ pboot_message("keys: c=changeres del=GameOS ESC=quit"); ++ pboot_message("keys: c=resolution del=GameOS ESC=quit"); pboot_select_lpane(); return TWIN_TRUE; + case KEY_E: @@ -272,36 +369,42 @@ default: break; } -@@ -564,24 +793,6 @@ static twin_bool_t pboot_rpane_event (tw - return TWIN_FALSE; +@@ -622,19 +951,18 @@ int pboot_add_option(int devindex, const + opt->box.top = PBOOT_RIGHT_OPTION_TMARGIN + + index * PBOOT_RIGHT_OPTION_STRIDE; + opt->box.bottom = opt->box.top + PBOOT_RIGHT_OPTION_HEIGHT; +- opt->data = data; ++ ++ opt->data = data; + + if (default_prio && strlen(default_prio)) { + dev->option_default = index; + } +- + return index; } --static twin_time_t pboot_default_boot (twin_time_t now, void *closure) --{ -- pboot_choose_option(); -- return TWIN_FALSE; --} - --#if 0 --static twin_time_t pboot_select_default (twin_time_t now, void *closure) --{ -- pboot_device_t *dev; -- dev = pboot_devices[pboot_dev_sel]; -- -- pboot_message("TIMEOUT: booting default!"); -- pboot_choose_option(); -- return TWIN_FALSE; --} --#endif + void pboot_set_device_select(int sel, int force) + { +- LOG("%s: %d -> %d\n", __FUNCTION__, pboot_dev_sel, sel); ++ + if (!force && sel == pboot_dev_sel) + return; + if (sel >= pboot_dev_count) +@@ -702,7 +1030,6 @@ static void pboot_create_rpane(void) + twin_window_queue_paint(pboot_rpane->window); + } + - - int pboot_add_option(int devindex, const char *title, const char *subtitle, - twin_pixmap_t *badge, const char *default_prio, - void *data) -@@ -813,8 +1024,18 @@ static twin_bool_t pboot_lpane_event (tw + static twin_time_t pboot_lfocus_timeout (twin_time_t now, void *closure) + { + int dir = 1, dist, pos; +@@ -829,8 +1156,18 @@ static twin_bool_t pboot_lpane_event (tw pboot_set_lfocus(pboot_lpane->focus_curindex + 1); return TWIN_TRUE; case KEY_RIGHT: -+ pboot_message("keys: c=changeres e=edit del=GameOS ESC=quit"); ++ pboot_message("keys: c=resolution e=edit del=GameOS ESC=quit"); pboot_select_rpane(); return TWIN_TRUE; + case KEY_C: @@ -316,7 +419,7 @@ default: break; } -@@ -825,15 +1046,6 @@ static twin_bool_t pboot_lpane_event (tw +@@ -841,11 +1178,6 @@ static twin_bool_t pboot_lpane_event (tw return TWIN_FALSE; } @@ -325,32 +428,39 @@ - kill(0, SIGINT); -} - --static void pboot_changeres(void) --{ -- exit(42); --} - twin_bool_t pboot_event_filter(twin_screen_t *screen, twin_event_t *event) -@@ -852,6 +1064,7 @@ twin_bool_t pboot_event_filter(twin_scre - case TwinEventKeyDown: - switch(event->u.key.key) { - /* Gross hack for video modes, need something better ! */ -+#if 0 - case KEY_0: - pboot_vmode_change = 0; /* auto */ - pboot_changeres(); -@@ -868,12 +1081,12 @@ twin_bool_t pboot_event_filter(twin_scre - pboot_vmode_change = 5; /* 1080p */ - pboot_changeres(); - return TWIN_TRUE; + { +@@ -860,32 +1192,6 @@ twin_bool_t pboot_event_filter(twin_scre + pboot_cursor_hx, + pboot_cursor_hy); + break; +- case TwinEventKeyDown: +- switch(event->u.key.key) { +- /* Gross hack for video modes, need something better ! */ +- case KEY_0: +- pboot_vmode_change = 0; /* auto */ +- pboot_quit(); +- return TWIN_TRUE; +- case KEY_1: +- pboot_vmode_change = 3; /* 720p */ +- pboot_quit(); +- return TWIN_TRUE; +- case KEY_2: +- pboot_vmode_change = 4; /* 1080i */ +- pboot_quit(); +- return TWIN_TRUE; +- case KEY_3: +- pboot_vmode_change = 5; /* 1080p */ +- pboot_quit(); +- return TWIN_TRUE; - - /* Another gross hack for booting back to gameos */ - case KEY_BACKSPACE: - case KEY_DELETE: - system("ps3-boot-game-os"); - pboot_quit(); -+#endif - } +- /* Another gross hack for booting back to gameos */ +- case KEY_BACKSPACE: +- case KEY_DELETE: +- system("boot-game-os"); +- pboot_quit(); +- } case TwinEventKeyUp: twin_screen_set_cursor(pboot_screen, NULL, 0, 0); + break; ++++++ petitboot.parsers.patch ++++++ Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/kboot-parser.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/kboot-parser.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/kboot-parser.c @@ -9,6 +9,8 @@ #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> +#include <linux/limits.h> +#include <errno.h> #include "parser.h" #include "params.h" @@ -17,6 +19,47 @@ static const char *mountpoint; +/* /dev/sda5:/vmlinux */ +static char *create_mountp(const char *option) +{ + struct stat sb; + char mount_path[PATH_MAX]; + char *filepath, *p, *dev, *file; + int i; + + dev = strdup(option); + if (!dev) + return NULL; + file = strrchr(dev, ':'); + if (!file) + return NULL; + *file = '\0'; + file++; + i = stat(dev, &sb); + if (i < 0) + return NULL; + if (!S_ISBLK(sb.st_mode)) { + pb_log("'%s' is not a blockdevice\n", dev); + return NULL; + } + /* create an unique mountpoint */ + snprintf(mount_path, sizeof(mount_path), "/%016llx", (unsigned long long)sb.st_rdev); + i = mkdir(mount_path, 0755); + if (i < 0) + pb_log("failed to create mount dir '%s': %s\n", mount_path, strerror(errno)); + + filepath = malloc(strlen(mount_path) + 1 + strlen(file) + 1); + if (filepath) { + sprintf(filepath, "%s/%s", mount_path, file); + i = asprintf(&p, "/bin/sh -c ' /bin/mount -o ro %s %s' >> /log 2>&1", dev, mount_path); + if (i > 0) + i = system(p); + pb_log("system ret %d for '%s'\n", i, p); + } + pb_log("ret '%s'\n", filepath); + return filepath; +} + static int param_is_ignored(const char *param) { static const char *ignored_options[] = @@ -97,13 +140,13 @@ static int parse_option(struct boot_opti /* if there's no space, it's only a kernel image with no params */ if (!pos) { - opt->boot_image_file = join_paths(mountpoint, config); + opt->boot_image_file = create_mountp(config); opt->description = strdup(config); return 1; } *pos = 0; - opt->boot_image_file = join_paths(mountpoint, config); + opt->boot_image_file = create_mountp(config); cmdline = malloc(buf_size); *cmdline = 0; @@ -128,13 +171,8 @@ static int parse_option(struct boot_opti } } - if (initrd) { - asprintf(&tmp, "initrd=%s %s", initrd, cmdline); - free(cmdline); - cmdline = tmp; - - opt->initrd_file = join_paths(mountpoint, initrd); - } + if (initrd) + opt->initrd_file = create_mountp(initrd); if (root) { asprintf(&tmp, "root=%s %s", root, cmdline); @@ -142,13 +180,10 @@ static int parse_option(struct boot_opti cmdline = tmp; } else if (!initrd) { - /* if there's an initrd but no root, fake up /dev/ram0 */ - asprintf(&tmp, "root=/dev/ram0 %s", cmdline); - free(cmdline); - cmdline = tmp; + /* if there's an initrd but no root, then its not a problem */ } - pb_log("kboot cmdline: %s", cmdline); + pb_log("parsed commandline: %s", cmdline); opt->boot_args = cmdline; asprintf(&opt->description, "%s %s", config, cmdline); @@ -158,9 +193,25 @@ static int parse_option(struct boot_opti static void parse_buf(struct device *dev, char *buf) { - char *pos, *name, *value; + char *pos, *name, *value, *defimage, *tmp, *timeout; int sent_device = 0; + /* check for default entry and timeout */ + defimage = NULL; + timeout = NULL; + tmp = strdup(buf); + for (pos = tmp; pos;) { + pos = get_param_pair(pos, &name, &value, '\n'); + + if (name == NULL || *name == '#') + continue; + if (streq(name,"default")) + defimage = strdup(value); + /* set device timeout */ + if (streq(name,"timeout")) + dev->timeout = strdup(value); + } + for (pos = buf; pos;) { struct boot_option opt; @@ -176,7 +227,12 @@ static void parse_buf(struct device *dev memset(&opt, 0, sizeof(opt)); opt.name = strdup(name); - + if (defimage != NULL) { + if (streq(defimage, name)) + opt.default_prio = "5"; + else + opt.default_prio = ""; + } if (parse_option(&opt, value)) if (!sent_device++) add_device(dev); Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/yaboot-parser.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/yaboot-parser.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/yaboot-parser.c @@ -15,7 +15,6 @@ static struct device *dev; static const char *mountpoint; -static char partition_mntpoint[PATH_MAX]; static char *defimage; char * @@ -97,19 +96,35 @@ static int check_and_add_device(struct d void process_image(char *label) { struct boot_option opt; - char *cfgopt; - + char *cfgopt, path[PATH_MAX]; memset(&opt, 0, sizeof(opt)); opt.name = label; cfgopt = cfg_get_strg(label, "image"); - opt.boot_image_file = join_paths(mountpoint, cfgopt); + + if (!cfgopt) + cfgopt = cfg_get_strg(label, "image[64bit]"); + if (cfgopt[0] == '/') + opt.boot_image_file = join_paths(mountpoint, cfgopt); + else { + snprintf(path, sizeof(path), "/suseboot/%s", cfgopt); + opt.boot_image_file = join_paths(mountpoint, path); + } + pb_log("boot_image_file %s\n",opt.boot_image_file); + if (cfgopt == defimage) - pb_log("This one is default. What do we do about it?\n"); + opt.default_prio = "7"; cfgopt = cfg_get_strg(label, "initrd"); - if (cfgopt) - opt.initrd_file = join_paths(mountpoint, cfgopt); + if (cfgopt) { + if (cfgopt[0] == '/') + opt.initrd_file = join_paths(mountpoint, cfgopt); + else { + snprintf(path, sizeof(path), "/suseboot/%s", cfgopt); + opt.initrd_file = join_paths(mountpoint, path); + } + pb_log("initrd_file %s\n",opt.initrd_file); + } opt.boot_args = make_params(label, NULL); @@ -123,7 +138,6 @@ static int yaboot_parse(const char *devi { char *filepath; char *conf_file; - char *tmpstr; ssize_t conf_len; int fd; struct stat st; @@ -131,7 +145,7 @@ static int yaboot_parse(const char *devi mountpoint = _mountpoint; - filepath = join_paths(mountpoint, "/etc/yaboot.conf"); + filepath = join_paths(mountpoint, "/suseboot/yaboot.cnf"); fd = open(filepath, O_RDONLY); if (fd < 0) { @@ -173,6 +187,15 @@ static int yaboot_parse(const char *devi dev = malloc(sizeof(*dev)); memset(dev, 0, sizeof(*dev)); dev->id = strdup(devicepath); + + /* read timeout value */ + if (cfg_get_strg(0, "timeout")) { + char *newline; + dev->timeout = strdup(cfg_get_strg(0, "timeout")); + newline = strchr(dev->timeout, '\n'); + if (newline) + *newline = 0; + } if (cfg_get_strg(0, "init-message")) { char *newline; dev->description = strdup(cfg_get_strg(0, "init-message")); @@ -182,39 +205,6 @@ static int yaboot_parse(const char *devi } dev->icon_file = strdup(generic_icon_file(guess_device_type())); - /* Mount the 'partition' which is what all the image filenames - are relative to */ - tmpstr = cfg_get_strg(0, "partition"); - if (tmpstr) { - char *endp; - int partnr = strtol(tmpstr, &endp, 10); - if (endp != tmpstr && !*endp) { - char *new_dev = malloc(strlen(devicepath) + strlen(tmpstr) + 1); - if (!new_dev) - return 0; - - strcpy(new_dev, devicepath); - - /* Strip digits (partition number) from string */ - endp = &new_dev[strlen(devicepath) - 1]; - while (isdigit(*endp)) - *(endp--) = 0; - - /* and add our own... */ - sprintf(endp+1, "%d", partnr); - - /* FIXME: udev may not have created the device node - yet. And on removal, unmount_device() only unmounts - it once, while in fact it may be mounted twice. */ - if (mount_device(new_dev, partition_mntpoint)) { - pb_log("Error mounting image partition\n"); - return 0; - } - mountpoint = partition_mntpoint; - dev->id = new_dev; - } - } - defimage = cfg_get_default(); if (!defimage) return 0; Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/yaboot-cfg.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/yaboot-cfg.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/yaboot-cfg.c @@ -26,11 +26,13 @@ #include <stdint.h> #include <stdio.h> #include <libio.h> +#include "parser.h" #define prom_printf printf #define prom_putchar putchar #define prom_vprintf vprintf + /* Imported functions */ extern int strcasecmp(const char *s1, const char *s2); @@ -295,8 +297,7 @@ static void cfg_return (char *item, char static int cfg_set (char *item, char *value) { CONFIG *walk; - - if (!strcasecmp (item, "image")) { + if (!strcasecmp (item, "image") || !strcasecmp (item, "image[64bit]")) { struct IMAGES **p = &images; while (*p) @@ -309,6 +310,7 @@ static int cfg_set (char *item, char *va (*p)->next = 0; curr_table = ((*p)->table); memcpy (curr_table, cf_image, sizeof (cf_image)); + item = "image"; } for (walk = curr_table; walk->type != cft_end; walk++) { if (walk->name && !strcasecmp (walk->name, item)) { @@ -341,13 +343,16 @@ int cfg_parse (char *cfg_file, char *buf currp = buff; endp = currp + len; - if (setjmp (env)) + if (setjmp (env)) { + pb_log("setjump failed\n"); return -1; +} while (1) { - if (!cfg_next (&item, &value)) + if (!cfg_next (&item, &value)) { return 0; + } if (!cfg_set (item, value)) { -#if DEBUG +#ifdef DEBUG prom_printf("Can't set item %s to value %s\n", item, value); #endif } @@ -359,9 +364,10 @@ static char *cfg_get_strg_i (CONFIG * ta { CONFIG *walk; - for (walk = table; walk->type != cft_end; walk++) + for (walk = table; walk->type != cft_end; walk++) { if (walk->name && !strcasecmp (walk->name, item)) return walk->data; + } return 0; } Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/message.h =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/message.h +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/message.h @@ -14,6 +14,7 @@ struct device { char *name; char *description; char *icon_file; + char *timeout; }; struct boot_option { @@ -24,6 +25,7 @@ struct boot_option { char *boot_image_file; char *initrd_file; char *boot_args; + char *default_prio; }; Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/udev-helper.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/udev-helper.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/udev-helper.c @@ -104,13 +104,14 @@ int add_device(const struct device *dev) { int rc; - pb_log("device added:\n"); + pb_log("try to add new device...\n"); print_device(dev); rc = write_action(sock, DEV_ACTION_ADD_DEVICE) || write_string(sock, dev->id) || write_string(sock, dev->name) || write_string(sock, dev->description) || - write_string(sock, dev->icon_file); + write_string(sock, dev->icon_file) || + write_string(sock, dev->timeout); if (rc) pb_log("error writing device %s to socket\n", dev->name); @@ -122,7 +123,7 @@ int add_boot_option(const struct boot_op { int rc; - pb_log("boot option added:\n"); + pb_log("try to add boot option...\n"); print_boot_option(opt); rc = write_action(sock, DEV_ACTION_ADD_OPTION) || @@ -132,7 +133,8 @@ int add_boot_option(const struct boot_op write_string(sock, opt->icon_file) || write_string(sock, opt->boot_image_file) || write_string(sock, opt->initrd_file) || - write_string(sock, opt->boot_args); + write_string(sock, opt->boot_args) || + write_string(sock, opt->default_prio); if (rc) pb_log("error writing boot option %s to socket\n", opt->name); @@ -183,23 +185,25 @@ int connect_to_socket() int mount_device(const char *dev_path, char *mount_path) { - char *dir; - const char *basename; + struct stat sb; int pid, status, rc = -1; - basename = strrchr(dev_path, '/'); - if (basename) - basename++; - else - basename = dev_path; - - /* create a unique mountpoint */ - dir = malloc(strlen(TMP_DIR) + 13 + strlen(basename)); - sprintf(dir, "%s/mnt-%s-XXXXXX", TMP_DIR, basename); - - if (!mkdtemp(dir)) { - pb_log("failed to create temporary directory in %s: %s", - TMP_DIR, strerror(errno)); + memset(&sb, 0, sizeof(sb)); + status = stat(dev_path, &sb); + if (status < 0) { + pb_log("failed to stat '%s', %s\n", dev_path, strerror(errno)); + goto out; + } + if (!S_ISBLK(sb.st_mode)) { + pb_log("'%s' is not a blockdevice\n", dev_path); + goto out; + } + + /* create an unique mountpoint */ + snprintf(mount_path, PATH_MAX, "/%016llx", (unsigned long long)sb.st_rdev); + status = mkdir(mount_path, 0755); + if (status < 0) { + pb_log("failed to create mount dir '%s': %s\n", mount_path, strerror(errno)); goto out; } @@ -210,7 +214,7 @@ int mount_device(const char *dev_path, c } if (pid == 0) { - execl(MOUNT_BIN, MOUNT_BIN, dev_path, dir, "-o", "ro", NULL); + execl(MOUNT_BIN, MOUNT_BIN, dev_path, mount_path, "-o", "ro", NULL); exit(EXIT_FAILURE); } @@ -220,13 +224,10 @@ int mount_device(const char *dev_path, c goto out; } - if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - strcpy(mount_path, dir); + if (WIFEXITED(status) && WEXITSTATUS(status) == 0) rc = 0; - } out: - free(dir); return rc; } @@ -491,7 +492,6 @@ int main(int argc, char **argv) logf = fopen("/var/tmp/petitboot-udev-helpers.log", "a"); if (!logf) logf = stdout; - pb_log("%d started\n", getpid()); rc = EXIT_SUCCESS; if (!action) { ++++++ petitboot.pb_log.patch ++++++ Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/udev-helper.c =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/udev-helper.c +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/udev-helper.c @@ -28,7 +28,7 @@ static FILE *logf; static int sock; -void pb_log(const char *fmt, ...) +void __pb_log(const char *fmt, ...) { va_list ap; Index: powerpc-utils-1.0.0/petitboot-0.0.1/devices/parser.h =================================================================== --- powerpc-utils-1.0.0.orig/petitboot-0.0.1/devices/parser.h +++ powerpc-utils-1.0.0/petitboot-0.0.1/devices/parser.h @@ -33,7 +33,10 @@ char *join_paths(const char *a, const ch const char *generic_icon_file(enum generic_icon_type type); /* functions provided by udev-helper or the test wrapper */ -void pb_log(const char *fmt, ...); +void __pb_log(const char *fmt, ...); +#define pb_log(fmt, args ...) __pb_log("%s:%s(%u)|" fmt, __FILE__, __FUNCTION__, __LINE__,##args) + + int mount_device(const char *dev_path, char *mount_path); ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org
participants (1)
-
root@Hilbert.suse.de