概要
Friendlywrtをビルドして、eBPFを使えるようにできるるかを試す。
手順
を見て進めていく。
対象ボードはnano pi neoなので、
FriendlyWrt for H3
を参照。
まずはソースコードを取得する。
取得できたら解凍して、手順に沿ってrepoする。
git clone https://github.com/friendlyarm/repo --depth 1
sudo cp repo/repo /usr/bin/
tar xvf /path/to/netdisk/sources/friendlywrt-h3-20190101.tar
cd friendlywrt-h3
repo sync -l --no-clone-bundle
ここでPythonエラー発生
Traceback (most recent call last):
File "/media/data/work/friendlywrt/friendlywrt-h3/.repo/repo/main.py", line 19, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
python3.12系の対応によって無くなったimpやformatterがエラーになる。
ちょこちょこ手直しするけど、らちが開かないので、
を参考にさせていただいて、pyenvで古い環境を使う。
curl https://pyenv.run | bash
すると、~/.bash_profile(~/.bashrc)にパスを追加してシェルを再起動するように言われるので、そうする
export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init - bash)"
pyenvにパスが通ったら、使いたいpythonをinstall
pyenv install 3.8.2
pyenv install 3.12.3
pyenv global 3.12.3
pyenv local 3.8.2
python --version
Python 3.8.2
これでrepo syncをリトライ
$repo sync -l --no-clone-bundle
/media/data/work/friendlywrt/friendlywrt-h3/.repo/repo/main.py:19: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
Updating files: 100% (61515/61515), done.es: 25% (15513/61515)
Syncing work tree: 100% (8/8), done.
ワーニング出るけど成功。
ここまで書いておいて、これはdockerコンテナ内でやったほうがいいなと思ったので、一旦中断。
のリンク先のDockerコンテナを使うと良さそう。
私はUbutnu20.04のDockerコンテナに必要なパッケージを入れて対応した。
UbuntuへのDockerインストールは
を参照。ちらっと見るとちょっと変わっているように見えるので、
改めてDockerとcomposeのインストールの手順をまとめたい。
Dockerコンテナ内だと、
$repo sync -l --no-clone-bundle
は問題なく成功?する。新しいPythonに対応できてないという問題はある気がしますが。。
で環境構築して、ビルド実行
wget -O - https://raw.githubusercontent.com/friendlyarm/build-env-on-ubuntu-bionic/master/install.sh | bash
./build.sh nanopi_r1.mk
このあと、
uboot src: /home/build/src/friendlywrt-h3/u-boot File "<string>",
line 1 from distutils import sysconfig as s; print s.get_config_vars()['INCLUDEPY']
のようなエラーが出たら、コンテナ内のPythonがPython2にできていないので、
渋々
sudo apt-get install python-is-python2
すると回避できる。解決はしていない。
その後ビルドが進むと
INSTALL sound/usb/line6/snd-usb-toneport.ko
INSTALL sound/usb/line6/snd-usb-variax.ko
INSTALL sound/usb/misc/snd-ua101.ko
INSTALL sound/usb/snd-usb-audio.ko
INSTALL sound/usb/snd-usbmidi-lib.ko
DEPMOD 4.14.111
Cloning into 'wireguard'...
fatal: unable to access 'https://git.zx2c4.com/wireguard-linux-compat/': The requested URL returned error: 500
というエラーが出た。
ここへのアクセスがタイムアウトになる様子。
https://git.zx2c4.com/wireguard-linux-compat/
grepしてみる。
grep -R "wireguard-linux-compat" -n .
./scripts/sd-fuse/build-kernel.sh:185: git clone https://git.zx2c4.com/wireguard-linux-compat -b master wireguard
直接git cloneしているので、ミラー先を以下に変えてみる
# wireguard
(cd ${OUT} && {
if [ ! -d wireguard ]; then
git clone https://github.com/WireGuard/wireguard-linux-compat.git -b master wireguard
# git clone https://git.zx2c4.com/wireguard-linux-compat -b master wireguard
これでエラーは抜けれたけれど、
Cloning into './feeds/routing'...
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
failed.
次のエラー発生。
これはHTTP/2が切れているので、
git config --global http.version HTTP/1.1
で1.1固定する
次のエラーは
make[3]: Leaving directory '/home/build/src/friendlywrt-h3/friendlywrt/feeds/packages/utils/unzip'
time: package/feeds/packages/unzip/compile#0.09#0.14#0.31
yes
libtool: compile: arm-openwrt-linux-muslgnueabi-gcc -DHAVE_CONFIG_H -I. -I. -I. -I/home/build/src/friendlywrt-h3/friendlywrt/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/usr/include -I/home/build/src/friendlywrt-h3/friendlywrt/stag\
ing_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/include -I/home/build/src/friendlywrt-h3/friendlywrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.5.0_musl_eabi/usr/include -I/home/build/src/friendlywrt-h3/friendlywrt/staging_dir/to\
olchain-arm_cortex-a7+neon-vfpv4_gcc-7.5.0_musl_eabi/include/fortify -I/home/build/src/friendlywrt-h3/friendlywrt/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.5.0_musl_eabi/include -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts \
-Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -iremap/home/build/src/friendlywrt-h3/friendlywrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/popt-1.16:popt-1.16 -Wformat -Werror=format-security -fstack-p\
rotector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -fpic -Wall -W -D_GNU_SOURCE -D_REENTRANT -MT poptint.lo -MD -MP -MF .deps/poptint.Tpo -c poptint.c -fPIC -DPIC -o .libs/poptint.o
checking whether C compiler accepts -Wcomment... ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 Not Found
Download failed.
No more mirrors to try - giving up.
make[3]: *** [qca_ath10k.mk:11: /home/build/src/friendlywrt-h3/friendlywrt/dl/board-2.bin.ddcec9efd245da9365c474f513a855a55f3ac7fe] Error 2
make[3]: Leaving directory '/home/build/src/friendlywrt-h3/friendlywrt/package/firmware/linux-firmware'
qca_ath10k.mkで書かれている
board-2.bin
のダウンロード場所が古くて取れないらしい。
friendlywrt/package/firmware/linux-firmware/qca_ath10k.mk
のboard-2.binの新しい場所を更新することもできるが、いたちごっこっぽいので、
kernelのath10kを無効にして対応する
ここを見て、make menuconfigして、
module-ath関連を全部無効にする
./scripts/diffconfig.sh > ../configs/my_config
でデフォルトのコンフィグを置き換えて、再ビルドしたけれど、やはり
No more mirrors to try - giving up.
make[3]: *** [qca_ath10k.mk:11: /home/build/src/friendlywrt-h3/friendlywrt/dl/board-2.bin.ddcec9efd245da9365c474f513a855a55f3ac7fe] Error 2
になるので、今日はここまで。