moudi
moudi

Reputation: 518

configure default mount options in yocto

I have a yocto meta layer which build a complete Linux distribution for an embedded system. It is based on 'dunfell' (3.1.11) branch of yocto and using the linux mainline kernel 5.10.57.

The file system which I use is ext4 and the /etc/fstab file contains the following lines (snipped):

/dev/root            /                    auto       defaults              1  1
/dev/mmcblk0p4  /data ext4    defaults,x-systemd.before=network-pre        0       1

The defaults option for mounting results in the following mount configuration (cat /proc/mounts):

/dev/root / ext4 rw,relatime 0 0
/dev/mmcblk0p4 /data ext4 rw,relatime 0 0

I will change the default mounting option to rw,sync,noatime,nodelalloc,barrier=1,commit=1,data=journal.

I'm able to manipulate the /etc/fstab file manually. But how could I change the defaults options in my yocto recipe? I have no idea where to find the default mount options definition in the recipe.

Thanks for any Hint

Edit: Clarify the question:

  1. Where are the mount options defined which are used when defaults is configured in the fstab?
  2. Where could this options configured in a yocto recipe?
  3. How to change the filesystem journaling (enable/disable journal of ext4 filesystem) in the yocto recipe? I think it must be done in the WIC step when the SD Card image is created?

Upvotes: 3

Views: 2540

Answers (1)

Talel BELHAJSALEM
Talel BELHAJSALEM

Reputation: 4294

fstab file is handled by base-files recipe located in:

poky/meta/recipes-core/base-files

To implement your own fstab file:

  • meta-custom/recipes-core/base-files/files/myfstab
  • meta-custom/recipes-core/base-files/base-files_%.bbappend :
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

SRC_URI_append = " file://myfstab"

do_install_append(){
    install -m 0644 ${WORKDIR}/myfstab ${D}${sysconfdir}/fstab
}

Upvotes: 2

Related Questions