Merge pull request #65 from IRONICBo/fix/fix-ubuntu-build

This commit is contained in:
crispyberry
2026-02-19 23:16:40 +08:00
committed by GitHub
10 changed files with 359 additions and 2 deletions

25
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,25 @@
name: Build
on:
push:
branches:
- '**'
pull_request:
jobs:
idf-build:
runs-on: ubuntu-latest
container:
image: espressif/idf:v5.5.2
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build firmware (ESP32-S3)
shell: bash
run: |
. "$IDF_PATH/export.sh"
idf.py set-target esp32s3
idf.py fullclean
idf.py build

View File

@@ -54,6 +54,65 @@ cd mimiclaw
idf.py set-target esp32s3 idf.py set-target esp32s3
``` ```
<details>
<summary>Ubuntu Install</summary>
Recommended baseline:
- Ubuntu 22.04/24.04
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb-1.0-0`, `libffi-dev`, `libssl-dev`
Install and build on Ubuntu:
```bash
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv \
cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
./scripts/setup_idf_ubuntu.sh
./scripts/build_ubuntu.sh
```
</details>
<details>
<summary>macOS Install</summary>
Recommended baseline:
- macOS 12/13/14
- Xcode Command Line Tools
- Homebrew
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb`, `libffi`, `openssl`
Install and build on macOS:
```bash
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
./scripts/setup_idf_macos.sh
./scripts/build_macos.sh
```
</details>
### Configure ### Configure
MimiClaw uses a **two-layer config** system: build-time defaults in `mimi_secrets.h`, with runtime overrides via the serial CLI. CLI values are stored in NVS flash and take priority over build-time values. MimiClaw uses a **two-layer config** system: build-time defaults in `mimi_secrets.h`, with runtime overrides via the serial CLI. CLI values are stored in NVS flash and take priority over build-time values.

View File

@@ -54,6 +54,65 @@ cd mimiclaw
idf.py set-target esp32s3 idf.py set-target esp32s3
``` ```
<details>
<summary>Ubuntu 安装</summary>
建议基线:
- Ubuntu 22.04/24.04
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb-1.0-0``libffi-dev``libssl-dev`
Ubuntu 安装与构建:
```bash
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv \
cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
./scripts/setup_idf_ubuntu.sh
./scripts/build_ubuntu.sh
```
</details>
<details>
<summary>macOS 安装</summary>
建议基线:
- macOS 12/13/14
- Xcode Command Line Tools
- Homebrew
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb``libffi``openssl`
macOS 安装与构建:
```bash
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
./scripts/setup_idf_macos.sh
./scripts/build_macos.sh
```
</details>
### 配置 ### 配置
MimiClaw 使用**两层配置**`mimi_secrets.h` 提供编译时默认值,串口 CLI 可在运行时覆盖。CLI 设置的值存在 NVS Flash 中,优先级高于编译时值。 MimiClaw 使用**两层配置**`mimi_secrets.h` 提供编译时默认值,串口 CLI 可在运行时覆盖。CLI 设置的值存在 NVS Flash 中,优先级高于编译时值。

View File

