Рецепт базовых файлов создает основные системные каталоги и делает изменчивые символические ссылки. Существует также второй файл, который влияет, это сценарий инициализации, который проверяет изменчивые каталоги, символические ссылки во время запуска и создает, если они отсутствуют. Вы должны добавить как base-files
, так и initscripts
рецепты. Наконец, вам нужно обновить ссылки, связанные с базовыми файлами, в fs-perms.txt
.
Я предлагаю, если на вашем жестком диске достаточно места, вы можете смонтировать /var/log
в другой раздел из rootfs. Это более практичный и безопасный способ, если что-то случится в вашем разделе rootfs.
new_log_part
- это мой раздел журнала в данном случае.
Если вы создаете новый раздел для журналов, вам следует добавить его в fstab для автоматического монтирования при запуске. Включить новый fstab в рецепт базовых файлов.
Рецепт добавления базовых файлов:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://fstab"
dirs755_remove = "${localstatedir}/volatile/log"
volatiles_remove = "log"
do_install_append () {
ln -snf new_log_part ${D}${localstatedir}/log
}
initscripts добавляют:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://volatiles"
volatiles файл:
# This configuration file lists filesystem objects that should get verified
# during startup and be created if missing.
#
# Every line must either be a comment starting with #
# or a definition of format:
# <type> <owner> <group> <mode> <path> <linksource>
# where the items are separated by whitespace !
#
# <type> : d|f|l : (d)irectory|(f)ile|(l)ink
#
# A linking example:
# l root root 0777 /var/test /tmp/testfile
# f root root 0644 /var/test none
#
# Understanding links:
# When populate-volatile is to verify/create a directory or file, it will first
# check it's existence. If a link is found to exist in the place of the target,
# the path of the target is replaced with the target the link points to.
# Thus, if a link is in the place to be verified, the object will be created
# in the place the link points to instead.
# This explains the order of "link before object" as in the example above, where
# a link will be created at /var/test pointing to /tmp/testfile and due to this
# link the file defined as /var/test will actually be created as /tmp/testfile.
d root root 0755 /var/volatile/cache none
d root root 1777 /var/volatile/lock none
d root root 0755 /var/new_log_part none
d root root 0755 /var/volatile/run none
d root root 1777 /var/volatile/tmp none
l root root 0755 /var/cache /var/volatile/cache
l root root 1777 /var/lock /var/volatile/lock
l root root 0755 /var/log /var/new_log_part
l root root 0755 /var/run /var/volatile/run
l root root 1777 /var/tmp /var/volatile/tmp
d root root 0755 /var/lock/subsys none
f root root 0664 /var/new_log_part/wtmp none
f root root 0664 /var/run/utmp none
l root root 0644 /etc/resolv.conf /var/run/resolv.conf
f root root 0644 /var/run/resolv.conf none
Изменения в fs-perms.txt:
# Items from base-files
# Links
${localstatedir}/run link volatile/run
${localstatedir}/log link new_log_part
${localstatedir}/lock link volatile/lock
${localstatedir}/tmp link volatile/tmp
Затем в файле слоя layer.conf добавьте эту строку, чтобы включить новый файл fs-perms.txt:
FILESYSTEM_PERMS_TABLES = "${LAYER_PATH}/fs_files/fs-perms.txt"
Примечание. Вы можете создать свой собственный файл fs-perm и добавить файл по умолчанию в свой conf.layer.
FILESYSTEM_PERMS_TABLES = "fs-perm.txt my-fs-perm.txt"
person
alpi
schedule
04.04.2017