Rebuilding exisiting linux kernel on hardware(microzed zynq) - linux-kernel

I have xillinux OS (based on ubunutu 12.04.LTS) installed on my hardware (ZYNQ FPGA Board). I have done some hardware reconfiguration and I need to rebuild my kernel after editing the config-3.12.0-xillinux-1.3 file. My question is how do I rebuild the existing kernel on the hardware after making changes to the config file
http://www.wiki.xilinx.com/Uartlite+Driver
This is the page above that I am referring to where they say that:
To enable the uartlite driver in the linux kernel you either have to integrate it or build it as kernel module (.ko). You can enable it with:
make menuconfig
---> Device Drivers ---> Character devices ---> Serial drivers ---> Xilinx uartlite serial port support
make menuconfig - I have to enter this command on the OS running on my hardware in the /root/boot/.config folder to enable it ?
What does , ---> Device Drivers ---> Character devices ---> Serial drivers ---> Xilinx uartlite serial port support THIS MEAN ? I have to change directory ?
The other option as per the link posted above is to add certain lines as below to the config file, for which I would use the nano editor and then save it with ctrl+X and then Y.
# integrate into the kernel
CONFIG_SERIAL_UARTLITE=y
# build as loadable module
CONFIG_SERIAL_UARTLITE=m
But they say that, "After that you of course have to rebuild the kernel and deploy it to your Zynq device."
Where zynq is the hardware I am running my OS on. What commands do I have to use to rebuild the existing kernel on my hardware after making changes to the .config file ?
So, after rebuilding the kernel with the changes above, I just reboot to observer the changes ?
EDIT:
I was referring to this link, http://www.thegeekstuff.com/2013/06/...-linux-kernel/
So, in order to compile the exisiting kernel on the hadrware and build it, I edit the .config file using nano in /boot folder and save it.
Then, I type "make" in the same folder as config.
Then, I type "make modules" in the same folder
Then I type make modules_install Then I type make install
Then I reboot the system to see the new kernel installed.
Is this the right way of doing it ?
Is this how you recompiled and rebuilt it ?
Currently in my boot directory, there are 4 files.
One config file and 3 .dts files. After rebuilding the kernel, this might change ?

Related

Is it possible to run the rootfs containing kernel and DTB files for a specific board using qemu

Our hardware vendor provides us the yocto based rootfs for a gateway device (ARM softfloat) as a tar file. This file includes kernel image and the DTB files for that board. Is it possible to run this rootfs with no or minimal modifications using qemu? I extracted the tar file and created a CPIO archive (kept kernel image outside) and tried this command :
sudo qemu-system-arm -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -kernel boot/zImage -initrd ../initramfs.gz -machine versatilepb -m 2012
But it just showed blank UI window. Is this not possible?
Or do I need to ask our hardware vendor for a yocto build with MACHINE set as "qemuarm"?
Note: Its OK if QEMU is unable to simulate any hardware from the DTBs
It is highly unlikely that this will work to a sufficient extent. However, your hardware vendor is legally obliged to hand out the sources, and (given some jurisdictional nitpicking) also the the metadata layers used to build the rootfs. So instead of asking then for a favor, just ask for your rights and then build whatever you need to help your development/debugging needs.
NOTE: this might exclude sources to custom applications that they provide. If you intend to use such, it is up for discussion.

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.

linux/bounds.h not found while compiling source of my driver

I am developing drivers for my embedded device that has linux kernel version 2.6.32. In driver code, I am including linux/modules.h but on compiling, It gives me error linux/bounds.h not found.
I have downloaded kernel source from linux git repository. I have checked path settings. They are ok.
I checked my kernel source, there is no bounds.h file. So why my driver is expecting that. Error is coming due to including modules.h.
First, I need to run make command, so that it can generate and link all necessary files.

how to build linux kernel in OpenWrt distribution

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.

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

Resources