cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
473 Views
Registered: ‎08-25-2019

Petalinux 2018.2 update fstab how to

Jump to solution

Hi 

I would like to change the default mount point of partition 

I tried 

How to Auto Mount SD card in Yocto Recipes 

meta-intel-edison 

 

But when image.ub created it still take the default fstab without my changes

Created 

project-spec/meta-user/recipes-core/base-files

File:

base-files_%.bbappend & 

File content:

SRC_URI += "file://fstab"
do_install_append() {
install -m 0644 ${WORKDIR}/fstab ${D}${sysconfdir}/fstab
}

project-spec/meta-user/recipes-core/base-files/base-files

fstab

/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

I would like to update SD mount point to this

#Re-Mount EMMC
/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0
/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0
/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
147 Views
Registered: ‎08-25-2019

How to update udev black.list 

/project-spec/meta-user/recipes-core/udev$ 

drwxr-xr-x 2 mbalanga mbalanga 4096 Oct 25 11:01 udev-extraconf
-rw-r--r-- 1 mbalanga mbalanga 99 Oct 25 11:10 udev-extraconf_%.bbappenda

And then 

do_install_append() {
sed -i '$s|$|\n/dev/mmcblk0*|' ${D}${sysconfdir}/udev/mount.blacklist
}

/project-spec/meta-user/recipes-core/udev/udev-extraconf$ ls -l

-rw-r--r-- 1 mbalanga mbalanga 66 Oct 25 09:21 mount.blacklist

 

 

And It work

 

View solution in original post

12 Replies
Highlighted
Observer
Observer
455 Views
Registered: ‎08-25-2019

I tried 

https://stackoverflow.com/questions/43283825/yocto-recipe-to-update-etc-fstab 

Create a new layer using

yocto-layer create mylayer

inside it, create a folder called recipes-core and inside this folder create another folder called base-files.

Inside this folder create a file called base-files_%.bbappend, with the following content:

FILESEXTRAPATHS_append := "${THISDIR}/${PN}:"

Create another folder called base-files, inside which you should put a file called fstab with your configurations.

 

Also Tried

SRC_URI += "file://fstab"
FILESEXTRAPATHS_prepend := "${THISDIR}/base-files:"

Tried also 

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

 

Didn't work

0 Kudos
Highlighted
Advisor
Advisor
416 Views
Registered: ‎01-28-2008

Hi @micki_b12 

  You may try using a sed command in the .bbappend, as follows:

do_install_append() {
    sed -i '$|s|$|\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n
/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n
/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
}

  The sed command matches the last line ($), then replaces it with the 3 lines that follow. The sed separator '|' is used to avoid conflict with the forward slashes '/'.

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

0 Kudos
Highlighted
Observer
Observer
404 Views
Registered: ‎08-25-2019

Hi

Thank for the reply I am miising something attach below the 

PATH: project-spec/meta-user/recipes-core/base-file/base-files_%.bbappend

do_install_append() {
sed -i '$s$\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n /dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n /dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
}

And I get this error

sed: -e expression #1, char 213: unterminated `s' command

0 Kudos
Highlighted
Advisor
Advisor
401 Views
Registered: ‎01-28-2008

Hi @micki_b12 

  Looks like you're missing the first "|" (i.e. pipe) separators?

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

0 Kudos
Highlighted
Observer
Observer
387 Views
Registered: ‎08-25-2019

do_install_append() {
sed -i '$|s|$|\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n /dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n /dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
}

 

sed: -e expression #1, char 2: unknown command: `|'

0 Kudos
Highlighted
Advisor
Advisor
382 Views
Registered: ‎01-28-2008

Hi @micki_b12 

  How about this:

do_install_append() {
    sed -i '$s|$|\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n
/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n
/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
}

  I think I transcribed an extra "|" character in the sed expression.

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

Highlighted
Observer
Observer
372 Views
Registered: ‎08-25-2019

Thanks it worked and update the fstab

But the mount is the same attach /etc/fstab and mount output 

micki_b12_0-1603398642060.png

It's seems both 

/dev/mmcblk0p3 and  /dev/mmcblk0p1 are mounted to  /run/media/mmcblk0p1

