problem with grub
problem with grub
i compile with these instructions in cygwin ..
gcc -c -m32 -B /home/vivek/os/kernel -Wall -nostdlib -nostartfiles -nostdinc -std=gnu99 *.c
as --32 startk.s -o startk.so
ld -m i386pe -T linker.ld startk.so *.o -o kernel
when i boot with bochs it shows unrecognized executable format
gcc -c -m32 -B /home/vivek/os/kernel -Wall -nostdlib -nostartfiles -nostdinc -std=gnu99 *.c
as --32 startk.s -o startk.so
ld -m i386pe -T linker.ld startk.so *.o -o kernel
when i boot with bochs it shows unrecognized executable format
- piranha
- Member
- Posts: 1391
- Joined: Thu Dec 21, 2006 7:42 pm
- Location: Unknown. Momentum is pretty certain, however.
- Contact:
Try linking with 'ld -m elf_i386 -T linker.ld startk.so *.o -o kernel'
-JL
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
this is the cde..
.global _loader # making entry point visible to linker
# setting up the Multiboot header - see GRUB docs for details
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum required
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
# reserve initial kernel stack space
.set STACKSIZE, 0x4000 # that is, 16k.
.comm stack, STACKSIZE, 32 # reserve 16k stack on a quadword boundary
_loader:
mov $(stack + STACKSIZE), %esp # set up the stack
push %eax # Multiboot magic number
push %ebx # Multiboot data structure
call kmain # call kernel proper
hlt # halt machine should kernel retur
# setting up the Multiboot header - see GRUB docs for details
.set ALIGN, 1<<0 # align loaded modules on page boundaries
.set MEMINFO, 1<<1 # provide memory map
.set FLAGS, ALIGN | MEMINFO # this is the Multiboot 'flag' field
.set MAGIC, 0x1BADB002 # 'magic number' lets bootloader find the header
.set CHECKSUM, -(MAGIC + FLAGS) # checksum required
.align 4
.long MAGIC
.long FLAGS
.long CHECKSUM
# reserve initial kernel stack space
.set STACKSIZE, 0x4000 # that is, 16k.
.comm stack, STACKSIZE, 32 # reserve 16k stack on a quadword boundary
_loader:
mov $(stack + STACKSIZE), %esp # set up the stack
push %eax # Multiboot magic number
push %ebx # Multiboot data structure
call kmain # call kernel proper
hlt # halt machine should kernel retur
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
for starters, build a GCC Cross-Compiler instead of using that ugly cygwin thing.
Do you understand the meaning of the errors? If you don't understand the basics behind the error messages you are getting, you need to learn a lot more before you set off on your journey. Perhaps you should start with freestanding the parameters you are passing to your tools and the code itself.
It's possible to make a pe kernel.
It's possible to make a pe kernel.