summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2010-06-22 23:30:25 +0200
committerErwan Velu <erwanaliasr1@gmail.com>2010-06-22 23:30:25 +0200
commitd5ddfb6d284761850d00781ab206254bbe11665b (patch)
treec5f39284222dca7842840a7612be3270cae6223b
parent8cf1cc38bf47c39e40dabf581378a05baa4ed365 (diff)
downloadsyslinux-d5ddfb6d284761850d00781ab206254bbe11665b.tar.gz
hdt: Using syslinux_reboot() call
Rebooting can be achieved via syslinux_reboot() instead of the useless reboot.c32 module.
-rw-r--r--com32/hdt/Makefile5
-rw-r--r--com32/hdt/hdt-cli-hdt.c9
-rw-r--r--com32/hdt/hdt-common.c6
-rw-r--r--com32/hdt/hdt-common.h4
-rw-r--r--com32/hdt/hdt-menu.c7
5 files changed, 14 insertions, 17 deletions
diff --git a/com32/hdt/Makefile b/com32/hdt/Makefile
index f2e5f833..96af05f6 100644
--- a/com32/hdt/Makefile
+++ b/com32/hdt/Makefile
@@ -43,7 +43,6 @@ ISOLINUX_DIR ?= isolinux
FLOPPY_DIR ?= floppy
PCI_IDS_FILE ?= $(PWD)/$(FLOPPY_DIR)/pci.ids
GZ_PCI_IDS_FILE ?= $(PCI_IDS_FILE).gz
-REBOOT_COM32 ?= $(com32)/modules/reboot.c32
MENU_COM32 ?= $(com32)/menu/menu.c32
ART_DIR ?= art/
@@ -55,7 +54,7 @@ hdt.elf : $(OBJS) $(LIBS) $(C_LIBS)
memtest:
-[ ! -f $(FLOPPY_DIR)/$(MEMTEST) ] && $(WGET) $(MEMTEST_URL) -O $(FLOPPY_DIR)/$(MEMTEST)
-hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(REBOOT_COM32) $(MENU_COM32) memtest
+hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtools/syslinux $(MENU_COM32) memtest
rm -f hdt*.img
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(FLOPPY_DIR)/syslinux.cfg
@@ -67,7 +66,6 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
-[ -f $(MODULES_PCIMAP_FILE) ] && cat $(MODULES_PCIMAP_FILE) | $(GZIPPROG) - -f | MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) - a:modules.pcimap
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) hdt.c32 a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(MENU_COM32) a:
- MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(REBOOT_COM32) a:
@ [ -f $(GZ_PCI_IDS_FILE) ] && MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(GZ_PCI_IDS_FILE) a:pci.ids || printf "\nThe $(GZ_PCI_IDS_FILE) file is missing and can be downloaded from http://pciids.sourceforge.net and gzipped in\nthe ./com32/hdt/$(FLOPPY_DIR) directory of the extracted Syslinux source.\n\n"
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/syslinux.cfg a:
MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(FLOPPY_DIR)/$(MEMTEST) a:
@@ -88,7 +86,6 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg memtest
$(SED) -e 's/%VERSION%/$(VERSION)/g' $(FLOPPY_DIR)/hdt.cfg |\
$(SED) -e 's/%CODENAME%/$(CODENAME)/g' > $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg
cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR)
- cp $(REBOOT_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(FLOPPY_DIR)/$(MEMTEST) $(ISO_DIR)/$(ISOLINUX_DIR)
cp $(MENU_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
cp -av $(ART_DIR)/backgnd.png $(ISO_DIR)/$(ISOLINUX_DIR)
diff --git a/com32/hdt/hdt-cli-hdt.c b/com32/hdt/hdt-cli-hdt.c
index 65bb4444..f4854e37 100644
--- a/com32/hdt/hdt-cli-hdt.c
+++ b/com32/hdt/hdt-cli-hdt.c
@@ -30,6 +30,7 @@
#include <string.h>
#include <stdlib.h>
#include <syslinux/config.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
#include "hdt-cli.h"
@@ -246,11 +247,9 @@ void main_show_hdt(int argc __unused, char **argv __unused,
static void do_reboot(int argc __unused, char **argv __unused,
struct s_hardware *hardware)
{
- /* Use specific syslinux call if needed */
- if (issyslinux())
- return runsyslinuxcmd(hardware->reboot_label);
- else
- return csprint(hardware->reboot_label, 0x07);
+ (void) hardware;
+ /* Let's call the internal rebooting call */
+ syslinux_reboot(1);
}
/* Default hdt mode */
diff --git a/com32/hdt/hdt-common.c b/com32/hdt/hdt-common.c
index 114e6ee9..5a187f26 100644
--- a/com32/hdt/hdt-common.c
+++ b/com32/hdt/hdt-common.c
@@ -85,10 +85,6 @@ void detect_parameters(const int argc, const char *argv[],
strlcpy(hardware->memtest_label, argv[i] + 8,
sizeof(hardware->memtest_label));
convert_isolinux_filename(hardware->memtest_label, hardware);
- } else if (!strncmp(argv[i], "reboot=", 7)) {
- strlcpy(hardware->reboot_label, argv[i] + 7,
- sizeof(hardware->reboot_label));
- convert_isolinux_filename(hardware->reboot_label, hardware);
} else if (!strncmp(argv[i], "vesa", 4)) {
vesamode = true;
max_console_lines = MAX_CLI_LINES;
@@ -191,14 +187,12 @@ void init_hardware(struct s_hardware *hardware)
memset(hardware->modules_alias_path, 0,
sizeof hardware->modules_alias_path);
memset(hardware->memtest_label, 0, sizeof hardware->memtest_label);
- memset(hardware->reboot_label, 0, sizeof hardware->reboot_label);
memset(hardware->auto_label, 0, sizeof hardware->auto_label);
memset(hardware->vesa_background, 0, sizeof hardware->vesa_background);
strcat(hardware->pciids_path, "pci.ids");
strcat(hardware->modules_pcimap_path, "modules.pcimap");
strcat(hardware->modules_alias_path, "modules.alias");
strcat(hardware->memtest_label, "memtest");
- strcat(hardware->reboot_label, "reboot.c32");
strlcpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
sizeof(hardware->vesa_background));
}
diff --git a/com32/hdt/hdt-common.h b/com32/hdt/hdt-common.h
index 0a0c8c4e..fd9d7853 100644
--- a/com32/hdt/hdt-common.h
+++ b/com32/hdt/hdt-common.h
@@ -60,6 +60,9 @@
#define HDT_RETURN_TO_CLI 100
#define MAX_VESA_MODES 255
+/* This value is used for rebooting from the menu mode */
+#define HDT_REBOOT "hdt_reboot"
+
/* The maximum number of commands we can process */
#define MAX_NB_AUTO_COMMANDS 255
/* The maximum size of a command */
@@ -196,7 +199,6 @@ struct s_hardware {
char modules_alias_path[255];
char pciids_path[255];
char memtest_label[255];
- char reboot_label[255];
char auto_label[AUTO_COMMAND_SIZE];
char vesa_background[255];
};
diff --git a/com32/hdt/hdt-menu.c b/com32/hdt/hdt-menu.c
index 4629ee58..219f6987 100644
--- a/com32/hdt/hdt-menu.c
+++ b/com32/hdt/hdt-menu.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <memory.h>
+#include <syslinux/reboot.h>
#include "hdt-menu.h"
int start_menu_mode(struct s_hardware *hardware, char *version_string)
@@ -64,6 +65,10 @@ int start_menu_mode(struct s_hardware *hardware, char *version_string)
(curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) {
return HDT_RETURN_TO_CLI;
}
+ if (!strncmp
+ (curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) {
+ syslinux_reboot(1);
+ }
strcpy(cmd, curr->data);
/* Use specific syslinux call if needed */
@@ -284,7 +289,7 @@ void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware)
HDT_SWITCH_TO_CLI, 0);
add_item("<A>bout", "About Menu", OPT_SUBMENU, NULL,
hdt_menu->about_menu.menu);
- add_item("<R>eboot", "Reboot", OPT_RUN, hardware->reboot_label, 0);
+ add_item("<R>eboot", "Reboot", OPT_RUN, HDT_REBOOT, 0);
add_item("E<x>it", "Exit", OPT_EXITMENU, NULL, 0);
hdt_menu->main_menu.items_count++;