我在yocto构建中使用github.com/mendersoftware/meta-mender。我想使用sed
在我自己的图层中使用bbappend文件编辑/ etc / fstab。具体来说,meta-mender目前正在提供他们自己的fstab文件并使用base-files_3.%.bbappend
进行编辑,我只想从生成的/ etc / fstab中删除auto
关键字。
问题在于,当我在我的图层中为base-files_3。%。bbappend提供我自己的bbappend(我的图层具有比meta-mender更高的优先级)时,meta-mender fstab似乎不是根本就是创建的,而来自open-embedded的库存则是。
这是我的元层/ 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 /碱基文件/基层 - files_3:
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
}
然而,我的/ 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
正如您所看到的,它完全跳过了元商人和#39; / etc / fstab文件,只写一个库存。
答案 0 :(得分:1)
那么,你的sed-expression中的.*@MENDER_BOOT_PART@.*
评估为什么?
据我所知,你fstab中的.*@MENDER_BOOT_PART@.*
和.*@MENDER_DATA_PART@.*
都不匹配。
如果我的理解是正确的,你可以使用与
类似的东西 echo "data" >> ${D}${sysconfdir}/fstab