forked from lmnos/lmosem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.x86
168 lines (146 loc) · 6.05 KB
/
Makefile.x86
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
###################################################################
# 主控自动化编译配置文件 Makefile #
# 彭东 @ 2012.08.13.23.50 #
###################################################################
MAKEFLAGS = -sR
MKDIR = mkdir
RMDIR = rmdir
CP = cp
CD = cd
DD = dd
RM = rm
LKIMG = ./lmoskrlimg -m k
VM = qemu-system-x86_64 #qemu-system-i386 qemu-x86_64
DBUGVM = bochs -q
IMGTOVDI = qemu-img convert -f raw -O vdi
IMGTOVMDK = qemu-img convert -f raw -O vmdk
MAKE = make
PREMENTMFLGS = -C $(BUILD_PATH) -f pretreatment.mkf
X86ARCHMFLGS = -C $(BUILD_PATH) -f x86arch.mk
X86BOOTMFLGS = -C $(BUILD_PATH) -f x86boot.mk
X86_64BOOTMFLGS = -C $(BUILD_PATH) -f x86_64boot.mk
X86_64ARCHMFLGS = -C $(BUILD_PATH) -f x86_64arch.mk
X86LINKMFLGS = -C $(BUILD_PATH) -f krnllink.mk
DRIVERSMFLGS = -C $(BUILD_PATH) -f drivers.mk
INTMGRMFLGS = -C $(BUILD_PATH) -f intmgr.mk
DEVMGRMFLGS = -C $(BUILD_PATH) -f devmgr.mk
IFEMGRMFLGS = -C $(BUILD_PATH) -f ifemgr.mk
MEMMGRMFLGS = -C $(BUILD_PATH) -f memmgr.mk
KOBMGRMFLGS = -C $(BUILD_PATH) -f kobmgr.mk
KVMRLMOSFLGS = -C $(BUILD_PATH) -f kvmrlmos.mk
VVMRLMOSFLGS = -C $(BUILD_PATH) -f vbox.mkf
X86_64LINKMFLGS = -C $(BUILD_PATH) -f x86_64krnllink.mk
ARMHALYMFLGS = -C $(BUILD_PATH) -f lmosemhal.mk
ARMKRNLMFLGS = -C $(BUILD_PATH) -f lmosemkrl.mk
ARMDRIVMFLGS = -C $(BUILD_PATH) -f lmosemdrv.mk
ARMLIBSMFLGS = -C $(BUILD_PATH) -f lmosemlib.mk
ARMTASKMFLGS = -C $(BUILD_PATH) -f lmosemtask.mk
ARMLINKMFLGS = -C $(BUILD_PATH) -f lmosemlink.mk
KERNELMFLGS = -C $(BUILD_PATH) -f kernel.mk
MMMFLGS = -C $(BUILD_PATH) -f mm.mk
LIBMFLGS = -C $(BUILD_PATH) -f lib.mk
INITSHELLMFLGS = -C $(BUILD_PATH) -f initshell.mk
LINKINITSHELLMFLGS = -C $(BUILD_PATH) -f linkinitshell.mk
FSMFLGS = -C $(BUILD_PATH) -f krnlfs.mk
VBOXVMFLGS = -C $(VM_PATH) -f vbox.mk
CPFLAGES =
DDFLAGS =
VMFLAGES = -smp 4 -hda $(DSKIMG) -enable-kvm
READSECTOR = 520
SHELLREADSECTOR = 20
SHELLSTARTSECTOR = 600
DSKIMG =hd10g.img #hd50m.img PDOS.vhd
IMGSECTNR = 204800
PHYDSK = /dev/sdb
VDIFNAME = lmos.vdi
VMDKFNAME = lmos.vmdk
UMBREXCIMG = u.mbr
BOOTEXCIMG = lmhdboot.bin
KRNLEXCIMG = lmoskrnl.bin
LDEREXCIMG = lmosldr.bin
SHELEXCIMG = lmosinitshell.bin #LMOSBKDG1.bmp LMOSBKDG2.bmp LMOSBKDG3.bmp LMOSBKDG5.bmp LMOSBKDG6.bmp
LOGOFILE = LMOSLOGO.bmp LMOSBKDG4.bmp DIPDRV.bmp
GIFFILE = #./lmosbitmap/mn/*.bmp
GIFFILE2 = #./lmosbitmap/星空/*.bmp
FONTFILE = lmos.fnt
BUILD_PATH = ./build
EXKNL_PATH = ./exckrnl
VM_PATH = ./vm
DSTPATH = ../exckrnl
RELEDSTPATH = ../release
LMINITLDR_PATH =./lminitldr/
LMILDR_BUILD_PATH =./lminitldr/build/
CPLILDR_PATH =./release/
INSTALL_PATH =/boot/
INSTALLSRCFILE_PATH =./release/lmoskrnl.eki
SRCFILE = $(BOOTEXCIMG) $(KRNLEXCIMG) $(LDEREXCIMG) $(SHELEXCIMG)
RSRCFILE = $(BOOTEXCIMG) $(KRNLEXCIMG) $(LDEREXCIMG) $(SHELEXCIMG) #$(VDIFNAME) $(VMDKFNAME)
LMOSLDRIMH = lmldrimh.bin
LMOSLDRKRL = lmldrkrl.bin
LMOSLDRSVE = lmldrsve.bin
CPLILDRSRC= $(LMILDR_BUILD_PATH)$(LMOSLDRSVE) $(LMILDR_BUILD_PATH)$(LMOSLDRKRL) $(LMILDR_BUILD_PATH)$(LMOSLDRIMH)
LKIMG_INFILE = $(LMOSLDRSVE) $(LMOSLDRKRL) $(KRNLEXCIMG) $(SHELEXCIMG) $(FONTFILE) $(LOGOFILE) $(GIFFILE) $(GIFFILE2)
.PHONY : install x32 build print clean all krnlexc cpkrnl wrimg phymod exc vdi vdiexc cprelease release createimg
build: clean print all
all:
$(CD) $(LMINITLDR_PATH) && $(MAKE)
$(MAKE) $(PREMENTMFLGS)
$(MAKE) $(ARMHALYMFLGS)
$(MAKE) $(ARMKRNLMFLGS)
$(MAKE) $(ARMDRIVMFLGS)
$(MAKE) $(ARMLIBSMFLGS)
$(MAKE) $(ARMTASKMFLGS)
$(MAKE) $(ARMLINKMFLGS)
@echo '恭喜我,系统编译构建完成! ^_^'
clean:
$(CD) $(BUILD_PATH); $(RM) -f *.o *.bin *.i *.krnl *.s *.map *.lib *.btoj *.vdi *vmdk *.mk *.mki krnlobjs.mh
$(CD) $(EXKNL_PATH); $(RM) -f *.o *.bin *.i *.krnl *.s *.map *.lib *.btoj *.vdi *vmdk *.mk *.mki krnlobjs.mh
$(CD) $(CPLILDR_PATH); $(RM) -f *.o *.bin *.i *.krnl *.s *.eki *.map *.lib *.btoj *.vdi *.mk *.mki *vmdk krnlobjs.mh
@echo '清理全部已构建文件... ^_^'
print:
@echo '*********正在开始编译构建系统*************'
krnlexc: cpkrnl wrimg exc
dbugkrnl: cpkrnl wrimg dbugexc
vdiexc: vdi
$(MAKE) $(VBOXVMFLGS)
vdi:cpkrnl wrimg
$(CD) $(EXKNL_PATH) && $(IMGTOVDI) $(DSKIMG) $(VDIFNAME)
$(CD) $(EXKNL_PATH) && $(IMGTOVMDK) $(DSKIMG) $(VMDKFNAME)
cplmildr:
$(CP) $(CPFLAGES) $(CPLILDRSRC) $(CPLILDR_PATH)
cpkrnl:
$(CD) $(BUILD_PATH) && $(CP) $(CPFLAGES) $(SRCFILE) $(DSTPATH)
cprelease:
$(CD) $(EXKNL_PATH) && $(CP) $(CPFLAGES) $(RSRCFILE) $(RELEDSTPATH)
wrimg:
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(UMBREXCIMG) of=$(DSKIMG) count=1 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(BOOTEXCIMG) of=$(DSKIMG) seek\=63 count=1 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(LDEREXCIMG) of=$(DSKIMG) seek\=68 count=9 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(KRNLEXCIMG) of=$(DSKIMG) seek\=80 count=$(READSECTOR) conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(SHELEXCIMG) of=$(DSKIMG) seek\=$(SHELLSTARTSECTOR) count=$(SHELLREADSECTOR) conv\=notrunc
phymod: cpkrnl
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(UMBREXCIMG) of=$(PHYDSK) count=1 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(BOOTEXCIMG) of=$(PHYDSK) seek\=63 count=1 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(LDEREXCIMG) of=$(PHYDSK) seek\=68 count=9 conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(KRNLEXCIMG) of=$(PHYDSK) seek\=80 count=$(READSECTOR) conv\=notrunc
$(CD) $(EXKNL_PATH) && $(DD) bs=512 if=$(SHELEXCIMG) of=$(PHYDSK) seek\=$(SHELLSTARTSECTOR) count=$(SHELLREADSECTOR) conv\=notrunc
exc:
$(CD) $(EXKNL_PATH) && $(VM) $(VMFLAGES)
dbugexc:
$(CD) $(EXKNL_PATH) && $(DBUGVM)
KIMG:
@echo '正在生成LMOS内核映像文件,请稍后……'
$(CD) $(CPLILDR_PATH) && $(LKIMG) -lhf $(LMOSLDRIMH) -o lmoskrnl.eki -f $(LKIMG_INFILE)
KVMRUN:
$(MAKE) $(KVMRLMOSFLGS)
VBOXRUN:
$(MAKE) $(VVMRLMOSFLGS)
release: clean all cpkrnl cprelease cplmildr KIMG
kvmtest: release KVMRUN
vboxtest: release VBOXRUN
createimg:
$(DD) bs=512 if=/dev/zero of=$(DSKIMG) count=$(IMGSECTNR)
install:
@echo '下面将开始安装LMOS内核,请确认……'
sudo $(CP) $(CPFLAGES) $(INSTALLSRCFILE_PATH) $(INSTALL_PATH)
@echo 'LMOS内核已经安装完成,请重启计算机……'