Avnu / OpenAvnu

OpenAvnu - an Avnu sponsored repository for Time Sensitive Network (TSN and AVB) technology
470 stars 289 forks source link

TSN and repository doubt #578

Closed zeefpt closed 7 years ago

zeefpt commented 7 years ago

Hi again folks,

I have 2 boards with Ethernet and want to include the TSN using this OpenAvnu repository. Want to Clog with garbage packages my network and see if with TSN only video/audio packages are delivery just in timing and respecting an certain criterias. Then enable/disable the tsn and see the diferences.

Do you have anyguide or examples of how to implement it using this repository?

Regards,

pinealservo commented 7 years ago

If you build avtp_pipeline along with the gPTP and MRP daemons, you should be able to use the combination to set up streams across AVB-capable switches. Configuring them to continue working when you turn off AVB/TSN support in the bridges should be possible, but things don't work that way by default; disabling the protocols in the network just shuts things down cleanly rather than allowing interfering traffic to produce poor streaming performance.

The general principles upon which AVB/TSN is based have been pretty thoroughly simulated, tested, and modeled, and most of the people contributing here have moved on to building systems with it instead of re-running old experiments. You are certainly welcome to perform any experiments you'd like, and we will try to help out with specific problems you may encounter, but we don't have guides prepared for that kind of experiment. There's enough example code, working protocol implementations, and documentation available in the repository for a self-motivated implementer to figure out how to do what you describe, but sadly we lack enough time to provide a lot of detailed assistance in the process. Good luck!

zeefpt commented 7 years ago

Hi again pinealservo, Thnks again for response, I will use the examples that repository provide and documentation and if doubts emerge i will ask you guys for help/suggestion. :) Regards from Portugal,

zeefpt commented 7 years ago

1st doubt. :) From 'make' top level directory i can compile gptp and mrpd daemon.

Now im trying to make avtp_pipeline but gives me one error:

make[1]: Entering directory '/home/jp/projetos/openavnu/OpenAvnu/lib/common' cc -O2 -g -Wall -Wextra -Wno-parentheses -I../igb -c avb.c avb.c:34:21: fatal error: pci/pci.h: No such file or directory

include <pci/pci.h>

Where can i find the pci.h ? or should i compile first anything else ?

Regards

andrew-elder commented 7 years ago

Are you working on branch open-avb-next ?

zeefpt commented 7 years ago

Hi,

I cloned the repository:

git clone https://github.com/AVnu/OpenAvnu git submodule update --init --recursive

and doned make from here.

Regards

andrew-elder commented 7 years ago

go

andrew-elder commented 7 years ago

go git checkout -b open-avb-next and use that.

zeefpt commented 7 years ago

Hi, Installed sudo apt-get install libpci-dev and solved the problem. :) You recommend that instead of master?

zeefpt commented 7 years ago

Now i can compile daemons_all , lib , examples_all but in avtp_pipeline gives me that error:

-- IGB launch time enabled -- Native build for Linux-4.8.0-46-generic on x86_64 -- Checking for modules 'gstreamer-app-0.10;gstreamer-rtp-0.10' -- No package 'gstreamer-app-0.10' found -- No package 'gstreamer-rtp-0.10' found CMake Error at platform/Linux/CMakeLists.txt:152 (MESSAGE): Aborting: gstreamer library not found Call Stack (most recent call first): CMakeLists.txt:37 (include)

-- Configuring incomplete, errors occurred! See also "/home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/CMakeFiles/CMakeOutput.log". avtp_pipeline.mk:19: recipe for target 'build/Makefile' failed make[1]: [build/Makefile] Error 1 Makefile:126: recipe for target 'avtp_pipeline' failed make: [avtp_pipeline] Error 2

Probably beacuse gstreamer not found.

i already tryed: sudo apt-get install libgstreamer0.10-dev sudo apt-get install libgstreamer-plugins-base0.10-dev

but linux is unable to locate that package. I can only install libgstreamer1.0-dev..

Im using Linux JP 4.8.0-46-generic #49-Ubuntu and i think not support libgstreamer0.10.

AnyIdea how to resolve this situation? :)

I cant build igb module too. But that i think i will not need for now.

P.S - Now working with open-avb-next like you recommend. :)

thks

zeefpt commented 7 years ago

Hi,

Just installed Ubuntu 14.04 on Vbox and all compile problems were solved. Have doned : EXTRA_CFLAGS="-DIGB_PTP" ARCH=I210 and make all :)

My ETH card is an I219-LM.

One question is if i have to adapte the igb_avb.ko to my interface. ?

