From: Joseph Kogut <joseph.kogut@gmail.com>
To: buildroot@buildroot.org
Cc: Joseph Kogut <joseph.kogut@gmail.com>
Subject: [Buildroot] [PATCH v2] package/llama-cpp: new package
Date: Wed, 22 Oct 2025 10:35:02 -0700 [thread overview]
Message-ID: <20251022-llama-cpp-v2-1-c41a43382093@gmail.com> (raw)
Add a package for llama.cpp, a C/C++ LLM inference library, used in
popular projects like Ollama, RamaLama, and more.
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
---
I've bumped this package to the latest revision and I'm resending it for
review as a v2.
This patch adds a package for llama.cpp, an LLM inference library,
supporting many popular models, including LLaMa, Gemma, Deepseek, Qwen,
and many more.
This library includes tools that can be used for standalone inference,
like llama-cli and llama-server, as well as benchmarking, in
llama-bench. The library has a variety of software and hardware
accelerated backends, but this patch focuses on OpenBLAS and Vulkan
support to start.
The patch disables building for S390X and RISCV due to compilation
errors related to intrinsics, even though they're technically supported.
Older GCC versions are also problematic, and GCC > v9 is required.
As mentioned in the virglrenderer series, this package was used to test
virglrenderer with venus in a nested qemu guest using virtio-gpu.
https://lists.buildroot.org/pipermail/buildroot/2025-June/781395.html
The package was tested against all toolchains with utils/test-pkg:
40 builds, 28 skipped, 0 build failed, 0 legal-info failed, 0 show-info failed
Feedback welcome.
Thanks,
Joseph
---
Changes in v2:
- Bump version to b6818
- Link to v1: https://lore.kernel.org/r/20250619-llama-cpp-v1-1-0d4fe6710102@gmail.com
---
DEVELOPERS | 1 +
package/Config.in | 1 +
package/llama-cpp/Config.in | 36 +++++++++++++++++++++++++++++++++
package/llama-cpp/llama-cpp.hash | 4 ++++
package/llama-cpp/llama-cpp.mk | 43 ++++++++++++++++++++++++++++++++++++++++
5 files changed, 85 insertions(+)
diff --git a/DEVELOPERS b/DEVELOPERS
index 9e31f6b515..157e3d3149 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1762,6 +1762,7 @@ F: package/at-spi2-core/
F: package/earlyoom/
F: package/gconf/
F: package/libnss/
+F: package/llama-cpp/
F: package/llvm-project/clang/
F: package/llvm-project/lld/
F: package/llvm-project/llvm/
diff --git a/package/Config.in b/package/Config.in
index 10f6856dea..97cd5c616a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2299,6 +2299,7 @@ comment "linux-pam plugins"
source "package/libpam-tacplus/Config.in"
endif
source "package/liquid-dsp/Config.in"
+ source "package/llama-cpp/Config.in"
source "package/llvm-project/llvm/Config.in"
source "package/lttng-libust/Config.in"
source "package/matio/Config.in"
diff --git a/package/llama-cpp/Config.in b/package/llama-cpp/Config.in
new file mode 100644
index 0000000000..5bba0067cf
--- /dev/null
+++ b/package/llama-cpp/Config.in
@@ -0,0 +1,36 @@
+config BR2_PACKAGE_LLAMA_CPP
+ bool "llama.cpp"
+ depends on BR2_TOOLCHAIN_USES_GLIBC || BR2_TOOLCHAIN_USES_MUSL
+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_9
+ depends on !BR2_s390x
+ depends on !BR2_riscv
+ help
+ LLM inference in C/C++
+
+comment "llama-cpp needs glibc or musl toolchain w/ c++, gcc >= 9"
+ depends on !BR2_INSTALL_LIBSTDCPP \
+ || !BR2_TOOLCHAIN_GCC_AT_LEAST_9 \
+ || (!BR2_TOOLCHAIN_USES_GLIBC && !BR2_TOOLCHAIN_USES_MUSL)
+
+if BR2_PACKAGE_LLAMA_CPP
+
+config BR2_PACKAGE_LLAMA_CPP_TOOLS
+ bool "Enable tools"
+ help
+ Build CLI tools like llama-cli, llama-bench, etc.
+
+config BR2_PACKAGE_LLAMA_CPP_SERVER
+ bool "Enable server"
+ help
+ Build OpenAI API-compatible web server, llama-server.
+
+config BR2_PACKAGE_LLAMA_CPP_VULKAN
+ bool "Vulkan support"
+ depends on BR2_INSTALL_LIBSTDCPP # vulkan-loader
+ depends on !BR2_STATIC_LIBS # vulkan-loader
+ depends on BR2_TOOLCHAIN_HAS_THREADS # vulkan-loader
+ select BR2_PACKAGE_VULKAN_HEADERS
+ select BR2_PACKAGE_VULKAN_LOADER
+ help
+ Enable Vulkan backend for GPU acceleration.
+endif
diff --git a/package/llama-cpp/llama-cpp.hash b/package/llama-cpp/llama-cpp.hash
new file mode 100644
index 0000000000..9eb950a5c7
--- /dev/null
+++ b/package/llama-cpp/llama-cpp.hash
@@ -0,0 +1,4 @@
+# Locally calculated
+sha256 44fb7508b578d7e263fb4c5ef8252f406cb5951a9891c107ee8553a5f1b2e186 b6818.tar.gz
+# License
+sha256 e562a2ddfaf8280537795ac5ecd34e3012b6582a147ef69ba6a6a5c08c84757d LICENSE
diff --git a/package/llama-cpp/llama-cpp.mk b/package/llama-cpp/llama-cpp.mk
new file mode 100644
index 0000000000..92dde059d2
--- /dev/null
+++ b/package/llama-cpp/llama-cpp.mk
@@ -0,0 +1,43 @@
+################################################################################
+#
+# llama.cpp
+#
+################################################################################
+
+LLAMA_CPP_VERSION = 6818
+LLAMA_CPP_SOURCE = b$(LLAMA_CPP_VERSION).tar.gz
+LLAMA_CPP_SITE = https://github.com/ggml-org/llama.cpp/archive/refs/tags
+LLAMA_CPP_LICENSE = MIT
+LLAMA_CPP_LICENSE_FILES = LICENSE
+LLAMA_CPP_INSTALL_STAGING = YES
+LLAMA_CPP_CONF_OPTS = \
+ -DLLAMA_BUILD_TESTS=OFF \
+ -DLLAMA_BUILD_EXAMPLES=OFF \
+ -DLLAMA_FATAL_WARNINGS=OFF
+
+ifeq ($(BR2_PACKAGE_CURL),y)
+LLAMA_CPP_CONF_OPTS += -DLLAMA_CURL=ON
+LLAMA_CPP_DEPENDENCIES += libcurl
+else
+LLAMA_CPP_CONF_OPTS += -DLLAMA_CURL=OFF
+endif
+
+ifeq ($(BR2_PACKAGE_LLAMA_CPP_TOOLS),y)
+LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_TOOLS=ON
+endif
+
+ifeq ($(BR2_PACKAGE_LLAMA_CPP_SERVER),y)
+LLAMA_CPP_CONF_OPTS += -DLLAMA_BUILD_SERVER=ON
+endif
+
+ifeq ($(BR2_PACKAGE_LLAMA_CPP_VULKAN),y)
+LLAMA_CPP_DEPENDENCIES += vulkan-loader
+LLAMA_CPP_CONF_OPTS += -DGGML_VULKAN=ON
+endif
+
+ifeq ($(BR2_PACKAGE_OPENBLAS),y)
+LLAMA_CPP_DEPENDENCIES += openblas
+LLAMA_CPP_CONF_OPTS += -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS
+endif
+
+$(eval $(cmake-package))
---
base-commit: f23c810176305604c54b79611d885547f4e45c23
change-id: 20250618-llama-cpp-d3fc28b4562f
Best regards,
--
Joseph Kogut <joseph.kogut@gmail.com>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2025-10-22 17:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-22 17:35 Joseph Kogut [this message]
2025-10-23 21:10 ` [Buildroot] [PATCH v2] package/llama-cpp: new package Julien Olivain via buildroot
2025-10-23 21:13 ` Joseph Kogut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251022-llama-cpp-v2-1-c41a43382093@gmail.com \
--to=joseph.kogut@gmail.com \
--cc=buildroot@buildroot.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox