Skip to content
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
1 change: 1 addition & 0 deletions .github/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apt-get update -y && \
libssl-dev \
dos2unix \
sudo \
sshpass \
unzip \
wget \
g++-aarch64-linux-gnu \
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ jobs:
echo "${{ env.GIT_VERSION }}" > pr-info/version
echo "${{ env.JOB_START }}" > pr-info/job_start
echo "$(date +%s)" > pr-info/job_end
echo basic-build >> pr-info/artifacts
echo extended-build >> pr-info/artifacts
echo basic-devel-build >> pr-info/artifacts
echo extended-devel-build >> pr-info/artifacts

- name: Upload PR info
if: github.event_name == 'pull_request'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pull_request_comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ jobs:
run_id: runId
});

const buildArtifacts = artifacts.artifacts.filter(a => a.name !== 'pr-info');
const artifactNames = fs.readFileSync('pr-info/artifacts', 'utf8').trim().split('\n');
const buildArtifacts = artifacts.artifacts.filter(a => artifactNames.includes(a.name));
const artifactLines = buildArtifacts.map(a => {
const url = `https://github.com/${{ github.repository }}/actions/runs/${runId}/artifacts/${a.id}`;
const size = (a.size_in_bytes / 1024 / 1024).toFixed(2);
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ all: tools
# ================= Build Tools =================

OUTPUT_FILE := firmware/firmware.bin
BUILD_DIR ?= tmp/firmware

ifneq (,$(PROFILE))
PROFILE_MAIN := $(patsubst %-devel,%,$(PROFILE))
Expand All @@ -26,7 +27,7 @@ else ifeq (,$(filter $(PROFILE_MAIN),$(PROFILES)))
@echo "Invalid profile '$(PROFILE_MAIN)'. Available profiles are: $(PROFILES)."
@exit 1
endif
./scripts/create_firmware.sh $< tmp/firmware $@ $(OVERLAYS)
./scripts/create_firmware.sh $< $(BUILD_DIR) $@ $(OVERLAYS)

.PHONY: build
build: $(OUTPUT_FILE)
Expand Down
2 changes: 1 addition & 1 deletion dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ fi
TTY_FLAG=""
[[ -t 0 ]] && TTY_FLAG="-it"

ENV_FLAGS="-e GIT_VERSION -e CI"
ENV_FLAGS="-e GIT_VERSION -e CI -e PASSWORD"

exec docker run --rm $TTY_FLAG $ENV_FLAGS --cap-add=SYS_ADMIN -w "$PWD" -v "$PWD:$PWD" "$IMAGE_NAME" "$@"
20 changes: 20 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,26 @@ To extract and examine the base firmware:

Output: `tmp/extracted/`

## Upgrade Firmware

To build and deploy firmware directly to a connected printer:

```bash
./dev.sh ./scripts/dev/upgrade-firmware.sh root@<printer-ip> <profile>
```

Example:

```bash
./dev.sh ./scripts/dev/upgrade-firmware.sh root@192.168.1.100 extended
```

By default, the script uses `snapmaker` as the SSH password. To use a different password:

```bash
PASSWORD=mypassword ./dev.sh ./scripts/dev/upgrade-firmware.sh root@192.168.1.100 extended
```

## Release Process

The project uses GitHub Actions for automated releases:
Expand Down
10 changes: 6 additions & 4 deletions scripts/dev/upgrade-firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ SSH_HOST="$1"
PROFILE="$2"
shift 2

PASSWORD="${PASSWORD:-snapmaker}"
SSH_OPTS="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"

set -xe

rm -rf "firmware/firmware_$PROFILE.bin" "tmp/firmware"
make build OUTPUT_FILE=firmware/firmware_$PROFILE.bin PROFILE="$PROFILE"
scp "tmp/firmware/update.img" "$SSH_HOST:/tmp/"
ssh "$SSH_HOST" /home/lava/bin/systemUpgrade.sh upgrade soc /tmp/update.img
make build OUTPUT_FILE=firmware/firmware_$PROFILE.bin PROFILE="$PROFILE" OVERWRITE=1
sshpass -p "$PASSWORD" scp $SSH_OPTS "tmp/firmware/update.img" "$SSH_HOST:/tmp/"
sshpass -p "$PASSWORD" ssh $SSH_OPTS "$SSH_HOST" /home/lava/bin/systemUpgrade.sh upgrade soc /tmp/update.img
2 changes: 1 addition & 1 deletion scripts/helpers/pack_firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [[ ! -d "$1" ]]; then
exit 1
fi

if [[ -f "$2" ]]; then
if [[ -f "$2" ]] && [[ -z "$OVERWRITE" ]]; then
echo "Error: Output file $2 already exists."
exit 1
fi
Expand Down
Loading