rpms/petitboot/devel petitboot-0.0.1-defaults.patch, NONE, 1.1 petitboot-0.0.1-artwork-not-executable.patch, 1.1, 1.2 petitboot.spec, 1.1, 1.2

David Woodhouse (dwmw2) fedora-extras-commits at redhat.com
Fri Apr 6 23:36:22 UTC 2007


Author: dwmw2

Update of /cvs/extras/rpms/petitboot/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17468

Modified Files:
	petitboot-0.0.1-artwork-not-executable.patch petitboot.spec 
Added Files:
	petitboot-0.0.1-defaults.patch 
Log Message:
default

petitboot-0.0.1-defaults.patch:

--- NEW FILE petitboot-0.0.1-defaults.patch ---
commit 2e4eb975214f6a107acdaac1652fcb462c55a985
Author: David Woodhouse <dwmw2 at infradead.org>
Date:   Fri Apr 6 19:18:46 2007 -0400

    Support default boot options, with a timeout.
    
    It's a crappy hack, but it does the job for now and actually lets the
    machine boot unattended.
    
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
    Acked-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>

diff --git a/devices.c b/devices.c
index e4d6913..6c4bc40 100644
--- a/devices.c
+++ b/devices.c
@@ -168,7 +168,8 @@ static int read_option(int fd, struct device_context *dev_ctx)
 
 	if (icon)
 		index = pboot_add_option(dev_ctx->device_idx, opt->name,
-					 opt->description, icon, opt);
+					 opt->description, icon,
+					 opt->default_prio, opt);
 
 	return index != -1;
 }
diff --git a/devices/message.h b/devices/message.h
index 7a5d4f2..2a16bdd 100644
--- a/devices/message.h
+++ b/devices/message.h
@@ -24,6 +24,7 @@ struct boot_option {
 	char *boot_image_file;
 	char *initrd_file;
 	char *boot_args;
+	char *default_prio;
 };
 
 
diff --git a/devices/udev-helper.c b/devices/udev-helper.c
index 4ec054b..491662d 100644
--- a/devices/udev-helper.c
+++ b/devices/udev-helper.c
@@ -132,7 +132,8 @@ int add_boot_option(const struct boot_option *opt)
 		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);
diff --git a/devices/yaboot-parser.c b/devices/yaboot-parser.c
index 2324950..286babb 100644
--- a/devices/yaboot-parser.c
+++ b/devices/yaboot-parser.c
@@ -104,9 +104,10 @@ void process_image(char *label)
 	opt.name = label;
 	cfgopt = cfg_get_strg(label, "image");
 	opt.boot_image_file = join_paths(mountpoint, cfgopt);
+	/* FIXME: Lower priority for removable media */
 	if (cfgopt == defimage)
-		pb_log("This one is default. What do we do about it?\n");
-
+		opt.default_prio = "99";
+	
 	cfgopt = cfg_get_strg(label, "initrd");
 	if (cfgopt)
 		opt.initrd_file = join_paths(mountpoint, cfgopt);
diff --git a/petitboot.c b/petitboot.c
index f875768..2c5b8d7 100644
--- a/petitboot.c
+++ b/petitboot.c
@@ -29,6 +29,7 @@ static twin_fbdev_t *pboot_fbdev;
 #endif
 
 static twin_screen_t *pboot_screen;
+static twin_timeout_t *default_timeout;
 
 #define PBOOT_INITIAL_MESSAGE		\
 	"keys: 0=safe 1=720p 2=1080i 3=1080p del=GameOS"
@@ -143,6 +144,9 @@ static pboot_spane_t	*pboot_spane;
 
 static int pboot_vmode_change = -1;
 
+static void pboot_set_lfocus(int index);
+static void pboot_set_device_select(int sel, int force);
+
 /* XXX move to twin */
 static inline twin_bool_t twin_rect_intersect(twin_rect_t r1,
 					      twin_rect_t r2)
