Subject: petitboot: Update petitboot fixup patches
authorGeoff Levand <geoffrey.levand@am.sony.com>
Wed, 26 Aug 2009 22:02:51 +0000 (22:02 +0000)
committerGeoff Levand <geoffrey.levand@am.sony.com>
Wed, 26 Aug 2009 22:02:51 +0000 (22:02 +0000)
Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
SVN-Revision: 17413

utils/petitboot/patches/010-petitboot-fixups.diff
utils/petitboot/patches/020-petitboot-fix-pb-twin.diff

index 5cddeb6b032b11a8eb6d1ff5e6fbe2689e577b06..cdc0c74ab31e9abd3a69707b13e0b878c15a835e 100644 (file)
@@ -1,4 +1,4 @@
9 files changed, 90 insertions(+), 33 deletions(-)
12 files changed, 96 insertions(+), 40 deletions(-)
 
 diff --git a/discover/kboot-parser.c b/discover/kboot-parser.c
 index 23d48a4..7c7cb5d 100644
@@ -51,6 +51,19 @@ index 1000505..6101cd8 100644
  
        conf->dc = dc;
        conf->global_options = yaboot_global_options,
+diff --git a/lib/log/log.h b/lib/log/log.h
+index 2a5d375..6f44bea 100644
+--- a/lib/log/log.h
++++ b/lib/log/log.h
+@@ -3,7 +3,7 @@
+ #include <stdio.h>
+-void pb_log(const char *fmt, ...);
++void __attribute__ ((format (printf, 1, 2))) pb_log(const char *fmt, ...);
+ void pb_log_set_stream(FILE *stream);
+ FILE * pb_log_get_stream(void);
+ void pb_log_always_flush(int state);
 diff --git a/lib/system/system.c b/lib/system/system.c
 index 65bd6bf..7371445 100644
 --- a/lib/system/system.c
@@ -159,6 +172,53 @@ index b06bb43..42d4d4b 100644
 +char *pb_load_file(void *ctx, const char *remote, unsigned int *tempfile);
  
  #endif
+diff --git a/ui/common/ps3.c b/ui/common/ps3.c
+index cb1c8d1..c62a10d 100644
+--- a/ui/common/ps3.c
++++ b/ui/common/ps3.c
+@@ -87,7 +87,7 @@ static int ps3_flash_open(struct ps3_flash_ctx *fc, const char *mode)
+       result = os_area_fixed_read(&fc->header, &fc->params, fc->dev);
+       if (result) {
+-              pb_log("%s: os_area_fixed_read failed: %s\n", __func__);
++              pb_log("%s: os_area_fixed_read failed\n", __func__);
+               goto fail;
+       }
+@@ -114,7 +114,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       result = ps3_flash_open(&fc, "r");
+       if (result)
+-              goto done;
++              goto fail;
+       result = os_area_db_read(&fc.db, &fc.header, fc.dev);
+@@ -123,7 +123,7 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       if (result) {
+               pb_log("%s: os_area_db_read failed: %s\n", __func__,
+                       strerror(errno));
+-              goto done;
++              goto fail;
+       }
+       sum = result = os_area_db_get(&fc.db, &id_default_item, &tmp);
+@@ -141,14 +141,13 @@ int ps3_flash_get_values(struct ps3_flash_values *values)
+       if (!result)
+               values->video_mode = (uint16_t)tmp;
+-done:
+       pb_log("%s: default_item: %x\n", __func__,
+               (unsigned int)values->default_item);
+       pb_log("%s: timeout: %u\n", __func__,
+               (unsigned int)values->timeout);
+       pb_log("%s: video_mode:   %u\n", __func__,
+               (unsigned int)values->video_mode);
+-
++fail:
+       return (result || sum) ? -1 : 0;
+ }
 diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
 index bd6dd31..0140f0e 100644
 --- a/ui/common/ui-system.c
@@ -316,3 +376,16 @@ index bd6dd31..0140f0e 100644
        return result;
  }
  
+diff --git a/ui/common/url.c b/ui/common/url.c
+index 0de0f58..544eee2 100644
+--- a/ui/common/url.c
++++ b/ui/common/url.c
+@@ -140,7 +140,7 @@ struct pb_url *pb_url_parse(void *ctx, const char *url_str)
+               path = strchr(p, '/');
+               if (!path) {
+-                      pb_log("%s: parse path failed '%s'\n", p);
++                      pb_log("%s: parse path failed '%s'\n", __func__ , p);
+                       goto fail;
+               }
index ed8f93d3a10d501ec3bc23c265b32a144719ae7d..aa24f56598e362e90ef264898222c3dcf14b9590 100644 (file)
@@ -6,10 +6,43 @@ Update the PS3 twin GUI program to work with petitboot-multi-ui.
 
 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 ---
- rules.mk           |   13 
- ui/twin/ps3-twin.c | 1434 +++++++++++++++++++++++++++++++++++++++++++++++++++++
- 2 files changed, 1443 insertions(+), 4 deletions(-)
+ Makefile.in        |    1 
+ configure.ac       |   12 
+ rules.mk           |   14 
+ ui/twin/ps3-twin.c | 1441 +++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 1463 insertions(+), 5 deletions(-)
 
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -18,6 +18,7 @@ twin_LDFLAGS = @twin_LIBS@
+ # build target
+ ENABLE_PS3 = @ENABLE_PS3@
++ENABLE_X11 = @ENABLE_X11@
+ # other programs
+ INSTALL = @INSTALL@
+--- a/configure.ac
++++ b/configure.ac
+@@ -56,7 +56,17 @@ AS_IF([test "x$with_twin" != xno],
+               [if test "x$with_twin" != xcheck; then
+                       AC_MSG_FAILURE([--with-twin was given, but test for twin failed])
+               fi],
+-              [${twin_LIBS}])])
++              [${twin_LIBS}])
++      AC_CHECK_HEADERS([libtwin/twin_x11.h])])
++
++AC_ARG_ENABLE([x11],
++      [AS_HELP_STRING([--enable-x11],
++              [build for x11])],
++      [],
++      [enable_x11=check])
++
++AS_IF([test "x$enable_x11" != xno], [AC_SUBST([ENABLE_X11], ["y"])], [])
++
+ mkdir -p discover lib/list lib/log lib/pb-protocol lib/system lib/talloc \
+       lib/waiter test ui/common ui/ncurses ui/test ui/twin utils
 --- a/rules.mk
 +++ b/rules.mk
 @@ -54,7 +54,7 @@ ui_common_objs = ui/common/discover-clie
@@ -21,13 +54,14 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
  
  # Makefiles
  makefiles = Makefile $(top_srcdir)/rules.mk
-@@ -89,11 +89,16 @@ $(pb_test): $(pb_test_objs)
+@@ -89,11 +89,17 @@ $(pb_test): $(pb_test_objs)
        $(LINK.o) -o $@ $^
  
  # twin gui
 -pb_twin_objs = $(client_objs) $(twin_objs) ui/twin/ps3-twin.o
 +pb_twin_objs-y$(ENABLE_PS3) += ui/twin/pb-twin.o
 +pb_twin_objs-$(ENABLE_PS3) += ui/twin/ps3-twin.o ui/common/ps3.o
++pb_twin_cflags-$(ENABLE_X11) += -DUSE_X11
 +pb_twin_ldflags-$(ENABLE_PS3) += -lps3-utils
 +
 +pb_twin_objs = $(client_objs) $(twin_objs)  $(pb_twin_objs-y)
@@ -36,14 +70,14 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 -$(pb_twin): LDFLAGS+=$(twin_LDFLAGS) $(LIBTWIN)
 -$(pb_twin): CFLAGS+=$(twin_CFLAGS)
 +$(pb_twin): LDFLAGS += $(pb_twin_ldflags-y) $(twin_LDFLAGS) $(LIBTWIN)
