Getting a rebuilt vtysh into the container in SONiC

118 views
Skip to first unread message

Chris Ward

unread,
Oct 27, 2021, 6:55:14 AM10/27/21
to sonicproject
I need to rebuild "vtysh", because I want it to support flags "-f -" to make it read from stdin which may be a pipe. I can see the source code and I can rebuild it in the source tree, but I can't see how to get my built binary into the resulting SONiC image. Can anyone help me with how to do this ? Thanks !

Masaru OKI

unread,
Oct 27, 2021, 11:23:29 AM10/27/21
to Chris Ward, sonicproject
vtysh is part of FRRouting.  Put patch into src/sonic-frr/patch and update src/sonic-frr/patch/series then build SONiC.

$ dpkg-deb -c target/debs/buster/frr_7.5.1-sonic-0_amd64.deb | grep vtysh
-rw-r--r-- root/root        32 2021-03-03 23:10 ./etc/frr/vtysh.conf
-rwxr-xr-x root/root   1153416 2021-03-03 23:10 ./usr/bin/vtysh
-rw-r--r-- root/root       128 2021-03-03 23:10 ./usr/share/doc/frr/examples/vtysh.conf.sample
-rw-r--r-- root/root      2212 2021-03-03 23:10 ./usr/share/man/man1/vtysh.1.gz
$

2021年10月27日(水) 19:55 Chris Ward <tjc...@gmail.com>:
I need to rebuild "vtysh", because I want it to support flags "-f -" to make it read from stdin which may be a pipe. I can see the source code and I can rebuild it in the source tree, but I can't see how to get my built binary into the resulting SONiC image. Can anyone help me with how to do this ? Thanks !

--
You received this message because you are subscribed to the Google Groups "sonicproject" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonicproject...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonicproject/edd3f126-24fe-421c-82d0-53186e19e7can%40googlegroups.com.

Chris Ward

unread,
Oct 27, 2021, 11:55:16 AM10/27/21
to sonicproject
vtysh is a one megabyte binary. I can build it (from source in frr plus my patch), but then I need to supply the binary so that 'patch' will find it. How do I do that ?

Chris Ward

unread,
Oct 28, 2021, 7:08:33 AM10/28/21
to sonicproject
I have added the patch ( my repo is https://github.com/tjcw/sonic-buildimage/tree/tjcw-fix-vtysh-for--f ) and attempted a build. The build fails with messages

dh clean --with=systemd,autoreconf --parallel
   dh_testdir -O--parallel
   debian/rules override_dh_auto_clean
make[3]: Entering directory '/sonic/src/sonic-frr/frr'
if test -f Makefile; then make redistclean; fi
make[4]: Entering directory '/sonic/src/sonic-frr/frr'
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /build/openstack/sonic-buildimage-vs/src/sonic-frr/frr/missing aclocal-1.16 -I m4
/bin/bash: /build/openstack/sonic-buildimage-vs/src/sonic-frr/frr/missing: No such file or directory
make[4]: *** [Makefile:4211: aclocal.m4] Error 127
make[4]: Leaving directory '/sonic/src/sonic-frr/frr'

Can anyone tell me what is wrong ?

Masaru OKI

unread,
Oct 28, 2021, 9:44:31 AM10/28/21
to Chris Ward, sonicproject
Umm, I have tried below and built it successfully.

 git clone https://github.com/tjcw/sonic-buildimage
 cd sonic-buildimage/
 git checkout tjcw-fix-vtysh-for--f
 make init
 make configure PLATFORM=vs
 make target/debs/buster/frr_7.5.1-sonic-0_amd64.deb

2021年10月28日(木) 20:08 Chris Ward <tjc...@gmail.com>:

Chris Ward

unread,
Oct 29, 2021, 12:12:06 PM10/29/21
to sonicproject
When I built completely afresh, the build worked. But I have another problem now; I constructed a patch in what I thought was the approved way, but I get an error message that makes no sense to me . Here is an extract from the build log :

Switched to a new branch 'frr/7.5'
Branch 'frr/7.5' set up to track remote branch 'frr/7.5' from 'origin'.
error: patch failed: vtysh/vtysh_config.c:505
error: vtysh/vtysh_config.c: patch does not apply
stg import: Diff does not apply cleanly
make[1]: *** [Makefile:11: /sonic/target/debs/buster/frr_7.5.1-sonic-0_amd64.deb] Error 2
make[1]: Leaving directory '/sonic/src/sonic-frr'
[  FAIL LOG END  ] [ target/debs/buster/frr_7.5.1-sonic-0_amd64.deb ]

Again my repository is  https://github.com/tjcw/sonic-buildimage/tree/tjcw-fix-vtysh-for--f .

Chris Ward

unread,
Nov 2, 2021, 5:35:44 AM11/2/21
to sonicproject
This turned out to be finger trouble; I had the sonic-frr repository at the 'master' branch rather than the 'frr/7.5' branch that I should have selected. All is well now.
Reply all
Reply to author
Forward
0 new messages