mirror of https://github.com/jetkvm/kvm.git
[WIP] Updates: update build flows to work with the CGO jetkvm_native
This commit is contained in:
parent
160a925f40
commit
bdcac6a468
|
@ -1,6 +1,10 @@
|
|||
{
|
||||
"name": "JetKVM",
|
||||
"image": "mcr.microsoft.com/devcontainers/go:1.25-trixie",
|
||||
"runArgs": [
|
||||
"--platform=linux/amd64"
|
||||
],
|
||||
"onCreateCommand": ".devcontainer/install-deps.sh",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": {
|
||||
// Should match what is defined in ui/package.json
|
||||
|
@ -10,7 +14,6 @@
|
|||
"mounts": [
|
||||
"source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached"
|
||||
],
|
||||
"onCreateCommand": ".devcontainer/install-deps.sh",
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
|
|
|
@ -16,7 +16,7 @@ sudo apt-get update && \
|
|||
sudo apt-get install -y --no-install-recommends \
|
||||
build-essential \
|
||||
device-tree-compiler \
|
||||
gperf g++-multilib gcc-multilib \
|
||||
gperf \
|
||||
libnl-3-dev libdbus-1-dev libelf-dev libmpc-dev dwarves \
|
||||
bc openssl flex bison libssl-dev python3 python-is-python3 texinfo kmod cmake \
|
||||
wget zstd \
|
||||
|
@ -30,6 +30,21 @@ pushd "${BUILDKIT_TMPDIR}" > /dev/null
|
|||
|
||||
wget https://github.com/jetkvm/rv1106-system/releases/download/${BUILDKIT_VERSION}/buildkit.tar.zst && \
|
||||
sudo mkdir -p /opt/jetkvm-native-buildkit && \
|
||||
sudo tar --use-compress-program="unzstd --long=31" -xvf buildkit.tar.zst -C /opt/jetkvm-native-buildkit && \
|
||||
sudo tar --use-compress-program="zstd -d --long=31" -xvf buildkit.tar.zst -C /opt/jetkvm-native-buildkit && \
|
||||
rm buildkit.tar.zst
|
||||
popd
|
||||
|
||||
# Install audio dependencies (ALSA and Opus) for JetKVM
|
||||
echo "Installing JetKVM audio dependencies..."
|
||||
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
|
||||
PROJECT_ROOT="$(dirname "${SCRIPT_DIR}")"
|
||||
AUDIO_DEPS_SCRIPT="${PROJECT_ROOT}/install_audio_deps.sh"
|
||||
|
||||
if [ -f "${AUDIO_DEPS_SCRIPT}" ]; then
|
||||
echo "Running audio dependencies installation..."
|
||||
bash "${AUDIO_DEPS_SCRIPT}"
|
||||
echo "Audio dependencies installation completed."
|
||||
else
|
||||
echo "Warning: Audio dependencies script not found at ${AUDIO_DEPS_SCRIPT}"
|
||||
echo "Skipping audio dependencies installation."
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
# .devcontainer/install_audio_deps.sh
|
||||
# Build ALSA and Opus static libs for ARM in /opt/jetkvm-audio-libs
|
||||
set -e
|
||||
|
||||
# Accept version parameters or use defaults
|
||||
ALSA_VERSION="${1:-1.2.14}"
|
||||
OPUS_VERSION="${2:-1.5.2}"
|
||||
|
||||
AUDIO_LIBS_DIR="/opt/jetkvm-audio-libs"
|
||||
BUILDKIT_PATH="/opt/jetkvm-native-buildkit"
|
||||
BUILDKIT_FLAVOR="arm-rockchip830-linux-uclibcgnueabihf"
|
||||
CROSS_PREFIX="$BUILDKIT_PATH/bin/$BUILDKIT_FLAVOR"
|
||||
|
||||
mkdir -p "$AUDIO_LIBS_DIR"
|
||||
cd "$AUDIO_LIBS_DIR"
|
||||
|
||||
# Download sources
|
||||
[ -f alsa-lib-${ALSA_VERSION}.tar.bz2 ] || wget -N https://www.alsa-project.org/files/pub/lib/alsa-lib-${ALSA_VERSION}.tar.bz2
|
||||
[ -f opus-${OPUS_VERSION}.tar.gz ] || wget -N https://downloads.xiph.org/releases/opus/opus-${OPUS_VERSION}.tar.gz
|
||||
|
||||
# Extract
|
||||
[ -d alsa-lib-${ALSA_VERSION} ] || tar xf alsa-lib-${ALSA_VERSION}.tar.bz2
|
||||
[ -d opus-${OPUS_VERSION} ] || tar xf opus-${OPUS_VERSION}.tar.gz
|
||||
|
||||
# Optimization flags for ARM Cortex-A7 with NEON (simplified to avoid FD_SETSIZE issues)
|
||||
OPTIM_CFLAGS="-O2 -mfpu=neon -mtune=cortex-a7 -mfloat-abi=hard"
|
||||
|
||||
export CC="${CROSS_PREFIX}-gcc"
|
||||
export CFLAGS="$OPTIM_CFLAGS"
|
||||
export CXXFLAGS="$OPTIM_CFLAGS"
|
||||
|
||||
# Build ALSA
|
||||
cd alsa-lib-${ALSA_VERSION}
|
||||
if [ ! -f .built ]; then
|
||||
chown -R $(whoami):$(whoami) .
|
||||
# Use minimal ALSA configuration to avoid FD_SETSIZE issues in devcontainer
|
||||
CFLAGS="$OPTIM_CFLAGS" ./configure --host $BUILDKIT_FLAVOR \
|
||||
--enable-static=yes --enable-shared=no \
|
||||
--with-pcm-plugins=rate,linear \
|
||||
--disable-seq --disable-rawmidi --disable-ucm \
|
||||
--disable-python --disable-old-symbols \
|
||||
--disable-topology --disable-hwdep --disable-mixer \
|
||||
--disable-alisp --disable-aload --disable-resmgr
|
||||
make -j$(nproc)
|
||||
touch .built
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Build Opus
|
||||
cd opus-${OPUS_VERSION}
|
||||
if [ ! -f .built ]; then
|
||||
chown -R $(whoami):$(whoami) .
|
||||
CFLAGS="$OPTIM_CFLAGS" ./configure --host $BUILDKIT_FLAVOR --enable-static=yes --enable-shared=no --enable-fixed-point
|
||||
make -j$(nproc)
|
||||
touch .built
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo "ALSA and Opus built in $AUDIO_LIBS_DIR"
|
|
@ -34,34 +34,37 @@ jobs:
|
|||
ALSA_VERSION=$(grep '^ALSA_VERSION' Makefile | cut -d'=' -f2 | tr -d ' ')
|
||||
OPUS_VERSION=$(grep '^OPUS_VERSION' Makefile | cut -d'=' -f2 | tr -d ' ')
|
||||
|
||||
# Get rv1106-system latest commit
|
||||
RV1106_COMMIT=$(git ls-remote https://github.com/jetkvm/rv1106-system.git HEAD | cut -f1)
|
||||
# Define buildkit path
|
||||
BUILDKIT_PATH="/opt/jetkvm-native-buildkit"
|
||||
BUILDKIT_FLAVOR="arm-rockchip830-linux-uclibcgnueabihf"
|
||||
|
||||
# Set environment variables
|
||||
echo "ALSA_VERSION=$ALSA_VERSION" >> $GITHUB_ENV
|
||||
echo "OPUS_VERSION=$OPUS_VERSION" >> $GITHUB_ENV
|
||||
echo "RV1106_COMMIT=$RV1106_COMMIT" >> $GITHUB_ENV
|
||||
echo "BUILDKIT_PATH=$BUILDKIT_PATH" >> $GITHUB_ENV
|
||||
echo "BUILDKIT_FLAVOR=$BUILDKIT_FLAVOR" >> $GITHUB_ENV
|
||||
|
||||
# Set outputs for use in other steps
|
||||
echo "alsa_version=$ALSA_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "opus_version=$OPUS_VERSION" >> $GITHUB_OUTPUT
|
||||
echo "rv1106_commit=$RV1106_COMMIT" >> $GITHUB_OUTPUT
|
||||
echo "buildkit_path=$BUILDKIT_PATH" >> $GITHUB_OUTPUT
|
||||
echo "buildkit_flavor=$BUILDKIT_FLAVOR" >> $GITHUB_OUTPUT
|
||||
|
||||
# Set resolved cache path
|
||||
CACHE_PATH="$HOME/.jetkvm/audio-libs"
|
||||
CACHE_PATH="/opt/jetkvm-audio-libs"
|
||||
echo "CACHE_PATH=$CACHE_PATH" >> $GITHUB_ENV
|
||||
echo "cache_path=$CACHE_PATH" >> $GITHUB_OUTPUT
|
||||
|
||||
echo "Extracted ALSA version: $ALSA_VERSION"
|
||||
echo "Extracted Opus version: $OPUS_VERSION"
|
||||
echo "Latest rv1106-system commit: $RV1106_COMMIT"
|
||||
echo "Buildkit path: $BUILDKIT_PATH"
|
||||
echo "Cache path: $CACHE_PATH"
|
||||
- name: Restore audio dependencies cache
|
||||
id: cache-audio-deps
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ steps.build-env.outputs.cache_path }}
|
||||
key: audio-deps-${{ runner.os }}-alsa-${{ steps.build-env.outputs.alsa_version }}-opus-${{ steps.build-env.outputs.opus_version }}-rv1106-${{ steps.build-env.outputs.rv1106_commit }}
|
||||
key: audio-deps-${{ runner.os }}-alsa-${{ steps.build-env.outputs.alsa_version }}-opus-${{ steps.build-env.outputs.opus_version }}-buildkit
|
||||
- name: Setup development environment
|
||||
if: steps.cache-audio-deps.outputs.cache-hit != 'true'
|
||||
run: make dev_env
|
||||
|
@ -87,7 +90,7 @@ jobs:
|
|||
GOOS: linux
|
||||
GOARCH: arm
|
||||
GOARM: 7
|
||||
CC: ${{ steps.build-env.outputs.cache_path }}/../rv1106-system/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc
|
||||
CC: ${{ steps.build-env.outputs.buildkit_path }}/bin/${{ steps.build-env.outputs.buildkit_flavor }}-gcc
|
||||
PKG_CONFIG_PATH: ${{ steps.build-env.outputs.cache_path }}/alsa-lib-${{ steps.build-env.outputs.alsa_version }}/utils:${{ steps.build-env.outputs.cache_path }}/opus-${{ steps.build-env.outputs.opus_version }}
|
||||
CGO_CFLAGS: "-O3 -mfpu=neon -mtune=cortex-a7 -mfloat-abi=hard -ftree-vectorize -ffast-math -funroll-loops -mvectorize-with-neon-quad -marm -D__ARM_NEON -I${{ steps.build-env.outputs.cache_path }}/alsa-lib-${{ steps.build-env.outputs.alsa_version }}/include -I${{ steps.build-env.outputs.cache_path }}/opus-${{ steps.build-env.outputs.opus_version }}/include -I${{ steps.build-env.outputs.cache_path }}/opus-${{ steps.build-env.outputs.opus_version }}/celt"
|
||||
CGO_LDFLAGS: "-L${{ steps.build-env.outputs.cache_path }}/alsa-lib-${{ steps.build-env.outputs.alsa_version }}/src/.libs -lasound -L${{ steps.build-env.outputs.cache_path }}/opus-${{ steps.build-env.outputs.opus_version }}/.libs -lopus -lm -ldl -static"
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
"cva",
|
||||
"cx"
|
||||
],
|
||||
"git.ignoreLimitWarning": true
|
||||
"git.ignoreLimitWarning": true,
|
||||
"cmake.ignoreCMakeListsMissing": true
|
||||
}
|
|
@ -26,7 +26,7 @@ Welcome to JetKVM development! This guide will help you get started quickly, whe
|
|||
- **[Git](https://git-scm.com/downloads)** for version control
|
||||
- **[SSH access](https://jetkvm.com/docs/advanced-usage/developing#developer-mode)** to your JetKVM device
|
||||
- **Audio build dependencies:**
|
||||
- **New:** The audio system uses a dual-subprocess architecture with CGO, ALSA, and Opus integration. You must run the provided scripts in `tools/` to set up the cross-compiler and build static ALSA/Opus libraries for ARM. See below.
|
||||
- **New:** The audio system uses a dual-subprocess architecture with CGO, ALSA, and Opus integration. The audio dependencies are automatically installed by the devcontainer or can be manually built using `.devcontainer/install_audio_deps.sh`.
|
||||
|
||||
|
||||
### Development Environment
|
||||
|
@ -37,12 +37,16 @@ Welcome to JetKVM development! This guide will help you get started quickly, whe
|
|||
|
||||
If you are developing on an Apple Silicon Mac, you should use a devcontainer to ensure compatibility with the JetKVM build environment (which targets linux/amd64 and ARM). There are two main options:
|
||||
|
||||
- **VS Code Dev Containers**: Open the project in VS Code and use the built-in Dev Containers support. The configuration is in `.devcontainer/devcontainer.json`.
|
||||
- **VS Code Dev Containers**: Open the project in VS Code and use the built-in Dev Containers support. The configuration in `.devcontainer/devcontainer.json` is set to use `linux/amd64` platform.
|
||||
- **Devpod**: [Devpod](https://devpod.sh/) is a fast, open-source tool for running devcontainers anywhere. If you use Devpod, go to **Settings → Experimental → Additional Environmental Variables** and add:
|
||||
- `DOCKER_DEFAULT_PLATFORM=linux/amd64`
|
||||
This ensures all builds run in the correct architecture.
|
||||
- **devcontainer CLI**: You can also use the [devcontainer CLI](https://github.com/devcontainers/cli) to launch the devcontainer from the terminal.
|
||||
|
||||
**Important:** If you're switching from an ARM64 devcontainer or updating the platform settings, you'll need to rebuild the devcontainer completely:
|
||||
- In VS Code: Run "Dev Containers: Rebuild Container" from the command palette
|
||||
- With devcontainer CLI: Use `devcontainer up --build`
|
||||
|
||||
This approach ensures compatibility with all shell scripts, build tools, and cross-compilation steps used in the project.
|
||||
|
||||
If you're using Windows, we strongly recommend using **WSL (Windows Subsystem for Linux)** for the best development experience:
|
||||
|
@ -68,8 +72,8 @@ This ensures compatibility with shell scripts and build tools used in the projec
|
|||
3. **Set up the cross-compiler and audio dependencies:**
|
||||
```bash
|
||||
make dev_env
|
||||
# This will run tools/setup_rv1106_toolchain.sh and tools/build_audio_deps.sh
|
||||
# It will clone the cross-compiler and build ALSA/Opus static libs in $HOME/.jetkvm
|
||||
# This will install audio dependencies using .devcontainer/install_audio_deps.sh
|
||||
# It will build ALSA/Opus static libs in /opt/jetkvm-audio-libs using the buildkit from /opt/jetkvm-native-buildkit
|
||||
#
|
||||
# **Note:** This is required for the audio subprocess architecture. If you skip this step, builds will not succeed.
|
||||
```
|
||||
|
@ -249,15 +253,12 @@ The project includes several essential Makefile targets for development environm
|
|||
```bash
|
||||
# Set up complete development environment (recommended first step)
|
||||
make dev_env
|
||||
# This runs setup_toolchain + build_audio_deps + installs Go tools
|
||||
# - Clones rv1106-system toolchain to $HOME/.jetkvm/rv1106-system
|
||||
# - Builds ALSA and Opus static libraries for ARM
|
||||
# This runs build_audio_deps + installs Go tools
|
||||
# - Uses buildkit from /opt/jetkvm-native-buildkit for cross-compilation
|
||||
# - Builds ALSA and Opus static libraries for ARM in /opt/jetkvm-audio-libs
|
||||
# - Installs goimports and other Go development tools
|
||||
|
||||
# Set up only the cross-compiler toolchain
|
||||
make setup_toolchain
|
||||
|
||||
# Build only the audio dependencies (requires setup_toolchain)
|
||||
# Build only the audio dependencies
|
||||
make build_audio_deps
|
||||
```
|
||||
|
||||
|
@ -267,7 +268,7 @@ make build_audio_deps
|
|||
# Build development version with debug symbols
|
||||
make build_dev
|
||||
# Builds jetkvm_app with version like 0.4.7-dev20241222
|
||||
# Requires: make dev_env (for toolchain and audio dependencies)
|
||||
# Requires: make dev_env (for buildkit and audio dependencies)
|
||||
|
||||
# Build release version (production)
|
||||
make build_release
|
||||
|
@ -334,7 +335,7 @@ The `dev_deploy.sh` script is the primary tool for deploying your development ch
|
|||
|
||||
**Requirements:**
|
||||
- SSH access to your JetKVM device
|
||||
- `make dev_env` must be run first (for toolchain and audio dependencies)
|
||||
- `make dev_env` must be run first (for buildkit and audio dependencies)
|
||||
- Device IP address or hostname
|
||||
|
||||
### API Testing
|
||||
|
@ -381,7 +382,7 @@ ssh root@<IP> echo "Connection OK"
|
|||
```bash
|
||||
# Make sure you have run:
|
||||
make dev_env
|
||||
# If you see errors about ALSA/Opus, check logs and re-run the setup scripts in tools/.
|
||||
# # If you see errors about ALSA/Opus, check logs and re-run: make build_audio_deps
|
||||
```
|
||||
|
||||
### "Frontend not updating"
|
||||
|
|
|
@ -6,6 +6,8 @@ ENV GOPATH=/go
|
|||
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
|
||||
|
||||
COPY install-deps.sh /install-deps.sh
|
||||
COPY install_audio_deps.sh /install_audio_deps.sh
|
||||
|
||||
RUN /install-deps.sh
|
||||
|
||||
# Create build directory
|
||||
|
|
17
Makefile
17
Makefile
|
@ -1,10 +1,6 @@
|
|||
# Clone the rv1106-system toolchain to $HOME/.jetkvm/rv1106-system
|
||||
setup_toolchain:
|
||||
bash tools/setup_rv1106_toolchain.sh
|
||||
|
||||
# Build ALSA and Opus static libs for ARM in $HOME/.jetkvm/audio-libs
|
||||
build_audio_deps: setup_toolchain
|
||||
bash tools/build_audio_deps.sh $(ALSA_VERSION) $(OPUS_VERSION)
|
||||
# Build ALSA and Opus static libs for ARM in /opt/jetkvm-audio-libs
|
||||
build_audio_deps:
|
||||
bash .devcontainer/install_audio_deps.sh $(ALSA_VERSION) $(OPUS_VERSION)
|
||||
|
||||
# Prepare everything needed for local development (toolchain + audio deps + Go tools)
|
||||
dev_env: build_audio_deps
|
||||
|
@ -13,8 +9,9 @@ dev_env: build_audio_deps
|
|||
go install golang.org/x/tools/cmd/goimports@latest
|
||||
@echo "Development environment ready."
|
||||
JETKVM_HOME ?= $(HOME)/.jetkvm
|
||||
TOOLCHAIN_DIR ?= $(JETKVM_HOME)/rv1106-system
|
||||
AUDIO_LIBS_DIR ?= $(JETKVM_HOME)/audio-libs
|
||||
BUILDKIT_PATH ?= /opt/jetkvm-native-buildkit
|
||||
BUILDKIT_FLAVOR ?= arm-rockchip830-linux-uclibcgnueabihf
|
||||
AUDIO_LIBS_DIR ?= /opt/jetkvm-audio-libs
|
||||
|
||||
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||
BUILDDATE ?= $(shell date -u +%FT%T%z)
|
||||
|
@ -41,7 +38,7 @@ OPTIM_CFLAGS := -O3 -mfpu=neon -mtune=cortex-a7 -mfloat-abi=hard -ftree-vectoriz
|
|||
export GOOS := linux
|
||||
export GOARCH := arm
|
||||
export GOARM := 7
|
||||
export CC := $(TOOLCHAIN_DIR)/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf-gcc
|
||||
export CC := $(BUILDKIT_PATH)/bin/$(BUILDKIT_FLAVOR)-gcc
|
||||
export CGO_ENABLED := 1
|
||||
export CGO_CFLAGS := $(OPTIM_CFLAGS) -I$(AUDIO_LIBS_DIR)/alsa-lib-$(ALSA_VERSION)/include -I$(AUDIO_LIBS_DIR)/opus-$(OPUS_VERSION)/include -I$(AUDIO_LIBS_DIR)/opus-$(OPUS_VERSION)/celt
|
||||
export CGO_LDFLAGS := -L$(AUDIO_LIBS_DIR)/alsa-lib-$(ALSA_VERSION)/src/.libs -lasound -L$(AUDIO_LIBS_DIR)/opus-$(OPUS_VERSION)/.libs -lopus -lm -ldl -static
|
||||
|
|
|
@ -17,8 +17,8 @@ import (
|
|||
)
|
||||
|
||||
/*
|
||||
#cgo CFLAGS: -I$HOME/.jetkvm/audio-libs/alsa-lib-$ALSA_VERSION/include -I$HOME/.jetkvm/audio-libs/opus-$OPUS_VERSION/include -I$HOME/.jetkvm/audio-libs/opus-$OPUS_VERSION/celt
|
||||
#cgo LDFLAGS: -L$HOME/.jetkvm/audio-libs/alsa-lib-$ALSA_VERSION/src/.libs -lasound -L$HOME/.jetkvm/audio-libs/opus-$OPUS_VERSION/.libs -lopus -lm -ldl -static
|
||||
#cgo CFLAGS: -I/opt/jetkvm-audio-libs/alsa-lib-$ALSA_VERSION/include -I/opt/jetkvm-audio-libs/opus-$OPUS_VERSION/include -I/opt/jetkvm-audio-libs/opus-$OPUS_VERSION/celt
|
||||
#cgo LDFLAGS: -L/opt/jetkvm-audio-libs/alsa-lib-$ALSA_VERSION/src/.libs -lasound -L/opt/jetkvm-audio-libs/opus-$OPUS_VERSION/.libs -lopus -lm -ldl -static
|
||||
|
||||
#include "c/audio.c"
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ show_help() {
|
|||
echo " --run-go-tests-only Run go tests and exit"
|
||||
echo " --skip-ui-build Skip frontend/UI build"
|
||||
echo " --skip-native-build Skip native build"
|
||||
echo " --disable-docker Disable docker build"
|
||||
echo " --disable-docker Disable docker build (auto-detected if Docker unavailable)"
|
||||
echo " -i, --install Build for release and install the app"
|
||||
echo " --help Display this help message"
|
||||
echo
|
||||
|
@ -106,15 +106,39 @@ if [ -z "$REMOTE_HOST" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# Auto-detect architecture requirements
|
||||
# check if the current CPU architecture is x86_64
|
||||
if [ "$(uname -m)" != "x86_64" ]; then
|
||||
msg_warn "Warning: This script is only supported on x86_64 architecture"
|
||||
BUILD_IN_DOCKER=true
|
||||
fi
|
||||
|
||||
# Auto-detect Docker availability and fallback if not available
|
||||
# This is especially useful in devcontainers where Docker-in-Docker might not be available
|
||||
if [ "$BUILD_IN_DOCKER" = true ]; then
|
||||
# Check if Docker is available and accessible
|
||||
if ! command -v docker &> /dev/null; then
|
||||
msg_warn "Docker command not found, disabling Docker build"
|
||||
msg_info "Building on host instead (equivalent to --disable-docker)"
|
||||
BUILD_IN_DOCKER=false
|
||||
elif ! docker info &> /dev/null; then
|
||||
msg_warn "Docker daemon not accessible (possibly in devcontainer without Docker socket), disabling Docker build"
|
||||
msg_info "Building on host instead (equivalent to --disable-docker)"
|
||||
BUILD_IN_DOCKER=false
|
||||
else
|
||||
msg_info "Docker is available and accessible"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$BUILD_IN_DOCKER" = true ]; then
|
||||
# Double-check Docker availability before building image
|
||||
if ! docker info &> /dev/null; then
|
||||
msg_warn "Docker daemon became unavailable, switching to host build"
|
||||
BUILD_IN_DOCKER=false
|
||||
else
|
||||
build_docker_image
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build the development version on the host
|
||||
# When using `make build_release`, the frontend will be built regardless of the `SKIP_UI_BUILD` flag
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
#!/bin/bash
|
||||
# tools/build_audio_deps.sh
|
||||
# Build ALSA and Opus static libs for ARM in $HOME/.jetkvm/audio-libs
|
||||
set -e
|
||||
|
||||
# Accept version parameters or use defaults
|
||||
ALSA_VERSION="${1:-1.2.14}"
|
||||
OPUS_VERSION="${2:-1.5.2}"
|
||||
|
||||
JETKVM_HOME="$HOME/.jetkvm"
|
||||
AUDIO_LIBS_DIR="$JETKVM_HOME/audio-libs"
|
||||
TOOLCHAIN_DIR="$JETKVM_HOME/rv1106-system"
|
||||
CROSS_PREFIX="$TOOLCHAIN_DIR/tools/linux/toolchain/arm-rockchip830-linux-uclibcgnueabihf/bin/arm-rockchip830-linux-uclibcgnueabihf"
|
||||
|
||||
mkdir -p "$AUDIO_LIBS_DIR"
|
||||
cd "$AUDIO_LIBS_DIR"
|
||||
|
||||
# Download sources
|
||||
[ -f alsa-lib-${ALSA_VERSION}.tar.bz2 ] || wget -N https://www.alsa-project.org/files/pub/lib/alsa-lib-${ALSA_VERSION}.tar.bz2
|
||||
[ -f opus-${OPUS_VERSION}.tar.gz ] || wget -N https://downloads.xiph.org/releases/opus/opus-${OPUS_VERSION}.tar.gz
|
||||
|
||||
# Extract
|
||||
[ -d alsa-lib-${ALSA_VERSION} ] || tar xf alsa-lib-${ALSA_VERSION}.tar.bz2
|
||||
[ -d opus-${OPUS_VERSION} ] || tar xf opus-${OPUS_VERSION}.tar.gz
|
||||
|
||||
# Optimization flags for ARM Cortex-A7 with NEON
|
||||
OPTIM_CFLAGS="-O3 -mfpu=neon -mtune=cortex-a7 -mfloat-abi=hard -ftree-vectorize -ffast-math -funroll-loops"
|
||||
|
||||
export CC="${CROSS_PREFIX}-gcc"
|
||||
export CFLAGS="$OPTIM_CFLAGS"
|
||||
export CXXFLAGS="$OPTIM_CFLAGS"
|
||||
|
||||
# Build ALSA
|
||||
cd alsa-lib-${ALSA_VERSION}
|
||||
if [ ! -f .built ]; then
|
||||
CFLAGS="$OPTIM_CFLAGS" ./configure --host arm-rockchip830-linux-uclibcgnueabihf --enable-static=yes --enable-shared=no --with-pcm-plugins=rate,linear --disable-seq --disable-rawmidi --disable-ucm
|
||||
make -j$(nproc)
|
||||
touch .built
|
||||
fi
|
||||
cd ..
|
||||
|
||||
# Build Opus
|
||||
cd opus-${OPUS_VERSION}
|
||||
if [ ! -f .built ]; then
|
||||
CFLAGS="$OPTIM_CFLAGS" ./configure --host arm-rockchip830-linux-uclibcgnueabihf --enable-static=yes --enable-shared=no --enable-fixed-point
|
||||
make -j$(nproc)
|
||||
touch .built
|
||||
fi
|
||||
cd ..
|
||||
|
||||
echo "ALSA and Opus built in $AUDIO_LIBS_DIR"
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
# tools/setup_rv1106_toolchain.sh
|
||||
# Clone the rv1106-system toolchain to $HOME/.jetkvm/rv1106-system if not already present
|
||||
set -e
|
||||
JETKVM_HOME="$HOME/.jetkvm"
|
||||
TOOLCHAIN_DIR="$JETKVM_HOME/rv1106-system"
|
||||
REPO_URL="https://github.com/jetkvm/rv1106-system.git"
|
||||
|
||||
mkdir -p "$JETKVM_HOME"
|
||||
if [ ! -d "$TOOLCHAIN_DIR" ]; then
|
||||
echo "Cloning rv1106-system toolchain to $TOOLCHAIN_DIR ..."
|
||||
git clone --depth 1 "$REPO_URL" "$TOOLCHAIN_DIR"
|
||||
else
|
||||
echo "Toolchain already present at $TOOLCHAIN_DIR"
|
||||
fi
|
Loading…
Reference in New Issue