summaryrefslogtreecommitdiff
path: root/packages/kexecboot
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2009-01-27 00:25:39 +0100
committerAndrea Adami <andrea.adami@gmail.com>2009-01-27 23:26:25 +0100
commitddf9f35be9bfd945bfeb5b12b767142b1ac3d786 (patch)
treea505bfc34c173717e98768ce43f6e20ca34c8042 /packages/kexecboot
parent40c87872fcb4c437f5de9eb227eb3efd8b36f613 (diff)
kexecboot: add new (beta) release 0.4 and add patches from upstream
Diffstat (limited to 'packages/kexecboot')
-rw-r--r--packages/kexecboot/kexecboot-0.4/add-reboot-option.patch41
-rw-r--r--packages/kexecboot/kexecboot-0.4/add-sleep.patch12
-rw-r--r--packages/kexecboot/kexecboot-0.4/graphical-no-devices.patch20
-rw-r--r--packages/kexecboot/kexecboot-0.4/scan_devices-top.patch39
-rw-r--r--packages/kexecboot/kexecboot-0.4/silent-output-hack.patch79
-rw-r--r--packages/kexecboot/kexecboot-0.4/switch-cursor-off.patch11
-rw-r--r--packages/kexecboot/kexecboot_0.4.bb41
7 files changed, 243 insertions, 0 deletions
diff --git a/packages/kexecboot/kexecboot-0.4/add-reboot-option.patch b/packages/kexecboot/kexecboot-0.4/add-reboot-option.patch
new file mode 100644
index 0000000000..52619229fd
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/add-reboot-option.patch
@@ -0,0 +1,41 @@
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -536,11 +536,23 @@ int main(int argc, char **argv)
+ fread(&evt, sizeof(struct input_event), 1, f);
+ while(evt.type != EV_KEY || evt.value != 0);
+
+- if(evt.code == KEY_UP && choice >0)
+- choice--;
+- if(evt.code == KEY_DOWN && choice < bl->size-1)
+- choice++;
+- // printf("%d %d\n",choice, evt.code);
++ switch (evt.code) {
++ case KEY_UP:
++ if (choice > 0) choice--;
++ break;
++ case KEY_DOWN:
++ if ( choice < (bl->size - 1) ) choice++;
++ break;
++ case KEY_R:
++ /* FIXME: Should work while no boot devices is found */
++ sync();
++ sleep(1);
++ /* if ( -1 == reboot(LINUX_REBOOT_CMD_RESTART) ) { */
++ if ( -1 == reboot(RB_AUTOBOOT) ) {
++ perror("Can't initiate reboot");
++ }
++ break;
++ }
+
+ }while(evt.code != 87 && evt.code != 63);
+ fclose(f);
+--- a/kexecboot.h
++++ b/kexecboot.h
+@@ -29,6 +29,7 @@
+ #include <sys/wait.h>
+ #include <ctype.h>
+ #include <errno.h>
++#include <sys/reboot.h>
+ #include "fb.h"
+ #include "devicescan.h"
+ #include "res/logo-img.h"
diff --git a/packages/kexecboot/kexecboot-0.4/add-sleep.patch b/packages/kexecboot/kexecboot-0.4/add-sleep.patch
new file mode 100644
index 0000000000..8f41b0ef10
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/add-sleep.patch
@@ -0,0 +1,12 @@
+--- a/kexecboot.c 2009-01-24 14:11:17.000000000 +0100
++++ b/kexecboot.c 2009-01-24 14:15:03.000000000 +0100
+@@ -427,6 +427,9 @@
+
+ DPRINTF("I'm the init-process!\n");
+
++ /* extra delay for initializing slow SD/CF */
++ sleep(1);
++
+ /* Mount procfs */
+ if ( -1 == mount("proc", "/proc", "proc",
+ 0, NULL) ) {
diff --git a/packages/kexecboot/kexecboot-0.4/graphical-no-devices.patch b/packages/kexecboot/kexecboot-0.4/graphical-no-devices.patch
new file mode 100644
index 0000000000..b2cb214894
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/graphical-no-devices.patch
@@ -0,0 +1,20 @@
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -66,8 +66,15 @@ void display_menu(FB *fb, struct bootlist *bl, int current)
+ LOGO_IMG_WIDTH,
+ LOGO_IMG_HEIGHT,
+ LOGO_IMG_BYTES_PER_PIXEL, LOGO_IMG_RLE_PIXEL_DATA);
+- fb_draw_text (fb, LOGO_IMG_WIDTH + margin, margin, 0, 0, 0, &radeon_font,
+- "Make your choice by selecting\nan item with the cursor keys\nand press OK to continue");
++ /* If no devices found print a message */
++ if (0 == bl->size) {
++ fb_draw_text (fb, LOGO_IMG_WIDTH + margin, margin, 0, 0, 0, &radeon_font,
++ "No bootable devices found.\nInsert bootable device\nand press 'R' to reboot.");
++ } else {
++ fb_draw_text (fb, LOGO_IMG_WIDTH + margin, margin, 0, 0, 0, &radeon_font,
++ "Make your choice by selecting\nan item with the cursor keys\nand press OK to continue.\nPress 'R' to reboot.");
++ }
++
+ if(current < firstslot)
+ firstslot=current;
+ if(current > firstslot + slots -1)
diff --git a/packages/kexecboot/kexecboot-0.4/scan_devices-top.patch b/packages/kexecboot/kexecboot-0.4/scan_devices-top.patch
new file mode 100644
index 0000000000..6b21d03a3d
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/scan_devices-top.patch
@@ -0,0 +1,39 @@
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -508,28 +508,27 @@ int main(int argc, char **argv)
+ if ((fb = fb_new(angle)) == NULL)
+ exit(-1);
+
+- bl = scan_devices();
+-
+- if(!bl->size){
+- puts("No bootable device found");
+- exit(-1);
+- }
+-
+ f = fopen(eventif,"r");
+ if(!f){
+ perror(eventif);
+ exit(3);
+ }
+
+-
+ // deactivate terminal input
+-
+ tcgetattr(fileno(stdin), &old);
+ new = old;
+ new.c_lflag &= ~ECHO;
+ // new.c_cflag &=~CREAD;
+ tcsetattr(fileno(stdin), TCSANOW, &new);
+
++ bl = scan_devices();
++/*
++ if(!bl->size){
++ puts("No bootable device found");
++ exit(-1);
++ }
++*/
++
+ do{
+ display_menu(fb, bl, choice);
+ do
diff --git a/packages/kexecboot/kexecboot-0.4/silent-output-hack.patch b/packages/kexecboot/kexecboot-0.4/silent-output-hack.patch
new file mode 100644
index 0000000000..abe8e84dd1
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/silent-output-hack.patch
@@ -0,0 +1,79 @@
+--- a/devicescan.c 2009-01-17 00:51:35.000000000 +0100
++++ b/devicescan.c 2009-01-24 22:13:45.000000000 +0100
+@@ -120,14 +120,14 @@
+ malloc((strlen(split) + strlen("/dev/") +
+ 1) * sizeof(char));
+ sprintf(device, "/dev/%s", split);
+- printf("Probing %s\n",device);
++ /* printf("Probing %s\n",device); */
+ int fd = open(device, O_RDONLY);
+ if (fd < 0) {
+ perror(device);
+ free(device);
+ continue;
+ }
+- printf("Device %s is opened\n", device);
++ /* printf("Device %s is opened\n", device); */
+ if (-1 == identify_fs(fd, &fstype, NULL, 0)) {
+ free(device);
+ continue;
+@@ -137,33 +137,33 @@
+ free(device);
+ continue;
+ }
+- printf("FS on device %s is %s\n", device, fstype);
++ /* printf("FS on device %s is %s\n", device, fstype); */
+ // no unknown filesystems
+ if (contains(fstype, fl) == -1) {
+ free(device);
+ continue;
+ }
+- printf("found %s (%s)\n",device, fstype);
++ /* printf("found %s (%s)\n",device, fstype); */
+ // mount fs
+ if (mount(device, "/mnt", fstype, MS_RDONLY, NULL)) {
+- printf("mount failed\n");
++ /* printf("mount failed\n"); */
+ perror(device);
+ free(device);
+ continue;
+ }
+- printf("mount successful\n");
++ /* printf("mount successful\n"); */
+ if ( (g = fopen("/mnt/zImage", "r")) )
+ kernelpath = "/mnt/zImage";
+ else if ( (g = fopen("/mnt/boot/zImage", "r")) )
+ kernelpath = "/mnt/boot/zImage";
+ else {
+- printf("%s no kernel found, umounting\n", device);
++ /* printf("%s no kernel found, umounting\n", device); */
+ free(device);
+ umount("/mnt");
+ continue;
+ }
+ fclose(g);
+- printf("found kernel\n");
++ /* printf("found kernel\n"); */
+ bl->list[count] = malloc(sizeof(struct boot));
+ bl->list[count]->device = device;
+ bl->list[count]->fstype = fstype;
+@@ -174,7 +174,7 @@
+ fgets(bl->list[count]->cmdline, COMMAND_LINE_SIZE,
+ g);
+ fclose(g);
+- printf("found command line\n");
++ /* printf("found command line\n"); */
+ bl->list[count]->cmdline[strlen(bl->list[count]->cmdline)-1] = '\0';
+ } else
+ bl->list[count]->cmdline = NULL;
+--- a/kexecboot.c 2009-01-25 10:41:04.000000000 +0100
++++ b/kexecboot.c 2009-01-24 22:13:45.000000000 +0100
+@@ -558,7 +558,7 @@
+ case KEY_R:
+ /* FIXME: Should work while no boot devices is found */
+ sync();
+- sleep(1);
++ /* REMOVE: we sleep on boot sleep(1); */
+ /* if ( -1 == reboot(LINUX_REBOOT_CMD_RESTART) ) { */
+ if ( -1 == reboot(RB_AUTOBOOT) ) {
+ perror("Can't initiate reboot");
diff --git a/packages/kexecboot/kexecboot-0.4/switch-cursor-off.patch b/packages/kexecboot/kexecboot-0.4/switch-cursor-off.patch
new file mode 100644
index 0000000000..632cc6a01c
--- /dev/null
+++ b/packages/kexecboot/kexecboot-0.4/switch-cursor-off.patch
@@ -0,0 +1,11 @@
+--- a/kexecboot.c
++++ b/kexecboot.c
+@@ -512,6 +512,9 @@ int main(int argc, char **argv)
+ DPRINTF("FB angle is %d, input device is %s\n", angle, eventif);
+ DPRINTF("Going to fb mode\n");
+
++ /* Switch cursor off. NOTE: works only when master-console is tty */
++ printf("\033[?25l\n");
++
+ if ((fb = fb_new(angle)) == NULL)
+ exit(-1);
diff --git a/packages/kexecboot/kexecboot_0.4.bb b/packages/kexecboot/kexecboot_0.4.bb
new file mode 100644
index 0000000000..557c5be4b3
--- /dev/null
+++ b/packages/kexecboot/kexecboot_0.4.bb
@@ -0,0 +1,41 @@
+LICENSE = "GPL"
+PR = "r0"
+DEPENDS = "klibc"
+RDEPENDS = "kexec-static"
+
+inherit autotools
+
+# You can create your own *-img.h by doing
+# ./make-image-header.sh <file>.png HAND
+
+SRC_URI = "http://projects.linuxtogo.org/~jay7/kexecboot-${PV}.tar.gz \
+ file://add-reboot-option.patch;patch=1 \
+ file://scan_devices-top.patch;patch=1 \
+ file://graphical-no-devices.patch;patch=1 \
+ file://switch-cursor-off.patch;patch=1 \
+ file://add-sleep.patch;patch=1 \
+ file://silent-output-hack.patch;patch=1 \
+ "
+
+S = "${WORKDIR}/kexecboot-${PV}"
+
+export CC=${TARGET_PREFIX}klcc
+
+# standard oe cflags don't work with klcc
+export CFLAGS = ""
+export CPPFLAGS = ""
+export LDFLAGS = ""
+
+do_install () {
+ install -d ${D}${bindir}
+ install -m 0755 kexecboot ${D}${bindir}/
+
+ install -d ${D}/proc
+ install -d ${D}/mnt
+}
+
+FILES_${PN} += " ${bindir}/kexecboot /init /proc /mnt"
+
+pkg_postinst_${PN} () {
+ ln -sf ${bindir}/kexecboot $D/init
+}