Fl0*_*0v0 6 embedded-linux openembedded bitbake yocto
我试图/var/log坚持我的fido构建.poky的默认设置是,有一个符号链接,/var其中包含点log -> volatile/log.volatile是一个安装在tmpfs上.
到目前为止,我发现符号链接应该由base-files配方创建:
volatiles = "log tmp"
do_install () {
...
for d in ${volatiles}; do
ln -sf volatile/$d ${D}${localstatedir}/$d
done
...
Run Code Online (Sandbox Code Playgroud)
我附加了基本文件配方,因此没有创建链接,但它仍然在我的rootfs中出现.那么它来自哪里?我怀疑它可能fs-perms.txt与它有关.但我试图创造一个没有
${localstatedir}/log link volatile/log
Run Code Online (Sandbox Code Playgroud)
线,它仍然创建了该链接.有线索吗?
Bl0*_*und 10
Yocto 2.4 中有一个持久的日志数据选项:https ://bugzilla.yoctoproject.org/show_bug.cgi ? id = 6132
现在可以通过在发行版配置中定义以下内容来使日志数据持久化:
VOLATILE_LOG_DIR = "no"
Run Code Online (Sandbox Code Playgroud)
基本文件配方创建基本系统目录并生成易失性符号链接.还有一个影响的第二个文件,它是一个initscript,用于检查易失性目录,启动期间的符号链接以及创建是否丢失.你应该追加两个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
}
Run Code Online (Sandbox Code Playgroud)
initscripts追加:
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://volatiles"
Run Code Online (Sandbox Code Playgroud)
挥发物文件:
# 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
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
然后在图层的layer.conf文件中添加此行以包含新的fs-perms.txt:
FILESYSTEM_PERMS_TABLES = "${LAYER_PATH}/fs_files/fs-perms.txt"
Run Code Online (Sandbox Code Playgroud)
注意:您可以创建自己的fs-perm文件,并在conf.layer中附加默认文件.
FILESYSTEM_PERMS_TABLES = "fs-perm.txt my-fs-perm.txt"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3104 次 |
| 最近记录: |