加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Makefile.head 2.47 KB
一键复制 编辑 原始数据 按行查看 历史
OS := $(shell uname)
ifeq ($V, 1)
Q =
S =
else
MAKEFLAGS += --no-print-directory
S ?= -s
Q ?= @
endif
export V Q S
LINUX_VERSION ?= 0.11
LINUX_SRC := src
LINUX_IMAGE ?= $(LINUX_SRC)/Image
# src/boot/bootsect.sym, src/boot/setup.sym
DST ?= $(if $(LINUX_DST), $(LINUX_DST), $(LINUX_SRC)/kernel.sym)
TOOL_DIR := tools
ROOTFS_DIR := rootfs
CALLGRAPH_DIR := callgraph
# Xterminal: lxterminal, terminator ...
ifeq ($(shell env | grep -q ^XDG; echo $$?), 0)
XTERM ?= $(shell echo `tools/xterm.sh lxterminal`)
else
XTERM := null
endif
GDB ?= gdb
# Qemu
QEMU_PATH =
QEMU ?= qemu-system-i386
MEM ?= 16M
# Bochs
#BOCHS ?= tools/bochs/bochs-debugger
BOCHS_PATH =
BOCHS_PREBUILT ?= 1
BOCHS_PREBUILT_PATH = ${TOOL_DIR}/bochs
BOCHS ?= bochs
# VM configuration
VM_CFG = $(TOOL_DIR)/.vm.cfg
# Tool for specify root device
SETROOTDEV = RAMDISK_START=$(RAMDISK_START) $(TOOL_DIR)/setrootdev.sh
# Specify the Rootfs Image file
HDA_IMG = hdc-0.11.img
FLP_IMG = rootimage-0.11
RAM_IMG = rootram.img
# Ramdisk start offset and size, in Kb
RAMDISK_START ?= 256
# Tool for call graph generation
CG = $(TOOL_DIR)/callgraph
_QEMU_OPTS = -m $(MEM) -boot c 2>/dev/null
QEMU_OPTS = -m $(MEM) -boot a -fda $(LINUX_IMAGE) 2>/dev/null
# To using this kvm feature in hardisk boot, please must enable cpu virtualization in bios
#
# Usage: CTRL+ALT+Delete --> Delete --> bios features --> Intel virtualization technology --> enabled
#
QEMU_PREBUILT_PATH= $(TOOL_DIR)/qemu
# Linux 0.11 floppy support is broken in new qemu version, so, please use prebuilt 0.10.6 qemu by default
# But the harddisk support is ok in both of old and new qemu, use qemu here to get possible kvm speedup
ifeq ($(filter $(MAKECMDGOALS),start-hd boot-hd hd-boot hd-start debug-hd),$(MAKECMDGOALS))
QEMU_PREBUILT ?= 0
else
QEMU_PREBUILT ?= 1
endif
# Only enable kvm for new qemu, the old one prebuilt in tools/qemu/ not work with kvm
ifeq ($(QEMU_PREBUILT),0)
# KVM speedup for x86 architecture, assume our host is x86 currently
QEMU := sudo $(QEMU)
ifneq ($(findstring debug,$(MAKECMDGOALS)),debug)
KVM_DEV ?= /dev/kvm
ifeq ($(KVM_DEV),$(wildcard $(KVM_DEV)))
QEMU_OPTS += -enable-kvm
_QEMU_OPTS += -enable-kvm
endif
endif
endif
ifeq ($(OS), Linux)
ifeq ($(QEMU_PREBUILT), 1)
QEMU_PATH = $(QEMU_PREBUILT_PATH)
QEMU_XOPTS += -no-kqemu -L $(QEMU_PATH)
endif
ifeq ($(BOCHS_PREBUILT), 1)
BOCHS_PATH = $(BOCHS_PREBUILT_PATH)
endif
endif
ifeq ($(OS), Darwin)
GDB := tools/mac/gdb
endif
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化