Skip to contentSkip to conversation

hw/arm: Improve detection of Linux kernels

PATCH In review Stefan Weil 1 participant 2 messages Aug 9, 2010 – Sep 9, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/arm: Improve detection of Linux kernels

ELF images were not detected as linux kernels.

Assume that they are linux kernels if the kernel name contains 'vmlinux'.

---
 hw/arm_boot.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/arm_boot.c +4 -2
index 620550b..e73ef42 100644
@@ -204,7 +204,7 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
     int kernel_size;
     int initrd_size;
     int n;
-    int is_linux = 0;
+    int is_linux;
     uint64_t elf_entry;
     target_phys_addr_t entry;
     int big_endian;
@@ -225,7 +225,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
     big_endian = 0;
 #endif
 
-    /* Assume that raw images are linux kernels, and ELF images are not.  */
+    /* Assume that raw images are linux kernels, and ELF images
+       are not (unless the kernel filename contains 'vmlinux'). */
+    is_linux = (strstr(info->kernel_filename, "vmlinux") != NULL);
     kernel_size = load_elf(info->kernel_filename, NULL, NULL, &elf_entry,
                            NULL, NULL, big_endian, ELF_MACHINE, 1);
     entry = elf_entry;
Signature · 1 line
1.7.1
#1 lore raw

Am 09.08.2010 16:48, schrieb Stefan Weil:

Quoted 25 lines

ELF images were not detected as linux kernels.

Assume that they are linux kernels if the kernel name contains 'vmlinux'.

---
  hw/arm_boot.c |    6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)
hw/arm_boot.c +1 -1
index 620550b..e73ef42 100644
@@ -204,7 +204,7 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
      int kernel_size;
      int initrd_size;
      int n;
-    int is_linux = 0;
+    int is_linux;
      uint64_t elf_entry;
      target_phys_addr_t entry;
      int big_endian;

hw/arm_boot.c void arm_load_kernel(CPUState *env, struct arm_boot_info *info) · line 233

Quoted 10 lines
hw/arm_boot.c +3 -1
@@ -225,7 +225,9 @@ void arm_load_kernel(CPUState *env, struct arm_boot_info *info)
      big_endian = 0;
  #endif
 
-    /* Assume that raw images are linux kernels, and ELF images are not.  */
+    /* Assume that raw images are linux kernels, and ELF images
+       are not (unless the kernel filename contains 'vmlinux'). */
+    is_linux = (strstr(info->kernel_filename, "vmlinux") != NULL);
      kernel_size = load_elf(info->kernel_filename, NULL, NULL,&elf_entry,
                             NULL, NULL, big_endian, ELF_MACHINE, 1);
      entry = elf_entry;

The patch is still missing in qemu master. Is anything missing, or can it be applied?