Multiboot1 Bare Bones: Difference between revisions

→‎All in one makefile (Bochs): Some touches to Makefile. -Wall -Wextra deemed more important than -Werror.
[unchecked revision][unchecked revision]
(→‎All in one makefile (Bochs): cleaned up the Makefile. Needs -Wall -Wextra etc adding but having not built the bare bones tutorial myself don't want to add these as they may break something)
(→‎All in one makefile (Bochs): Some touches to Makefile. -Wall -Wextra deemed more important than -Werror.)
Line 262:
===All in one makefile (Bochs)===
<source lang="make">
CC = i586-elf-gcc
CFLAGS = -WerrorWall -Wextra -nostdlib -fno-builtin -nostartfiles -nodefaultlibs
LD = i586-elf-ld
 
OBJFILES = loader.o kernel.o
 
all: kernel.img
 
.s.o:
loader.o: loader.s
nasm -f elf -o loader.o$@ loader.s$<
 
.c.o:
kernel.o: kernel.c
$(CC) $(CFLAGS) -o kernel.o$@ -c kernel.c$<
 
kernel.bin: kernel.o loader.o$(OBJFILES)
$(LD) -T linker.ld -o kernel.bin$@ loader.o kernel.o$^
 
kernel.img: kernel.bin
dd if=/dev/zero of=pad bs=1 count=750
cat stage1 stage2 pad kernel.bin$< > kernel.img$@
 
clean:
rm$(RM) -f loader.o kernel.o$(OBJFILES) kernel.bin kernel.img
 
install:
rm$(RM) -f loader.o kernel.o$(OBJFILES) kernel.bin
</source>
 
448

edits