요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
========================
Direct filesystem lookup
========================
Direct filesystem lookup is the most common form of firmware lookup performed
by the kernel. The kernel looks for the firmware directly on the root
filesystem in the paths documented in the section 'Firmware search paths'.
The filesystem lookup is implemented in fw_get_filesystem_firmware(), it
uses common core kernel file loader facility kernel_read_file_from_path().
The max path allowed is PATH_MAX -- currently this is 4096 characters.
It is recommended you keep /lib/firmware paths on your root filesystem,
avoid having a separate partition for them in order to avoid possible
races with lookups and avoid uses of the custom fallback mechanisms
documented below.
Firmware and initramfs
----------------------
Drivers which are built-in to the kernel should have the firmware integrated
also as part of the initramfs used to boot the kernel given that otherwise
a race is possible with loading the driver and the real rootfs not yet being
available. Stuffing the firmware into initramfs resolves this race issue,
however note that using initrd does not suffice to address the same race.
There are circumstances that justify not wanting to include firmware into
initramfs, such as dealing with large firmware files for the
remote-proc subsystem. For such cases using a userspace fallback mechanism
is currently the only viable solution as only userspace can know for sure
when the real rootfs is ready and mounted.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Direct filesystem lookup
1-15문서 제목은 `Direct filesystem lookup`입니다.
Direct filesystem lookup은 kernel이 수행하는 가장 일반적인 firmware lookup 형식입니다. Kernel은 `Firmware search paths` 절에 설명된 root filesystem 경로에서 firmware를 직접 찾습니다.
Filesystem lookup은 `fw_get_filesystem_firmware()`에 구현되어 있으며, 공통 core kernel file loader 기능인 `kernel_read_file_from_path()`를 사용합니다. 허용되는 최대 경로 길이는 `PATH_MAX`이고 현재 4,096자입니다.
`/lib/firmware` 경로는 root filesystem에 두는 것을 권장합니다. 별도 partition에 두면 lookup과 mount 사이에 race가 생길 수 있고 아래에서 설명하는 custom fallback mechanism을 사용해야 할 수 있으므로 피해야 합니다.
Firmware와 initramfs
16-24Kernel에 built-in된 driver가 사용하는 firmware도 kernel boot에 쓰는 `initramfs`에 함께 포함해야 합니다. 그렇지 않으면 driver를 load하는 시점에 실제 rootfs가 아직 준비되지 않아 race가 발생할 수 있습니다.
Firmware를 `initramfs`에 넣으면 이 race를 해결할 수 있습니다. 다만 `initrd`를 사용하는 것만으로는 같은 race를 해결하기에 충분하지 않습니다.
Driver load보다 firmware가 먼저 접근 가능해야 rootfs 준비와의 race를 피할 수 있습니다.
Userspace fallback이 필요한 경우
25-30`remote-proc` subsystem의 대용량 firmware file처럼 firmware를 `initramfs`에 포함하고 싶지 않은 정당한 상황이 있습니다.
이런 경우에는 userspace만 실제 rootfs가 준비되어 mount된 시점을 확실히 알 수 있으므로, 현재로서는 userspace fallback mechanism을 사용하는 것이 유일하게 실현 가능한 해결책입니다.
요약과 해설
direct-fs-lookup.rst:1-30일반적인 firmware request는 root filesystem의 `/lib/firmware` 계열 경로를 직접 탐색합니다. 이 경로를 별도 partition으로 분리하면 mount 시점과 lookup이 경쟁할 수 있습니다.
Built-in driver가 초기 boot 중 firmware를 필요로 하면 이를 `initramfs`에 포함해야 합니다. 대용량 firmware처럼 포함하기 어려운 경우에는 실제 rootfs 준비 시점을 아는 userspace fallback이 필요합니다.