diff --git a/doc/installing-from-source.md b/doc/installing-from-source.md index c29e481..de139b2 100644 --- a/doc/installing-from-source.md +++ b/doc/installing-from-source.md @@ -12,7 +12,7 @@ At a high level, we have: It's recommended to work either on Mac/Linux, or WSL on Windows. -## Quick start +## Building frontend and backend If you have [Rust](https://www.rust-lang.org/tools/install) and [Node.js/npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) @@ -23,70 +23,7 @@ installed, you can build everything with: ./scripts/install-dev.sh orbic # replace 'orbic' with your device type ``` -## Step 1: Building the frontend - -Install [nodejs/npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), which is required to build Rayhunter's web UI. - -Run: - -```sh -pushd daemon/web && npm install && npm run build && popd -``` - -## Step 2: Building the daemon - -[Install Rust the usual way](https://www.rust-lang.org/tools/install). Then, - -- install a C compiler (`apt install build-essential` would be the command under Ubuntu) - -- install the cross-compilation target for the device Rayhunter will run on: - - ```sh - rustup target add armv7-unknown-linux-musleabihf - ``` - -- install the statically compiled target for your host machine: - - ```sh - # check which toolchain you have installed by default with - rustup show - # now install the correct variant for your host platform, one of: - rustup target add aarch64-unknown-linux-musl - rustup target add armv7-unknown-linux-musleabi - rustup target add x86_64-unknown-linux-musl - rustup target add aarch64-apple-darwin - rustup target add x86_64-apple-darwin - rustup target add x86_64-pc-windows-gnu - ``` - -Now to build the daemon: - -```sh -# Build the daemon binary for local development (rustcrypto TLS backend, fast compilation) -# WARNING: The rustcrypto library, though not known to be insecure, is less well -# tested than its counterpart and could potentially have severe issues in -# its cryptographic implementation. We therefore recommend using ring-tls in -# production builds (see below) -cargo build-daemon-firmware-devel - -# To build it exactly like in CI (more mature ring TLS backend, slower compilation) -# CC_armv7_unknown_linux_musleabihf=arm-linux-gnueabihf-gcc cargo build-daemon-firmware - -# Build rootshell -cargo build-rootshell-firmware-devel -``` - -## Step 3: Running the installer - -Now that all dependencies of the installer have been built, you can run the installer like so (with the device connected according to the regular installation instructions): - -```sh -# Replace 'orbic' with your device type if different. -# A list of possible values can be found with 'cargo run --bin installer help'. -FIRMWARE_PROFILE=firmware-devel cargo run -p installer --bin installer orbic -``` - -## Optional: Hot-reloading the frontend +## Hot-reloading the frontend If you are working on the frontend, you normally have to repeat all of the above steps everytime to see a change. @@ -106,7 +43,7 @@ API_TARGET=http://192.168.1.1:8080 npm run dev The UI will listen on `localhost:5173` and instantly show any frontend changes you make. Backend changes require building everything from the top (daemon and installer). -## Optional: Installer utils, getting a shell +## Installer utils, getting a shell Check `FIRMWARE_PROFILE=firmware-devel cargo run -p installer -- util --help` for useful utilities for transferring files, opening shells. The exact tools diff --git a/scripts/build-dev.sh b/scripts/build-dev.sh index 593a479..10a0e94 100755 --- a/scripts/build-dev.sh +++ b/scripts/build-dev.sh @@ -33,8 +33,6 @@ check_dependencies() { echo "Installing ARM target (armv7-unknown-linux-musleabihf)..." rustup target add armv7-unknown-linux-musleabihf fi - - echo "All dependencies found." } build_frontend() { @@ -62,10 +60,9 @@ case "$COMMAND" in build_daemon echo "" echo "Build complete! To install to a device, run:" - echo " FIRMWARE_PROFILE=firmware-devel cargo run -p installer --bin installer " + echo " ./scripts/install-dev.sh " echo "" echo "Replace with your device type (e.g. orbic, tplink)." - echo "Run 'cargo run --bin installer help' for a list of supported devices." ;; frontend) build_frontend diff --git a/scripts/install-dev.sh b/scripts/install-dev.sh index 62e1f49..2d32023 100755 --- a/scripts/install-dev.sh +++ b/scripts/install-dev.sh @@ -11,15 +11,4 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" cd "$PROJECT_DIR" - -DEVICE="${1:-}" - -if [ -z "$DEVICE" ]; then - echo "Usage: $0 " - echo "" - echo "Run 'cargo run --bin installer help' for a list of supported devices." - exit 1 -fi - -shift -FIRMWARE_PROFILE=firmware-devel cargo run -p installer --bin installer -- "$DEVICE" "$@" +FIRMWARE_PROFILE=firmware-devel cargo run -p installer --bin installer -- "$@"