You will need to do something for this.
-, , nasm, gcc ld macho i386. -f macho nasm, -m32 gcc -arch i386 ld, x86_64 .
-, GRUB - ELF. - GRUB, , ββmacho multiboot.
, 16- FLAGS multiboot:
FLAGS 1<<16 | whateverelse
GRUB , , , .
GRUB . , 4 , GRUB ( ) :
header_addr: , ββ . .text. (: .text )load_addr: , GRUB . ,.text - , .text locationload_end_addr: GRUB . - stack+STACKSIZE.bss_end_addr: BSS. , , load_end_addr .entry_addr: . OS X start, loader.
:
global start ; making entry point visible to linker
extern _kmain ; kmain is defined elsewhere
; setting up the Multiboot header - see GRUB docs for details
MODULEALIGN equ 1<<0 ; align loaded modules on page boundaries
MEMINFO equ 1<<1 ; provide memory map
MACHO equ 1<<16
FLAGS equ MODULEALIGN | MEMINFO | MACHO ; this is the Multiboot 'flag' field
MAGIC equ 0x1BADB002 ; 'magic number' lets bootloader find the header
CHECKSUM equ -(MAGIC + FLAGS) ; checksum required
section .text
align 4
MultiBootHeader:
dd MAGIC
dd FLAGS
dd CHECKSUM
dd MultiBootHeader
dd MultiBootHeader
dd stack+STACKSIZE
dd stack+STACKSIZE
dd start
; reserve initial kernel stack space
STACKSIZE equ 0x4000 ; that 16k.
start:
mov esp, stack+STACKSIZE ; set up the stack
push eax ; pass Multiboot magic number
push ebx ; pass Multiboot info structure
call _kmain ; call kernel proper
cli
hang:
hlt ; halt machine should kernel return
jmp hang
section .bss
align 4
stack:
resb STACKSIZE ; reserve 16k stack on a doubleword boundary
, GRUB kernel 200+x, "multiboot-kludge" , . boot ββmacho, !