|
29 | 29 | from typing import List
|
30 | 30 |
|
31 | 31 |
|
| 32 | +def log_info(msg): |
| 33 | + """ |
| 34 | + Logs a message with info log level. |
| 35 | + """ |
| 36 | + print(f"\033[1m\033[92minfo\033[0m: {msg}") |
| 37 | + |
| 38 | + |
| 39 | +def log_error(msg): |
| 40 | + """ |
| 41 | + Logs a message with error log level. |
| 42 | + """ |
| 43 | + print(f"\033[1m\033[91merror\033[0m: {msg}") |
| 44 | + |
| 45 | + |
32 | 46 | # Make sure requests is installed
|
33 | 47 | try:
|
34 | 48 | import requests
|
35 | 49 | import xbstrap
|
36 | 50 | except ImportError:
|
37 |
| - print('Please install required libraires using the following command:') |
38 |
| - print(' - python3 -m pip install requests xbstrap') |
| 51 | + log_error('Please install required libraires using the following command:') |
| 52 | + log_error(' - python3 -m pip install requests xbstrap') |
39 | 53 |
|
40 | 54 | sys.exit(0)
|
41 | 55 |
|
42 |
| -import requests |
43 |
| -import xbstrap |
44 |
| - |
45 | 56 |
|
46 |
| -OVMF_URL = 'https://github.com/rust-osdev/ovmf-prebuilt/releases/latest/download' |
| 57 | +OVMF_URL = 'https://github.com/aero-os/ovmf-prebuilt' |
47 | 58 | LIMINE_URL = 'https://github.com/limine-bootloader/limine'
|
48 | 59 |
|
49 | 60 | BUILD_DIR = 'build'
|
|
52 | 63 | EXTRA_FILES = 'extra-files'
|
53 | 64 | SYSROOT_CARGO_HOME = os.path.join(SYSROOT_DIR, 'cargo-home')
|
54 | 65 | BASE_FILES_DIR = 'base-files'
|
55 |
| -OVMF_FILES = ['OVMF-pure-efi.fd'] |
56 | 66 |
|
57 | 67 | LIMINE_TEMPLATE = """
|
58 | 68 | TIMEOUT=0
|
@@ -81,20 +91,6 @@ def __init__(self, target_arch: str, args: argparse.Namespace):
|
81 | 91 | self.args = args
|
82 | 92 |
|
83 | 93 |
|
84 |
| -def log_info(msg): |
85 |
| - """ |
86 |
| - Logs a message with info log level. |
87 |
| - """ |
88 |
| - print(f"\033[1m\033[92minfo\033[0m: {msg}") |
89 |
| - |
90 |
| - |
91 |
| -def log_error(msg): |
92 |
| - """ |
93 |
| - Logs a message with error log level. |
94 |
| - """ |
95 |
| - print(f"\033[1m\033[91merror\033[0m: {msg}") |
96 |
| - |
97 |
| - |
98 | 94 | def download_userland_host_rust():
|
99 | 95 | out_file = os.path.join(BUNDLED_DIR, "host-rust-prebuilt.tar.gz")
|
100 | 96 |
|
@@ -235,16 +231,7 @@ def download_bundled():
|
235 | 231 | limine_path = os.path.join(BUNDLED_DIR, 'limine')
|
236 | 232 |
|
237 | 233 | if not os.path.exists(ovmf_path):
|
238 |
| - os.makedirs(ovmf_path) |
239 |
| - |
240 |
| - for ovmf_file in OVMF_FILES: |
241 |
| - file_path = os.path.join(ovmf_path, ovmf_file) |
242 |
| - |
243 |
| - if not os.path.exists(file_path): |
244 |
| - with open(file_path, 'wb') as file: |
245 |
| - response = requests.get(f'{OVMF_URL}/{ovmf_file}') |
246 |
| - |
247 |
| - file.write(response.content) |
| 234 | + run_command(['git', 'clone', '--depth', '1', OVMF_URL, ovmf_path]) |
248 | 235 |
|
249 | 236 | if not os.path.exists(limine_path):
|
250 | 237 | run_command(['git', 'clone', '--branch', 'v4.x-branch-binary',
|
@@ -536,13 +523,8 @@ def run_in_emulator(build_info: BuildInfo, iso_path):
|
536 | 523 | '-serial', 'stdio']
|
537 | 524 |
|
538 | 525 | if args.bios == 'uefi':
|
539 |
| - if build_info.target_arch == "aarch64": |
540 |
| - qemu_args += ['-bios', 'bundled/ovmf/OVMF.fd'] |
541 |
| - elif build_info.target_arch == "x86_64": |
542 |
| - qemu_args += ['-bios', 'bundled/ovmf/OVMF-pure-efi.fd'] |
543 |
| - else: |
544 |
| - log_error("unknown target architecture") |
545 |
| - exit(1) |
| 526 | + qemu_args += ['-bios', |
| 527 | + f'bundled/ovmf/ovmf-{build_info.target_arch}/OVMF.fd'] |
546 | 528 |
|
547 | 529 | cmdline = args.remaining
|
548 | 530 |
|
|
0 commit comments