hdt: Adding background image for the CLI
authorErwan Velu <erwan.velu@free.fr>
Fri, 20 Nov 2009 21:00:50 +0000 (22:00 +0100)
committerErwan Velu <erwan.velu@free.fr>
Fri, 20 Nov 2009 21:00:50 +0000 (22:00 +0100)
Impact: Visual

The cli now features a background image when started in vesa mode

com32/hdt/Makefile
com32/hdt/art/backgnd.png [new file with mode: 0644]
com32/hdt/hdt-common.c
com32/hdt/hdt-common.h
com32/hdt/hdt.c

index abe21f5..4851980 100644 (file)
@@ -37,7 +37,8 @@ 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
+REBOOT_COM32            ?= $(com32)/modules/reboot.c32
+ART_DIR                 ?= art/
 
 all: $(MODULES) $(TESTFILES)
 
@@ -56,6 +57,7 @@ hdt.img: hdt.c32 $(FLOPPY_DIR)/hdt.cfg $(FLOPPY_DIR)/mtools.conf $(topdir)/mtool
        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)/hdt.cfg a:syslinux.cfg
+       MTOOLSRC=$(PWD)/$(FLOPPY_DIR)/mtools.conf $(MCOPY) $(ART_DIR)/* a:
 
 hdt.img.gz: hdt.img
        rm -rf hdt.img.gz
@@ -69,6 +71,7 @@ hdt.iso: hdt.c32 $(topdir)/core/isolinux.bin $(FLOPPY_DIR)/hdt.cfg
        cp $(FLOPPY_DIR)/hdt.cfg $(ISO_DIR)/$(ISOLINUX_DIR)/isolinux.cfg
        cp hdt.c32 $(ISO_DIR)/$(ISOLINUX_DIR)
        cp $(REBOOT_COM32) $(ISO_DIR)/$(ISOLINUX_DIR)
+       cp -av $(ART_DIR)/* $(ISO_DIR)/$(ISOLINUX_DIR)
        -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/hwdata/pci.ids $(PCI_IDS_FILE) && $(GZIP) $(PCI_IDS_FILE)
        -[ ! -f $(GZ_PCI_IDS_FILE) ] && cp /usr/share/pci.ids $(PCI_IDS_FILE) && $(GZIP) $(PCI_IDS_FILE)
        -[ -f $(MODULES_ALIAS_FILE) ] && cp $(MODULES_ALIAS_FILE) $(ISO_DIR)/$(ISOLINUX_DIR)\
diff --git a/com32/hdt/art/backgnd.png b/com32/hdt/art/backgnd.png
new file mode 100644 (file)
index 0000000..a51efeb
Binary files /dev/null and b/com32/hdt/art/backgnd.png differ
index cdcd695..01ef8b1 100644 (file)
 #include <disk/mbrs.h>
 
 /* ISOlinux requires a 8.3 format */
-void convert_isolinux_filename(char *filename, struct s_hardware *hardware) {
+void *convert_isolinux_filename(char *filename, struct s_hardware *hardware) {
   /* Exit if we are not running ISOLINUX */
   if (hardware->sv->filesystem != SYSLINUX_FS_ISOLINUX) return;
   /* Searching the dot */
   char *dot=strchr(filename,'.');
-  /* Exiting if not dot exists in that string */
+  /* Exiting if no dot exists in that string */
   if (dot==NULL) return;
   /* Exiting if the extension is 3 char or less */
   if (strlen(dot)<=4) return;
@@ -640,3 +640,19 @@ char *del_multi_spaces(char *p) {
 void reset_more_printf() {
   display_line_nb=0;
 }
+
+int draw_background(const char *what)
+{
+    if (!what)
+        return vesacon_default_background();
+    else
+        return vesacon_load_background(what);
+}
+
+void init_console() {
+  if (vesamode) {
+       openconsole(&dev_rawcon_r, &dev_vesaserial_w);
+       draw_background(CLI_BACKGROUND);
+  }
+  else console_ansi_raw();
+}
index cd1dc3c..b231ad7 100644 (file)
@@ -30,6 +30,9 @@
 #define DEFINE_HDT_COMMON_H
 #include <stdio.h>
 #include <syslinux/pxe.h>
+#include <console.h>
+#include <consoles.h>
+#include <syslinux/vesacon.h>
 #include "sys/pci.h"
 
 #include <disk/bootloaders.h>
@@ -66,6 +69,9 @@
 /* The char that surround the list of commands */
 #define AUTO_DELIMITER "'"
 
+/* Graphic to load in background when using the vesa mode */
+#define CLI_BACKGROUND "backgnd.png"
+
 /* Defines if the cli is quiet*/
 bool quiet;
 
@@ -206,4 +212,5 @@ void detect_syslinux(struct s_hardware *hardware);
 void detect_parameters(const int argc, const char *argv[],
                        struct s_hardware *hardware);
 int detect_vesa(struct s_hardware *hardware);
+void init_console();
 #endif
index 6daf3ae..73cd890 100644 (file)
@@ -33,9 +33,6 @@
  */
 
 #include <stdio.h>
-#include <console.h>
-#include <consoles.h>
-#include <syslinux/vesacon.h>
 #include "hdt.h"
 #include "hdt-cli.h"
 #include "hdt-menu.h"
@@ -56,23 +53,22 @@ int main(const int argc, const char *argv[])
   snprintf(version_string, sizeof version_string, "%s %s (%s)",
            PRODUCT_NAME,VERSION, CODENAME);
 
-  /* Detecting parameters */
-  detect_parameters(argc, argv, &hardware);
-
-  /* Opening the Syslinux console */
-  if (vesamode) openconsole(&dev_rawcon_r, &dev_vesaserial_w);
-  else console_ansi_raw();
-
   /* Cleaning structures */
   init_hardware(&hardware);
 
   /* Detecting Syslinux version */
   detect_syslinux(&hardware);
-  
+
+  /* Detecting parameters */
+  detect_parameters(argc, argv, &hardware);
+
+  /* Opening the Syslinux console */
+  init_console();
+
   /* Clear the screen and reset position of the cursor */
   clear_screen();
   printf("\033[1;1H");
-  
+
   printf("%s\n", version_string);
 
   if ((arg = find_argument(argv + 1, "nomenu")) || (find_argument(argv+1,"auto")))