when i try to load my os, this msg appear.
i didnt find out any answer about it.
this stuff maybe help:
objdump -h ./bin/kernel.bin
./bin/kernel.bin: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00003ca2 00100000 00100000 00001000 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rodata 00000e06 00104000 00104000 00005000 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .data 00000320 00105000 00105000 00006000 2**5
CONTENTS, ALLOC, LOAD, DATA
3 .bss 0000bac8 00105320 00105320 00006320 2**5
ALLOC
4 .comment 00000023 00000000 00000000 00006320 2**0
CONTENTS, READONLY
compile:
cd ./bin
rm -rf *
nasm -f elf ../src/libasm.asm -o libasm.o
nasm -f elf ../src/kstart.asm -o kstart.o
nasm -f elf ../src/loader.asm -o kstart.o
gcc -c ../src/kernel.c -o kernel.o -fno-builtin -fno-stack-protector
gcc -c -fno-stack-protector ../src/libc.c -o libc.o -fno-builtin
gcc -c ../src/buffer.c -o buffer.o -fno-builtin
gcc -c ../src/bufferTeclado.c -o bufferTeclado.o -fno-builtin
gcc -c ../src/initMouse.c -o initMouse.o -fno-builtin
gcc -c ../src/mouse.c -o mouse.o -fno-builtin
gcc -c ../src/video.c -o video.o -fno-builtin
gcc -c ../src/protpant.c -o protpant.o -fno-builtin
gcc -c ../src/paginacion.c -o paginacion.o -fno-builtin
gcc -c ../src/string.c -o string.o -fno-builtin
gcc -c ../src/sched.c -o sched.o -fno-builtin -fno-stack-protector
gcc -c ../src/malloc.c -o malloc.o -fno-builtin
ld -T ../src/link.ld -o kernel.bin kernel.o kstart.o libc.o libasm.o bufferTeclado.o buffer.o video.o initMouse.o mouse.o protpant.o paginacion.o string.o sched.o malloc.o
thx.
Invalid or unsupported executable format from GRUB
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: Invalid or unsupported executable format from GRUB
I'm guessing either your multiboot header is incorrect, or in an ELF section that is too far from the beginning of the kernel. Try putting the multiboot header in a new section, or near the beginning of .text. Also, you really shouldn't have "rm -rf *" anywhere in a build script...
Re: Invalid or unsupported executable format from GRUB
rm is for remove old objects when i'm compiling. how i put in a new section?
this are my constants
MULTIBOOT_PAGE_ALIGN equ 1<<0 ; Alineado a 4KB ( pagina )
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_AOUT_KLUDGE equ 1<<16 ; Indica que los offset del 8 al 24 en el header son
; validos para extraer información.
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
my kstart.asm:
[BITS 32]
[global start]
[extern kmain] ; en kernel.c
start:
call kmain
jmp $
EXTERN code, bss, end
ALIGN 4
mboot:
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
dd mboot
dd code
dd bss
dd end
dd start
this are my constants
MULTIBOOT_PAGE_ALIGN equ 1<<0 ; Alineado a 4KB ( pagina )
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_AOUT_KLUDGE equ 1<<16 ; Indica que los offset del 8 al 24 en el header son
; validos para extraer información.
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO | MULTIBOOT_AOUT_KLUDGE
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
my kstart.asm:
[BITS 32]
[global start]
[extern kmain] ; en kernel.c
start:
call kmain
jmp $
EXTERN code, bss, end
ALIGN 4
mboot:
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
dd mboot
dd code
dd bss
dd end
dd start
Re: Invalid or unsupported executable format from GRUB
Do an objdump -d or -D and see whether the header is in the first 8k and 32bit aligned.
Is the header in kernel.o ? or kstart .o ? Careful of the link order.
- gerryg400
Is the header in kernel.o ? or kstart .o ? Careful of the link order.
- gerryg400
If a trainstation is where trains stop, what is a workstation ?
Re: Invalid or unsupported executable format from GRUB
objdump -d kstart.o
is it ok??
thx again!
Code: Select all
kstart.o: file format elf32-i386
Disassembly of section .text:
00000000 <MultiBootHeader>:
0: 02 b0 ad 1b 03 00 add 0x31bad(%eax),%dh
6: 00 00 add %al,(%eax)
8: fb sti
9: 4f dec %edi
a: 52 push %edx
b: e4 bc in $0xbc,%al
0000000c <_loader>:
c: bc 00 40 00 00 mov $0x4000,%esp
11: 50 push %eax
12: 53 push %ebx
13: e8 fc ff ff ff call 14 <_loader+0x8>
18: f4 hlt
00000019 <eokl>:
19: 00 40 00 add %al,0x0(%eax)
thx again!
Re: Invalid or unsupported executable format from GRUB
cazador4,
I don't think you should set bit 16 if you are loading and ELF file. My code looks like this.
- gerryg400
I don't think you should set bit 16 if you are loading and ELF file. My code looks like this.
Code: Select all
start:
jmp over_multiboot_header
.align 4
.long 0x1badb002 /* multiboot magic number */
.long 0x00000003 /* ELF file multiboot flags */
.long -(0x1badb002 + 0x00000003) /* checksum */
over_multiboot_header:
If a trainstation is where trains stop, what is a workstation ?
Re: Invalid or unsupported executable format from GRUB
cazador4 wrote: how i put in a new section?
Code: Select all
[SECTION section_name] ; General
[SECTION .text] ; Example: use text section.
When the chance of succeeding is 99%, there is still a 50% chance of that success happening.