Which buildroot package needs to be installed to get any given utility onto the target rootfs? - package

I am new to buildroot. Using buildroot 2016.05, I have successfully built a target SD card for a MicroZed board with a Xilinx kernel, but it was missing some utilities that I wanted in the root file system. In particular, I wanted scp.
Looking through the buildroot documentation and web searches didn't yield the answer, but I was able to search the Config.in files in the package folders for "scp" and eventually determine that I could install either dropbear or openssh to get scp.
Other than the brute force way I searched Config.in files, is there an approach with buildroot to resolve a "which package produces binary XYZ" question?

A big part of building embedded Linux systems is understanding the components of Linux systems in general. How do you figure out what packages to install on your desktop/server Linux installation? In this way Buildroot isn't really any different. As a help we do sort packages in groups (E.G. Network applications in this case) and provide help text for each package, but you are really expected to know that 'scp' is part of the ssh package (openssh or dropbear).
What can sometimes be helpful is to check what package a program comes from on your desktop Linux installation - E.G. dpkg -S $(which scp) for this question in case you are using Debian/Ubuntu

Related

C app deployment and managing dependencies in c

I'm new to c development, but I have some experience in other modern languages .so the first thing that I found hard is dependencies and deployment, while we got Gradle, maven, NuGet and pipy and... but in c I find it a bit difficult to manage this process.
for example, I have an app that should use mongo-c-library, log4c,libarchive so basically, in my development environment, I download and unzip all of the tar files of the above libraries and then followed their instruction(usually some make stuff) and installed them in order to include them in code make the code work.
I have studied a bit about CMake but I couldn't get a clear picture of how that could actually solve the problem.
at this moment my best solution is to create an install bash script and zip all dependencies unzipped folder with that install script and then send it to the production server to deploy it.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include
and /path/of/installed/dependencies/lib in the destination server libary path.
2.if not what is the faster way?
while I was surfing the CMake source file I found that its developers just use this package source code directly.
cmxxx contains the xxx sources and headers files.
3.how can apt-get and Linux package manager help in the deployment process?
2 first question was more about dependencies. imagine we have a simple c app and we want to install(build and make a useable executable file) quickly. how it can be related to .deb packages.
1.The first question is : is it possible to just copy and past all of .so .h and etc files in /path/of/installed/dependencies/include and /path/of/installed/dependencies/lib in the destination server libary path.
Yes, technically it's possible. That's essentially what package managers do under the hood. However, doing that is a colossal mistake and screams bad practices. If that's what you want then in the very least you should look into package managers to build up your own installer, which handles this sort of stuff already for you.
2.if not what is the faster way?
You're actually asking an entirely different question, which is: how should I distribute my code, and how do I expect users to use/deploy it?
If you want users to access your source code and build it locally, as you've mentioned cmake then you just to set up your project right as cmake already supports that usecase.
If instead you just want to distribute binaries for a platform then you'll need to build and package that code. Again, cmake can also help you on that one, as cmake's cpack supports generating some types of packages like DEB packages used by Debian and Ubuntu, and which are handled by apt.
3.how can apt-get and Linux package manager help in the deployment process?
apt is designed to download and install packages from a repository.
Under the hood, apt uses DEB packages, which can be installed with dpkg.
If you're targeting a system that uses apt/deb, you can build DEB packages whenever you release a version to allow people to install their software.
You can also go a step beyond and release your DEB packages in a Personal Package Archive.
You would typically NOT download and install source packages. Instead you should generally rely on the libraries and development packages of the distribution. When building your own package you would typically just reference the packages or files that your package is dependent on. Then you build your own package and you're done. Upon installation of your package, all dependencies will automatically be resolved in an appropriate order.
What exactly needs to be done is dependent on the package management system, but generally the above statements apply. Be advised, package management apparently is pretty hard, because so many 3rd party developers screw it up.

How to iterate effectively in Linux kernel development

I'm fairly new to Linux kernel development. It is certainly quite a bit different than the Windows kernel (I am a recovering Microsoft engineer). Can you provide advice on how to iterate effectively on updating modules that come with the Linux kernel?
Specifically, I am updating hid and bcm5974 to support the latest Macbook Pro (early 2015), and am using Ubuntu 15.04 (kernel 3.19). Would you recommend I test it out in a Virtual Machine? Are there ways to incrementally build instead of clean + build the whole tree? I'd love to be able to build just the affected modules but I can't find a good way to do that. The Makefiles are rather complicated.
Time to answer my own question. After doing a full build, incrementals are pretty straightforward given you're not editing headers that are consumed by other modules.
make modules SUBDIRS=drivers/input/mouse
Once I've installed the kernel from the full build, iterating on new module compilations is a breeze. sudo rmmod bcm5974. scp file from build desktop to Macbook Pro. sudo insmod bcm5974.

How to configure Macports installed application for first time?

