0

I'm using the multiboot2 for my kernel, and I'm trying to get the ELF symbols from GRUB2, but I do not know how to do that.

I have set .long MULTIBOOT_TAG_TYPE_ELF_SECTIONS in boot.s, also I got elf type, size, num, entsize and shndx from grub2.

.section .multiboot_header
.align 8
multiboot_header:
  .long MULTIBOOT2_HEADER_MAGIC
  .long MULTIBOOT_ARCHITECTURE_I386
  .long multiboot_header_end - multiboot_header
  .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + multiboot_header_end - multiboot_header)

# multiboot2 information request
.align 8
mbi_tag_start:
  .short MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST
  .short MULTIBOOT_HEADER_TAG_OPTIONAL
  .long mbi_tag_end - mbi_tag_start
  .long MULTIBOOT_TAG_TYPE_CMDLINE
  .long MULTIBOOT_TAG_TYPE_MODULE
  .long MULTIBOOT_TAG_TYPE_BOOTDEV
  .long MULTIBOOT_TAG_TYPE_MMAP
  .long MULTIBOOT_TAG_TYPE_ELF_SECTIONS
  .long MULTIBOOT_TAG_TYPE_APM
.align 8
mbi_tag_end:
    .short MULTIBOOT_HEADER_TAG_END
  .short 0
  .long 8
multiboot_header_end:
struct multiboot_tag_elf_sections {
    multiboot_uint32_t type;
    multiboot_uint32_t size;
    multiboot_uint32_t num;
    multiboot_uint32_t entsize;
    multiboot_uint32_t shndx;
    char sections[0];
};

Zone233
  • 23
  • 1
  • 7

1 Answers1

0

Search for tag with type=9 in multiboot infomation.

William Taylor
  • 549
  • 3
  • 22