Access UFS When Booting Debian From SD Card

Hello,

I have a HiKey960 and am currently booting Debian 4.15 from an SD card. I am interested in mounting the onboard UFS as a block device. At boot I receive the following console output:

Is there a way to mount the UFS as a block device?

Thank You.

@TEST you should be able to see UFS as a block device as follows:

root@linaro-developer:~# fdisk -l /dev/sdd
GPT PMBR size mismatch (7805956 != 7805951) will be corrected by w(rite).
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
Disk /dev/sdd: 29.8 GiB, 31973179392 bytes, 7805952 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 16384 bytes
I/O size (minimum/optimal): 16384 bytes / 8192 bytes
Disklabel type: gpt
Disk identifier: 2CB85345-6A91-4043-8203-723F0D28FBE8

Device       Start     End Sectors  Size Type
/dev/sdd1      256     511     256    1M Microsoft basic data
/dev/sdd2      512    3583    3072   12M Microsoft basic data
/dev/sdd3     3584    5119    1536    6M Microsoft basic data
/dev/sdd4     5120    8191    3072   12M Linux filesystem
/dev/sdd5     8192   73727   65536  256M Microsoft basic data
/dev/sdd6    73728   73983     256    1M Microsoft basic data
/dev/sdd7    73984   90367   16384   64M EFI System
/dev/sdd8    90368   94463    4096   16M Microsoft basic data
/dev/sdd9    94464   94975     512    2M Microsoft basic data
/dev/sdd10   94976 1295103 1200128  4.6G Linux filesystem
/dev/sdd11 1295104 1495807  200704  784M Microsoft basic data
/dev/sdd12 1495808 1496063     256    1M Microsoft basic data
/dev/sdd13 1496064 7805951 6309888 24.1G Linux filesystem

Note: Here you should use /dev/sdd13 (user-data partition) only as other partitions may have useful data required to boot.

I am unable to see the UFS chip as "/dev/sdd. I currently am booting Debian from an SD card and do not have Debian flashed to the internal UFS chip. Do I have to have to have Linux running on the UFS to recognize it from the operating system running on the SD card? I also noticed that the Debian SD image does not have any SCSI or UFS modules compiled. Is this not a problem?

@TEST I again had a closer look at your logs, it seems your hikey960 is fitted with hynix UFS flash which has a potential timing issue whose fix is available here [1]. I haven’t tried this fix as my hikey960 has different UFS flash.

So I would suggest you to apply this patch to 96boards-hikey kernel [2] and update kernel on hikey960 following this guide [3].

[1] LKML: John Stultz: [PATCH v3] scsi: ufs: Fix hynix ufs bug with quirk on hi36xx SoC
[2] https://github.com/96boards-hikey/linux/tree/hikey960-upstream-rebase
[3] https://github.com/96boards/documentation/blob/master/consumer/hikey/hikey620/build/linux-kernel.md