Author Topic: [Question]-Make a System Call Linux Kernel 3  (Read 885 times)

0 Members and 1 Guest are viewing this topic.

Offline resid3nt

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
[Question]-Make a System Call Linux Kernel 3
« on: 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
Code: [Select]
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
Code: [Select]
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
Quote
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
« Last Edit: May 02, 2015, 02:22:59 pm by resid3nt »

Offline ThePH30N1X

  • Peasant
  • *
  • Posts: 50
  • Cookies: 18
  • Java Programmer
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #1 on: May 02, 2015, 02:40:23 pm »
You need to compile the kernel and modules first.
Code: [Select]
$ 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

Offline resid3nt

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #2 on: May 02, 2015, 02:47:11 pm »
ok thanks a lot

I did make and make modules

I will try all of them again

Offline resid3nt

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #3 on: May 02, 2015, 02:50:01 pm »
You need to compile the kernel and modules first.
Code: [Select]
$ 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??

Offline resid3nt

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #4 on: 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
« Last Edit: May 02, 2015, 03:51:55 pm by resid3nt »

Offline resid3nt

  • /dev/null
  • *
  • Posts: 5
  • Cookies: 0
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #5 on: 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
Code: [Select]
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
Code: [Select]
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

Offline f2f

  • NULL
  • Posts: 1
  • Cookies: -3
  • Gnu's not unix
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #6 on: May 06, 2015, 12:21:21 am »
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I recommend you to compile it the Debian way:
Code: [Select]
make -jX deb-pkgInstead of "X" put your processor's cores numbers plus one, so if you have 2 cores:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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-----
GPG Public Key

Fingerprint:
8191 6C2D D673 9C97 E736  FCC0 91A0 D668 5316 5E29

Offline v32itas

  • Peasant
  • *
  • Posts: 123
  • Cookies: -4
  • coup de grâce
    • View Profile
Re: [Question]-Make a System Call Linux Kernel 3
« Reply #7 on: 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.
"There is nothing more deceptive then an obvious fact." - SH

“There was no such thing as a fair fight. All vulnerabilities must be exploited.”
― Cary Caffrey