Rev 9409 | Rev 9414 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9409 | Rev 9412 | ||
---|---|---|---|
Line 189... | Line 189... | ||
189 | libcrash = "programs/develop/libraries/libcrash/hash" |
189 | libcrash = "programs/develop/libraries/libcrash/hash" |
190 | env["INCLUDE"] = "" |
190 | env["INCLUDE"] = "" |
191 | env["INCLUDE"] += f"{kolibrios_folder}/kernel/trunk;" |
191 | env["INCLUDE"] += f"{kolibrios_folder}/kernel/trunk;" |
192 | env["INCLUDE"] += f"{kolibrios_folder}/{libcrash}" |
192 | env["INCLUDE"] += f"{kolibrios_folder}/{libcrash}" |
193 | command = "fasm " |
193 | command = "fasm " |
- | 194 | command += "-dWIN32=1 " if sys.platform == "win32" else "" |
|
194 | command += "-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 " |
195 | command += "-dUEFI=1 -dextended_primary_loader=1 -dUMKA=1 " |
195 | command += "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas " |
196 | command += "umka/umka.asm umka/build/umka.o -s umka/build/umka.fas " |
196 | command += "-m 2000000 " |
197 | command += "-m 2000000 " |
- | 198 | print(command) |
|
197 | stdout = subprocess.check_output(command, shell=True, env=env) |
199 | stdout = subprocess.check_output(command, shell=True, env=env) |
198 | print(stdout) |
200 | print(stdout.decode("ascii")) |
199 | return umka_o |
201 | return umka_o |
Line 200... | Line 202... | ||
200 | 202 | ||
201 | 203 | ||
202 | def cc(src, obj, include_path): |
204 | def cc(src, obj, include_path): |
203 | command = "clang " |
205 | command = "clang " |
204 | command += "-Wno-everything -std=c11 -g -O0 -fno-pie -m32 -masm=intel -c " |
206 | command += "-Wno-everything -std=c11 -g -O0 -fno-pie -m32 -masm=intel -c " |
- | 207 | command += "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L " |
|
205 | command += "-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_POSIX_C_SOURCE=200809L " |
208 | command += f"-I {include_path} {src} -o {obj}" |
206 | command += f"-I {include_path} {src} -o {obj}" |
209 | print(command) |
Line 207... | Line 210... | ||
207 | if os.system(command) != 0: |
210 | if os.system(command) != 0: |
- | 211 | exit() |
|
- | 212 | ||
- | 213 | ||
- | 214 | def link(objects): |
|
208 | exit() |
215 | if sys.platform == "linux" or sys.platform == "linux2": |
209 | 216 | linker_script = "-T umka/umka.ld" |
|
210 | 217 | else: |
|
211 | def link(objects): |
218 | linker_script = "-Wl,/ALIGN:65536 -Wl,/MAP:umka.map " |
- | 219 | command = "clang " |
|
212 | command = "clang " |
220 | command += "-Wno-everything " |
213 | command += "-Wno-everything " |
221 | command += f"-no-pie -m32 -o umka_shell.exe -static {linker_script} " |
Line 214... | Line 222... | ||
214 | command += "-no-pie -m32 -o umka_shell -static -T umka/umka.ld " |
222 | command += " ".join(objects) |
215 | command += " ".join(objects) |
223 | print(command) |
216 | if os.system(command) != 0: |
224 | if os.system(command) != 0: |
Line 217... | Line 225... | ||
217 | exit() |
225 | exit() |
Line -... | Line 226... | ||
- | 226 | ||
- | 227 | ||
- | 228 | def build_umka(): |
|
- | 229 | if not use_umka: |
|
218 | 230 | return |
|
219 | 231 | ||
220 | def build_umka(): |
232 | os.makedirs("umka/build", exist_ok=True) |
221 | if not use_umka: |
233 | |
222 | return |
234 | platform = "win32" if sys.platform == "win32" else "linux" |
223 | 235 | ||
224 | os.makedirs("umka/build", exist_ok=True) |
236 | os.makedirs(f"umka/build/{platform}", exist_ok=True) |
- | 237 | ||
- | 238 | c_sources = [ |
|
225 | 239 | "umka_shell.c", |
|
226 | c_sources = [ |
240 | "shell.c", |
227 | "umka_shell.c", |
241 | "trace.c", |
228 | "shell.c", |
242 | "trace_lbr.c", |
229 | "trace.c", |
243 | "vdisk.c", |
Line 230... | Line 244... | ||
230 | "trace_lbr.c", |
244 | "vnet.c", |
231 | "vdisk.c", |
245 | "getopt.c", |
232 | "vnet.c", |
246 | "isatty.c", |
Line 233... | Line 247... | ||
233 | "lodepng.c", |
247 | "lodepng.c", |
234 | "linux/pci.c", |
248 | f"{platform}/pci.c", |
Line 250... | Line 264... | ||
250 | 264 | ||
251 | os.chdir("umka/test") |
265 | os.chdir("umka/test") |
252 | for test in [t for t in os.listdir(".") if t.endswith(".t")]: |
266 | for test in [t for t in os.listdir(".") if t.endswith(".t")]: |
253 | out_log = f"{test[:-2]}.out.log" |
267 | out_log = f"{test[:-2]}.out.log" |
254 | ref_log = f"{test[:-2]}.ref.log" |
268 | ref_log = f"{test[:-2]}.ref.log" |
255 | cmd_umka = f"../../umka_shell < {test} > {out_log}" |
269 | cmd_umka = f"..{os.sep}..{os.sep}umka_shell.exe < {test} > {out_log}" |
256 | print(cmd_umka) |
270 | print(cmd_umka) |
257 | os.system(cmd_umka) |
271 | os.system(cmd_umka) |
- | 272 | with open(out_log, "rb") as f: |
|
258 | cmd_cmp = f"cmp {out_log} {ref_log}" |
273 | crlf = bytes([0x0D, 0x0A]) |
- | 274 | lf = bytes([0x0A]) |
|
259 | print(cmd_cmp) |
275 | out_log_contents = f.read().replace(crlf, lf) |
- | 276 | with open(out_log, "wb") as f: |
|
- | 277 | f.write(out_log_contents) |
|
- | 278 | with open(ref_log, "rb") as f: |
|
- | 279 | ref_log_contents = f.read() |
|
260 | if os.system(cmd_cmp) != 0: |
280 | if out_log_contents != ref_log_contents: |
261 | print("FAILURE") |
281 | print("FAILURE") |
262 | exit() |
282 | exit() |
263 | os.chdir("../../") |
283 | os.chdir("../../") |
264 | print("SUCCESS") |
284 | print("SUCCESS") |