Commit 8e6f3660 by triazo

Add elf and load it into kernel memory

parent 4e2be3d0
/*
elf.h
Structures and symbols used for loading elf files
*/
#ifndef _ELF_INC
#define _ELF_INT
#include <stdint.h>
extern uint8_t elf_hello[] asm("_binary_hello_elf_start");
#endif
No preview for this file type
......@@ -19,6 +19,7 @@
#include "pic.h"
#include "pit.h"
#include "io.h"
#include "elf.h"
// The parameters passed here ultimately come through the bootloader
void kernel_main(multiboot_info* mbt, uint32_t magic)
......@@ -68,6 +69,12 @@ void kernel_main(multiboot_info* mbt, uint32_t magic)
// PCI
checkAllBuses();
// Elf testing
// This is defined in elf.h
serial_writestring("Elf address: 0x");
serial_hexstring(elf_hello, 4);
serial_writestring("\n");
test_idt();
while(true)
{
......
......@@ -5,7 +5,7 @@ all:
/usr/bin/nasm -felf32 paging.asm
/usr/bin/nasm -felf32 idta.asm
$C *.c -std=gnu99 -ffreestanding -O2 -Wall -Wextra -c
$C -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib *.o -lgcc
$C -Wl,--format=binary -Wl,hello.elf -Wl,--format=default -T linker.ld -o myos.bin -ffreestanding -O2 -nostdlib *.o -lgcc
clean:
rm *.o *.bin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment