how to build linux kernel in OpenWrt distribution - linux-kernel

I make a modification in linux kernel of OpenWrt and then I compile the new (kernel) with command :
make target/linux/compile V=99
but I don't found the new image under
build_dir\linux-x86_generic\linux-3.3.8
in order to upgrade the kernel in my OpenWrt running in VM VirtuaBox
how to proceed to get the new kernel and upgrade the Openwrt ?

I am a bit puzzled by the fact you are looking at the linux-x86 folder since with openWRT you usually cross-compile everytime, or at least I've never used it for not cross compilations.
What are you compiling for ?
You should see a build/$TARGET folder with a linux-x-x directory in it where the linux kernel was compiled.

Related

Installing GCC after flashing SD-Card / Buildroot Distro

I am brand-new to Buildroot and didn’t use embedded systems or distros a lot.
I successfully flashed my STM32 and have buildroot as distro on it but after flashing it I figured out that I needed to install gcc package.
I didn’t find the gcc package after make menuconfig -->target packages. In fact not all packages listed in the buildroot/package/ Directory are listed in the menuconfig target packages interface.
I am really a noob and it would be great if you orient me step by step in order to get this done.
Best Regards
I think you need native compiler on the target in Buildroot. But Buildroot do not provide native toolchain after Buildroot-2012.11.
For more details refer : https://buildroot.org/downloads/manual/manual.html#faq-no-compiler-on-target
If you really need native toolchain try a real distribution like
openembedded
yocto
Fedora
I think this helped you !

Basic linux kernel development and testing environment using qemu

I want to learn about the linux kernel and this is why I wanted a simple but powerful enough way test kernel changes that I do.
I used the info on this page https://mgalgs.github.io/2015/05/16/how-to-build-a-custom-linux-kernel-for-qemu-2015-edition.html to start.
So now I can start a qemu session with the kernel I choose and also have busybox utilities.
The part I cannot understand is how do I transfer a kernel module .ko on this virtual machine as to load it in my modified kernel ? I tried also transfering a c program by incorporating it in the initramfs but when I try to run the program I receive the following error message:
"/bin/sh: ./proc1: not found" .
Should I use a virtual hdd image ? If so how do I create and use one ? How do I transfer files from host os to the virtual hdd ?
Thnaks in advance.
The created virtual hdd was not discovered because I didn't use mdev -s in the init file.
After that I could mount the sda in qemu session.
The c program that could not be ran I solved by compiling it with the -static flag.

Compile C file on openwrt

I have built the openwrt firmware and installed it to a device.
Now I want to compile my source code in C in the device (I can ssh into it).
However, openwrt firmware is quite basic and does not include make.
How can I install make/ equivalent to compile my C source code inside the device running openwrt firmware?
OpenWrt is not intended to work as a build server, so you won't find compiler, linker etc. in its root file system. As you mentioned before, you've successfully compiled the firmware. That means you have cross compiler at hand, so you can cross compile your software and then copy it to your system via scp.
Another approach would be to create your own feed, add your software to this feed, so that at the end you'll get an ordinary ipkg package, that you can download and install via web interface. See OpenWrt documentation for more details.
Lots of Cross Compiler are available for host system i.e PC running any Linux OS.
Just install compiler corresponding to Architecture in which Openwrt is running,
e.g If OpenWRT running on ARM architecture,
sudo apt-get install gcc-arm-linux-gnueabi
then compile source code as:
arm-linux-gcc -o yourprogram yourprogram.c

How to build only usb-storage.ko?

How can I build usb-storage.ko module for a running kernel distro (ubuntu)
thanks for your response.
You need the kernel source and kernel configuration (just as for compiling the complete kernel).
To build only a single file, tell make about it:
make drivers/usb/storage/usb-storage.ko

Cross-compiling Linux kernel for ARM on Windows using Sourcery Toolchain

I am trying to cross-compile a Linux kernel for an ARM-target (Freescale i.Mx28) on a Windows host. I know that this approach is not the best one compared to using a Linux host, but unfortunately it's not up to me to decide that.
The restrictions are:
The kernel has to be the one provided by Freescale (L2.6.35_MX28_SDK_10.12)
It must be build using Sourcery Toolchain and CodeBench
The whole thing must be done on Windows
I got that far, that I worked around the missing case sensitivity on Windows so that I can extract the kernel sources using Cygwin. But now I got problems with the kernel Makefile. I think there are some issues with the Windows paths as I get the error message *** multiple target patterns. Stop., which comes from the : in paths and other errors concerning the dependency check when configuring:
HOSTCC scripts/basic/fixdep
/usr/bin/sh: scripts/basic/fixdep: cannot execute binary file
make[1]: *** [scripts/basic/fixdep] Error 126
make: *** [scripts_basic] Error 2
Is there a way to port the Makefile without having to rewrite it or is there another way to build the kernel without using the given Makefile? Can I use the sourcery toolchain or IDE to handle the Makefile?
Is there a way to build the kernel within the given restrictions?
To cross compile the kernel, you'll need two compilers: One that is able to build tools that run in your build environment, and one that can create executables for your target.
It seems like you aren't really cross compiling but you have just replaced your compiler. You are now building tools required for the build for ARM and try to run them on Windows.
You can specify which cross compiler to use:
make ARCH=arm CROSS_COMPILE=your-compiler-prefix- ...
You might also have a problem with the filesystem. The filesystem in Windows is case-insensitive and the Kernel build might create files where the case matters. To get support for a case-insensitive filesystem on Windows, you can have a look at Windows Services for UNIX.
Use another toolchain! CodeBench is NOT compatible with building Linux on Windows hosts, not matter what eye candy (lies) they put on their website about using CYGPATH, etc.
I have tried this myself for weeks, and the problem is that CodeBench accepts POSIX paths, but insists outputting Win32 paths that are hard, if not impossible, to control in the Linux Kernel Make procedures.
I'm not saying it is impossible; I'm sure it is possible. But it is not worth the time, no matter what your boss tells you. There are more problems to consider. Another problem is that the tools in the Linux sources ./scripts directory are not directly compatible with the Windows environment and thus, although they might compile they don't run as expected. They need to be patched!
The best chance you have, is by compiling your own cross-compiler with Cygwin. Or find one already cooked for you.

Resources