From fb407961046dff6f79b788fd68ba3fa2280bac8e Mon Sep 17 00:00:00 2001 From: Daniel Li Date: Thu, 21 Nov 2024 03:02:21 +0800 Subject: [PATCH] Add jetson orin nano support (#23) --- Makefile | 7 +++++++ build.sh | 18 ++++++++++++------ msposd.c | 3 ++- osd/util/Render_x86.c | 15 ++++++++++++++- 4 files changed, 35 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d266acb..4d524bb 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,13 @@ star6e: $(eval LIB = -lcam_os_wrapper -lm -lmi_rgn -lmi_sys -lmi_venc) $(BUILD) +jetson: + $(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: $(eval SDK = ./sdk/gk7205v300) $(eval CFLAGS += -D_x86) diff --git a/build.sh b/build.sh index 40fe101..4d64670 100755 --- a/build.sh +++ b/build.sh @@ -14,13 +14,16 @@ fi GCC=$PWD/toolchain/$CC/bin/arm-linux-gcc OUT=msposd_$1 -if [ ! -e toolchain/$CC ]; then - wget -c -q --show-progress $DL/$CC.tgz -P $PWD - mkdir -p toolchain/$CC - tar -xf $CC.tgz -C toolchain/$CC --strip-components=1 || exit 1 - rm -f $CC.tgz +if [[ "$1" != *"jetson"* && "$1" != *"x86"* ]]; then + if [ ! -e toolchain/$CC ]; then + wget -c -q --show-progress $DL/$CC.tgz -P $PWD + mkdir -p toolchain/$CC + tar -xf $CC.tgz -C toolchain/$CC --strip-components=1 || exit 1 + rm -f $CC.tgz + fi fi + if [ ! -e firmware ]; then git clone https://github.com/openipc/firmware --depth=1 fi @@ -37,10 +40,13 @@ 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 DRV=$PWD make DRV=$DRV OUTPUT=$OUT $1 else - echo "Usage: $0 [goke|hisi|star6b0|star6e]" + echo "Usage: $0 [goke|hisi|star6b0|star6e|jetson|x86]" exit 1 fi diff --git a/msposd.c b/msposd.c index 4765e27..8b51a23 100644 --- a/msposd.c +++ b/msposd.c @@ -1200,6 +1200,7 @@ int main(int argc, char **argv) printf("Ver: %s\n", VERSION_STRING); int opt; + int r; int long_index = 0; int rc_channel_no = 0; @@ -1255,7 +1256,7 @@ int main(int argc, char **argv) break; case 'r': - int r=atoi(optarg); + r=atoi(optarg); if (r>100){ enable_fast_layout=true; r=r%100; diff --git a/osd/util/Render_x86.c b/osd/util/Render_x86.c index 69ff4c5..4bc010c 100644 --- a/osd/util/Render_x86.c +++ b/osd/util/Render_x86.c @@ -73,7 +73,20 @@ int Init_x86(uint16_t *width, uint16_t *height) { #ifdef _DEBUG_x86 forcefullscreen=false; #endif - + + +#ifdef _jetson + 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); + } +#endif + + + display = XOpenDisplay(NULL); if (!display) { fprintf(stderr, "Cannot open display\n");