Issue with emmc-install

Don’t know if that was fixed, so bag you a pardon…

Anyway I’ve found an issue when I’ve tried to move my Ubuntu 20.04 with mainline kernel using emmc-install.
After successful competition - it was no possible to start from MMC…

So environment is the following:
1/ I have latest mainline uboot build with Fenix installed on SPI memory and kbi switched to bootmode spi
2/ I’ve my own build Ubuntu minimal build using Fenix (it is 1.0.7 version but I’ve found any relevant changes to emmc-install in 1.0.9)

So attached to serial uart and see the the following picture from u-boot

SF: 32768 bytes @ 0x160000 Read: OK
** Script wrong header **

Device 0: unknown device
Card did not respond to voltage select! : -110
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc2(part 0) is current device
** Unrecognized filesystem type **

So uboot can’t recognize emmc /boot partition…

Further digging revealed the following problem
U-Boot expects boot partition to be type of 0xB - Windows 95 FAT 32
however emmc-install formats first emmc partition as 0xC type - which corresponds to Windows 95 FAT32 (LBA) partition type…

Here is an output of printing partition tables from SD and EMMC (after emmc-install)

=> mmc part

Partition Map for MMC device 2  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	8192      	516096    	7fe590c6-01	0c Boot
  2	524288    	29706016  	7fe590c6-02	83
=> 

Partition Map for MMC device 2  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	8192      	516096    	7fe590c6-01	0c Boot
  2	524288    	29706016  	7fe590c6-02	83
=> mmc dev 1
switch to partitions #0, OK
mmc1 is current device
=> 
=> mmc part

Partition Map for MMC device 1  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	32768     	491520    	715e90c6-01	0b Boot
  2	524288    	30280832  	715e90c6-02	83
=> 

Partition Map for MMC device 1  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	32768     	491520    	715e90c6-01	0b Boot
  2	524288    	30280832  	715e90c6-02	83
=> mmc list
sd@ffe03000: 0
sd@ffe05000: 1 (SD)
mmc@ffe07000: 2 (eMMC)
=> 

And if I try to list fat files on EMMC partition it fails as uboot doesn’t know 0xC partition type

=> fatls mmc 2
** Unrecognized filesystem type **
=> 

That’s why I wasn’t able to boot mainline kernel from EMMC after emmc-install

The quick fix is the following:

After emmc-install completed:
1/ mount /dev/mmcbl1p1 (put you emmc block device name here) /mnt
2/ copy files from /mnt somewhere just in case
3/ unmount fs
3/ try to change a partition type using fdisk change partition type command to 0xB type
4/ Sync
5/ Try to mount - if fails format this partition to FAT32 and copy saved files back

now uboot can successfully recognize a correct partition and boot ubuntu with mainline kernel installed to EMMC with emmc-install

@Frank @numbqq - could you please have a look ?

tnx

yes u right ! looks like emmc-install create partition type not equal real fs type with partition table record and maybe this deprecated for mainline uboot

i think we can improve both uboot and fenix
i will check uboot soon