I'm new to macports, and I'm really lost. I am trying to download PSPP (statistical software) via the GNU open software project using MacPorts, and installation completed without hiccups but I do not know how to proceed. How do I configure the application I just installed? Also, how do I get it to start up at automatically at boot?
I know this is a basic question, but I'd really appreciate the help! The MacPort QuickStart help questions are very confusing to me. Thanks!
The real question here is how to start the application. This largely depends on the application you installed, so PSPP in your case. Consult the documentation of PSPP (e.g. on their Website) to learn more.
In most cases, software installs a number of executables that you should run to start it. You can get a list of all files installed by PSPP using MacPorts by running
$> port contents pspp
Since this list will likely be huge, you can limit it to the locations where executables are usually installed:
$> port contents pspp | grep -E '/s?bin/'
For the PSPP port, it seems MacPorts also creates an .app wrapper. Check for /Applications/MacPorts/ – there should be a PSPP.app there.

(Mac OSX) Adding libraries to C -specifically gnuplot

I am a begineer trying to get code in C. I am working on a Mac and using xcode. My only past experience has been with java using eclipse and everything was pretty straight forward. I have almost no experience with terminal.
I am required to learn a bit of C for a project I will be working on and the learning of syntax is coming along okay, but I am at a point where I need to include some libraries in my c program. Specifically I am attempting to make plots with gnuplots.
I have downloaded gnuplot-4.6.3 from their repository and I do not even know how to install the files. I have been looking around and have tried using terminal to use the ./configure command when I am in the gnuplot-4.6.3 directory. But I really don't know what I am doing so I don't even know where to go next or what to do next.
Sorry if this is so trivial, I honestly just have never done this before and I cannot find a good tutorial on what to do.
Thanks for any help you can offer.
I would recommend using MacPorts for installing third-party tools and libraries. It knows the dependencies required and will install them as part of the installation.
Download it from macports.org.
Install it, and allow it to modify your ~/.profile so that /opt/local/bin is in your $PATH (any issue then just do export PATH=/opt/local/bin:$PATH from the command line).
sudo port selfupdate
sudo port install gnuplot
Now that will install the library into /opt/local/lib with the include files in /opt/local/include, so now just add that library to your Xcode project. Select the target and in the Build Phases tab open up the Link Binary With Libraries and press the + button and select Add Other. Now find /opt/local/lib/libgnuplot.a (I am assuming that's what it's called; I don't have it installed my self):
Now add /opt/local/include to your Header Search Paths so the compiler can find the gnuplot header files. Select the target and in Build Setting type in "header search" in the search box. Now double-click on the Header Search Path in the target column (or the project column to the right) and add /opt/local/include:
It's fine! You're learning then! Keep up! When I hit this kind of problem you may want to learn about the basis for linux gcc/g++ compilation and linking processes. Then you should learn Cmake and Automake, which are basically packages to configure projects before compiling building.
A typical (good) project in Unix systems build with commands
./configure
make
sudo make install
or
cmake CMakelists.txt
make all
sudo make install
That's what you need to do after downloading a source tarball online to install unix programs.
Now since you are using Mac, there are so-called package installers, one which is macports and homebrew. I personally suggest homebrew than macports here (I've tried both, although macports still outnumber homebrew with the number of repos, homebrew has the newest support, especially when upgrading to a new OS). So to install homebrew you can do
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute that in your terminal (see http://brew.sh/) for more information.
Then you could simply install GNUplot by
brew install gnuplot

libcap-bin for ARM

I'd like to use setcap, part of libcap-bin, on an embedded Linux device. I use buildroot and see that it has the packages libcap and libcap-ng available, but not libcap-bin.
I googled around but cannot find the source for libcap-bin to produce the setcap binary for the ARM target board.
On Ubuntu I just install with:
sudo apt-get install libcap-bin
Where can I get the source and how can I build libcap-bin for my ARM board?
As others have explained: you can't expect a 1:1 match between the packages you're seeing in your Ubuntu/Debian distribution and the packages you're seeing in Buildroot.
Ubuntu/Debian packages take source packages (in this case libcap) and create multiple binary packages from them, in order to allow you to install only the library, or the library + development files, or the library + programs, etc. For example, look at http://packages.ubuntu.com/source/quantal/libcap2, which is the reference page for the libcap2 source package: it gives you the list of binary packages generated in Ubuntu from this source package.
On the other hand, in Buildroot, there is only the concept of source packages. One package in Buildroot == one tarball from a given software component. Therefore, there is only package/libcap. At the moment, package/libcap/libcap.mk is written to only install the library because no-one needed the setcap and getcap programs. But you can extend package/libcap/libcap.mk (and possibly package/libcap/Config.in) to enable the compilation of the programs as well. As another commenter noted, you will need to add attr as a dependency (though the commenter wrongly said that Buildroot didn't had attr: it does have it, see package/attr).

Resources