Closed1

LLM_buildroot-external-m5stackのビルド手順

nnn112358nnn112358

https://github.com/m5stack/LLM_buildroot-external-m5stack

1. 必要なパッケージのインストール

まず、BuildRootの実行に必要な基本的な開発ツールをインストールします。

$ sudo apt install debianutils sed make binutils build-essential gcc g++ bash patch gzip bzip2 perl tar cpio unzip rsync file bc git

このコマンドでインストールされるツールには以下のような重要な要素が含まれています:

  • コンパイラ関連:gcc, g++, binutils
  • ビルドツール:make, build-essential
  • アーカイブツール:gzip, bzip2, tar, cpio, unzip
  • 基本ユーティリティ:sed, bash, perl, rsync, file
  • バージョン管理:git

2. ビルド環境の準備

M5Stack用のBuildRoot外部ツリーを取得します:

$ git clone https://github.com/m5stack/LLM_buildroot-external-m5stack
$ cd LLM_buildroot-external-m5stack/tools/

3. ビルドスクリプトの実行

toolsディレクトリには8種類のビルドスクリプトが用意されています。使用するモジュールに応じて適切なスクリプトを選択し実行します:
https://zenn.dev/nnn112358/scraps/5173a0b2daa496

$ ./creat_Module_LLM_buidlroot_image.sh

4. カスタム設定の適用

ビルド設定をカスタマイズする場合は、以下の手順で行います:
creat_Module_LLM_buidlroot_image.shに make menuconfigを追加します。

参考:
https://github.com/nnn112358/LLM_buildroot-external-m5stack/blob/main/tools/creat_Module_LLM_buidlroot_image.sh

$ vi ./creat_Module_LLM_buidlroot_image.sh
make_buildroot() {
    cd buildroot
    make BR2_EXTERNAL=../../.. m5stack_module_llm_4_19_defconfig
    
    # menuconfigを実行
    make menuconfig
    
    [[ -v ROOTFS_SIZE ]] && sed -i 's/^\(BR2_TARGET_ROOTFS_EXT2_SIZE=\).*$/\1"'"${ROOTFS_SIZE}"'"/' .config
    make -j `nproc`
}

menuconfig画面では、以下のような項目を設定できます:

  • Target options:ターゲットアーキテクチャの設定
  • Build options:ビルドオプションの設定
  • Toolchain:ツールチェーンの設定
  • System configuration:システム設定
  • Target packages:必要なパッケージの選択
  • Filesystem images:ファイルシステムイメージの設定

outputディレクトリにaxpファイルが生成されます。

このスクラップは2025/01/27にクローズされました