-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
26 lines (19 loc) · 1.09 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Development Platform
OS: Ubuntu 15.10 - GNU/Linux 4.2.0-35-generic, 64-bit
Hardware: 7.7 GiB RAM, Intel Core i7-4500 CPU @ 1.80GHz x 4
To build and run:
1. make clean
2. make
3. make run
---------------------NOTES----------------------
to compile:
nasm main.asm -f bin -o main
The reason for the run_qemu bash script is that qemu now needs to specify format of raw
so that it won't give a warning. So we pass in the binary as a variable.
-----------
When we get to the point that we are going to load the C kernel we have to pad the os-image with extra space to make it big enough to read 15 sectors. If you don't do this then you will get disk read errors. We need the -m32 since we are compiling on Ubuntu 64-bit but creating a 32-bit output. Also, we need the -melf_i386 in the ld command for same reason. It spots the -m32 from the gcc and knows to create a 32-bit output.
gcc -m32 -ffreestanding -c kernel.c -o kernel.o
ld -melf_i386 -o kernel.bin -Ttext 0x1000 kernel_entry.o kernel.o --oformat binary
cat boot_sect.bin kernel.bin > os-image
dd if=/dev/zero bs=512 count=60 >> os-image
./run_qemu os-image