@@ -326,6 +330,11 @@ static void pboot_set_rfocus(int index)
 {
 	pboot_device_t	*dev;
 
+	if (default_timeout) {
+		twin_clear_timeout(default_timeout);
+		default_timeout = NULL;
+	}
+
 	if (pboot_dev_sel < 0 || pboot_dev_sel >= pboot_dev_count)
 		return;
 	dev = pboot_devices[pboot_dev_sel];
@@ -477,9 +486,16 @@ static twin_bool_t pboot_rpane_event (twin_window_t	    *window,
 	return TWIN_FALSE;
 }
 
+static twin_time_t pboot_default_boot (twin_time_t now, void *closure)
+{
+	pboot_choose_option();
+	return TWIN_FALSE;
+}
+
 
-int pboot_add_option(int devindex, const char *title,
-		     const char *subtitle, twin_pixmap_t *badge, void *data)
+int pboot_add_option(int devindex, const char *title, const char *subtitle,
+		     twin_pixmap_t *badge, const char *default_prio,
+		     void *data)
 {
 	pboot_device_t	*dev;
 	pboot_option_t	*opt;
@@ -517,6 +533,26 @@ int pboot_add_option(int devindex, const char *title,
 	opt->box.bottom = opt->box.top + PBOOT_RIGHT_OPTION_HEIGHT;
 
 	opt->data = data;
+
+	if (default_prio && strlen(default_prio)) {
+		/* FIXME: Compare with priority of other 'default' options,
+		   which might be lower if they're on removable media etc. */
+		pboot_set_device_select(devindex, 1);
+		pboot_select_rpane();
+		pboot_set_rfocus(index);
+		if (default_timeout)
+			twin_clear_timeout(default_timeout);
+		default_timeout = twin_set_timeout(pboot_default_boot, 5000, NULL);
+	} else if (pboot_dev_sel == devindex && !pboot_focus_lpane) {
+		int focus = pboot_rpane->focus_curindex;
+		int have_default = !!default_timeout;
+
+		pboot_set_device_select(devindex, 1);
+		pboot_select_rpane();
+		pboot_set_rfocus(focus);
+		if (have_default)
+			default_timeout = twin_set_timeout(pboot_default_boot, 5000, NULL);
+	}
 	return index;
 }
 
@@ -627,6 +663,10 @@ static void pboot_set_lfocus(int index)
 	if (index >= pboot_dev_count)
 		return;
 
+	if (default_timeout) {
+		twin_clear_timeout(default_timeout);
+		default_timeout = NULL;
+	}
 	pboot_lpane->focus_start = pboot_lpane->focus_box.top;
 
 	if (index < 0)
diff --git a/petitboot.h b/petitboot.h
index a77bfef..bc4563d 100644
--- a/petitboot.h
+++ b/petitboot.h
@@ -8,8 +8,9 @@
 
 int pboot_add_device(const char *dev_id, const char *name,
 		twin_pixmap_t *pixmap);
-int pboot_add_option(int devindex, const char *title,
-		     const char *subtitle, twin_pixmap_t *badge, void *data);
+int pboot_add_option(int devindex, const char *title, const char *subtitle,
+		     twin_pixmap_t *badge, const char *default_prio,
+		     void *data);
 int pboot_remove_device(const char *dev_id);
 
 int pboot_start_device_discovery(int udev_trigger);

petitboot-0.0.1-artwork-not-executable.patch:

Index: petitboot-0.0.1-artwork-not-executable.patch
===================================================================
RCS file: /cvs/extras/rpms/petitboot/devel/petitboot-0.0.1-artwork-not-executable.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- petitboot-0.0.1-artwork-not-executable.patch	5 Apr 2007 20:45:27 -0000	1.1
+++ petitboot-0.0.1-artwork-not-executable.patch	6 Apr 2007 23:35:48 -0000	1.2
@@ -1,5 +1,15 @@
---- petitboot-0.0.1/Makefile~	2007-04-05 08:28:45.000000000 -0400
-+++ petitboot-0.0.1/Makefile	2007-04-05 11:53:37.000000000 -0400
+commit 20ad052d963a85685760f2699b8a267541973917
+Author: David Woodhouse <dwmw2 at infradead.org>
+Date:   Thu Apr 5 18:28:26 2007 -0400
+
+    Install artwork files without x bit set
+    
+    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
+
+diff --git a/Makefile b/Makefile
+index 54e8f9a..7974a27 100644
+--- a/Makefile
++++ b/Makefile
 @@ -36,7 +36,7 @@ install: all
  	$(INSTALL) -D petitboot $(DESTDIR)$(PREFIX)/sbin/petitboot
  	$(INSTALL) -D udev-helper $(DESTDIR)$(PREFIX)/sbin/udev-helper


Index: petitboot.spec
===================================================================
RCS file: /cvs/extras/rpms/petitboot/devel/petitboot.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- petitboot.spec	5 Apr 2007 20:45:27 -0000	1.1
+++ petitboot.spec	6 Apr 2007 23:35:48 -0000	1.2
@@ -1,6 +1,6 @@
 Name:		petitboot
 Version:	0.0.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 Summary:	Graphical kexec-based bootloader, originally for PlayStation 3
 
 Group:		System Environment/Base
@@ -8,6 +8,7 @@
 URL:		http://ozlabs.org/~jk/projects/petitboot/
 Source0:	http://ozlabs.org/~jk/projects/petitboot/downloads/%{name}-%{version}.tar.gz
 Patch0:		petitboot-0.0.1-artwork-not-executable.patch
+Patch1:		petitboot-0.0.1-defaults.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  libpng-devel zlib-devel libX11-devel libjpeg-devel
@@ -21,6 +22,7 @@
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 
 %build
 make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS -I."
@@ -43,5 +45,8 @@
 
 
 %changelog
+* Fri Apr  6 2007 David Woodhouse <dwmw2 at infradead.org> 0.0.1-2
+- Support unattended boot of 'default' options, with timeout.
+
 * Thu Apr  5 2007 David Woodhouse <dwmw2 at infradead.org> 0.0.1-1
 - Initial package




More information about the scm-commits mailing list