Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

rpm 패키지를 빌드하고 설치하는 방법에 대해 설명합니다.(CentOS 6.x 이상)

환경 설정

  • rpm-build 패키지를 설치 합니다.

Code Block
[root@bsr-01 bsr]# yum install rpm-build

CentOS 8 에선 다음의 추가 설치가 필요할 수 있습니다.

[root@bsr-01 bsr]# dnf install kernel-rpm-macros kernel-abi-whitelists

  • rpm 빌드

...

패키징

...

  • 경로를 생성합니다.

Code Block
[root@bsr-01 bsr]# mkdir /root/rpmbuild 
[root@bsr-01 bsr]# mkdir /root/rpmbuild/SOURCES

커널 모듈

  • rpm 을 생성 합니다.

Code Block
[root@bsr-01 bsr]#  make kmp-rpm
  • rpm 빌드가 완료되면 다음과 같은 위치에 kmod-bsr rpm 패키지가 생성 됩니다.

Code Block
...
You have now:
/root/rpmbuild/RPMS/x86_64/bsr-kernel-debuginfo-1.6.0-PREALPHA3.el6.x86_64.rpm
/root/rpmbuild/RPMS/x86_64/kmod-bsr-1.6.0_2.6.32_754.24.3-PREALPHA3.el6.x86_64.rpm


  • rpm 명령으로 설치 합니다.

Code Block
[root@bsr-01 bsr]# rpm -ivh /root/rpmbuild/RPMS/x86_64/kmod-bsr-1.6.0_2.6.32_754.24.3-PREALPHA3.el6.x86_64.rpm


  • bsr 모듈을 적재 합니다.

Code Block
[root@bsr-01 bsr]# modprobe bsr


Code Block
[root@bsr-01 bsr]# modinfo bsr
filename:       /lib/modules/2.6.32-754.24.3.el6.x86_64/extra/bsr/bsr.ko
license:        GPL
alias:          block-major-147-*
license:        GPL
version:        1.6.0-PREALPHA3
description:    bsr - Block Sync and Replication v1.6.0-PREALPHA3
author:         Man Technology Inc. <dev3@mantech.co.kr>
retpoline:      Y
srcversion:     8A7DAFDEC0E6383AFB76501
depends:        libcrc32c
vermagic:       2.6.32-754.24.3.el6.x86_64 SMP mod_unload modversions 
parm:           minor_count:Approximate number of bsr devices (1-255) (uint)
parm:           disable_sendpage:bool
parm:           allow_oos:DONT USE! (bool)
parm:           use_fast_sync:bool
parm:           debug_fast_sync:bool
parm:           enable_faults:int
parm:           fault_rate:int
parm:           fault_count:int
parm:           fault_devs:int
parm:           two_phase_commit_fail:int
parm:           usermode_helper:string

rpm 설치 시 bsr의 모듈 기본 경로는 /lib/modules/(kernel_version)/extra/bsr/bsr.ko 입니다. 만약 이미 다른 경로로 부터 bsr 모듈이 적재된 경우 로드된 bsr 모듈을 제거하고 의존성을 재 생성해야 합니다.(의존성을 재 생성하지 않으면 모듈 적재 시 이전 경로를 참조하게 됩니다)

[root@localhost x86_64]# modinfo bsr filename: /lib/modules/2.6.32-754.24.3.el6.x86_64/updates/bsr.ko license: GPL alias: block-major-147-* license: GPL version: 1.6.0-PREALPHA3 description: bsr - Block Sync and Replication v1.6.0-PREALPHA3 author: Man Technology Inc. <dev3@mantech.co.kr> rhelversion: 8.1 srcversion: BFDF8D2F1E41F6A18478892 depends: libcrc32c name: bsr vermagic: 4.18.0-147.el8.x86_64 SMP mod_unload modversions parm: minor_count:Approximate number of bsr devices (1-255) (uint) parm: disable_sendpage:bool parm: allow_oos:DONT USE! (bool) parm: use_fast_sync:bool parm: debug_fast_sync:bool parm: enable_faults:int parm: fault_rate:int parm: fault_count:int parm: fault_devs:int parm: two_phase_commit_fail:int parm: usermode_helper:string

[root@localhost x86_64]# rmmod bsr

[root@localhost x86_64]# rm -rf /lib/modules/2.6.32-754.24.3.el6.x86_64/updates/bsr.ko

[root@localhost x86_64]# depmod -a

[root@localhost x86_64]# cat /lib/modules/2.6.32-754.24.3.el6.x86_64/modules.dep | grep bsr.ko

extra/bsr/bsr.ko: kernel/lib/libcrc32c.ko

[root@bsr-01 bsr]# modprobe bsr

유틸리티 

  • bsr-utils 경로로 이동 합니다.

Code Block
[root@bsr-01 bsr]# cd bsr-utils
  • bsr-utils rpm을 생성합니다.

    • CentOS 6

      • Code Block
        [root@bsr-01 bsr-utils]# ./autogen.sh 
        [root@bsr-01 bsr-utils]# ./configure
        [root@bsr-01 bsr-utils]# make
        [root@bsr-01 bsr-utils]# make rpm RPMOPT="--without bsrmon --without manual --without xen"
        

    • CentOS 7/8

      • Code Block
        [root@bsr-01 bsr-utils]# ./autogen.sh 
        [root@bsr-01 bsr-utils]# ./configure 
        [root@bsr-01 bsr-utils]# make
        [root@bsr-01 bsr-utils]# make rpm RPMOPT="--without bsrmon --without manual --without xen --without sbinsymlinks"

  • rpm 빌드가 완료되면 다음 경로에 bsr-utils rpm 패키지가 생성 됩니다.

Code Block
... 
You have now: 
/root/rpmbuild/RPMS/x86_64/bsr-1.6.0-PREALPHA3.el6.x86_64.rpm 
/root/rpmbuild/RPMS/x86_64/bsr-debuginfo-1.6.0-PREALPHA3.el6.x86_64.rpm 
/root/rpmbuild/RPMS/x86_64/bsr-bash-completion-1.6.0-PREALPHA3.el6.x86_64.rpm 
/root/rpmbuild/RPMS/x86_64/bsr-udev-1.6.0-PREALPHA3.el6.x86_64.rpm 
/root/rpmbuild/RPMS/x86_64/bsr-utils-1.6.0-PREALPHA3.el6.x86_64.rpm

  • rpm 명령으로 설치 합니다.

Code Block
[root@bsr-01 x86_64]# rpm -ivh /root/rpmbuild/RPMS/x86_64/bsr-utils-1.6.0-PREALPHA3.el6.x86_64.rpm
Code Block
[root@bsr-01 x86_64]# bsradm -V
BSRADM_BUILDTAG=GIT-hash:\ e3fff1406638405bef558c540c2622b24fc4e5f4\ build\ by\ root@centos803\,\ 2020-03-09\ 02:02:01
BSRADM_API_VERSION=2
BSR_KERNEL_VERSION_CODE=0x000000
BSR_KERNEL_VERSION=0.0.0
BSRADM_VERSION_CODE=0x010600
BSRADM_VERSION=1.6.0-PREALPHA3