Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Last active April 6, 2024 14:50
Show Gist options
  • Save hiroyuki-sato/9975936 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/9975936 to your computer and use it in GitHub Desktop.
おれおれVyOSの作り方。

VyOSの独自拡張の方法(ソースの修正は多分あってる)

ちょっとコマンド追加したVyOSを作りたいなという時に利用します。

カスタムパッケージの作成

自分のgithubなどにカスタムのvyatta-cfg-systemを作っておきます。 例では、https://github.com/hiroyuki-sato/vyatta-cfg-system.git を使います。

build-isoの取得

git clone https://github.com/vyos/build-iso.git

build-isoでカスタムモジュールを参照するように設定します。

cd build-iso

.gitmoduleをのURLを修正します。

vi  .gitmodules

次のようにURLを変更します。

[submodule "pkgs/vyatta-cfg-system"]
    path = pkgs/vyatta-cfg-system
    url = https://github.com/hiroyuki-sato/vyatta-cfg-system.git

git submodule syncコマンドを実行します。(必要?)

git submodule sync

パッケージを取得して、利用しているブランチをチェックアウトします。

git submodule init pkgs/vyatta-cfg-system  
git submodule update  pkgs/vyatta-cfg-system
git checkout -b branch_name origin/branch_name

修正をコミットします。

git commit 

変更は次のようになります。

diff --git a/.gitmodules b/.gitmodules
index 4ee2ec0..d708034 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -18,7 +18,7 @@
        url = https://github.com/vyos/vyatta-cfg-quagga.git
 [submodule "pkgs/vyatta-cfg-system"]
        path = pkgs/vyatta-cfg-system
-   url = https://github.com/vyos/vyatta-cfg-system.git
+ url = https://github.com/hiroyuki-sato/vyatta-cfg-system.git
 [submodule "pkgs/vyatta-config-migrate"]
        path = pkgs/vyatta-config-migrate
        url = https://github.com/vyos/vyatta-config-migrate.git
diff --git a/pkgs/vyatta-cfg-system b/pkgs/vyatta-cfg-system
index e256ce8..208381b 160000
--- a/pkgs/vyatta-cfg-system
+++ b/pkgs/vyatta-cfg-system
@@ -1 +1 @@
-Subproject commit e256ce86052957f41955470079820f3b5e29e44b
+Subproject commit 208381bee5f444782a78dc29c5254c095d2eed61

これでカスタマイズされたbuild-isoの設定は完了です。

build-isoの作成(これだとうまく行かない)

これだとうまく行かない。誰か教えてください。 一部だけ別のリポジトリから持ってくるのはどうしたら良いのでしょうか?

VYATTA_BUILD_BRANCHをmakeする前に設定しましょう。こうしないとパッケージの取得に失敗するようです。

export VYATTA_BUILD_BRANCH=helium
export PATH=/sbin:/usr/sbin:$PATH
autoreconf -i
./configure
sudo make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment