DKMS를 사용하여 업데이트 시 커널을 자동으로 패치하고 설치합니다.

DKMS를 사용하여 업데이트 시 커널을 자동으로 패치하고 설치합니다.

제대로 작동하려면 커널에 파일을 패치해야 하는 시스템이 있습니다. 시스템에서 Ubuntu 14.04를 실행 중입니다.

패치는 drivers/hwmon.

따라서 모든 커널 업데이트 후에는 커널 소스를 다운로드하고, 패치를 적용하고, 커널을 다시 빌드하고 설치해야 합니다.

본질적으로 내 질문은 다음과 매우 유사합니다.업데이트 시 자동으로 모듈 패치를 적용하고 커널을 컴파일하시겠습니까?, 여기서는 DKMS를 사용하는 것이 좋습니다. 제공되는 일반 DKMS 문서에 대한 링크가 있지만 모듈 패치 상황은 다루지 않습니다.

자동으로 패치를 수행하도록 DKMS를 구성하는 방법을 알려주시겠습니까? 감사해요!

답변1

모듈을 패치한다고 해서 실제로 방식이 바뀌지는 않습니다. 기본적으로 필요한 것은 특정 커널 모듈의 트리 외부 빌드를 컴파일하는 데 필요한 모든 파일을 폴더에 넣고 해당 폴더에 /usr/src/<modulename>-</moduleversion>/구성 파일을 추가해야 하는 것입니다 .dkms.conf

기본적으로 다음과 같아야 합니다.

MAKE="make -C $kernel_source_dir M=\$(pwd)"
PACKAGE_NAME=hwmon
PACKAGE_VERSION=1.2.3.4
BUILT_MODULE_NAME[0]="hwmon"
DEST_MODULE_LOCATION[0]="/kernel/extra"
AUTOINSTALL=yes

패치의 경우 다음을 살펴봐야 합니다.dkms 매뉴얼 페이지발췌한 내용은 아래에 링크되어 있습니다.

   PATCH[#]=
          Use  the  PATCH directive array to specify patches which should be applied to
          your source before a build occurs.  All patches are expected  to  be  in  -p1
          format  and  are  applied  with the patch -p1 command.  Each directive should
          specify the filename of the patch to apply, and all patches must  be  located
          in  the  patches  subdirectory  of  your  source  directory  ( /usr/src/<mod‐
          ule>-<module-version>/patches/ ).  If any patch fails  to  apply,  the  build
          will  be  halted  and  the rejections can be inspected in /var/lib/dkms/<mod‐
          ule>/<module-version>/build/.  If a PATCH should only be  applied  condition‐
          ally,  the  PATCH_MATCH[#]  array should be used, and a corresponding regular
          expression should be placed in PATCH_MATCH[#] which will alert dkms  to  only
          use that PATCH[#] if the regular expression matches the kernel which the mod‐
          ule is currently being built for.

   PATCH_MATCH[#]=
          See the above description for PATCH[#] directives. If you only want  a  patch
          applied  in  certain  scenarios,  the PATCH_MATCH array should be utilized by
          giving a regular expression which matches the kernels you intend  the  corre‐
          sponding PATCH[#] to be applied to before building that module.

그런 다음 dkms에 등록하고 모듈을 빌드하고 설치하려고 합니다.

dkms add     -m hwmon -v 1.2.3.4
dkms build   -m hwmon -v 1.2.3.4
dkms install -m hwmon -v 1.2.3.4

모듈 이름과 버전에 자리 표시자를 사용했지만 여러분도 이해하실 것입니다. 이 내용은 모두dkms 매뉴얼 페이지.

관련 정보