Linux Project 1

Embed Size (px)

DESCRIPTION

Linux Project 1. 中央大學資工系 碩士二年級 江瑞敏. Outline. Install fedora on Virtualbox How to compile linux kernel How to add a system call Project hint Solution. Install Fedora. Ftpes://140.115.53.23 Username: linux Password: vm3zj4cl4. Install Fedora. 新增一個 Virtual Machine (1/9). 點選「下一步」. - PowerPoint PPT Presentation

Citation preview

Linux Project 1

Linux Project 1 Install fedora on VirtualboxHow to compile linux kernelHow to add a system callProject hintSolutionOutlineFtpes://140.115.53.23Username: linuxPassword: vm3zj4cl4Install FedoraInstall Fedora

Virtual Machine (1/9)

Virtual Machine (2/9)Virtual MachineLinuxFedora

Virtual Machine (3/9)512MBOS

Virtual Machine (4/9)

Virtual Machine (5/9)

Virtual Machine (6/9)

Virtual Machine (7/9)10GBKernel

Virtual Machine (8/9)

Virtual Machine (9/9)Virtual Machine

Fedora (1/18)

Fedora (1/18)

Fedora (2/18)ISO

Fedora (3/18)

Fedora (4/18)Enter

Fedora (5/18)SkipISO

Fedora (6/18)Next

Fedora (7/18)Next

Fedora (8/18)Next

Fedora (9/18)Yes

Fedora (10/18)Next

Fedora (11/18)Yes

Fedora (12/18)VirtualBoxNext

Fedora (13/18)Asia/TaipeiNext

Fedora (14/18)rootKernelNext

Fedora (15/18)Software DevelopmentKernel

Fedora (16/18)DependenciesNext

Fedora (17/18)10~20

Fedora (18/18)Reboot

ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2

http://mike820324.blogspot.tw/2013/01/linux-kernel-1-how-to-compile-linux.htmlCompile Linux Kernel1. make oldconfig2. make j[n]3. make modules_install4. make installl5. rebootCompile Linux Kernelhttp://in1.csie.ncu.edu.tw/~hsufh/COURSES/FALL2007/syscall.htmlAdd a System call1. cd $kernel_src2. cd arch/i386/kernel/syscall_table.S3. ..long sys_tee/* 315 */.long sys_vmsplice.long sys_move_pages.long sys_project/* 318 */Add a System Callcd linux/include/asm/unistd.h#define __NR_vmsplice316#define __NR_move_pages317#define __NR_project318

#ifdef __KERNEL__

#define NR_syscalls319Add a System Callcd linux/include/linux/syscalls.hasmlinkage long sys_set_robust_list(struct robust_list_head __user *head,size_t len);asmlinkage long sys_project( int i );

#endifAdd a System Callcd linux/kerneltouch project.cMakefileobj-y =project.osched.o fork.o exec_domain.o panic.o printk.o profile.oAdd a System CallProject.c#include #include

asmlinkage long sys_project( int i ){printk( "Success!! -- %d\n", i );return 0;}Add a System Call/usr/include/asm/unistd.h#define __NR_vmsplice316#define __NR_move_pages317#define __NR_project318

#endif /* _ASM_I386_UNISTD_H_ */Add a System Call(optional)Recompile linux kernelRebootCreate a new file test.c

#include

int main(){syscall( __NR_project, 2 );/* 5, syscall( 318, 2 ); */return 0;}

Add a System CallHow to find the process you want?How to find Virtual Address that is being used by the current process?How to transfer Virtual Address to Physical Address?Good luck!! Project Hinthttp://pastebin.com/wEVLaQygSolution