imx sdcard post-boot weirdism

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

imx sdcard post-boot weirdism

1,050 Views
edwardtyrrell
Senior Contributor I

Hello,

I have a very strange issue with mounting a sdcard if the board has been booted without one inserted. The board is an imx7 custom board based of the sabresd7 development board and running  4.1.32 Yocto Krogoth.

The sdcard regarding this issue is only used for AV media files once booting is finished. The board itself boots off NV.

The issue:

1) If the media sdcard is inserted before booting the board everything is fine. After the booting has completed scripts mount the sdcard onto /media/sdcard - everything works and runs fine. I can insert various cards with varying media and ls /media/sdcard will list the media accordingly per card. Whether I manually mount or fstabs mount all is fine.

 

2)This is where things misbehave. If the AV media sdcard is left out during boot then after booting any of the previous  cards "appear" to mount and umount same as before. BUT irrespective of the media file on the sdcard

 ls /media/sdcard always returns imx7.dtb and zImage. These two files clearly are not on the card. Every card has been formatted with only a single partition containing the AV media.  

What is interesting are the results from fdisk -l  ( before mounting the card after boot/login ) If the card is inserted before booting then fdisk -l will show the card as:  

Disk /dev/mmcblk1: 127.8 GB, 127865454592 bytes
255 heads, 63 sectors/track, 15545 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                      Boot    Start   End          Blocks           Id     System
/dev/mmcblk1p1                  3         15546      124852224      7     HPFS/NTFS

However, if the sdcard is not inserted before and during the boot process, but after booting has completed then inserted,  fdisk -l returns:

Disk /dev/mmcblk2rpmb: 127.8 GB, 127865454592 bytes
255 heads, 63 sectors/track, 15545 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device                         Boot    Start       End          Blocks          Id      System
/dev/mmcblk1p1                     65           192           8192              c       Win95 FAT32 (LBA)
/dev/mmcblk1p2                     93            6080        376832          83      Linux

The two tests above are using the exact same sdcard for each scenario but clearly the results are wildly different.  

No matter how many cards or the number of times the media sdcards are mounted and umounted after booting without a card, the "ls /medial/sdcard" is always the same => imx7.dtb and zImage.

Could this be a device tree issue when booting with an empty sdcard slot? Is the driver making a few assumptions and somehow linking over to the zImage and dtb files which are obviously on the board somewhere?

Please help!

0 Kudos
Reply
2 Replies

865 Views
edwardtyrrell
Senior Contributor I

Hi Victor, thanks for replying. 

Currently I have commented out the line /etc/fstab which auto mounts, it makes no difference. I think as you that it must be getting remapped but how? Here's a paste of my device tree if you can see any clues: 

&usdhc2 {
pinctrl-names = "default"; 
pinctrl-0 = <&pinctrl_usdhc2>;
cd-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio5 10 GPIO_ACTIVE_HIGH>;
bus-width = <4>;
removable;
// no-1-8-v;
// vmmc-supply = <&reg_sd2_vmmc>;
enable-sdio-wakeup;
keep-power-in-suspend;
status = "okay";
};

0 Kudos
Reply

865 Views
b36401
NXP Employee
NXP Employee

I never saw such issue before. It seems you are getting secure storage of eMMC mapped on /dev/mmcblk1 instead of /dev/mmcblk2 when expected mmcblk1 (SD card) is not present.
Please check if there is something regarding to SD card or some other media in /etc/fstab file, Possibly there is some misconfiguration.

Have a great day,
Victor

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply