我在yocto版本中使用github.com/mendersoftware/meta-mender。我想使用sed编辑/etc/fstab,在我自己的层中使用bbappend文件。具体来说,meta-mender目前正在提供自己的fstab文件并用base-files_3.%.bbappend编辑它,我只想从生成的/etc/fstab中删除auto关键字。
问题是,当我在我的层中为基础文件提供自己的bbappend(我的层比meta mender具有更高的优先级)时,.bbappend,meta mender fstab似乎根本没有创建,而open embedded中的stock就是。
这是我的meta layer/recipes core/base files/base-files_3.%.bbappend:

do_install_append(){
    sed -i -e 's$.*@MENDER_BOOT_PART@.*$@MENDER_BOOT_PART@   /uboot           @MENDER_BOOT_PART_FSTYPE@       defaults,sync    0  0$' ${D}${sysconfdir}/fstab
    sed -i -e 's$.*@MENDER_DATA_PART@.*$@MENDER_DATA_PART@   /data     @MENDER_DATA_PART_FSTYPE@       defaults         0  0$' ${D}${sysconfdir}/fstab
}

如果我运行bitbake -e base-files,然后查找do_install函数,您可以清楚地看到我的sed命令被正确地附加到meta mender/meta mender core/recipes core/base files/base-files中:
do_install() {
for d in /boot /dev /bin /sbin /lib            /etc /etc/default            /etc/skel /lib /mnt /proc /home/root /run            /usr /usr/bin /usr/share/doc/base-files-3.0.14 /usr/games /usr/include            /usr/lib /usr/sbin /usr/share            /usr/share/common-licenses /usr/share/dict /usr/share/info            /usr/share/man /usr/share/misc /var            /var/backups /var/lib            /sys /var/lib/misc /var/spool            /var/volatile            /var/volatile/log            /home /usr/src /var/local            /media; do
    install -m 0755 -d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image$d
done
for d in /tmp /var/volatile/tmp; do
    install -m 1777 -d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image$d
done
for d in ; do
    install -m 2775 -d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image$d
done
for d in log tmp; do
    ln -sf volatile/$d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/var/$d
done

ln -snf ../run /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/var/run
ln -snf ../run/lock /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/var/lock

do_install_basefilesissue

rotation=`cat /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/rotation`
if [ "$rotation" != "0" ]; then
    install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/rotation /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/rotation
fi

install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/fstab /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/fstab
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/filesystems /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/filesystems
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/usbd /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/default/usbd
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/profile /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/profile
sed -i 's#ROOTHOME#/home/root#' /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/profile
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/shells /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/shells
install -m 0755 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/share/dot.profile /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/skel/.profile
install -m 0755 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/share/dot.bashrc /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/skel/.bashrc
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/nsswitch.conf /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/nsswitch.conf
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/host.conf /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/host.conf
install -m 0644 /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/motd /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/motd

ln -sf /proc/mounts /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/mtab
install -d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/uboot
install -d /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/data
sed -i -e 's$.*@MENDER_BOOT_PART@.*$@MENDER_BOOT_PART@   /uboot               @MENDER_BOOT_PART_FSTYPE@       defaults,sync    0  0$' /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/fstab
sed -i -e 's$.*@MENDER_DATA_PART@.*$@MENDER_DATA_PART@   /data                @MENDER_DATA_PART_FSTYPE@       defaults         0  0$' /home/user/Desktop/yocto/build/tmp/work/raspberrypi3-poky-linux-gnueabi/base-files/3.0.14-r89/image/etc/fstab

}
但是,my/etc/fstab看起来是这样的:
# stock fstab - you probably want to override this with a machine specific one

/dev/root            /                    auto       defaults              1  1
proc                 /proc                proc       defaults              0  0
devpts               /dev/pts             devpts     mode=0620,gid=5       0  0
tmpfs                /run                 tmpfs
mode=0755,nodev,nosuid,strictatime 0  0
tmpfs                /var/volatile        tmpfs      defaults              0  0

# uncomment this if your device has a SD/MMC/Transflash slot
#/dev/mmcblk0p1       /media/card          auto       defaults,sync,noauto  0  0

如您所见,它完全跳过了meta-menders的/etc/fstab文件,而只是编写了一个股票文件。

最佳答案

那么,sed表达式中的.*@MENDER_BOOT_PART@.*计算结果是什么?
据我所见,您的fstab中没有任何匹配.*@MENDER_BOOT_PART@.*.*@MENDER_DATA_PART@.*的内容。
如果我的理解是正确的,你也可以用类似于

 echo "data" >> ${D}${sysconfdir}/fstab

关于linux - 自定义bitbake bbapend无法正确附加修补程序fstab文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43599128/

10-10 07:19