From 69b6900dd6e424d31c3296397929934d0c79fe72 Mon Sep 17 00:00:00 2001 From: Daniel Li Date: Tue, 26 Nov 2024 07:27:17 +0800 Subject: [PATCH 1/3] Use native build instead of x86/jetson target Discussion: [ Ignore msposd_jetson for gs on jetson orin #29 ](https://github.com/OpenIPC/msposd/pull/29) --- .gitignore | 2 +- Makefile | 13 +++---------- build.sh | 17 ++++++++--------- osd/util/Render_x86.c | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 0479511..fcdebf0 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,6 @@ msposd_goke msposd_hisi msposd_star6b0 msposd_star6e -msposd_x86 +msposd serial_monitor.c version.h diff --git a/Makefile b/Makefile index f5a1768..ffcfeea 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ version.h: all: version.h clean: - rm -f *.o msposd_x86 msposd_goke msposd_hisi msposd_star6b0 msposd_star6e + rm -f *.o msposd msposd_goke msposd_hisi msposd_star6b0 msposd_star6e goke: version.h $(eval SDK = ./sdk/gk7205v300) @@ -45,17 +45,10 @@ star6e: version.h $(eval LIB = -lcam_os_wrapper -lm -lmi_rgn -lmi_sys -lmi_venc) $(BUILD) -jetson: version.h - $(eval SDK = ./sdk/gk7205v300) - $(eval CFLAGS += -D_x86 -D_jetson) - $(eval LIB = -lcsfml-graphics -lcsfml-window -lcsfml-system `pkg-config --libs cairo x11` -lm) - $(eval BUILD = $(CC) $(SRCS) -I $(SDK)/include -L $(DRV) $(CFLAGS) $(LIB) -levent_core -O0 -g -o $(OUTPUT)) - $(BUILD) - -x86: version.h +native: version.h $(eval SDK = ./sdk/gk7205v300) $(eval CFLAGS += -D_x86) $(eval LIB = -lcsfml-graphics -lcsfml-window -lcsfml-system `pkg-config --libs cairo x11` -lm) - $(eval BUILD = $(CC) $(SRCS) -I $(SDK)/include -L $(DRV) $(CFLAGS) $(LIB) -levent_core -O0 -g -o $(OUTPUT)) $(BUILD) + diff --git a/build.sh b/build.sh index 40ebba2..21722fb 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,10 @@ #!/bin/bash DL="https://github.com/OpenIPC/firmware/releases/download/toolchain/toolchain" +if [ "$#" -ne 1 ]; then + echo "Usage: $0 [goke|hisi|star6b0|star6e|native]" + exit 1 +fi if [[ "$1" == *"star6b0" ]]; then CC=sigmastar-infinity6b0 @@ -13,15 +17,16 @@ elif [[ "$1" == *"hisi" ]]; then fi GCC=$PWD/toolchain/$CC/bin/arm-linux-gcc -OUT=msposd_$1 +OUT=msposd -if [[ "$1" != *"jetson"* && "$1" != *"x86"* ]]; then +if [[ "$1" != *"native"* ]]; then if [ ! -e toolchain/$CC ]; then wget -c -q --show-progress $DL.$CC.tgz -P $PWD mkdir -p toolchain/$CC tar -xf toolchain.$CC.tgz -C toolchain/$CC --strip-components=1 || exit 1 rm -f $CC.tgz fi + OUT=msposd_$1 fi @@ -41,13 +46,7 @@ elif [ "$1" = "star6b0" ]; then elif [ "$1" = "star6e" ]; then DRV=$PWD/firmware/general/package/sigmastar-osdrv-infinity6e/files/lib make -B CC=$GCC DRV=$DRV TOOLCHAIN=$PWD/toolchain/$CC OUTPUT=$OUT $1 -elif [ "$1" = "jetson" ]; then - DRV=$PWD - make DRV=$DRV OUTPUT=$OUT $1 -elif [ "$1" = "x86" ]; then +else DRV=$PWD make DRV=$DRV OUTPUT=$OUT $1 -else - echo "Usage: $0 [goke|hisi|star6b0|star6e|jetson|x86]" - exit 1 fi diff --git a/osd/util/Render_x86.c b/osd/util/Render_x86.c index 4bc010c..a49942b 100644 --- a/osd/util/Render_x86.c +++ b/osd/util/Render_x86.c @@ -75,7 +75,7 @@ int Init_x86(uint16_t *width, uint16_t *height) { #endif -#ifdef _jetson +#ifdef _x86 if (getenv("DISPLAY") == NULL) { /* * Use default display screen, especially launch from console From 58a07d63a9a23d68c1172468858391a962e3e8d8 Mon Sep 17 00:00:00 2001 From: Daniel Li Date: Tue, 26 Nov 2024 16:44:29 +0800 Subject: [PATCH 2/3] Fix workflow-build for adding native build --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 548f6b1..5e5363c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: ./build.sh hisi ./build.sh star6b0 ./build.sh star6e - ./build.sh x86 + ./build.sh native - name: Upload binary uses: actions/upload-artifact@v4 @@ -35,7 +35,7 @@ jobs: msposd_hisi msposd_star6b0 msposd_star6e - msposd_x86 + msposd - name: Versioned release if: startsWith(github.ref, 'refs/tags/') @@ -46,7 +46,7 @@ jobs: msposd_hisi msposd_star6b0 msposd_star6e - msposd_x86 + msposd - name: Upload latest if: github.ref == 'refs/heads/main' && github.event_name == 'push' @@ -58,4 +58,4 @@ jobs: msposd_hisi msposd_star6b0 msposd_star6e - msposd_x86 + msposd From a4ff7f61675b78f06289a29eb5e1ec31ba552824 Mon Sep 17 00:00:00 2001 From: Daniel Li Date: Wed, 27 Nov 2024 15:59:10 +0800 Subject: [PATCH 3/3] Optimize setenv for native build --- osd/util/Render_x86.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/osd/util/Render_x86.c b/osd/util/Render_x86.c index a49942b..28680dd 100644 --- a/osd/util/Render_x86.c +++ b/osd/util/Render_x86.c @@ -73,20 +73,11 @@ int Init_x86(uint16_t *width, uint16_t *height) { #ifdef _DEBUG_x86 forcefullscreen=false; #endif - #ifdef _x86 - if (getenv("DISPLAY") == NULL) { - /* - * Use default display screen, especially launch from console - * ToDo: x86 linux should implement this code also, test needed. - */ - setenv("DISPLAY", ":0", 1); - } + setenv("DISPLAY", ":0", 0); #endif - - display = XOpenDisplay(NULL); if (!display) { fprintf(stderr, "Cannot open display\n");