Skip to content
Snippets Groups Projects
Commit 3ba21a66 authored by Bensong Liu's avatar Bensong Liu
Browse files

note

parent a3e9b208
No related branches found
No related tags found
No related merge requests found
; This code file would be compiled and placed in MBR first block.
[bits 16]
[org 0x7c00]
......
......@@ -2,13 +2,15 @@
assemble: kernel head
ld -o kernel.img -Ttext 0x7e00 --oformat binary image_head.o kernel.o -m elf_i386
# Sector 1 = bootloader, Sector 2 - (512B TO 64K) = kernel
# Extend kernel.img to correct size.
test $$(stat -c %s kernel.img) -le 65024
truncate --size=65024 kernel.img
head:
nasm -f elf image_head.asm -o image_head.o
kernel:
gcc -ffreestanding -fno-pie -c kernel.c -o kernel.o -m32
g++ -ffreestanding -fno-pie -c kernel.cc -o kernel.o -m32
clean:
rm *.o *.img
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment