Skip to content

fix(hailo): build Hailo-Ollama from hailo_model_zoo_genai via cmake (real repo)#1850

Merged
jaylfc merged 1 commit into
devfrom
fix/hailo-real-repo-build
Jul 16, 2026
Merged

fix(hailo): build Hailo-Ollama from hailo_model_zoo_genai via cmake (real repo)#1850
jaylfc merged 1 commit into
devfrom
fix/hailo-real-repo-build

Conversation

@jaylfc

@jaylfc jaylfc commented Jul 16, 2026

Copy link
Copy Markdown
Owner

The installer defaulted HAILO_OLLAMA_REPO to hailo-ai/hailo-ollama, which does not exist (git ls-remote: Repository not found), so every Hailo-10H install failed at clone. Hailo-Ollama is not a standalone repo: it ships inside hailo-ai/hailo_model_zoo_genai and is built from source there (C++ on HailoRT, per its README).

  • Repo -> hailo_model_zoo_genai, pinned to 1a3ba6be.
  • Build -> the repo's actual cmake flow (configure/build/install) + the C++ toolchain and OpenSSL deps; cmake --install lands the hailo-ollama binary in /usr/local/bin.
  • Start bare (no serve --port); port via OLLAMA_HOST=127.0.0.1:7836 (off the banned default 8000), per the repo's docs/USAGE.rst.

