Create folders inside /mnt (w/o editing sierra_git.bb)

Hi, I recently started using a mangOH WP46 as a testbench for a project which requires specific folders scattered in /. As an example, I’m missing /mnt/ramdisk. Is there any way to generate these folders during image compilation from a personal meta layer (like meta-custom) without messing with files inside meta-swi and meta-swi-extras?

You can modify the init script to create folder

Yes, but only on folders that are abstracted by overlayfs, but since /mnt and /opt are not overlays, I can’t write on them because the OS is contained in a squashfs. I don’t want to break the existing layout of /mnt overlaying it since there are a lot of legato specific things in there. I just want to make my folders inside those paths in a clean way, without extracting the cwe and without messing with Sierra Wireless specific metas.

I remember i can overlay on read only file system.
For example,

mkdir /tmp/tmp_usr_lib;mkdir /tmp/tmp_usr_lib_wr;

mount -t overlay overlay /usr/lib -o lowerdir=/usr/lib,upperdir=/tmp/tmp_usr_lib,workdir=/tmp/tmp_usr_lib_wr;

Not sure if you can do the same.

I kinda solved the problem, by making a new recipe (called mountpoints) starting from sierra_bit.bb but using my own folders and deleting all the sierra licenses and legato specific code, but when I add IMAGE_INSTALL += “mountpoints” on top of mdm9x28-image.inc, I get the folders but the image is highly unstable, because it’s missing some busybox-related symlinks and it keeps panicking and restarting endlessly. On another note, yes, I could overlay /opt without any problems, but /mnt contains the overlays for /home, /dev and other locations in the system. If I mount on top of /mnt the system stop working properly since now it has no overlays working.

how about this?

root@swi-mdm9x28-wp:~# mkdir /mnt/test
mkdir: can’t create directory ‘/mnt/test’: Read-only file system
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# mkdir /tmp/tmp_mnt;mkdir /tmp/tmp_mnt_wr;
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# cp -rf /mnt/legato/ /tmp/tmp_mnt
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# mount -t overlay overlay /mnt -o lowerdir=/mnt,upperdir=/
tmp/tmp_mnt,workdir=/tmp/tmp_mnt_wr;
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ls /mnt
flash legato persist smack userrw
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# mkdir /mnt/test
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# ls /mnt
flash legato persist smack test userrw

root@swi-mdm9x28-wp:~# legato version
19.02.0_cf7c704124f14adfeb3f8595be4b0772_modified
root@swi-mdm9x28-wp:~#
root@swi-mdm9x28-wp:~# cm info
Device: WP7607
IMEI: 359779081234565
IMEISV: 6
FSN: VN730485080103
Firmware Version: SWI9X07Y_02.28.03.03 000000 jenki[ 254.838375] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
ns 2019/05/21 03:33:04
Bootloader Version: SWI9X07Y_[ 254.858904] i2c-msm-v2 78b8000.i2c: NACK: slave not responding, ensure its powered: msgs(n:1 cur:0 tx) bc(rx:0 tx:2) mode:FIFO slv_addr:0x3a MSTR_STS:0x0c1300c8 OPER:0x00000090
02.28.03.03 000000 jenkins 2019/05/21 03:33:04
MCU Version: 002.011
PRI Part Number (PN): 9908958
PRI Revision: 001.000
Carrier PRI Name: GENERIC
Carrier PRI Revision: 002.068_000
SKU: 1104301
Last Reset Cause: Reset, User Requested
Resets Count: Expected: 147 Unexpected: 12

1 Like

Yeah, I guess that could work too. I instead chose to make a recipe that makes the folders I need and adding them to the image using build.sh. I will still put your answer as a solution, since it’s more straightforward. Also, I messed up with the IMAGE_INSTALL, so that’s why the image was missing things. Thanks for the help!