How to compile linux bridge? - linux

I am working on a networking project and for some reason I need to modify the source code of the bridge that is used in Linux. I was wondering how to add http://lxr.free-electrons.com/source/net/bridge/ source codes into my Ubuntu distribution.
I am having Ubuntu 16.04 with a 4.4.0-64-generic kernel version. In my : /usr/src/linux-headers-4.4.0-66/net/bridge there is just : Kconfig and Makefile files with netfilter folder.
Could you please point me out to some solutions ?
Thank you in advance.

If you are looking to get the sources code of the kernel that you are currently running you can:
apt-get source linux-image-$(uname -r)
Modify the driver code and then compile.

Related

Patching and compiling kernel, in which directory

I'm trying to apply a patch to my kernel source with limited success. The target machine is really some ARM device, but I haven't compiled a kernel before so I thought I'd start with an x86_64 kernel. This has been only marginally easier :)
Now, according to some tutorials, it seemed like we should use the source in /usr/src/linux-something. But when I tried to patch there I got
File Documentation/sysrq.txt is read-only; trying to patch anyway
patch: **** Can't create temporary file Documentation/sysrq.txt.oG1oiZW : Permission denied
even under sudo. So I tried just copying the patch and the linux source folder to my home directory and patched it from there. This worked. Why is this and will this have any weird side effects when compiling?
It seems you have no permission to /usr/src/linux-something. Download kernel source, put it anywere you could, then patch & compile it.
Build a x86_64 arch kernel from source which downloaded from kernel.org is well, if you wanna build an arm arch kernel for a special board, use buildroot or openwrt is better.
The package manager for some distributions installs the kernel source in /usr/src and distribution-specific build scripts may assume that the source is in that directory.
However, if you download vanilla kernel source from kernel.org, you should be able to build it anywhere.

How to install "v4l1-compat.ko, videodev.ko, v4l2-common.ko" on Ubuntu 12.04?

We are working on a robotic project and we will use a camera (ArtCam 130MI) for image processing on Ubuntu 12.04, the company have terminated Linux support but sent us the source codes for compiling the driver, but in load.sh file v4l1-compat.ko, videodev.ko, v4l2-common.ko files are needed in /lib/modules/uname -r/kernel/drivers/media/video/. So, we don't know how to install these files. Can you help us for this problem?
You will need to recompile your kernel with "Video4Linux" support enabled.
Enable config options VIDEO_V4L1 and VIDEO_V4L2 before compiling.

Installing another version of linux on my system

I need to build locally a driver for "precise" Ubuntu edition (uname -r for that system returns 3.2.0-33-generic-pae).
My local host is Ubuntu 13.10 'sausy'.
But I fail to install the linux headers( what should I do to set up the environment I need?)
I downloaded the image from here: from packages.ubuntu but what my next steps should be?
Actually I don't need exact steps but pointing the right direction would be great!
Thanks in advance :)
If you want to just build the driver (with out installing/testing)
then you will just have to download the kernel source of the preferred version (in this case it is 3.2.0-33) from kernel.org, build it with config from your host PC, and then compile your driver/module against that.
If you plan to install/test then after building the kernel source of the preferred version,
install the same to your host PC, then you will be able to insmod the driver you built

Advice regarding installing ARM toolchain on Ubuntu VM (64bit)

Trying to compile Linux kernel for arm platform on a Ubuntu virtual machine
$make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
It fails as follows
arm-none-linux-gnueabi-gcc: not found
Tried to install
$sudo apt-get install arm-none-linux-gnueabi-gcc
E: unable to locate package arm-none-linux-gnueabi-gcc
Where to find the correct package? how to include it in the system? (I found a couple of links on line that didn't work for me). It would be great if you could provide a correct solution or reference.
The Ubuntu package names are gcc-arm-linux-gnueabi/gcc-arm-linux-gnueabihf.
For building the kernel, which one you use does not make much difference. For building anything else, "gnueabihf" is the hard-float version. For any modern ARM processor (this statement excludes the Raspberry PI), this is the one you would want.
Download arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 from https://sourcery.mentor.com/GNUToolchain/
or https://sourcery.mentor.com/sgpp/lite/arm/portal/subscription?#template=lite
Get correct version of the arm-none-linux-gnueabi toolchain (i.e. targetting GNU/Linux rather than EABI).
untar it
tar xvf arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
open bashrc
vi .bashrc
at the end add below comand
export PATH=$PATH:{path to toolchain}arm-2013.05/bin
e.g export PATH=$PATH:/home/vinay/under_linux/arm-2013.05/bin
save it and quit the terminal.
then you can cross-compile without everytime export.
Also take of correct toolchain there are two toolchain available choose according to your requirement.
Cross compile error "arm-none-eabi-g++ cannot find entry symbol"

Does Ubuntu 12.04 equipped with Kernel 3.2.0-29 has cgroup support?

I want to use control group (cgroup) to control and manage the computing resources of my cluster. I've done some survey work on cgroup itself, either the command line tool or the linux kernel source code. But when I was to implement a hello world program with cgroup, I found that the header file
#include <linux/cgroup.h>
is not existed in /usr/include/linux/cgroup.h, on my Ubuntu Server 12.04 LTS x86_64 with Linux Kernel version 3.2.0-29.
However I downloaded the kernel source file from kernel.org, and found that header file in the proper folder.
I also apt-get install libcgroup-dev and found something in /usr/include/libcgroup/, but those aren't what I want.
I start to wonder whether Ubuntu disabled the cgroup functionality or migrate it from the default path? How can I programming like RedHat guys do? Thank you!
I also I have installed ubuntu 12.04 and have been working with the cgroups for some time.
Try this:
apt-get install libcgroup
Use #include <libcgroup.h> instead of #include <linux/cgroup.h>.

Resources