feat(install): build for a named target kernel, not always the running one - #22
Closed
youngrok-XCENA wants to merge 1 commit into
Closed
feat(install): build for a named target kernel, not always the running one#22youngrok-XCENA wants to merge 1 commit into
youngrok-XCENA wants to merge 1 commit into
Conversation
…g one dkms and make default to `uname -r`. That is the kernel the module will run on when install.sh runs on the target machine, and the builder's kernel when it installs into an image being assembled, where the module built that way cannot load. Take the target as input: XCENA_TARGET_KVER names the kernel version (DKMS registration, install path, depmod, initramfs) and XCENA_TARGET_KDIR names the build tree. Either one is enough -- the version resolves to /lib/modules/<version>/build, the path DKMS and the distro header packages use, and the tree resolves to its own kernelrelease. With neither, the running kernel is used exactly as before. A tree outside the default path is passed on to DKMS via --kernelsourcedir. A missing tree fails with both remedies named. Two fixes in the same area: - The clean that runs before staging the source into /usr/src used the default build tree. Installing for another kernel made it fail silently, so build artifacts such as mx_dma.mod.c were copied into the DKMS source. - `udevadm control --reload-rules` is now best-effort. udevd is not running while an image is being assembled, and the rule file it would reload is already in place there.
Contributor
Author
|
개발 PR 은 같은 변경을 xcena-dev/mxdriver_dev#85 로 다시 올렸습니다. 브랜치 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 배경 및 동기 (Why)
dkms build와make는 러닝 커널을 타겟으로 잡습니다. 설치기가 설치 대상 머신 위에서 돌 때는 그게 정답입니다 — 실 HW 와 부팅된 게스트가 그 경우입니다.에뮬레이터 게스트 이미지를 조립할 때는 아닙니다. 그때 러닝 커널은 이미지를 굽는 머신의 것이고, 그 커널로 빌드한 모듈은 이미지가 부팅해도 로드되지 않습니다. 지금까지 이 자리는 에뮬레이터가 자체 크로스빌드로 메워 왔고, 그래서 같은 모듈의 설치 방법이 두 곳에 존재합니다.
🏗️ 설계 변경점
설치할 커널을 밖에서 지정할 수 있게 합니다. 지정하지 않으면 러닝 커널이므로 기존 사용자 경로의 동작은 바뀌지 않습니다.
입력이 두 개인 이유는 커널 모듈 설치에 필요한 것이 두 가지이고 쓰이는 자리가 다르기 때문입니다.
depmod, initramfs표준 배치에서는 버전이 트리를 함의하므로(
/lib/modules/<버전>/build, DKMS 자신의 기본값이자 배포판 헤더 패키지가 만드는 경로) 하나만 주면 나머지가 채워집니다.해석된 트리가 없으면 그 자리에서 실패합니다. "러닝 커널 헤더가 없으면 이 루트의 다른 빌드 트리를 쓴다" 같은 대체 탐색은 두지 않았습니다 — 커널 업그레이드 후 재부팅 전이거나 옛 헤더가 남은 상황에서 조용히 다른 커널로 빌드하게 되는데, 그것이 이 변경이 막으려는 문제 그 자체입니다.
📝 상세 구현 내용
XCENA_TARGET_KVER— 커널 버전.dkms build/install -k,depmod,update-initramfs -k가 이 값을 씁니다.XCENA_TARGET_KDIR— 커널 빌드 트리.BUILDSYSTEM_DIR로 전달하고, 표준 경로 밖이면 DKMS 에--kernelsourcedir로 함께 넘깁니다. 표준 경로일 때는 인자를 붙이지 않아 기존 호출과 동일합니다.linux-headers-<버전>설치와XCENA_TARGET_KDIR지정 두 가지를 안내하며 종료합니다.같은 구역의 문제 두 개를 함께 고쳤습니다.
/usr/src로 복사하기 전에 도는make clean이 기본 빌드 트리를 썼습니다. 다른 커널을 대상으로 설치하면 그 clean 이 조용히 실패해mx_dma.mod.c같은 빌드 잔여물이 DKMS 소스로 복사됩니다. 해석된 트리를 쓰도록 했습니다.udevadm control --reload-rules를 best-effort 로 바꿨습니다. 이미지 조립 중에는 udevd 가 없고, reload 대상인 룰 파일은 그 시점에 이미 제거돼 있습니다.✅ 테스트
turin-gb1 에서 확인했습니다.
vermagic이 게스트 커널과 일치, 부팅 후 자동 로드·디바이스 인식kernelrelease에서 버전 유도🔗 관련 이슈(선택)
🌿 관련 PR(선택)
🌿 관련 Branch(선택)
📦 Release Note (자동 생성용 / 영문 작성)
NEW
CHANGED
FIXED
IMPORTANT NOTES