EvilZone

General Tech => Operating System => : resid3nt May 02, 2015, 02:21:21 PM

: [Question]-Make a System Call Linux Kernel 3
: resid3nt May 02, 2015, 02:21:21 PM
Hello,
New member here:)

I need to make a System Call like this article here which I followed
:
https://arvindsraj.wordpress.com/2012/10/05/adding-hello-world-system-call-to-linux/
I downloaded Linux Kernel 3.2.0 and I have done the modifications are being said in the above article

According to this I am trying to install the Kernel with : sudo make modules_install
:
http://www.howopensource.com/2011/08/how-to-compile-and-install-linux-kernel-3-0-in-ubuntu-11-04-10-10-and-10-04/
I have this error
:cp: cannot stat ' /usr/src/linux-3.2.0/modules.builtin': NO such file directory
make: ***[_modinst_] Error 1

I installed module but again this error

Something more:
In the 1st article
Now, in the root directory of the kernel sources, create a directory named hello and in it, a file hello.c with the following content:
#include <linux/kernel.h> asmlinkage long sys_hello(void) { printk("Hello world\n"); return 0; } 
printk is similar to printf function of C but writes to the kernel log instead of the screen. asmlinkage is a key word used to indicate that all parameters of the function(here none of course :) ) would be available on the stack.

The root directory of the kernel sources is the linux-3.2.0 Folder??

I had never any experience with kernel if you know any book to get some more explanation please write

Thanks in advance
: Re: [Question]-Make a System Call Linux Kernel 3
: ThePH30N1X May 02, 2015, 02:40:23 PM
You need to compile the kernel and modules first.
:
$ make # Compile the kernel
$ make modules # Compile the modules
$ make install # Install the kernel (just moves it to /boot and stuff)
$ make modules_install # Install the modules
: Re: [Question]-Make a System Call Linux Kernel 3
: resid3nt May 02, 2015, 02:47:11 PM
ok thanks a lot

I did make and make modules

I will try all of them again
: Re: [Question]-Make a System Call Linux Kernel 3
: resid3nt May 02, 2015, 02:50:01 PM
You need to compile the kernel and modules first.
:
$ make # Compile the kernel
$ make modules # Compile the modules
$ make install # Install the kernel (just moves it to /boot and stuff)
$ make modules_install # Install the modules

Thanks a lot

The root directory of the kernel sources is the linux-3.2.0 Folder??
: Re: [Question]-Make a System Call Linux Kernel 3
: resid3nt May 02, 2015, 03:51:31 PM
They finished

output error:

ld: cannot find bloc/helloworld: No such file or directory
make: ***[vmlinux.o] Error 1

---
My system call is helloworld
: Re: [Question]-Make a System Call Linux Kernel 3
: resid3nt May 02, 2015, 06:06:44 PM
I did all the process from the begining

I donwloaded the kernel 3.2.0
 *linux_3.2.0-83.120.diff.gz
 *linux_3.2.0.orig.tar.gz
 *linux_3.2.0-83.12.0.dsc
 
 I had combined all these in linux-3.2 Folder

 
 I had inserted my System Call
:
https://arvindsraj.wordpress.com/2012/10/05/adding-hello-world-system-call-to-linux/
 According to this guide I try to Build the kernel and then Install it
:
https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
 When i write fakeroot debian/rules clean an erro appears :
 
 /usr/bin/fakeroot: line 178: debian/rules: no such a file or directory
 
 Thanks
 
 Using Ubuntu 12.04 64bit kernel 3.10
: Re: [Question]-Make a System Call Linux Kernel 3
: f2f May 06, 2015, 12:21:21 AM
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I recommend you to compile it the Debian way:
:
make -jX deb-pkgInstead of "X" put your processor's cores numbers plus one, so if you have 2 cores:
:
make -j3 deb-pkgAt this point you will your .deb packages on the folder on top of your current, so if you want to install all the packages:
:
dpkg -i ../*.deb # don't use it, CHECK ALL THE PACKAGES YOU INSTALLIn this way all the aspects about the kernel images will be managed by the system's packet manager, so you can install / install it really safely, without touching your config files.
You can also compile the kernel the old fashioned way:
:
make -jX && make modules_installAnd then proceed with the manual installation, but if you are new to the kernel world, I really don't suggest you to do it, stick it with Debian!

Best luck,
f2f
>:B
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQEcBAEBCgAGBQJVSUIBAAoJEJGg1mhTFl4p5XYH/1JWvFI9qP7eQaDW4EiDvzao
h2uNsvUxN0zRjkbZChnbak1WtgHZSJgDeDV8wbEMlayFi9HlhLm0EoaVjHe/OVnA
prgloUmbFb4cisnpzrh21Fw/9iKoXcqWifBfqnCmItzFP+g5yAIPf+nDOEG2fNPa
jUGc6WWbopJoPxNGgKmnNN2ZHOIDRH8nvt6ePphXIcRxuOAp77f1DeqqdaASWaEQ
miIWvQxneeUcsskQtlSTfPI5qA7ymHP3yfUTz7fy7FZ2rPeC7esLAiM/gyimTvym
YOpS/nDAurmBl5dQQ05dQpyX0KgGpGpZsxrpOYhNWO98sVKRGV3QNbYiRnp+n2o=
=NtVL
-----END PGP SIGNATURE-----
: Re: [Question]-Make a System Call Linux Kernel 3
: v32itas May 06, 2015, 01:49:53 AM
there are nice but quite outdated tuts on kernel building here

http://docs.slackware.com/howtos:slackware_admin:kernelbuilding
http://docs.slackware.com/slackbook:linux_kernel
http://docs.slackware.com/howtos:slackware_admin:building_the_linux_kernel_using_git_repository

however yesterday I got drunk and compiled my kernel now i have broken slackware. Trying to do that properly this time.