[syslinux:master] hdt: Adding Kernel dumping

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Mon Apr 25 15:28:51 PDT 2011


Commit-ID:  96a339ab2b9fdf7be11d46d442c9e87b6bdc5059
Gitweb:     http://syslinux.zytor.com/commit/96a339ab2b9fdf7be11d46d442c9e87b6bdc5059
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Mon, 11 Apr 2011 20:09:52 +0200
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Mon, 11 Apr 2011 20:09:52 +0200

hdt: Adding Kernel dumping

Kernel is now dumped into th 'kernel' file


---
 com32/hdt/{hdt-dump-cpu.c => hdt-dump-kernel.c} |   54 +++++++++++++++--------
 com32/hdt/hdt-dump.c                            |    1 +
 com32/hdt/hdt-dump.h                            |    1 +
 3 files changed, 37 insertions(+), 19 deletions(-)

diff --git a/com32/hdt/hdt-dump-cpu.c b/com32/hdt/hdt-dump-kernel.c
similarity index 57%
copy from com32/hdt/hdt-dump-cpu.c
copy to com32/hdt/hdt-dump-kernel.c
index 33d561c..e0df832 100644
--- a/com32/hdt/hdt-dump-cpu.c
+++ b/com32/hdt/hdt-dump-kernel.c
@@ -29,25 +29,41 @@
 #include "hdt-common.h"
 #include "hdt-dump.h"
 
-void dump_cpu(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item) {
+void dump_kernel(struct s_hardware *hardware, ZZJSON_CONFIG * config,
+		 ZZJSON ** item)
+{
+    struct pci_device *pci_device = NULL;
+    CREATE_ARRAY
+	    add_as("Linux Kernel modules", "")
+    END_OF_ARRAY;
 
-        CREATE_NEW_OBJECT;
-	add_hs(cpu.vendor);
-	add_hs(cpu.model);
-	add_hi(cpu.vendor_id);
-	add_hi(cpu.family);
-	add_hi(cpu.model_id);
-	add_hi(cpu.stepping);
-	add_hi(cpu.num_cores);
-	add_hi(cpu.l1_data_cache_size);
-	add_hi(cpu.l1_instruction_cache_size);
-	add_hi(cpu.l2_cache_size);
-	size_t i;
-	for (i = 0; i < cpu_flags_count; i++) {
-		char temp[128]={0};
-		snprintf(temp,sizeof(temp),"cpu.flags.%s",cpu_flags_names[i]);
-		add_b(temp,get_cpu_flag_value_from_name(&hardware->cpu,cpu_flags_names[i]));
+    if (hardware->pci_ids_return_code == -ENOPCIIDS) {
+	APPEND_ARRAY 
+		add_as("Error", "No pci.ids file")
+	END_OF_APPEND FLUSH_OBJECT;
+	return;
+    }
+
+    if ((hardware->modules_pcimap_return_code == -ENOMODULESPCIMAP)
+	&&(hardware->modules_pcimap_return_code == -ENOMODULESALIAS)) {
+	APPEND_ARRAY
+		add_as("Error", "No modules.pcimap or modules.alias file")
+	END_OF_APPEND FLUSH_OBJECT;
+	return;
+
+	}
+
+    /* For every detected pci device, compute its submenu */
+    for_each_pci_func(pci_device, hardware->pci_domain) {
+	if (pci_device == NULL)
+	    continue;
+	for (int kmod = 0;
+	     kmod < pci_device->dev_info->linux_kernel_module_count; kmod++) {
+	    APPEND_ARRAY
+		    add_as(pci_device->dev_info->category_name, pci_device->dev_info->linux_kernel_module[kmod])
+	    END_OF_APPEND;
 	}
-	FLUSH_OBJECT;
-	to_cpio("cpu");
+    }
+    FLUSH_OBJECT;
+    to_cpio("kernel");
 }
diff --git a/com32/hdt/hdt-dump.c b/com32/hdt/hdt-dump.c
index 695f8fa..ae531e2 100644
--- a/com32/hdt/hdt-dump.c
+++ b/com32/hdt/hdt-dump.c
@@ -131,6 +131,7 @@ void dump(struct s_hardware *hardware)
     dump_memory(hardware, &config, &json);
     dump_pci(hardware, &config, &json);
     dump_acpi(hardware, &config, &json);
+    dump_kernel(hardware, &config, &json);
 
     /* We close & flush the file to send */
     cpio_close(upload);
diff --git a/com32/hdt/hdt-dump.h b/com32/hdt/hdt-dump.h
index ae6aa80..a867368 100644
--- a/com32/hdt/hdt-dump.h
+++ b/com32/hdt/hdt-dump.h
@@ -80,3 +80,4 @@ void dump_dmi(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item)
 void dump_memory(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
 void dump_pci(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
 void dump_acpi(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);
+void dump_kernel(struct s_hardware *hardware, ZZJSON_CONFIG *config, ZZJSON **item);



More information about the Syslinux-commits mailing list