두근두근이야기

[퍼온글입니다]리눅스 프로젝트1 본문

IT/IT ::Advanced SystemProgramming

[퍼온글입니다]리눅스 프로젝트1

골든 2013. 4. 26. 02:52


wget ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.3.tar.gz
tar xvfz linux-2.6.37.3.tar.gz
mv linux-2.6.37.3 /usr/src/
cd /usr/src/linux-2.6.37.3
make mrproper
make oldconfig    //ncurse lib needed  .config 복사?..
make
make modules
make modules_install
cp /usr/src/linux-2.6.37.3/arch/x86/boot/bzImage /boot/vmlinuz-2.6.37.3
cp /usr/src/linux-2.6.37.3/System.map /boot/System.map-2.6.37.3
cd /boot
mkinitrd initrd-2.6.37.3.img 2.6.37.3
gedit /etc/grub.conf



######################################################################################

######################################################################################


2. syscall add

linux source/arch/x86/include/asm/unistd_32.h
#define __NR_newsyscall        341

gedit arch/x86/kernel/syscall_table_32.S
    .long sys_newcall        /* 341 */ 

linux source/kernel 에서 newcall.c
#include <linux/unistd.h , errno.h, kernel.h, sched.h>
asmlinkage int sys_newcall(int n){
    printk("hello");
    return 0;
}

linux source/kernel 에서 Makefile  o추가.

1.번과 동일.
test  gcc -I/linux source/include
test.c #include <linux/unistd.h, stdio.h>
int n; n= newsyscall(10);

라이브러리 작성?


######################################################################################

######################################################################################


3.


ifconfig eth0 192.168.0.1 up

ifconfig eth0 192.168.0.2 up

setip 192.168.0.1 192.168.0.2



setip 192.168.0.2 192.168.0.1

mount -t nfs 192.168.0.1:/nfs_resources /mnt/nfs


######################################################################################

######################################################################################



4? 

bus problem..

DEFAULTS=/root/linux-2.4.19-rmk4-pxa2-sm1/.config


######################################################################################

######################################################################################


5. 체크포인트..


/usr/src/linux-2.4.22/include/linux/sched.c  

420line  int shoud_ckpt;


/usr/src/linux-2.4.22/arch/i386/kernel/proccess.c

790line  current->should_ckpt = 0;


/usr/src/linux-2.4.22/include /asm-i386/unistd.h

260 line #define __NR_ckpt 259

#define __NR_recover 260


/usr/src/linux-2.4.22/arch/i386/kernel/entry.S

218line  call SYMBOL(do_ckpt)

667line .long SYMBOL_NAME(sys_ckpt)

668line .long SYMBOL_NAME(sys_recover)


/usr/src/linux-2.4.22/kernel/Makefile

ckpt.o 추가 ckpt.c복사


cp /boot/config-2.4.20-8 /usr/src/linux/.config, oldconfig , bzImage , modules , modules_install , install


######################################################################################

######################################################################################


6. 프로젝트


1. should ckpt;
./include/linux/sunrpc/sched.h

2.arch/arm/kernel/sys_arm.c
    error = do_execve(filename, argv, envp, regs);
    if ( error == 0 ){
        current->should_ckpt = 0;
    }
        putname(filename);

3./root/linux-2.4.19/include/asm-arm/unistd.h
#define __NR_ckpt            (__NR_SYSCALL_BASE+226)
#define __NR_recover            (__NR_SYSCALL_BASE+226)

4./root/linux-2.4.19/arch/arm/kernel/entry-common.S
    blne    __do_signal
    call SYMBOL_NAME(do_ckpt)
    restore_user_regs
5.call.S
/* 226 */    .long    SYMBOL_NAME(sys_ckpt)
/* 227 */    .long    SYMBOL_NAME(sys_recover)


출처: http://blog.naver.com/PostView.nhn?blogId=bg810113&logNo=30136468539

이쪽 블로그 한번씩 방문해 주세요!

[ㄴㄴ출처] 실습1,2,3,4,5|작성자 네모선장