-+$(pb_twin): CFLAGS += $(twin_CFLAGS) \
++$(pb_twin): CFLAGS += $(pb_twin_cflags-y) $(twin_CFLAGS) \
 +      -DPB_ARTWORK_PATH='"$(pkgdatadir)/artwork/"'
  
  $(pb_twin): $(pb_twin_objs)
        $(LINK.o) -o $@ $^
 --- /dev/null
 +++ b/ui/twin/ps3-twin.c
-@@ -0,0 +1,1434 @@
+@@ -0,0 +1,1441 @@
 +/*
 + * Petitboot twin bootloader for the PS3 game console
 + *
@@ -82,7 +116,7 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +#include <libtwin/twin_linux_mouse.h>
 +#include <libtwin/twin_linux_js.h>
 +#include <libtwin/twin_png.h>
-+#if defined(TWIN_X11)
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
 +# include <libtwin/twin_x11.h>
 +#endif
 +#include <linux/input.h>
@@ -213,11 +247,10 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +      enum pbt_sig sig;
 +      struct pbt_cursor cursor;
 +      twin_screen_t *tscreen;
-+#if defined(USE_TWIN_X11)
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
 +      twin_x11_t *x11;
-+#else
-+      twin_fbdev_t *fbdev;
 +#endif
++      twin_fbdev_t *fbdev;
 +};
 +
 +struct pbt_frame {
@@ -1420,37 +1453,45 @@ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
 +
 +      ps3.scr.sig = pbt_scr_sig;
 +
-+#if defined(USE_TWIN_X11)
-+      ps3.scr.x11 = twin_x11_create(XOpenDisplay(0), 1024, 768);
-+
-+      if (!ps3.scr.x11) {
-+              perror("failed to create x11 screen !\n");
-+              return EXIT_FAILURE;
-+      }
++#if defined(HAVE_LIBTWIN_TWIN_X11_H)
++# if defined(USE_X11)
++      if (1) {
++# else
++      if (0) {
++# endif
++              ps3.scr.x11 = twin_x11_create(XOpenDisplay(0), 1024, 768);
++
++              if (!ps3.scr.x11) {
++                      perror("failed to create x11 screen !\n");
++                      return EXIT_FAILURE;
++              }
 +
-+      ps3.scr.tscreen = ps3.scr.x11->screen;
++              ps3.scr.tscreen = ps3.scr.x11->screen;
++      } else {
 +#else
-+      result = ps3_get_video_mode(&mode);
++      if (1) {
++#endif
++              result = ps3_get_video_mode(&mode);
 +
-+      /* Current becomes default if ps3_flash_get_values() failed. */
++              /* Current becomes default if ps3_flash_get_values() failed. */
 +
-+      if (ps3.dirty_values && !result)
-+              ps3.values.video_mode = mode;
++              if (ps3.dirty_values && !result)
++                      ps3.values.video_mode = mode;
 +
-+      /* Set mode if not at default. */
++              /* Set mode if not at default. */
 +
-+      if (!result && (ps3.values.video_mode != (uint16_t)mode))
-+              ps3_set_video_mode(ps3.values.video_mode);
++              if (!result && (ps3.values.video_mode != (uint16_t)mode))
++                      ps3_set_video_mode(ps3.values.video_mode);
 +
-+      ps3.scr.fbdev = twin_fbdev_create(-1, SIGUSR1);
++              ps3.scr.fbdev = twin_fbdev_create(-1, SIGUSR1);
 +
-+      if (!ps3.scr.fbdev) {
-+              perror("failed to create fbdev screen !\n");
-+              return EXIT_FAILURE;
-+      }
++              if (!ps3.scr.fbdev) {
++                      perror("failed to create fbdev screen !\n");
++                      return EXIT_FAILURE;
++              }
 +
-+      ps3.scr.tscreen = ps3.scr.fbdev->screen;
-+#endif
++              ps3.scr.tscreen = ps3.scr.fbdev->screen;
++      }
 +
 +      ps3.scr.tscreen->event_filter = pbt_scr_event;
 +