0 Kudos
Highlighted
Advisor
Advisor
364 Views
Registered: ‎01-28-2008

Hi @micki_b12 

  I suspect the first space character is somehow affecting the line being taken. For example, the dmask on /dev/mmcblk0p1 is not being applied.

  Let's try removing the space after \n's, to avoid the leading whitespace.

do_install_append() {
    sed -i '$s|$|\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
}

Thanks,

-Pat

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

Highlighted
Observer
Observer
356 Views
Registered: ‎08-25-2019

Again Thanks For the help  didn't work

fstab

/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0
/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0
/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0

 

mtab

/dev/mmcblk0p1 /run/media/mmcblk0p1 vfat rw,relatime,gid=6,fmask=0007,dmask=0007,allow_utime=0020,codepage=437,iocharset=iso8859-1,s0
/dev/mmcblk0p3 /run/media/mmcblk0p3 ext4 rw,relatime,data=ordered 0 0
/dev/mmcblk0p2 /run/media/mmcblk0p2 ext4 rw,relatime,data=ordered 0 0

0 Kudos
Highlighted
Advisor
Advisor
326 Views
Registered: ‎01-28-2008

Hi @micki_b12 

  I suspect udev is interfering with the mounts and getting in front of fstab. I'm not familiar with udev, but there's a file in /etc/udev/mount_blacklist that you may patch to add the /dev/mmcblk*, so udev ignores the mmc mount and gives priority to fstab to do its thing.

  I'd try adding another sed command to the same script to patch it. Something like:

do_install_append() {
    sed -i '$s|$|\n/dev/mmcblk0p2 /run/media/mmcblk0p2 auto defaults,sync,noauto 0 0\n/dev/mmcblk0p3 /run/media/mmcblk0p1 auto defaults,sync,noauto 0 0\n/dev/mmcblk0p1 /run/media/mmcblk0p3 vfat dmask=000,fmask=0111,user 0 0|g' ${D}${sysconfdir}/fstab
    sed -i '$s|$|\n/dev/mmcblk0*|' ${D}${sysconfdir}/udev/mount.blacklist
}

Thanks,

-Pat

 

Give kudos if helpful. Accept as solution if it solves your problem.
https://tuxengineering.com/blog

0 Kudos
Highlighted
Observer
Observer
201 Views
Registered: ‎08-25-2019

Hi @patocarr appreciate the help 

Get this error:

can't /build/tmp/work/plnx_zynqmp-xilinx-linux/base-files/3.0.14-r89/image/etc/udev/mount.blacklist: No such file or directory

Tried to find mount.blacklist didn't find it even after I build the project 

 

 

Also Tried to create an app

petalinux-create -t apps -n mountblacklist --enable

mount.blacklist 

/dev/loop
/dev/ram
/dev/mtdblock
/dev/md
/dev/dm-*
/dev/mmcblk0*

 

mountbalcklist.bb

#
# This file is the mountblacklist recipe.
#

SUMMARY = "Simple mountblacklist application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://mount.blacklist \
"

S = "${WORKDIR}"

do_install() {
install -d ${D}${sysconfdir}/udev
install -m 0755 ${S}/mount.blacklist ${D}${sysconfdir}/udev/mount.blacklist
}
FILES_${PN} += "${sysconfdir}/*"

 

Didn't work

 

0 Kudos
Highlighted
Observer
Observer
148 Views
Registered: ‎08-25-2019

How to update udev black.list 

/project-spec/meta-user/recipes-core/udev$ 

drwxr-xr-x 2 mbalanga mbalanga 4096 Oct 25 11:01 udev-extraconf
-rw-r--r-- 1 mbalanga mbalanga 99 Oct 25 11:10 udev-extraconf_%.bbappenda

And then 

do_install_append() {
sed -i '$s|$|\n/dev/mmcblk0*|' ${D}${sysconfdir}/udev/mount.blacklist
}

/project-spec/meta-user/recipes-core/udev/udev-extraconf$ ls -l

-rw-r--r-- 1 mbalanga mbalanga 66 Oct 25 09:21 mount.blacklist

 

 

And It work

 

View solution in original post