Not hardware-tested locally (no Hailo-10H here); validated by bash -n + the upstream build docs. doc62fr (#1771) validates live and reports logs.

Summary by CodeRabbit

  • Improvements
    • Updated the Hailo Ollama installation process to use a pinned, reproducible source version.
    • Replaced the previous Python-based setup with a CMake build and system-wide installation.
    • Improved service startup and port configuration for more reliable operation.
    • Enhanced cleanup of orphaned Hailo Ollama processes during service restarts.

…istent repo

The installer defaulted HAILO_OLLAMA_REPO to hailo-ai/hailo-ollama, which does
not exist (git ls-remote: Repository not found), so every Hailo-10H install
failed at clone. The Hailo-Ollama server is not a standalone repo: it ships
inside hailo-ai/hailo_model_zoo_genai and is built from source there (its
README: an Ollama-compatible API written in C++ on top of HailoRT).

- Point the repo at hailo_model_zoo_genai, pinned to a real commit.
- Replace the Python venv/pip build with the repo's actual cmake flow
  (configure -> build -> install), adding the C++ toolchain + OpenSSL deps.
  cmake --install lands the hailo-ollama binary in /usr/local/bin and manifests
  under /usr/local/share/hailo-ollama.
- Resolve the binary from PATH (system install), not a venv.
- Start the server bare (it has no serve subcommand or --port flag) and set the
  listen port via OLLAMA_HOST (bind 127.0.0.1 on the managed port 7836, off the
  banned default 8000), per the repo's docs/USAGE.rst.

Not hardware-tested locally (no Hailo-10H here); validated by bash -n and the
upstream build docs. doc62fr (#1771) tests live on real hardware and reports logs.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Hailo installer now clones a pinned hailo_model_zoo_genai commit, builds hailo-ollama with CMake, installs it system-wide, and configures systemd to run the installed binary with OLLAMA_HOST.

Changes

Hailo Ollama installation

Layer / File(s) Summary
Pinned source and CMake installation
scripts/install-hailo.sh
The installer uses a pinned hailo_model_zoo_genai commit, builds with CMake, installs system-wide, and resolves the executable from PATH or /usr/local/bin.
Installed binary service wiring
scripts/install-hailo.sh
The systemd unit starts the installed binary directly, sets OLLAMA_HOST, and reaps orphan processes by matching the binary path.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • jaylfc/taOS#1803: Modifies the same installer’s source, build, binary resolution, and systemd wiring.
  • jaylfc/taOS#1807: Chains Hailo-10H install gating into this installer’s --yes execution path.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: switching Hailo-Ollama to build from the real hailo_model_zoo_genai repository via CMake.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hailo-real-repo-build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jaylfc
jaylfc enabled auto-merge (squash) July 16, 2026 16:55
@gitar-bot

gitar-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

Comment thread scripts/install-hailo.sh
cmake build-essential libssl-dev >/dev/null

log "configuring hailo-ollama build (cmake, Release)"
run_as_user sh -c "cd '$HAILO_OLLAMA_DIR' && cmake -B build -DCMAKE_BUILD_TYPE=Release"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Configuring from the repo top-level may not build the hailo-ollama server.

hailo_model_zoo_genai is a large meta-repo; its top-level CMakeLists.txt may build the entire GenAI zoo (or nothing relevant) rather than the C++ hailo-ollama server, or the server may live in a subdirectory (e.g. hailo-ollama/) that needs its own configure flag or that is disabled by default. A top-level cmake -B build could either fail (if it pulls in Python/GPU deps) or succeed while producing no hailo-ollama binary, and resolve_bin would then die. Since this path was not hardware-tested, please confirm against the tester's live install (#1771) that this exact top-level configure produces hailo-ollama in build/bin (or adjust the working directory / flags to the server's own CMake project).


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread scripts/install-hailo.sh
log "compiling hailo-ollama (C++; can take several minutes on the Pi)"
run_as_user sh -c "cd '$HAILO_OLLAMA_DIR' && cmake --build build --config Release"
log "installing hailo-ollama system-wide (cmake --install, needs sudo)"
sudo cmake --install "$HAILO_OLLAMA_DIR/build"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: cmake --install has no prefix or target selection.

Running cmake --install without -DCMAKE_INSTALL_PREFIX=... and without a target (--component/--target) installs whatever install rules the whole repo defines into /usr/local. For a meta-repo like hailo_model_zoo_genai that may install far more than the hailo-ollama binary (headers, manifests, other tools), polluting the system and widening the attack/footprint surface. Consider pinning the prefix (e.g. CMAKE_INSTALL_PREFIX=/usr/local explicitly) and, if the CMake project exposes a component/target for just the server, installing only that. Also note this step requires root and writes to /usr/local — the binary ends up root-owned, which is acceptable but worth being deliberate about.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

Comment thread scripts/install-hailo.sh
# Match the installed binary path, not any command line merely containing
# "hailo-ollama" (which would kill an editor or tail open on these files).
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN serve --port $HAILO_OLLAMA_PORT"
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: pkill -9 -f "$HAILO_OLLAMA_BIN" now matches only the bare binary path.

Previously the pattern included serve --port $HAILO_OLLAMA_PORT, so it targeted the specific daemon invocation. Now it matches any process whose full command line contains the binary path (e.g. hailo-ollama). This is more robust for reaping orphans, but be aware it will also kill the cmake --install-launched process or any manual hailo-ollama run if one is live during a restart. The - prefix tolerates "no process found", so a no-match won't fail the unit. Low risk, just confirming intent and that no unrelated process legitimately runs this exact path under the target user.


Reply with @kilocode-bot fix it to have Kilo Code address this issue.

@kilo-code-bot

kilo-code-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
scripts/install-hailo.sh 332 Top-level cmake -B build may not actually build the hailo-ollama server in the hailo_model_zoo_genai meta-repo; verify it produces the binary (untested on hardware).

SUGGESTION

File Line Issue
scripts/install-hailo.sh 336 cmake --install has no prefix/target selection and may install many repo artifacts into /usr/local.
scripts/install-hailo.sh 382 pkill -f "$HAILO_OLLAMA_BIN" now matches only the bare binary path (broader match, low risk).
Files Reviewed (1 files)
  • scripts/install-hailo.sh - 3 issues

Fix these issues in Kilo Cloud


Reviewed by hy3:free · Input: 70K · Output: 3.8K · Cached: 76.1K

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/install-hailo.sh`:
- Around line 376-382: Update the ExecStartPre pkill command to use exact
process-name matching with -x and pass the basename of HAILO_OLLAMA_BIN, rather
than matching the full command line or path. Preserve the existing pre-start
cleanup and non-failing behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 76bb0d9a-05ef-4307-9db3-44521cdeb85f

📥 Commits

Reviewing files that changed from the base of the PR and between 02c767f and 6f7a720.

📒 Files selected for processing (1)
  • scripts/install-hailo.sh

Comment thread scripts/install-hailo.sh
Comment on lines +376 to +382
Environment=OLLAMA_HOST=127.0.0.1:$HAILO_OLLAMA_PORT
# hailo-ollama can leave a bare orphan process listening on the port if it
# crashes during model load (the adopt-an-orphan lesson from PR #1755 for
# rkllama). Reap any such process before (re)start so the bind cannot fail.
# Match the exact server invocation, not any command line merely containing
# Match the installed binary path, not any command line merely containing
# "hailo-ollama" (which would kill an editor or tail open on these files).
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN serve --port $HAILO_OLLAMA_PORT"
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use exact process name matching (-x) to avoid killing editors.

The -f flag tells pkill to match the pattern against the full command line (i.e., argv), not just the executable path. Consequently, pkill -f "/usr/local/bin/hailo-ollama" will terminate commands like nano /usr/local/bin/hailo-ollama or tail -f /usr/local/bin/hailo-ollama because the string is present in their arguments, violating the explicit intent described in the comment.

To safely match the exact process and ignore arguments, use the exact process name matcher (-x) with the binary's basename. Process names in Linux are derived from the executable's basename.

🐛 Proposed fix
 Environment=OLLAMA_HOST=127.0.0.1:$HAILO_OLLAMA_PORT
 # hailo-ollama can leave a bare orphan process listening on the port if it
 # crashes during model load (the adopt-an-orphan lesson from PR `#1755` for
 # rkllama). Reap any such process before (re)start so the bind cannot fail.
-# Match the installed binary path, not any command line merely containing
-# "hailo-ollama" (which would kill an editor or tail open on these files).
-ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN"
+# Match the exact process name, not any command line merely containing the path
+# (which -f does, and would kill an editor or tail open on these files).
+ExecStartPre=-/usr/bin/pkill -9 -x "$(basename "$HAILO_OLLAMA_BIN")"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Environment=OLLAMA_HOST=127.0.0.1:$HAILO_OLLAMA_PORT
# hailo-ollama can leave a bare orphan process listening on the port if it
# crashes during model load (the adopt-an-orphan lesson from PR #1755 for
# rkllama). Reap any such process before (re)start so the bind cannot fail.
# Match the exact server invocation, not any command line merely containing
# Match the installed binary path, not any command line merely containing
# "hailo-ollama" (which would kill an editor or tail open on these files).
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN serve --port $HAILO_OLLAMA_PORT"
ExecStartPre=-/usr/bin/pkill -9 -f "$HAILO_OLLAMA_BIN"
Environment=OLLAMA_HOST=127.0.0.1:$HAILO_OLLAMA_PORT
# hailo-ollama can leave a bare orphan process listening on the port if it
# crashes during model load (the adopt-an-orphan lesson from PR `#1755` for
# rkllama). Reap any such process before (re)start so the bind cannot fail.
# Match the exact process name, not any command line merely containing the path
# (which -f does, and would kill an editor or tail open on these files).
ExecStartPre=-/usr/bin/pkill -9 -x "$(basename "$HAILO_OLLAMA_BIN")"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install-hailo.sh` around lines 376 - 382, Update the ExecStartPre
pkill command to use exact process-name matching with -x and pass the basename
of HAILO_OLLAMA_BIN, rather than matching the full command line or path.
Preserve the existing pre-start cleanup and non-failing behavior.

@jaylfc
jaylfc merged commit e54d25c into dev Jul 16, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant