Skip to content

Commit b4b21df

Browse files
authored
Merge pull request #11 from j005u/main
added preliminary libshims linking solution
2 parents e4380d9 + 5952d83 commit b4b21df

File tree

19 files changed

+436
-18
lines changed

19 files changed

+436
-18
lines changed

.github/workflows/build.yml

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
on:
2+
# Triggers the workflow on push or pull request events but only for the main branch
3+
push:
4+
branches: [ main ]
5+
tags:
6+
- '*'
7+
8+
# pull_request:
9+
# branches: [ main ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
jobs:
15+
release:
16+
name: Create new releas and attach IPKs
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
needs: build
21+
steps:
22+
- name: Branch name
23+
id: branch_name
24+
run: |
25+
echo ::set-output name=IS_TAG::${{ startsWith(github.ref, 'refs/tags/') }}
26+
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
27+
echo ::set-output name=RELEASE_VERSION::${GITHUB_REF#refs/*/}
28+
29+
- name: Download artifact
30+
env:
31+
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
32+
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
33+
if: "${{ env.IS_TAG == 'true' }}"
34+
uses: actions/download-artifact@v2
35+
with:
36+
name: ${{ env.ARTIFACT_NAME }}
37+
38+
- name: View content
39+
env:
40+
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
41+
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
42+
if: "${{ env.IS_TAG == 'true' }}"
43+
run: ls -R
44+
45+
- name: Create tagged release
46+
id: create_release
47+
env:
48+
IS_TAG: ${{ steps.branch_name.outputs.IS_TAG }}
49+
SOURCE_TAG: ${{ steps.branch_name.outputs.SOURCE_TAG }}
50+
if: "${{ env.IS_TAG == 'true' }}"
51+
uses: ncipollo/release-action@v1
52+
with:
53+
tag: ${{ env.SOURCE_TAG }}
54+
name: ${{ env.SOURCE_TAG }}
55+
token: ${{ secrets.GITHUB_TOKEN }}
56+
prerelease: false
57+
artifacts: "./*/*.ipk"
58+
59+
build:
60+
name: Build .ipk packages
61+
runs-on: ubuntu-latest
62+
63+
steps:
64+
- name: Checkout Code
65+
uses: actions/checkout@v2
66+
67+
- name: Get GitHub Build Number (ENV)
68+
id: get_buildno
69+
run: echo "GITHUBBUILDNUMBER=${{ github.run_number }}" >> $GITHUB_ENV
70+
continue-on-error: true
71+
72+
- name: Get repository name
73+
run: echo "REPOSITORY_NAME=$(echo '${{ github.repository }}' | cut -d '/' -f2)" >> $GITHUB_ENV
74+
shell: bash
75+
76+
- name: Make artifact name
77+
id: make_artifactname
78+
run: |
79+
ARTIFACT_NAME="${{ env.REPOSITORY_NAME }}-${{ github.run_number }}"
80+
echo "${ARTIFACT_NAME}"
81+
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
82+
83+
- uses: nttld/setup-ndk@v1
84+
id: setup-ndk
85+
with:
86+
ndk-version: r23b
87+
add-to-path: false
88+
89+
- name: Build .ipk
90+
env:
91+
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
92+
run: |
93+
export PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/:$PATH
94+
make ipk
95+
96+
- name: Upload release artifacts
97+
uses: actions/upload-artifact@v2
98+
with:
99+
name: ${{ env.ARTIFACT_NAME }}
100+
path: |
101+
./ipk/*.ipk

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.o
2+
osd_dji
3+
msp_displayport_mux
4+
ipk/goggle/build
5+
ipk/airunit/build
6+
*.ipk
7+
repo

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./Makefile.dji

Makefile.dji

+70-5
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,84 @@ CFLAGS=-I. -O2
33
DEPS = msp.h msp_displayport.h network.h serial.h
44
DISPLAYPORT_MUX_OBJ = msp_displayport_mux.o serial.o network.o msp.o
55
OSD_DJI_OBJ = osd_dji_udp.o network.o msp.o msp_displayport.o dji_display.o dji_services.o
6-
OSD_DJI_LIBS := -lduml_hal
7-
ifneq ($(DJI_LIB_PATH),)
8-
OSD_DJI_LIBS := -L$(DJI_LIB_PATH) -lduml_hal
9-
endif
6+
LIB_SHIMS = libshims/libduml_hal.so
7+
#OSD_DJI_LIBS := -lduml_hal
8+
#ifneq ($(DJI_LIB_PATH),)
9+
OSD_DJI_LIBS := -L./libshims -lduml_hal
10+
#endif
11+
12+
.PHONY: repo
1013

1114
%.o: %.c $(DEPS)
1215
$(CC) -c -o $@ $< $(CFLAGS)
1316

17+
all: msp_displayport_mux osd_dji
18+
1419
msp_displayport_mux: $(DISPLAYPORT_MUX_OBJ)
1520
$(CC) -o $@ $^ $(CFLAGS)
1621

1722
osd_dji: $(OSD_DJI_OBJ)
23+
$(MAKE) -f Makefile.dji libshims
1824
$(CC) -o $@ $^ $(CFLAGS) $(OSD_DJI_LIBS)
1925

20-
clean:
26+
#this doesn't work by default
27+
#an extra duss_result_t(frame_pop_handler)
28+
#is generated that the compiler doesn't like
29+
libshims/%.c: %.h
30+
stubgen -g -e .c -l -N -t libshims -p "../" -n $<
31+
32+
libshims/lib%.so: libshims/%.c
33+
$(CC) -Wno-c2x-extensions -O2 -shared -o $@ $<
34+
35+
libshims: $(LIB_SHIMS)
36+
37+
goggle_ipk: osd_dji
38+
$(eval PKG_NAME := $(shell cat ./ipk/goggle/control/control | grep Package | cut -d" " -f2))
39+
$(eval ARCH := $(shell cat ./ipk/goggle/control/control | grep Architecture | cut -d" " -f2))
40+
$(eval VERSION :=$(shell cat ./ipk/goggle/control/control | grep Version | cut -d" " -f2))
41+
$(eval IPK_NAME := "${PKG_NAME}_${VERSION}_${ARCH}.ipk")
42+
mkdir -p ipk/goggle/build
43+
cp -r ipk/goggle/data ipk/goggle/build/
44+
mkdir -p ipk/goggle/build/data/opt/bin
45+
mkdir -p ipk/goggle/build/opt/fonts
46+
echo "2.0" > ipk/goggle/build/debian-binary
47+
cp -r ipk/goggle/control ipk/goggle/build/
48+
cp osd_dji ipk/goggle/build/data/opt/bin
49+
chmod +x ipk/goggle/build/data/opt/bin/osd_dji
50+
cp font.bin ipk/goggle/build/data/opt/fonts
51+
cd ipk/goggle/build/control && tar czvf ../control.tar.gz .
52+
cd ipk/goggle/build/data && tar czvf ../data.tar.gz .
53+
cd ipk/goggle/build && tar czvf "../../${IPK_NAME}" ./control.tar.gz ./data.tar.gz ./debian-binary
54+
55+
airunit_ipk: msp_displayport_mux
56+
$(eval PKG_NAME := $(shell cat ./ipk/airunit/control/control | grep Package | cut -d" " -f2))
57+
$(eval ARCH := $(shell cat ./ipk/airunit/control/control | grep Architecture | cut -d" " -f2))
58+
$(eval VERSION :=$(shell cat ./ipk/airunit/control/control | grep Version | cut -d" " -f2))
59+
$(eval IPK_NAME := "${PKG_NAME}_${VERSION}_${ARCH}.ipk")
60+
mkdir -p ipk/airunit/build
61+
echo "2.0" > ipk/airunit/build/debian-binary
62+
cp -r ipk/airunit/data ipk/airunit/build/
63+
cp msp_displayport_mux ipk/airunit/build/data/opt/bin
64+
chmod +x ipk/airunit/build/data/opt/bin/msp_displayport_mux
65+
cp -r ipk/airunit/control ipk/airunit/build/
66+
cd ipk/airunit/build/control && tar czvf ../control.tar.gz .
67+
cd ipk/airunit/build/data && tar czvf ../data.tar.gz .
68+
cd ipk/airunit/build && tar czvf "../../${IPK_NAME}" ./control.tar.gz ./data.tar.gz ./debian-binary
69+
70+
ipk: goggle_ipk airunit_ipk
71+
72+
repo: ipk
73+
mkdir -p repo
74+
cp ipk/*.ipk repo/
75+
../opkg-utils-0.5.0/opkg-make-index ./repo/ > repo/Packages
76+
http-server -p 8042 ./repo/
77+
78+
clean:
2179
rm -rf *.o
80+
rm -rf repo
81+
rm -rf libshims/*.so
82+
rm -rf msp_displayport_mux
83+
rm -rf osd_dji
84+
rm -rf ipk/goggle/build
85+
rm -rf ipk/airunit/build
86+
rm -rf ipk/*.ipk

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ set displayport_msp_serial = <ConfiguratorUART - 1>
5151
adb push msp_displayport_mux /blackbox
5252
setprop dji.hdvt_uav_service 0
5353
mv /dev/ttyS1 /dev/ttyS1_moved
54-
nohup /blackbox/msp_displayport_mux 192.168.41.2 /dev/ttyS1_moved /dev/ttyS1
54+
nohup /blackbox/msp_displayport_mux 192.168.41.2 /dev/ttyS1_moved /dev/ttyS1 &
5555
setprop dji.hdvt_uav_service 1
5656
```
5757
This tells the displayport mux to send data from /dev/ttyS1_moved to 192.168.41.2 (goggles) and to create a fake serial port at /dev/ttyS1 with the displayport messages filtered out.

dji_display.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "duss_hal.h"
1+
#include "duml_hal.h"
22

33
typedef struct dji_display_state_s {
44
duss_disp_plane_id_t plane_id;

duss_hal.h renamed to duml_hal.h

File renamed without changes.

ipk/airunit/control/control

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Package: msp-osd-airside
2+
Version: 0.1.0
3+
Maintainer: bri3d
4+
Description: MSP OSD service for the DJI HD FPV airunit.
5+
Architecture: armv7-3.2
6+
Depends: dinit

ipk/airunit/control/postinst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/system/bin/sh
2+
/opt/sbin/dinitctl -u enable msp-osd-airside || true

ipk/airunit/control/prerm

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/system/bin/sh
2+
/opt/sbin/dinitctl -u disable msp-osd-airside || true
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/system/bin/sh
2+
setprop dji.hdvt_uav_service 0
3+
4+
if [ ! -e "/dev/ttyS1_moved" ]
5+
then
6+
mv /dev/ttyS1 /dev/ttyS1_moved
7+
fi
8+
9+
/opt/bin/msp_displayport_mux 192.168.41.2 /dev/ttyS1_moved /dev/ttyS1 &
10+
echo $! > /opt/var/run/airunit-osd-dji.pid
11+
setprop dji.hdvt_uav_service 1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type = bgprocess
2+
command = /opt/bin/airunit-osd-start.sh
3+
pid-file = /opt/var/run/airunit-osd-dji.pid
4+
restart = true

ipk/goggle/control/control

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Package: msp-osd-goggles
2+
Version: 0.1.0
3+
Maintainer: bri3d
4+
Description: MSP OSD service for the DJI HD FPV goggles.
5+
Architecture: armv7-3.2
6+
Depends: dinit

ipk/goggle/control/postinst

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/system/bin/sh
2+
/opt/sbin/dinitctl -u enable msp-osd-goggles || true

ipk/goggle/control/prerm

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/system/bin/sh
2+
/opt/sbin/dinitctl -u disable msp-osd-goggles || true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
type = process
2+
command = /opt/bin/osd_dji
3+
restart = true

0 commit comments

Comments
 (0)