우리 2번째 집.
by 라임
srpm 만들기 추가

춢처


[[Redhat 커널 소스를 이용하여 커널RPM 을 생성 하는 방법]]

리눅스 최신 소스 커널을  Redhat 싸이트에서 가져오라 (ftp.redhat.com)

  kernel-2.6.9-55.0.9.EL.src.rpm (2007년 10월 30일 기준 현재 최신이다)

[소스커널 설치]

   > rpm -Uvh kernel-2.6.9-55.0.9.EL.src.rpm

    > cd /usr/src/redhat/SOURCES

    > tar xvjf  linux-2.6.9.tar.bz2

    > cp -rp     linux-2.6.9.org

 

#Tuning Pint Patch File 생성

# 1.1.1 File Open Limit 수정

-----------------------------------------

  vi  linux-2.6.9/include/linux/fs.h 

  --  #define INR_OPEN 1024           /* Initial setting for nfile rlimits */

   ++ #define INR_OPEN 4096           /* Initial setting for nfile rlimits */

# 1.1.2 패치 파일 생성

 diff -uNr linux-2.6.9.org/include/linux/fs.h  linux-2.6.9/include/linux/fs.h  > linux-2.6.9-tune-fs-updaste.patch

 

# 1.2.1  Limit 수정

-----------------------------------------

vi linux-2.6.9/include/linux/limits.h

-- #define NR_OPEN         1024

++ #define NR_OPEN         8192

# 1.2.2 패치 파일 생성

 diff -uNr linux-2.6.9.org/include/linux/limits.h  linux-2.6.9/include/linux/limits.h  > linux-2.6.9-tune-limit-updaste.patch

 

# 1.2.1  TCP 수정

-----------------------------------------

vi linux-2.6.9/include/net/tcp.h

-- #define TCP_TIMEWAIT_LEN (60*HZ) /* how long to wait to destroy TIME-WAIT

++ #define TCP_TIMEWAIT_LEN (6*HZ) /* how long to wait to destroy TIME-WAIT

# 1.2.2 패치 파일 생성

 diff -uNr linux-2.6.9.org/include/net/tcp.h  linux-2.6.9/include/net/tcp.h  > linux-2.6.9-tune-tcp-updaste.patch

 

 

# 2. 커널 모듈 수정

      이부분은 양이 많으니 필요한 드리이버 XFS ReiserFS 같은 것은 따로 정리 하세요.

      cd linux-2.6.9

      make menuconfig

 

# 2.1.2 패치 파일 생성

 

# 3. kernel-2.6.spec  패치 항목등록

 cd /usr/src/redhat/SPECS

수정된 패치 목록을 Spec 파일에서 패치가 되도록 수정하자.

SPECS/kernel-2.6.spec 파일을 다음과 같이 수정 한후 복사하여 둔다.

-----------------------------------------------------------------

#
# Polite request for people who spin their own kernel rpms:
# please modify the "release" field in a way that identifies
# that the kernel isn't the stock distribution kernel, for example by
# adding some text to the end of the version number.
# > 릴리즈 를 수정한다.
%define release 55.0.9.EL.CDR
%define sublevel 9

---중략---

# empty final patch file to facilitate testing of kernel patches
Patch20000: linux-kernel-test.patch

# Patch For Tuning
Patch90000: linux-2.6.9-tune-fs-updaste.patch
Patch90001: linux-2.6.9-tune-limit-updaste.patch
Patch90002: linux-2.6.9-tune-tcp-updaste.patch

# END OF PATCH DEFINITIONS

 

---중략---

# conditionally applied test patch for debugging convenience
%if %([ -s %{PATCH20000} ] && echo 1 || echo 0)
%patch20000 -p1
%endif

# Kernel Tuning By CDR
%if %([ -s %{PATCH90000} ] && echo 1 || echo 0)
%patch90000 -p1
%endif

%if %([ -s %{PATCH90001} ] && echo 1 || echo 0)
%patch90001 -p1
%endif

%if %([ -s %{PATCH90002} ] && echo 1 || echo 0)
%patch90002 -p1
%endif

 

----------------------------------------------------------------------------

 

오랜 수고 끝에 소스들이 정리 되었다.

이제는 소스 RPM을 다시 만들어야 한다.

 

 rpmbuild -bs --target i686 SPECS/kernel-2.6.spec

 명령 수행후 SRPMS/kernel-2.6.9-55.0.9.EL.CDR.src.rpm  이 새로 생성 되었을 것이다.

이제 처음 부터 다시 시작 하면된다.

 

## SOURCE 폴더의 내용 과 SPEC BUILD 아래  내용들을 지우자.

rm -rf SOURCE/*

rm -rf BUILD/*

rm -f SPECS/kernel-2.6.spec

 

## RPM 커널 소스를 다시 설치한다.

rpm -Uvh SRPMS/kernel-2.6.9-55.0.9.EL.CDR.src.rpm 

 

## RPM 커널을 만들자.

rpmbuild -ba --target i686 SPECS/kernel-2.6.spec

 

한참 후에 RPMS폴더 아래 RPM 파일이 생성 될것이다.

by 라임 | 2010/08/26 14:24 | 트랙백 | 덧글(0)
< 이전페이지 다음페이지 >


카테고리
이전블로그
이글루링크
최근 등록된 덧글
이햐! 너무 감사합니다!!..
by kalcapt at 04/17
고맙습니다. 좋은정보 ..
by 까치 at 03/22
왠만하면 댓글 안남기지..
by ㅇㅇ at 11/13
감사합니다. 잘 읽고 갑..
by hodol at 06/03
You're Great !!!
by phper at 04/27
메모장
Candle


라이프로그
rss

skin by 소로진