Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grdddj/emu from url fix #277

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ def patch_emulators_for_nix(dir_to_patch: str = "") -> None:
That is on purpose, because it might be run in a non-Nix
environment.
"""
cmd = ["./patch_emulators.sh", dir_to_patch]
subprocess.run(cmd, cwd=ROOT_DIR)
cmd = ["./patch-bin.sh", dir_to_patch]
subprocess.run(cmd, cwd=FIRMWARE_BIN_DIR)
5 changes: 3 additions & 2 deletions src/binaries/firmware/bin/patch-bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
SYSTEM_ARCH=$(uname -m)
echo "System architecture: $SYSTEM_ARCH"

# Use the first argument as BINARY_DIR if provided; otherwise, default to './'
BINARY_DIR="${1:-./}"

if [[ "$SYSTEM_ARCH" == "x86_64" ]]; then
INTERPRETER_DEFAULT="/lib64/ld-linux-x86-64.so.2"
elif [[ "$SYSTEM_ARCH" == "aarch64" || "$SYSTEM_ARCH" == "arm64" ]]; then
Expand Down Expand Up @@ -62,8 +65,6 @@ export -f change_interpreter
export -f get_interpreter
export INTERPRETER_DEFAULT

BINARY_DIR="./"

find "$BINARY_DIR" -type f -executable -exec bash -c 'change_interpreter "$0"' {} \;

echo "All binaries patched."
2 changes: 1 addition & 1 deletion src/dashboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ <h4>{{details.header}} ({{ model }})</h4>
<div>
<input
type="text"
placeholder="Full emulator URL, or Gitlab job ID - as specified in select. Do not forget to specify correct model"
placeholder="Full emulator URL. Do not forget to specify correct model"
style="width: 50%"
v-model="emulatorUrl.url"
/>
Expand Down
21 changes: 2 additions & 19 deletions src/dashboard/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ const app = createApp({
},
emulatorUrl: {
url: "",
typeChoices: ["Gitlab job ID", "Custom link"],
type: "Gitlab job ID",
typeChoices: ["Custom link"],
type: "Custom link",
model: "T2T1",
downloadMessage: "",
},
Expand Down Expand Up @@ -277,23 +277,6 @@ const app = createApp({

const model = this.emulatorUrl.model;

// URL might need some processing in case it is not complete
// (Yes, handling URLs as strings is not very good, but should be alright in this easy case)
if (this.emulatorUrl.type === "Gitlab job ID") {
const gitlabJobPrefix =
"https://gitlab.com/satoshilabs/trezor/trezor-firmware/-/jobs";
const T1PathSuffix = "artifacts/raw/legacy/firmware/trezor.elf";
// TR/T3T1 share things with T2 here
const T2PathSuffix =
"artifacts/raw/core/build/unix/trezor-emu-core";
const baseUrl = `${gitlabJobPrefix}/${url}`;
if (model === "T1B1") {
url = `${baseUrl}/${T1PathSuffix}`;
} else {
url = `${baseUrl}/${T2PathSuffix}`;
}
}

this.sendMessage({
type: "emulator-start-from-url",
url,
Expand Down
Loading