代码拉取完成,页面将自动刷新
BUILD_DIR = ./build
ENTRY_POINT = 0xc0001500
AS = nasm
CC = gcc
LD = ld
LIB = -I lib/ -I lib/kernel/ -I lib/user/ -I kernel/ -I device/ -I thread/ -I userprog/
ASFLAGS = -f elf
CFLAGS1 = -Wall $(LIB) -E -fno-builtin \
-m32 -fno-stack-protector -nostdinc -fno-pic -gdwarf-2
CFLAGS = -Wall $(LIB) -c -fno-builtin \
-m32 -fno-stack-protector -nostdinc -fno-pic -gdwarf-2
LDFLAGS =-m elf_i386 -T script/kernel.ld -Map $(BUILD_DIR)/kernel.map -nostdlib
OBJS = ${BUILD_DIR}/grub_head.o $(BUILD_DIR)/main.o $(BUILD_DIR)/init.o \
$(BUILD_DIR)/timer.o $(BUILD_DIR)/kernel.o $(BUILD_DIR)/print.o \
$(BUILD_DIR)/debug.o $(BUILD_DIR)/memory.o $(BUILD_DIR)/bitmap.o \
$(BUILD_DIR)/string.o $(BUILD_DIR)/thread.o $(BUILD_DIR)/list.o \
$(BUILD_DIR)/switch.o $(BUILD_DIR)/console.o $(BUILD_DIR)/sync.o \
$(BUILD_DIR)/keyboard.o $(BUILD_DIR)/ioqueue.o $(BUILD_DIR)/tss.o \
$(BUILD_DIR)/process.o ${BUILD_DIR}/syscall_user.o \
$(BUILD_DIR)/syscall.o ${BUILD_DIR}/stdio.o ${BUILD_DIR}/ide.o\
$(BUILD_DIR)/interrupt.o ${BUILD_DIR}/boot.o \
############## c代码编译 ###############
$(BUILD_DIR)/main.o: kernel/main.c include/asm-i386/print.h \
include/asm-i386/stdint.h kernel/init.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/init.o: kernel/init.c kernel/init.h include/asm-i386/print.h \
include/asm-i386/stdint.h include/asm-i386/interrupt.h include/asm-i386/timer.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/interrupt.o: kernel/interrupt.c include/asm-i386/interrupt.h \
include/asm-i386/stdint.h include/linux/global.h lib/kernel/io.h include/asm-i386/print.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/timer.o: device/timer.c include/asm-i386/timer.h include/asm-i386/stdint.h\
lib/kernel/io.h include/asm-i386/print.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/debug.o: kernel/debug.c include/linux/debug.h \
include/asm-i386/print.h include/asm-i386/stdint.h include/asm-i386/interrupt.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/string.o: arch/i386/lib/string.c include/asm-i386/string.h include/asm-i386/stdint.h include/linux/global.h \
include/asm-i386/stdint.h include/linux/debug.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/bitmap.o: lib/kernel/bitmap.c include/asm-i386/bitmap.h \
include/linux/global.h include/asm-i386/stdint.h include/asm-i386/string.h include/asm-i386/stdint.h \
include/asm-i386/print.h include/asm-i386/interrupt.h include/linux/debug.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/memory.o: kernel/memory.c include/linux/memory.h include/asm-i386/stdint.h include/asm-i386/bitmap.h \
include/linux/global.h include/linux/global.h include/linux/debug.h include/asm-i386/print.h \
lib/kernel/io.h include/asm-i386/interrupt.h include/asm-i386/string.h include/asm-i386/stdint.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/thread.o: thread/thread.c include/linux/thread.h include/asm-i386/stdint.h include/linux/list.h \
include/linux/global.h include/asm-i386/string.h include/asm-i386/stdint.h include/linux/debug.h \
include/asm-i386/interrupt.h include/asm-i386/print.h include/linux/memory.h \
include/asm-i386/bitmap.h include/linux/process.h include/linux/thread.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/list.o: lib/kernel/list.c include/linux/list.h include/linux/global.h include/asm-i386/stdint.h \
include/asm-i386/interrupt.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/console.o: device/console.c include/asm-i386/console.h include/asm-i386/stdint.h \
include/asm-i386/print.h include/linux/sync.h include/linux/list.h include/linux/global.h \
include/linux/thread.h include/linux/thread.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/sync.o: thread/sync.c include/linux/sync.h include/linux/list.h include/linux/global.h \
include/asm-i386/stdint.h include/linux/thread.h include/asm-i386/string.h include/asm-i386/stdint.h include/linux/debug.h \
include/asm-i386/interrupt.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/keyboard.o: device/keyboard.c device/keyboard.h include/asm-i386/print.h \
include/asm-i386/stdint.h include/asm-i386/interrupt.h lib/kernel/io.h include/linux/ioqueue.h \
include/linux/thread.h include/linux/list.h include/linux/global.h include/linux/sync.h \
include/linux/thread.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/ioqueue.o: device/ioqueue.c include/linux/ioqueue.h include/asm-i386/stdint.h include/linux/thread.h \
include/linux/list.h include/linux/global.h include/linux/sync.h include/linux/thread.h include/asm-i386/interrupt.h \
include/linux/debug.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/tss.o: userprog/tss.c userprog/tss.h include/linux/thread.h include/asm-i386/stdint.h \
include/linux/list.h include/linux/global.h include/asm-i386/string.h include/asm-i386/stdint.h \
include/asm-i386/print.h
$(CC) $(CFLAGS) $< -o $@
$(BUILD_DIR)/process.o: userprog/process.c include/linux/process.h include/linux/thread.h \
include/asm-i386/stdint.h include/linux/list.h include/linux/global.h include/linux/debug.h \
include/linux/memory.h include/asm-i386/bitmap.h userprog/tss.h include/asm-i386/interrupt.h \
include/asm-i386/string.h include/asm-i386/stdint.h
$(CC) $(CFLAGS) $< -o $@
${BUILD_DIR}/syscall_user.o: userprog/syscall_user.c include/linux/syscall.h include/linux/syscall_user.h include/asm-i386/stdint.h
${CC} ${CFLAGS} $< -o $@
${BUILD_DIR}/syscall.o : kernel/syscall.c include/asm-i386/stdint.h\
include/linux/thread.h include/linux/syscall.h include/asm-i386/stdio.h include/asm-i386/console.h include/asm-i386/string.h
${CC} ${CFLAGS} $< -o $@
${BUILD_DIR}/stdio.o : lib/stdio.c include/asm-i386/stdio.h include/asm-i386/interrupt.h \
include/linux/global.h include/asm-i386/string.h include/linux/syscall.h include/asm-i386/print.h
${CC} ${CFLAGS} $< -o $@
${BUILD_DIR}/ide.o: device/ide.c include/asm-i386/ide.h include/asm-i386/stdint.h include/asm-i386/stdio.h include/linux/global.h include/linux/sync.h
${CC} ${CFLAGS} $< -o $@
${BUILD_DIR}/boot.o: boot/boot.c include/asm-i386/stdint.h include/linux/multiboot.h include/linux/global.h
${CC} ${CFLAGS} $< -o $@
############## 汇编代码编译 ###############
$(BUILD_DIR)/kernel.o: kernel/kernel.S
$(AS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/print.o: lib/kernel/print.S
$(AS) $(ASFLAGS) $< -o $@
$(BUILD_DIR)/switch.o: thread/switch.S
$(AS) $(ASFLAGS) $< -o $@
${BUILD_DIR}/grub_head.o: boot/grub_head.S
$(AS) $(ASFLAGS) $< -o $@ -I ./boot/include/
############## 链接所有目标文件 #############
$(BUILD_DIR)/kernel.bin: $(OBJS)
$(LD) $(LDFLAGS) $^ -o $@
.PHONY : mk_dir hd clean all
mk_dir:
if [[ ! -d $(BUILD_DIR) ]];then mkdir $(BUILD_DIR);fi
update_image:
sudo cp /home/ljy/myos/build/kernel.bin /home/ljy/disk/boot/
sync
sleep 1
clean:
cd $(BUILD_DIR) && rm -f ./*
build: $(BUILD_DIR)/kernel.bin
all:clean mk_dir build update_image
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。