Skip to content

Commit ac739b9

Browse files
bootstrap: heck fix config.toml not being copied over to cargo home
Signed-off-by: Andy-Python-Programmer <[email protected]>
1 parent 16448a3 commit ac739b9

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

aero.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
BUILD_DIR = 'build'
5050
BUNDLED_DIR = 'bundled'
5151
SYSROOT_DIR = 'sysroot'
52+
EXTRA_FILES = 'extra-files'
53+
SYSROOT_CARGO_HOME = os.path.join(SYSROOT_DIR, 'cargo-home')
5254
BASE_FILES_DIR = 'base-files'
5355
OVMF_FILES = ['OVMF-pure-efi.fd']
5456

@@ -240,6 +242,26 @@ def build_userland_sysroot(args):
240242
if not os.path.exists(SYSROOT_DIR):
241243
os.mkdir(SYSROOT_DIR)
242244

245+
# FIXME(xbstrap): xbstrap does not copy over the extra-files/rust/config.toml
246+
# file into the cargo home directory.
247+
if not os.path.exists(SYSROOT_CARGO_HOME):
248+
os.mkdir(SYSROOT_CARGO_HOME)
249+
250+
cargo_sys_cfg = os.path.join(SYSROOT_CARGO_HOME, 'config.toml')
251+
if not os.path.exists(cargo_sys_cfg):
252+
cargo_cfg_fd = open(os.path.join(
253+
EXTRA_FILES, 'rust', 'config.toml'), 'r')
254+
cargo_cfg = cargo_cfg_fd.read()
255+
cargo_cfg_fd.close()
256+
257+
cargo_cfg = cargo_cfg.replace("@SOURCE_ROOT@", os.getcwd())
258+
cargo_cfg = cargo_cfg.replace(
259+
"@BUILD_ROOT@", os.path.join(os.getcwd(), SYSROOT_DIR))
260+
261+
cargo_cfg_fd = open(cargo_sys_cfg, "w+")
262+
cargo_cfg_fd.write(cargo_cfg)
263+
cargo_cfg_fd.close()
264+
243265
blink = os.path.join(SYSROOT_DIR, 'bootstrap.link')
244266

245267
if not os.path.islink(blink):
@@ -479,7 +501,7 @@ def get_sysctl(name: str) -> str:
479501
if status != 0:
480502
print("`sysctl` failed: ", end="")
481503
print(stderr.decode())
482-
504+
483505
return stdout.strip().decode()
484506

485507

@@ -493,11 +515,11 @@ def is_kvm_supported() -> bool:
493515
if platform == "darwin":
494516
# Check for VMX support
495517
cpu_features = get_sysctl("machdep.cpu.features")
496-
vmx_support = "VMX" in cpu_features.split(' ')
518+
vmx_support = "VMX" in cpu_features.split(' ')
497519

498520
# Check for HVF support
499521
hv_support = get_sysctl("kern.hv_support") == "1"
500-
522+
501523
return hv_support and vmx_support
502524

503525
if platform == "linux":

extra-files/rust/config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ patch-in-config = true
44
[build]
55
rustc = "@BUILD_ROOT@/tools/host-rust/bin/rustc"
66
target = "x86_64-unknown-aero-system"
7+
rustflags = ["-C", "link-args=-no-pie"]
78

89
[target.x86_64-unknown-aero-system]
910
linker = "@BUILD_ROOT@/tools/host-gcc/bin/x86_64-aero-gcc"

0 commit comments

Comments
 (0)