Hello Jack Jiang,
You need to add the tool support to your Yocto build. 'tcpdump' or 'nmap' like Networking tools generally does not reside in the yocto builds for NXP. I think it is quite logical to not keep those tools, as those are required only for network related debugging, and those increase the footprint of the image considerably.
Well, you first check whether the networking layer is added to your build. It is the most basic requirement for both the tools:
$> bitbake-layers show-recipes tcpdump
Something like this should appear, if the layer is already added.=================================================================...Summary: There were 3 WARNING messages shown.=== Matching recipes: ===tcpdump: meta-networking <version>
If you do not find the above, then your journey is a bit longer. In that case you will have to download the layer from openembedded and include it to your Yocto build:
For that follow the below steps:
1. Visit the Openembedded Layer Index page, and go to "Recipes" tab: https://layers.openembedded.org/layerindex/branch/master/recipes/
2. Here, search for the intended tool [e.g. "tcpdump"]. The list of layer(s) containing it will appear.[NOTE: A list of layers, on which this layer is dependent, will appear within a box at right side of the screen.]
3. Click on the intended layer hyperlink. It will show the details of the layer including the Git repo URL,web subdirectory URL etc.
4. Get the layer from the above URL, and place it at some local path. Let the layer name be "meta-mylayer".Ensure to download the layers in the dependency list also following the same procedure.
5. Now issue the following command to add the layer to the present build: $> bitbake-layers add-layer path/to/meta-mylayer/ [NOTE: 1. Ensure that the environment is set-up before the above command is issued. 2. Ensure that the present directory should be "build_dir", before issuing the above command. In the same way add the downloaded layers in the depndency list also.]
Ok. Now you have overcome the first hurdle. Now, you have to actually include the tools you require:
This can be accomplished by simply adding the below line to the end of build_dir/conf/local.conf file: IMAGE_INSTALL_append = " tcpdump"
IMAGE_INSTALL_append = " nmap"
[NOTE: Do notice the space before the application name (e.g. " tcpdump" and " nmap").]
Now it is all set. Build the image with bitbake, and the image will conatin "tcpdump" and "nmap"!
Retrieving data ...