From bba1a94d8de020598951c1fe756c379ea307f56b Mon Sep 17 00:00:00 2001 From: Jiyoung Yun Date: Mon, 12 Dec 2016 13:41:30 +0900 Subject: [PATCH] Add CROSS and ROOTFS_DIR environment for ARM The CROSS env is passed through the BuildContext to the build.sh in corehost. If the value is set, corehost build script gives '--cross' argument. ROOTFS_DIR can support to specify the location of rootfs as CoreCLR does. If ROOTFS_DIR env is not defined, the default value(./cross/rootfs/${TARGETPLATFORM}/) will be used. Signed-off-by: Jiyoung Yun --- build_projects/dotnet-host-build/CompileTargets.cs | 6 ++++++ build_projects/dotnet-host-build/PrepareTargets.cs | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/build_projects/dotnet-host-build/CompileTargets.cs b/build_projects/dotnet-host-build/CompileTargets.cs index 073a75ee4a..2f5fab5a23 100644 --- a/build_projects/dotnet-host-build/CompileTargets.cs +++ b/build_projects/dotnet-host-build/CompileTargets.cs @@ -164,6 +164,7 @@ public static BuildTargetResult CompileCoreHost(BuildTargetContext c) var configuration = c.BuildContext.Get("Configuration"); string rid = c.BuildContext.Get("TargetRID"); string platform = c.BuildContext.Get("Platform"); + string crossEnv = c.BuildContext.Get("Cross"); // Generate build files var cmakeOut = Path.Combine(Dirs.CorehostLatest, "cmake"); @@ -306,6 +307,11 @@ public static BuildTargetResult CompileCoreHost(BuildTargetContext c) buildScriptArgList.Add("--commithash"); buildScriptArgList.Add(commitHash); + if (string.Equals(crossEnv, "1")) + { + buildScriptArgList.Add("--cross"); + } + ExecIn(cmakeOut, buildScriptFile, buildScriptArgList); // Copy the output out diff --git a/build_projects/dotnet-host-build/PrepareTargets.cs b/build_projects/dotnet-host-build/PrepareTargets.cs index 672986576f..ff2f85dd29 100644 --- a/build_projects/dotnet-host-build/PrepareTargets.cs +++ b/build_projects/dotnet-host-build/PrepareTargets.cs @@ -59,16 +59,29 @@ public static BuildTargetResult Init(BuildTargetContext c) configEnv = "Debug"; } + string crossEnv = Environment.GetEnvironmentVariable("CROSS") ?? "0"; + if (string.Equals(crossEnv, "1")) + { + string rootfsDir = Environment.GetEnvironmentVariable("ROOTFS_DIR"); + if (string.IsNullOrEmpty(rootfsDir)) + { + rootfsDir = Path.Combine(Dirs.RepoRoot, "cross", "rootfs", platformEnv); + Environment.SetEnvironmentVariable("ROOTFS_DIR", rootfsDir); + } + } + c.BuildContext["Configuration"] = configEnv; c.BuildContext["Channel"] = Environment.GetEnvironmentVariable("CHANNEL"); c.BuildContext["Platform"] = platformEnv; c.BuildContext["TargetRID"] = targetRID; c.BuildContext["TargetFramework"] = targetFramework; + c.BuildContext["Cross"] = crossEnv; c.Info($"Building {c.BuildContext["Configuration"]} to: {Dirs.Output}"); c.Info("Build Environment:"); c.Info($" Operating System: {RuntimeEnvironment.OperatingSystem} {RuntimeEnvironment.OperatingSystemVersion}"); c.Info($" Platform: " + platformEnv); + c.Info($" Cross Build: " + int.Parse(crossEnv)); return c.Success(); }