-
Notifications
You must be signed in to change notification settings - Fork 49
/
ya.py
233 lines (190 loc) · 4.3 KB
/
ya.py
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# coding:utf-8
# *******************************************************************
# * Copyright 2021-present evilbinary
# * 作者: evilbinary on 01/01/20
# * 邮箱: [email protected]
# ********************************************************************
import sys
module_path=['..',
'.',
'../../',
'../../..',
'xenv',
]
sys.path.extend(module_path)
import xenv.support as support
project("YiYiYa",
version='1.3.0',
desc='YiYiYa is an os , project page: https://github.com/evilbinary/YiYiYa',
targets=[
'kernel'
]
)
includes(
"xenv/env.py"
)
plat=get_plat()
if not plat:
plat="raspi2"
set_defaultplat(plat)
set_toolchain('arm-none-eabi')
arch=support.get_arch(plat)
arch_type=support.get_arch_type(arch)
set_arch(arch)
set_arch_type(arch_type)
#构建应用
if arch_type=='arm':
set_toolchains("arm-none-eabi")
elif arch_type=='x86':
set_toolchains("i386-elf")
elif arch_type=='riscv':
set_toolchains("riscv64-unknown-elf")
elif arch_type in ['dummy','general'] :
set_toolchains("gcc")
elif arch_type =='arm64':
set_toolchains('aarch64-none-elf')
else:
set_toolchains("arm-none-eabi")
#默认libc
default_libc = 'musl' # musl c newlib
#应用
apps = [
'cmd','gui','hello', 'test','unitest',
'microui', 'etk', 'lvgl', 'track',
'sdl2', 'infones', 'launcher', 'mgba',
'lua', 'scheme', 'qjs', 'gnuboy',
'watch',
#'sdlmine',
'sdl',
'doom',
'doom2',
'gpsp',
# 'yui'
]
if arch in ['armv5']:
apps=['cmd','gui','hello','test','unitest',
'microui', 'etk', 'lvgl', 'track',
'sdl2', 'infones', 'launcher', #'mgba',
'lua', 'qjs', 'gnuboy',
'watch',
'sdl'
]
elif arch in ['riscv']:
apps=[
'cmd','gui','hello','test','unitest',
'microui', 'etk', 'lvgl', 'track',
'sdl2', 'infones', 'launcher', #'mgba',
]
# cpp应用
cpp_apps=[
'xtrack','gmenu2x',
'monogui','testcpp',
'commander'
]
wayland_apps={
'weston'
}
#构建的module
modules=[
'devfs',
'serial',
'i2c',
'spi',
'loader',
'posix',
'test',
'gpu',
'mouse',
'sdhci',
'rtc',
'gpio',
'pty',
'ipc',
'musl',
'gaga',
'debug',
'keyboard',
'log',
'hello',
'sound',
'dma',
# 'fat',
'fatfs',
'ipc',
# 'debug',
#'ewok'
]
if plat in['t113-s3','stm32f4xx','v3s']:
modules+=['lcd']
elif arch in['x86']:
modules+=['ahci','pci','vga']
#构建foot
foot=[
'driver','service'
]
set_config('foot',foot)
set_config('modules',modules)
set_config('default_libc',default_libc)
# #c++ 应用 输入才编译
option("cpp-apps")
set_default(false)
set_showmenu(true)
set_description("Enable cpp support")
option_end()
#wayland 应用 输入才编译
option("wayland")
set_default(false)
set_showmenu(true)
set_description("Enable wayland support")
option_end()
option("app")
set_default(true)
set_showmenu(true)
set_description("Enable app build")
option_end()
option("tests")
set_default(false)
set_showmenu(true)
set_description("Enable tests build")
option_end()
option("single-kernel")
if arch_type=='x86':
set_default(false)
else:
set_default(true)
set_showmenu(true)
set_description("Enable kernel one file build")
option_end()
add_defines(plat.replace("-", "_").upper())
arch=get_arch()
if not arch:
print('not found arch, please config',plat,'arch in support.py')
exit(-1)
def_arch=arch.replace("-", "_").upper()
arch_type=get_arch_type()
if not arch_type:
print('not found arch_type, please config',plat,'arch type in support.py')
exit(-1)
def_arch_type=arch_type.replace( "-", "_").upper()
add_defines(def_arch)
add_defines(def_arch_type)
arch_cflags=support.get_arch_cflags(arch)
plat_cflags=support.get_platform_cflags(plat)
arch_ldflags=support.get_arch_linkflags(arch)
if arch_cflags:
add_cflags(arch_cflags)
add_cxxflags(arch_cflags)
if plat_cflags:
add_cflags(plat_cflags)
add_ldflags(arch_ldflags)
set_config('cflags',arch_cflags,plat_cflags)
set_config('cpp-apps',cpp_apps)
set_config('apps',apps)
#apply debug and release modes
add_rules("mode.debug", "mode.release","arch")
includes('./boot/ya.py')
includes('./duck/ya.py')
add_subs('./image/ya.py')
add_subs('./eggs/ya.py')
add_subs('./app/ya.py')
add_subs('./foot/ya.py')