@@ -54,6 +54,65 @@ cd mimiclaw
idf.py set-target esp32s3 idf.py set-target esp32s3
``` ```
<details>
<summary>Ubuntu インストール</summary>
推奨ベースライン:
- Ubuntu 22.04/24.04
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb-1.0-0`, `libffi-dev`, `libssl-dev`
Ubuntu でのインストールとビルド:
```bash
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv \
cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
./scripts/setup_idf_ubuntu.sh
./scripts/build_ubuntu.sh
```
</details>
<details>
<summary>macOS インストール</summary>
推奨ベースライン:
- macOS 12/13/14
- Xcode Command Line Tools
- Homebrew
- Python >= 3.10
- CMake >= 3.16
- Ninja >= 1.10
- Git >= 2.34
- flex >= 2.6
- bison >= 3.8
- gperf >= 3.1
- dfu-util >= 0.11
- `libusb`, `libffi`, `openssl`
macOS でのインストールとビルド:
```bash
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
./scripts/setup_idf_macos.sh
./scripts/build_macos.sh
```
</details>
### 設定 ### 設定
MimiClawは**2層設定**を採用しています:`mimi_secrets.h`でビルド時のデフォルト値を設定し、シリアルCLIで実行時にオーバーライドできます。CLI設定値はNVS Flashに保存され、ビルド時の値より優先されます。 MimiClawは**2層設定**を採用しています:`mimi_secrets.h`でビルド時のデフォルト値を設定し、シリアルCLIで実行時にオーバーライドできます。CLI設定値はNVS Flashに保存され、ビルド時の値より優先されます。

View File

@@ -2,7 +2,7 @@
dependencies: dependencies:
## Required IDF version ## Required IDF version
idf: idf:
version: '>=4.1.0' version: '>=5.5.0,<5.6.0'
# # Put list of dependencies here # # Put list of dependencies here
# # For components maintained by Espressif: # # For components maintained by Espressif:
# component: "~1.0.0" # component: "~1.0.0"

View File

@@ -7,7 +7,6 @@
#include "display/font5x7.h" #include "display/font5x7.h"
#include "wifi/wifi_manager.h" #include "wifi/wifi_manager.h"
#include "mimi_config.h" #include "mimi_config.h"
#include "mimi_secrets.h"
#include "nvs.h" #include "nvs.h"
#include "esp_log.h" #include "esp_log.h"

21
scripts/build_macos.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IDF_VERSION="${IDF_VERSION:-v5.5.2}"
ESP_ROOT="${ESP_ROOT:-$HOME/.espressif}"
DEFAULT_IDF_DIR="$ESP_ROOT/esp-idf-$IDF_VERSION"
IDF_DIR="${IDF_DIR:-${IDF_PATH:-$DEFAULT_IDF_DIR}}"
if [[ ! -f "$IDF_DIR/export.sh" ]]; then
echo "ESP-IDF not found at: $IDF_DIR" >&2
echo "Run scripts/setup_idf_macos.sh first, or set IDF_DIR/IDF_PATH." >&2
exit 1
fi
# shellcheck source=/dev/null
. "$IDF_DIR/export.sh"
cd "$PROJECT_ROOT"
idf.py set-target esp32s3
idf.py build

21
scripts/build_ubuntu.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IDF_VERSION="${IDF_VERSION:-v5.5.2}"
ESP_ROOT="${ESP_ROOT:-$HOME/.espressif}"
DEFAULT_IDF_DIR="$ESP_ROOT/esp-idf-$IDF_VERSION"
IDF_DIR="${IDF_DIR:-${IDF_PATH:-$DEFAULT_IDF_DIR}}"
if [[ ! -f "$IDF_DIR/export.sh" ]]; then
echo "ESP-IDF not found at: $IDF_DIR" >&2
echo "Run scripts/setup_idf_ubuntu.sh first, or set IDF_DIR/IDF_PATH." >&2
exit 1
fi
# shellcheck source=/dev/null
. "$IDF_DIR/export.sh"
cd "$PROJECT_ROOT"
idf.py set-target esp32s3
idf.py build

72
scripts/setup_idf_macos.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ "${OSTYPE:-}" != "darwin"* ]]; then
echo "This setup script currently supports macOS only." >&2
exit 1
fi
IDF_VERSION="${IDF_VERSION:-v5.5.2}"
ESP_ROOT="${ESP_ROOT:-$HOME/.espressif}"
IDF_DIR="${IDF_DIR:-$ESP_ROOT/esp-idf-$IDF_VERSION}"
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew not found. Install it first:" >&2
echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"" >&2
exit 1
fi
ensure_brew_pkg() {
local pkg="$1"
if brew list --formula --versions "$pkg" >/dev/null 2>&1; then
echo "brew: $pkg already installed, skipping"
else
if ! brew install "$pkg"; then
echo "warn: failed to install $pkg via brew; continuing" >&2
return 0
fi
fi
}
ensure_brew_pkg_if_missing_cmd() {
local pkg="$1"
local cmd="$2"
if command -v "$cmd" >/dev/null 2>&1; then
echo "cmd: $cmd already available, skipping brew $pkg"
else
ensure_brew_pkg "$pkg"
fi
}
ensure_brew_pkg_if_missing_cmd git git
ensure_brew_pkg_if_missing_cmd wget wget
ensure_brew_pkg_if_missing_cmd flex flex
ensure_brew_pkg_if_missing_cmd bison bison
ensure_brew_pkg_if_missing_cmd gperf gperf
ensure_brew_pkg_if_missing_cmd python python3
ensure_brew_pkg_if_missing_cmd cmake cmake
ensure_brew_pkg_if_missing_cmd ninja ninja
ensure_brew_pkg_if_missing_cmd ccache ccache
ensure_brew_pkg_if_missing_cmd dfu-util dfu-util
ensure_brew_pkg libusb
ensure_brew_pkg libffi
ensure_brew_pkg openssl@3
mkdir -p "$ESP_ROOT"
if [[ ! -d "$IDF_DIR/.git" ]]; then
git clone --depth 1 --branch "$IDF_VERSION" --recursive \
https://github.com/espressif/esp-idf.git "$IDF_DIR"
else
git -C "$IDF_DIR" fetch --tags --depth 1 origin "$IDF_VERSION"
git -C "$IDF_DIR" checkout "$IDF_VERSION"
git -C "$IDF_DIR" submodule update --init --recursive
fi
"$IDF_DIR/install.sh" esp32s3
echo
echo "ESP-IDF installed. For current shell run:"
echo " . \"$IDF_DIR/export.sh\""
echo "Then run from project root:"
echo " idf.py set-target esp32s3"
echo " idf.py build"

42
scripts/setup_idf_ubuntu.sh Executable file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ "${OSTYPE:-}" != "linux-gnu"* ]]; then
echo "This setup script currently supports Ubuntu/Debian only." >&2
exit 1
fi
IDF_VERSION="${IDF_VERSION:-v5.5.2}"
ESP_ROOT="${ESP_ROOT:-$HOME/.espressif}"
IDF_DIR="${IDF_DIR:-$ESP_ROOT/esp-idf-$IDF_VERSION}"
if [[ -f /etc/os-release ]]; then
. /etc/os-release
if [[ "${ID:-}" != "ubuntu" && "${ID_LIKE:-}" != *"debian"* ]]; then
echo "Detected ${PRETTY_NAME:-unknown}. Continuing, but package installation assumes apt." >&2
fi
fi
sudo apt-get update
sudo apt-get install -y \
git wget flex bison gperf python3 python3-pip python3-venv \
cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
mkdir -p "$ESP_ROOT"
if [[ ! -d "$IDF_DIR/.git" ]]; then
git clone --depth 1 --branch "$IDF_VERSION" --recursive \
https://github.com/espressif/esp-idf.git "$IDF_DIR"
else
git -C "$IDF_DIR" fetch --tags --depth 1 origin "$IDF_VERSION"
git -C "$IDF_DIR" checkout "$IDF_VERSION"
git -C "$IDF_DIR" submodule update --init --recursive
fi
"$IDF_DIR/install.sh" esp32s3
echo
echo "ESP-IDF installed. For current shell run:"
echo " . \"$IDF_DIR/export.sh\""
echo "Then run from project root:"
echo " idf.py set-target esp32s3"
echo " idf.py build"