I am working on linux on ubuntu. I am modifying the source code of linux 2.6.25 by adding a system call while my operating system has some other version of linux installed. To test my modified code, do I need to install an emulator or can I test it on the terminal window itself?
If I can build and compile my linux 2.6.25 on the terminal, how should I do it?
You can test your modified kernel by installing that kernel in your current Ubuntu system.
Please follow following steps to install kernel in your system.
1) compile your modified linux kernel
make
2) Install that kernel using following command
make modules_install install
3) update initramfs as per the changes made in kernel using following command
update-initramfs -u -k 3.0.0
4) Finally, Update the grub loader to add the entry of your kernel in boot loader using following command.
update-grub
5) Reboot the system and execute the uname -r command to verify that you have updated your kernel or not.
reboot
uname -r
You can find your updated kernel with your existing kernel on next reboot and check your updated kernel which you have modified with that kernel.
Please let me know if you need any more information,
You can use User Mode Linux.
Using UML, you can even use gdb to debug it.
http://user-mode-linux.sourceforge.net/
http://user-mode-linux.sourceforge.net/hacking.html
Although the document is rather old, it still works in recent kernel.
Related
I have a CentOS Linux release 7.2.1511 (Core).
I want to build some kernel code for currently running kernel.
My uname -r says 3.10.0-327.10.1.el7.x86_64, but ls -l /usr/src/kernels/
shows only 3.10.0-327.13.1.el7.x86_64. Why do I have sources of not current kernel on my filesystem(vanilla fresh provisioned Digitalocean box)?
Why does yum install kernel-devel does not install headers for currently running kernel?
uname is a system call to the kernel to get information. It's telling you what's running on that machine. What's physically present on the hard drive can be anything that anyone has installed. Someone may have downloaded the wrong package or you may have multiple kernels installed etc. But, the one that's running is what uname is telling you.
When I run "sudo sh VBoxLinuxAdditions.run" just like on Ubuntu or CentOS, TinyCore throws errors and failed, and the /var/log/vboxadd-install.log shows that:
/tmp/vbox.0/Makefile.include.header:97: *** Error:
unable to find the sources of your current Linux kernel.
Specify KERN_DIR=<directory> and run Make again. Stop.
I have used tce tools installed some packets such as gcc, make, linux-kernel-sources-env.tcz, linux-3.16.2_api_headers.tcz, and then the VBoxLinuxAdditions.run can get the KERN_DIR, but no KERN_INC at this time.
If anybody has done this before could you please give me some points? I really don't know which packages should be installed in TinyCore to make VBoxAdditions work. My VBox and TinyCore is up to date. Thanks.
Found a repo for this issue, but have yet to verify:
https://github.com/MSumulong/vmware-tools-on-tiny-core-linux
Prior to that, I attempted to follow this tutorial, but it is incomplete:
https://www.gilesorr.com/blog/tcl641-guest-additions.html
Prior to that, attempted to build the kernel headers (/lib/modules/5.15.10-tinycore) with no luck.
Copying the Guest Additions to home folder and running sudo VBoxLinuxAdditions.run returns "Kernel headers not found for target kernel 5.15.10-tinycore. Please install them and execute /sbin/rcvboxadd setup"
Basically you have to install the package linux-headers-${kernel_version}
# apt-get install linux-headers-3.16.0-4-amd64
This solved my problem on Debian linux.
To check the version of your kernel, you should run the command:
# uname -a
# Linux debian 3.16.0-4-amd64 # SMP Debian
I've installed a RPM (MySQL Shared glibc Library). After that I couldn't boot my fedora Linux box (Because of some crash with kernel glibc). I boot via LiveDVD and renamed the RPM's copied files, but it can't solved.
How can I uninstall my RPM (not only files) through other Linux or Live CD?
If you boot from a live cd you can remove rpm packages from the installed system by running
rpm --erase --root /mnt/your_system_mount_point the-package-you-want-to-remove
Another alternatively is boot the system by editing the boot loader kernel command line to contain init=/bin/bash and try to run rpm --erase the-package-you-want-to-remove from there. If the problem is with glibc you might have trouble getting bash executed (as well as rpm), but you might want to try this option as well just to see how far the startup is progressing without problems. Thinking of it, busybox usually comes with a statically linked binary that could be used as init shell, you might have better success using that.
The only source code related to perf I could find is in the kernel source, so am not sure what I need to do to get the latest perf.
If I upgrade the kernel version (leavin the rest of my distro unchanged), will I now get the latest version of perf or is there a user space library that I also need to rebuild?
Edit -
I see that the perf source is not actually in the kernel source but in a separate tools directory and I can just build this directory.
In deb based distribution perf is usually provided by a package with a name starting with linux-tools and yes, the version X of perf it's not designed to run on the kernel number Y, it's a program that is strictly tied to the kernel.
For example on Debian/Ubuntu you can write
sudo apt-get install linux-tools-$(uname -r)
I installed Fedora 19 x86_64 on My vmware workstation. When I try to install the third party software. it give me a message "can't find kernel source files".
I checked that the kernel version is 3.9.5-301.fc19.x86_64 via uname -r.
but I found the kernel source version is higher than the current running kernel version.
there are two symblic links in /lib/modules/3.9.5-301.fc19.x86_64 folder. they are
build -> /usr/src/kernels/3.9.5-301.fc19.x86_64
source -> build
They are broken, because there is no folder /usr/src/kernels/3.9.5-301.fc19.x86_64 in my system.
Can anyone tell me why this situation happens. and how to install correct kernel source in my Fedora.
Big thanks.
Any reason to not run the latest kernel? You might benefit from updating everything first.
# yum update
Doubt you actually need the entire kernel source. Have you installed kernel-devel?
# yum install kernel-devel
If you need more, next install kernel headers.
# yum install kernel-headers
If you do update the running kernel, reboot into that kernel before installing the 3rd party software.
You can check here what is the currently most stable kernel available (and download associated RPMs if you requiere):
https://admin.fedoraproject.org/updates/kernel
The same happened to me on my Fedora 19 box and my kernel version was: 3.14.4-100.fc19.x86_64 so VirtualBox was looking for the source here:
/usr/src/kernels/3.14.4-100.fc19.x86_64
I checked my /usr/src/kernels dir which and found that it was empty. Then I downloaded the kernel src from the net which was named:
kernel-3.14.4-100.fc19.**src**.rpm
and extracted to /usr/src/kernels/ and run:
/etc/init.d/vboxdrv setup
Which returned:
Stopping VirtualBox kernel modules [ OK ]
Recompiling VirtualBox kernel modules [ OK ]
Starting VirtualBox kernel modules [ OK ]
Was working great!