Now im testing the gptp daemon with sudo ./run_gptp.sh eth1 like suggested in readme and got this:

"INFO : GPTP [12:56:54:696] gPTP starting ERROR : GPTP [12:56:54:697] Failed to configure timestamping: Operation not supported ERROR : GPTP [12:56:54:697] post_init failed

ERROR : GPTP [12:56:54:697] failed to initialize port "

Using first script sudo ./run_igb.sh eth1 the igb_avb mod was succefully installed.

My Dmesg is : http://pasted.co/29647e02

Anyidea what can I search/do?

Regards

andrew-elder commented 7 years ago

You aren't running from the Vbox are you? You need to run on the host.

zeefpt commented 7 years ago

Yes Vmware. Ok i see other thread you saying that. I will try. Regards

pinealservo commented 7 years ago

If you look at the avtp_pipeline.mk file in lib/avtp_pipeline, you'll see there are some variables you can override in the environment to change how it's built. You can either do:

export AVB_FEATURE_GSTREAMER=0
make avtp_pipeline

Or you can just set variables on the same command line:

PLATFORM_TOOLCHAIN=generic make avtp_pipeline

You can see the options for toolchain files in lib/avtp_pipeline/platform/Linux as the .cmake files in there. And setting the gstreamer variable to 0 should keep it from searching for gstreamer, although if you build it without gstreamer you won't be able to do video streaming.

zeefpt commented 7 years ago

Hi pinealservo, Thnks for the tip :) Regards

pinealservo commented 7 years ago

If you try this and cmake gives you an error about a TEMP variable, see my comment on #579 about how you can fix it by commenting out a couple of lines.

zeefpt commented 7 years ago

Hi again pinealservo,

Now i need the gstream to run :) Im using buildroot and enable gstreamer 0.1 and 1 packages in makemenuconfig. But when i do make all give me the same error:

Can i change something for that in compilation aponts to my librarys or toolchain of buildroot?

Regards,

pinealservo commented 7 years ago

Probably you can, but you're mostly on your own at this point. You will probably have to look into cmake's cross-compilation support and how to use its toolchain files to specify the search paths it should use. You may be using buildroot, but it's still doing a native x86_64 build and is probably looking in your system paths rather than buildroot's paths.

zeefpt commented 7 years ago

Thanks for anwser pinealservo. :)

I have installed in my linux host the gstreamer 1.0 too it is not compatible or should i have the 0.1? Many distribution are also getting rid of gstreamer0.10. In my ubuntu Mate comes natevly with 1.0. :)

-I found this in /avtp_pipeline/platfrom/LinuxCMakeLists.txt:

if(AVB_FEATURE_GSTREAMER) if ( GSTREAMER_1_0) pkg_check_modules(GST_PKG gstreamer-app-1.0 gstreamer-rtp-1.0) else () pkg_check_modules(GST_PKG gstreamer-app-0.10 gstreamer-rtp-0.10) endif ()

I found this in my /avtp_pipeline/build/CMakeCache.txt:

GST_PKG_gstreamer-app-0.10_INCLUDEDIR:INTERNAL= GST_PKG_gstreamer-app-0.10_LIBDIR:INTERNAL= GST_PKG_gstreamer-app-0.10_PREFIX:INTERNAL= GST_PKG_gstreamer-app-0.10_VERSION:INTERNAL= GST_PKG_gstreamer-rtp-0.10_INCLUDEDIR:INTERNAL= GST_PKG_gstreamer-rtp-0.10_LIBDIR:INTERNAL= GST_PKG_gstreamer-rtp-0.10_PREFIX:INTERNAL= GST_PKG_gstreamer-rtp-0.10_VERSION:INTERNAL=

So its not have anything here :)

In this file /avtp_pipeline/platfrom/LinuxCMakeLists.txt i found that linuxheaders are not correct config to my path too, should be my buildroot path(i set a PATH environment variable of my buildroot headers):

set ( LINUX_KERNEL_DIR /usr/src/linux-headers-${CMAKE_SYSTEM_VERSION} ) find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB_PKG glib-2.0) if (AVB_FEATURE_GSTREAMER) if ( GSTREAMER_1_0) pkg_check_modules(GST_PKG gstreamer-app-1.0 gstreamer-rtp-1.0) else () pkg_check_modules(GST_PKG gstreamer-app-0.10 gstreamer-rtp-0.10) endif ()

Can i Point here for the correct path?

Any tip where path should i look or Anyideia what is the file that sniff my sytem in cmake that should i change? :)

