![yocto 기반 Linux 배포판에 /etc/hosts 파일을 추가하는 비결은 무엇입니까?](https://linux55.com/image/212033/yocto%20%EA%B8%B0%EB%B0%98%20Linux%20%EB%B0%B0%ED%8F%AC%ED%8C%90%EC%97%90%20%2Fetc%2Fhosts%20%ED%8C%8C%EC%9D%BC%EC%9D%84%20%EC%B6%94%EA%B0%80%ED%95%98%EB%8A%94%20%EB%B9%84%EA%B2%B0%EC%9D%80%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
저는 Yocto 배포판을 개발 중이며 기본 파일을 일부 DNS 설정을 삽입해야 하는 /etc/hosts
새 파일로 교체해야 합니다.hosts
이미지에서 찾은 기본 파일은 다음과 같습니다.
127.0.0.1 localhost.localdomain localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Yocto 이미지의 파일을 수정하려면 /etc/hosts
이미지에 파일을 추가하는 방법을 찾아야 합니다. 누군가 이 조리법을 찾는 데 도움을 줄 수 있나요?
감사해요
답변1
문제에 대한 해결책을 직접 찾았습니다. 이것이 최선의 해결책인지는 모르겠지만 나에게는 충분합니다.
작업을 두 가지 단계로 나눌 수 있습니다.
1단계: 레시피 찾기
나는 함께 일하고 있다제우스이 버전에서 마침내 /etc/hosts
이미지에 설치된 레시피를 찾았습니다.
meta/recipes-core/base-fles/base-files_<recipe_version>.bb
hosts
이전 레시피를 찾기 위해 모든 욕토 레이어가 포함된 폴더에서 파일을 찾았습니다. 이를 위해 다음 명령을 실행했습니다.
cd <path/to/yocto/folder>
find ./meta* -name "*hosts*"
이전 명령의 출력에는 다음이 포함됩니다.
...
./meta/recipes-core/base-files/base-files/hosts
...
요리책에서 ./meta/recipes-core/base-files/base-files_3.0.14.bb
다음과 같은 과제를 발견했습니다.
SRC_URI = "file://rotation \
file://nsswitch.conf \
file://motd \
=========> file://hosts \
file://host.conf \
file://profile \
file://shells \
file://fstab \
file://issue.net \
file://issue \
file://share/dot.bashrc \
file://share/dot.profile \
file://licenses/GPL-2 \
"
파일은 어디에 있습니까 hosts
?
2단계: base_files_%.bbappend
파일 만들기
파일을 바꾸는 방법 hosts
은 파일을 추가 base_files_%.bbappend
하고 mylayer/recipes-core/base-files
기본 파일을 새 파일로 바꾸는 것입니다.hosts
hosts
내 파일의 내용은 다음 base_files_%.bbappend
과 같습니다.
FILESEXTRAPATHS_prepend := "${THISDIR}/base-files:"
SRC_URI = "file://rotation \
file://nsswitch.conf \
file://motd \
file://hosts \
file://host.conf \
file://profile \
file://shells \
file://fstab \
file://issue.net \
file://issue \
file://share/dot.bashrc \
file://share/dot.profile \
file://licenses/GPL-2 \
"
또한 hosts
폴더에 새 파일을 삽입했습니다
mylayer/recipes-core/base-fles/base-files
. ::
mylayer
|
recipes-core
|
base-files
|
base-files
|
hosts
정의에 나열된 다른 파일 SRC_URI
( rotation
등 )은 계속해서 기본 폴더 nsswitch.conf
인 에서 나옵니다 .base-files
meta/recipes-core/base-fles/base-files