forked from zirandu/linux-0.11-lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.head
102 lines (81 loc) · 2.4 KB
/
Makefile.head
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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 ...
XTERM ?= $(shell echo `tools/xterm.sh lxterminal`)
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