Can i compile without this gstreamer version for compile the avtp_pipeline and after if i want to use gstream for streaming video use the gstreamer 1.0 version?

Other thing that bugs me is the file /avtp_pipeline/build/CMakeCache.txt , if i change the parameters everytime i do make it rebuilds itself, What makefile creates this file? what i can do to change paremeter in this file? How can i study the dependencies of each cmakelist, im confused what generate the files, and what creates what have anyguide or something? :)

Regards and thanks for the help :)

zeefpt commented 7 years ago

anyhelp? :)

andrew-elder commented 7 years ago

CMakeCache.txt is not the correct file to edit. You should edit the parent https://github.com/AVnu/OpenAvnu/blob/open-avb-next/lib/avtp_pipeline/CMakeLists.txt file, or another CMakeLists.txt file that it includes.

zeefpt commented 7 years ago

Thks andrew-elder i will explore what you suggest :) Regards

zeefpt commented 7 years ago

So i have to create a /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/platform/Linux /x86_i210_linux.cmake custom for pointing to what i want?

Best regards,

zeefpt commented 7 years ago

worked :) but i doned changing the avtp_pipeline.mk to:

PLATFORM_TOOLCHAIN ?= x86_i210_linux_test
and in the x86_i210_linux_test.cmake i change :

set ( GSTREAMER_1_0 1 )

I dont know if it is the best manner because i think it has sniffed my system and not the toolchain of buildroot. Can i do this in x86_i210_linux_test.cmake to pointing to my buildroot? :

set ( LINUX_KERNEL_DIR "home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/staging/usr/include" )

I have this erros too:

Now i have this erros:

-- Configuring incomplete, errors occurred!

I installed in buildroot the lib that faults but still the same error.

Its mandatory using cmake to build all the stuff or the makefiles do the work? This is confusing me. Using cmake and make all for to build all. :) because if i do :

cmake -DCMAKE_TOOLCHAIN_FILE=/home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/platform/Linux/x86_i210_linux_test.cmake -DCMAKE_BUILD_TYPE=Release /home/jp/projetos/openavnu/OpenAvnu/

It runs but overwrite the original make file that contains options for make.

Builds this: [ 13%] Built target CppUTest [ 23%] Built target CppUTestExt [ 45%] Built target CppUTestTests [ 59%] Built target CppUTestExtTests [ 62%] Built target alltests [ 68%] Built target mrpd [ 80%] Built target mrpd_simple_test [ 88%] Built target maap_daemon [ 91%] Built target test_intervals [100%] Built target maap_test

But not building what has in original MAKEFILE, for example avtp_pipeline, daemons_all etc.. Im confusing the use of cmake with makefile directly.

Really glad for your help, Regards, Jose

pinealservo commented 7 years ago

Try this, from the top level directory:

$ PLATFORM_TOOLCHAIN=x86_i210_linux_test make avtp_pipeline

The only build system for avtp_pipeline is based on cmake; most of the other subsystems in the repository have an alternate Makefile as well, but not avtp_pipeline.

In general, you should not run cmake directly from the top-level of a project. It expects to be run from a build directory and to be given the path of the source directory. The top-level Makefile rule for avtp_pipeline takes care of this for you.

Failing to find the pcap library in your buildroot is a tricky one, and my understanding of how cmake works is not perfect with respect to cross-compiling, but I think you will be able to fix this one by setting up some search paths in your x86_i210_linux_test.cmake file. Specifically, you'll need to set up the following variables:

CMAKE_FIND_ROOT_PATH
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE

All but the first one should (possibly?) be set to ONLY and the first one should be set to the paths that you want it to do library searches in.

Hopefully that will give you some pointers to where to look in the cmake documentation at least.

zeefpt commented 7 years ago

Hi pinealservo,

Thanks for guiding me. :) Now everything compiled.

My file now is:

and another kernel sources

set ( LINUX_KERNEL_DIR "/usr/src/kernel" )

this one is important

SET(CMAKE_SYSTEM_NAME Linux)

this one not so much

SET(CMAKE_SYSTEM_VERSION 1)

SET(CMAKE_SYSTEM_PROCESSOR x86_64)

specify the cross compiler

SET(CMAKE_C_COMPILER /home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/host/usr/bin/x86_64-linux-gcc) SET(CMAKE_CXX_COMPILER /home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/host/usr/bin/x86_64-linux-c++)

where is the target environment

set(CMAKE_FIND_ROOT_PATH /home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/staging/)

search for programs in the build host directories

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

for libraries and headers in the target directories

set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

MESSAGE ( "Passei aqui" )

build configuration

