#include <stdlib.h>
#include <errno.h>
#include <syslinux/pxe.h>
+#include <syslinux/config.h>
void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode) {
char buffer[81];
memset(buffer,0,sizeof(81));
+ if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX) {
+ more_printf("You are not currently using PXELINUX\n");
+ return;
+ }
detect_pxe(hardware);
more_printf("PXE\n");
#include "hdt-common.h"
#include <stdlib.h>
#include <string.h>
+#include <syslinux/config.h>
void set_mode(struct s_cli_mode *cli_mode, cli_mode_t mode, struct s_hardware *hardware) {
switch (mode) {
break;
case PXE_MODE:
+ if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX) {
+ more_printf("You are not currently using PXELINUX\n");
+ break;
+ }
cli_mode->mode=mode;
snprintf(cli_mode->prompt, sizeof(cli_mode->prompt), "%s> ", CLI_PXE);
break;
main_show_kernel(hardware,cli_mode);
}
-void show_main_help() {
+void show_main_help(struct s_hardware *hardware) {
more_printf("Show supports the following commands : \n");
more_printf(" %s\n",CLI_SUMMARY);
more_printf(" %s\n",CLI_PCI);
more_printf(" %s\n",CLI_DMI);
more_printf(" %s\n",CLI_CPU);
- more_printf(" %s\n",CLI_PXE);
more_printf(" %s\n",CLI_KERNEL);
+ if (hardware->sv->filesystem == SYSLINUX_FS_PXELINUX)
+ more_printf(" %s\n",CLI_PXE);
}
void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode) {
if (!strncmp(item,CLI_CPU, sizeof (CLI_CPU))) { main_show_cpu(hardware,cli_mode); return; }
if (!strncmp(item,CLI_PXE, sizeof (CLI_PXE))) { main_show_pxe(hardware,cli_mode); return; }
if (!strncmp(item,CLI_KERNEL, sizeof (CLI_KERNEL))) { main_show_kernel(hardware,cli_mode); return; }
- show_main_help();
+ show_main_help(hardware);
}
#include <stdio.h>
#include "syslinux/config.h"
+void detect_syslinux(struct s_hardware *hardware) {
+ hardware->sv = syslinux_version();
+ switch(hardware->sv->filesystem) {
+ case SYSLINUX_FS_SYSLINUX: strlcpy(hardware->syslinux_fs,"SYSlinux",9); break;
+ case SYSLINUX_FS_PXELINUX: strlcpy(hardware->syslinux_fs,"PXElinux",9); break;
+ case SYSLINUX_FS_ISOLINUX: strlcpy(hardware->syslinux_fs,"ISOlinux",9); break;
+ case SYSLINUX_FS_EXTLINUX: strlcpy(hardware->syslinux_fs,"EXTlinux",9); break;
+ case SYSLINUX_FS_UNKNOWN:
+ default: strlcpy(hardware->syslinux_fs,"Unknown Bootloader",sizeof hardware->syslinux_fs); break;
+ }
+}
+
void init_hardware(struct s_hardware *hardware) {
hardware->pci_ids_return_code=0;
hardware->modules_pcimap_return_code=0;
memset(&hardware->dmi,0,sizeof(s_dmi));
memset(&hardware->cpu,0,sizeof(s_cpu));
memset(&hardware->pxe,0,sizeof(struct s_pxe));
+ memset(hardware->syslinux_fs,0,sizeof hardware->syslinux_fs);
}
/* Detecting if a DMI table exist
void *dhcpdata;
size_t dhcplen;
- const struct syslinux_version *sv;
t_PXENV_UNDI_GET_NIC_TYPE gnt;
if (hardware->pxe_detection == true) return -1;
memset(&gnt,0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
memset(&hardware->pxe,0, sizeof(struct s_pxe));
- sv = syslinux_version();
/* This code can only work if pxelinux is loaded*/
- if (sv->filesystem != SYSLINUX_FS_PXELINUX) {
+ if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
return -1;
}
bool cpu_detection; /* Does the cpu stuff have been already detected */
bool disk_detection; /* Does the disk stuff have been already detected */
bool pxe_detection; /* Does the pxe stuff have been already detected*/
+
+ char syslinux_fs[22];
+ struct syslinux_version *sv;
};
char *find_argument(const char **argv, const char *argument);
int detect_pxe(struct s_hardware *hardware);
void init_hardware(struct s_hardware *hardware);
void clear_screen(void);
+void detect_syslinux(struct s_hardware *hardware);
#endif
#include "hdt-menu.h"
/* Computing Syslinux menu*/
-void compute_syslinuxmenu(struct s_my_menu *menu) {
- char syslinux_fs[22];
+void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware) {
char syslinux_fs_menu[24];
char buffer[SUBMENULEN+1];
char statbuffer[STATLEN+1];
- const struct syslinux_version *sv;
-
- memset(syslinux_fs,0,sizeof syslinux_fs);
memset(syslinux_fs_menu,0,sizeof syslinux_fs_menu);
- sv = syslinux_version();
- switch(sv->filesystem) {
- case SYSLINUX_FS_SYSLINUX: strlcpy(syslinux_fs,"SYSlinux",9); break;
- case SYSLINUX_FS_PXELINUX: strlcpy(syslinux_fs,"PXElinux",9); break;
- case SYSLINUX_FS_ISOLINUX: strlcpy(syslinux_fs,"ISOlinux",9); break;
- case SYSLINUX_FS_EXTLINUX: strlcpy(syslinux_fs,"EXTlinux",9); break;
- case SYSLINUX_FS_UNKNOWN:
- default: strlcpy(syslinux_fs,"Unknown Bootloader",sizeof syslinux_fs); break;
- }
- snprintf(syslinux_fs_menu,sizeof syslinux_fs_menu," %s ",syslinux_fs);
+ snprintf(syslinux_fs_menu,sizeof syslinux_fs_menu," %s ",hardware->syslinux_fs);
menu->menu = add_menu(syslinux_fs_menu,-1);
menu->items_count=0;
set_menu_pos(SUBMENU_Y,SUBMENU_X);
- snprintf(buffer, sizeof buffer, "Bootloader : %s", syslinux_fs);
- snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s", syslinux_fs);
+ snprintf(buffer, sizeof buffer, "Bootloader : %s", hardware->syslinux_fs);
+ snprintf(statbuffer, sizeof statbuffer, "Bootloader: %s", hardware->syslinux_fs);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Version : %s", sv->version_string+2);
- snprintf(statbuffer, sizeof statbuffer, "Version: %s", sv->version_string+2);
+ snprintf(buffer, sizeof buffer, "Version : %s", hardware->sv->version_string+2);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %s", hardware->sv->version_string+2);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Version : %u",sv->version);
- snprintf(statbuffer, sizeof statbuffer, "Version: %u",sv->version);
+ snprintf(buffer, sizeof buffer, "Version : %u",hardware->sv->version);
+ snprintf(statbuffer, sizeof statbuffer, "Version: %u",hardware->sv->version);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
menu->items_count++;
- snprintf(buffer, sizeof buffer, "Max API : %u",sv->max_api);
- snprintf(statbuffer, sizeof statbuffer, "Max API: %u",sv->max_api);
+ snprintf(buffer, sizeof buffer, "Max API : %u",hardware->sv->max_api);
+ snprintf(statbuffer, sizeof statbuffer, "Max API: %u",hardware->sv->max_api);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
menu->items_count++;
add_item("","",OPT_SEP,"",0);
- snprintf(buffer, sizeof buffer, "%s", sv->copyright_string+1);
- snprintf(statbuffer, sizeof statbuffer, "%s", sv->copyright_string+1);
+ snprintf(buffer, sizeof buffer, "%s", hardware->sv->copyright_string+1);
+ snprintf(statbuffer, sizeof statbuffer, "%s", hardware->sv->copyright_string+1);
add_item(buffer,statbuffer,OPT_INACTIVE,NULL,0);
menu->items_count++;
compute_kernel(&(hdt_menu->kernel_menu),hardware);
#endif
compute_summarymenu(&(hdt_menu->summary_menu),hardware);
- compute_syslinuxmenu(&(hdt_menu->syslinux_menu));
+ compute_syslinuxmenu(&(hdt_menu->syslinux_menu),hardware);
compute_aboutmenu(&(hdt_menu->about_menu));
}
void compute_processor(struct s_my_menu *menu,struct s_hardware *hardware);
// Syslinux stuff
-void compute_syslinuxmenu(struct s_my_menu *menu);
+void compute_syslinuxmenu(struct s_my_menu *menu,struct s_hardware *hardware);
// About menu
void compute_aboutmenu(struct s_my_menu *menu);
/* Cleaning structures */
init_hardware(&hardware);
+ /* Detecting Syslinux Version*/
+ detect_syslinux(&hardware);
+
/* Opening the syslinux console */
openconsole(&dev_stdcon_r, &dev_ansicon_w);