i.MX8MM: Formatting eMMC with mkfs.ext4 in initramfs environment

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MM: Formatting eMMC with mkfs.ext4 in initramfs environment

2,018 Views
harsh1621
Contributor II

I am working with Linux Kernel 4.19.35 for Arm64. My imx8mm-var-dart board has two storage devices - SD Card and eMMC. I need to partition, format and flash certain contents from the SD Card onto the eMMC.

For my use case, I intend to perform these manipulations from an intramfs environment using shell scripts triggered by init, and reboot the system into the flashed RFS after the above eMMC modification.

However, after successfully partitioning the eMMC, I am unable to create an ext4 filesystem on any of the created partitions.

mkfs.ext4 -v /dev/mmcblk2p1 -L "part1"

The command above throws a segmentation fault after successfully discarding the blocks in the first partition. 

The following is the output of the mkfs.ext4 operation:

mk2efs 1.45.6 (20-Mar-2020)
fs_types for mk2efs.conf resolution: 'ext4'
Discarding device blocks:
done
Segmentation fault

Before partitioning and formatting, the eMMC already had some data and a partition table, hence I am not using the -E nodiscard option as I need to get rid of the old blocks. 

However, the above segmentation fault message is way too minimal to guess anything for me. Any pointers to what might be going wrong would be very helpful.

Note: The commands fdisk -l -u and mmc part (from u-boot console) list the new partitions properly on the eMMC. Hence, I can be sure that there are no issues in the creation of partitions.

0 Kudos
1 Reply

1,998 Views
nxf54947
NXP Employee
NXP Employee

Hi @harsh1621,

If you are are able, could you use .ext3 at partitioning? Here is an snippet from our kernel examples for downloading  an image from RAM to the EMMC (please use a different partition):

mmc=`cat /tmp/mmcdev`;
 mkfs.ext3 -F -E nodiscard /dev/mmcblk${mmc}p2 

 

I have also found a similar post that could help you out:

How to flash eMMC from an SDCard on i.MX6Q ? 

 

Finally, I also believe that this documentation could help you out:
i.MX Linux® User's Guide 

Regards,

Ruben

0 Kudos