set ( OPENAVB_HAL "x86_i210" ) set ( OPENAVB_OSAL "Linux" ) set ( OPENAVB_TCAL "GNU" ) set ( OPENAVB_PLATFORM "${OPENAVB_HAL}-${OPENAVB_OSAL}" )

Platform Additions

set ( PLATFORM_INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/platform/x86_i210/include ${CMAKE_SOURCE_DIR}/../igb ${CMAKE_SOURCE_DIR}/openavb_common ${CMAKE_SOURCE_DIR}/../../daemons/common ${CMAKE_SOURCE_DIR}/../../daemons/mrpd )

set ( PLATFORM_LINK_DIRECTORIES ${CMAKE_SOURCE_DIR}/../igb )

set ( PLATFORM_LINK_LIBRARIES igb )

set ( GSTREAMER_1_0 1 ) set ( AVB_FEATURE_PCAP 1 )


I have a lot of questions :)

1- If i put the set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) to ONLY the program gives me that error:

CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:52 (find_package_handle_standard_args) platform/Linux/CMakeLists.txt:134 (find_package) CMakeLists.txt:37 (include)

Resolved puting NEVER! Why that error?

2- Again, the original makefile of /home/jp/projetos/openavnu/OpenAvnu/Makefile is overwriten at end of avtp_pipeline build is because of what you said: ?

Try this, from the top level directory:

$ PLATFORM_TOOLCHAIN=x86_i210_linux_test make avtp_pipeline

right?

2.1 - Using make all builds all the stuff ok but in the end overwrites the toplever Makefile again :) is normal?

3 - Can i change the cmake to install the stuff in my buildroot target system using sysroot? (http://docs.w3cub.com/cmake~3.5/variable/cmake_sysroot/#variable:CMAKE_SYSROOT)

Cmake install the binaries, etc in source folders : -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libintf_echo.a

Any tip how to build out of source? if can generates a package, or have to copy manually to embebed system?

Many thnks to all, Best Regards

pinealservo commented 7 years ago

I am really not an expert on cmake; I am cross-compiling with a system based on bitbake/openembedded tools rather than buildroot, and the cmake suggestions I gave were some stuff that worked for me that I found via mostly trial and error. I'm glad you're making progress, but I'm afraid I can't offer much more help than I already have!

zeefpt commented 7 years ago

Hi thanks for response.

I discover where in buildroot have sysroot : lrwxrwxrwx 1 jp jp 117 abr 20 13:23 staging -> /home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/host/usr/x86_64-buildroot-linux-uclibc/sysroot/

so i insert in my toolchainfile:

SET(CMAKE_SYSROOT /home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/staging)

and have to put this to:

NOTE: CMAKE_SYSROOT doesn't work as expected

add_definitions("--sysroot=${TOOLCHAIN_SYSROOT}")

and he is compiling using correct sysroot!

but when i do make avtp_pipeline or PLATFORM_TOOLCHAIN=x86_i210_linux_test make avtp_pipeline , cmake are installing in source diretory: (instead of my sysroot dir)

[100%] Linking C executable openavb_harness [100%] Built target openavb_harness Install the project... -- Install configuration: "Release" -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libavbTl.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_ctrl.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_mjpeg.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_mpeg2ts.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_null.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_pipe.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_aaf_audio.a -- Installing: /home/jp/projetos/openavnu/OpenAvnu/lib/avtp_pipeline/build/lib/libmap_uncmp_audio.a

etc...

Im setting this for my install path:

set(CMAKE_INSTALL_PREFIX /home/jp/projetos/test)

set(CMAKE_SYSTEM_PREFIX_PATH /home/jp/projetos/test)

I have to change something else?

Anyhelp is apreciated :)

Best Regards,

zeefpt commented 7 years ago

Hi Folks,

I have Another doubt. :)

I try to test in my target system the igb_avb.ko module but give me that error:

igb_avb: version magic '4.8.0-51-generic SMP mod_unload modversions ' should be '4.11.0-rc6 SMP mod_unload '

This error is because im not crosscompiling right :)

So analysing the kmod/igb makefile i susbtitute the KSRC for:

KSRC=/home/jp/projetos/advantech_eth_qos_minimal/buildroot-2017.02.1/output/build/linux-vETH20170418

and now trying to compile gives me that error:

http://pasted.co/d300096b

error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types] .fault = igb_vm_fault

any header or something that can miss me?

Anyideia what should more i have to substitue or what im doing wrong.

Best Regards,

zeefpt commented 7 years ago

Resolved the problem. Porting the functions from old kernel to new kernel. Now im ready for teste hehe Thnks averyone