Skip to content

Commit f5ecc43

Browse files
committed
Build toolchain
1 parent 8641ce1 commit f5ecc43

File tree

9 files changed

+937
-201
lines changed

9 files changed

+937
-201
lines changed

.github/workflows/build.yaml

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
name: Build kobo-ssh
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: build-kobo-ssh
12+
cancel-in-progress: true
13+
14+
jobs:
15+
filter-changes:
16+
name: Filter changes
17+
runs-on: ubuntu-latest
18+
outputs:
19+
toolchain_changed: ${{ steps.toolchain-changed-files.outputs.any_changed }}
20+
build_changed: ${{ steps.build-changed-files.outputs.any_changed }}
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Toolchain Changed Files
26+
id: toolchain-changed-files
27+
uses: tj-actions/changed-files@v45
28+
with:
29+
files: |
30+
toolchain/**
31+
32+
- name: Build Changed Files
33+
id: build-changed-files
34+
uses: tj-actions/changed-files@v45
35+
with:
36+
files: |
37+
.github/workflows/build.yaml
38+
KoboRoot/**
39+
compile.sh
40+
41+
build-toolchain-image:
42+
if: ${{ needs.filter-changes.outputs.toolchain_changed == 'true' }}
43+
name: Build toolchain image
44+
runs-on: ubuntu-latest
45+
permissions:
46+
contents: read
47+
packages: write
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Login to image registry
56+
uses: docker/login-action@v3
57+
with:
58+
registry: ghcr.io
59+
username: ${{ github.actor }}
60+
password: ${{ github.token }}
61+
62+
- name: Docker meta
63+
id: meta
64+
uses: docker/metadata-action@v5
65+
with:
66+
images: |
67+
ghcr.io/${{ github.repository_owner }}/kobo-ssh-toolchain
68+
tags: |
69+
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
70+
type=ref,event=branch
71+
type=ref,event=tag
72+
73+
- name: Build image
74+
uses: docker/build-push-action@v6
75+
id: build
76+
with:
77+
context: toolchain
78+
file: ./Dockerfile
79+
push: true
80+
tags: ${{ steps.meta.outputs.tags }}
81+
labels: ${{ steps.meta.outputs.labels }}
82+
cache-from: type=gha
83+
cache-to: type=gha,mode=max
84+
85+
build-koboroot:
86+
if: ${{ needs.filter-changes.outputs.build_changed == 'true' }}
87+
name: Build KoboRoot
88+
runs-on: ubuntu-latest
89+
needs:
90+
- filter-changes
91+
- build-toolchain-image
92+
permissions:
93+
contents: read
94+
packages: read
95+
env:
96+
TOOLCHAIN_IMAGE: ghcr.io/${{ github.repository_owner }}/kobo-ssh-toolchain:latest
97+
DROPBEAR_TAG: DROPBEAR_2025.87
98+
OPENSSH_TAG: V_9_9_P2
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
103+
- name: Clone dropbear sources
104+
run: |
105+
git clone --depth 1 --branch "${{ env.DROPBEAR_TAG }}" https://github.com/mkj/dropbear.git external/dropbear
106+
107+
- name: Build dropbear
108+
uses: kohlerdominik/docker-run-action@v2
109+
with:
110+
image: ${{ env.TOOLCHAIN_IMAGE }}
111+
volumes: |
112+
${{ github.workspace }}:/workspace
113+
workdir: /workspace
114+
run: |
115+
export PATH="/root/x-tools/arm-kobo-linux-gnueabihf/bin:$PATH"
116+
autoconf
117+
autoheader
118+
./configure --host=arm-kobo-linux-gnueabihf --disable-zlib --disable-zlib CC="arm-kobo-linux-gnueabihf"-gcc LD="arm-kobo-linux-gnueabihf"-ld --disable-wtmp --disable-lastlog --disable-syslog --disable-utmpx --disable-utmp --disable-wtmpx --disable-loginfunc --disable-pututxline --disable-pututline --enable-bundled-libtom --disable-pam
119+
make clean
120+
make PROGRAMS="dropbear dropbearkey" MULTI=1

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Compiled binaries
2+
KoboRoot/usr/bin/dropbearmulti
3+
KoboRoot/usr/libexec/sftp-server
4+
5+
# Remote sources
6+
external/
7+
# Generated files
8+
dist/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
KERNEL=="loop0", RUN+="/bin/sh -c '/usr/local/dropbear/launcher.sh'"
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Start by renicing ourselves to a neutral value, to avoid any mishap...
4+
renice 0 -p $$
5+
6+
# Launch in the background, with a clean env, after a setsid call to make very very sure udev won't kill us ;).
7+
env -i -- setsid /usr/local/dropbear/on-boot.sh &
8+
9+
# Done :)
10+
exit 0
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
case "$(pidof dropbear | wc -w)" in
4+
# Add the desired dropbear options here
5+
0) dropbearmulti dropbear -R -F -K 15 -s &
6+
;;
7+
*) ;;
8+
esac
9+
10+
exit 0

0 commit comments

Comments
 (0)