u-boot for Android can't find partitions from eMMC

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

u-boot for Android can't find partitions from eMMC

跳至解决方案
12,786 次查看
dennis3
Contributor V

The script to set up the android file system (fsl-sdcard-partition.sh) includes the following:

1) dd partition-table.img to card dev (/dev/sdN)

 note actual command has bs=1k count=${valid_gpt_size} where valid_gpt_size is set to 17 in my android 8 script. and the size of the imx is actually around 34K.

2) Formats/copies all the partition data.

3) dd u-boot.imx to /dev/sdN bs=1k seek=1

At this point, in Linux at least, the partitions disappear because 1k offset for u-boot overwrites part of the GPT table.  However, apparently this is OK because u-boot can read the backup GPT table at boot time.

So, if I have my board set up to boot from the sdcard (sd3 in my case), android boots fine.

If however, I flash the images to my emmc card, everything seems to be correctly written to the emmc but at boot time, u-boot complains that it can't find the boot partition.  I'm using a custom method of getting the data on the emmc storage (it's a custom board).

So, my question is.. do I need to enable something differently in the u-boot build to correctly work with emmc as opposed to the normal sd card boot?

2nd question, I'm aware mfgtool can deploy over USB to emmc storage but as stated, I'm not using that approach.  If I were to use that approach, does mfgtool do something differently to the emmc setup that the normal sdcard setup script does not do?  (I'm not completely sure how to use the emmc boot partitions yet and don't know if this is causing part of the issue or not.)

Any tips on helping me get Android up and running from the emmc greatly appreciated.  If I use the sdcard, I can completely boot up with our custom LCD, touch panel and hardware so I'm pretty sure I just need to get u-boot to load android correctly from the emmc and the rest will work fine.

标签 (3)
标记 (4)
0 项奖励
回复
1 解答
11,118 次查看
dennis3
Contributor V

If anyone else runs into this, the commands that mfgtool uses to create the partitions no an eMMC chip are slightly different than those that are in use by a regular SD card.

1) u-boot is written to the built in mmcblkXboot0 instead of being written over the top of the GPT table at 1k offset.

2) boot0 partition can then be enabled to stream u-boot data to CPU at power on with mmc command that is included in the mmc-utils package.

> dd if=u-boot.imx of=/dev/mmcblkXboot0 bs=1k seek=1

> mmc bootpart enable 1 1 /dev/mmcblkX

Other than that, the image is the same.

在原帖中查看解决方案

0 项奖励
回复
9 回复数
2,968 次查看
r_trivedi123
Contributor IV
0 项奖励
回复
11,117 次查看
balaarulsankar
Contributor II

Hi Dennis Muhlestein

I'm also facing same issue with eMMC booting, please suggest me if you have any input.

eMMc flashing is done using fsl script, but issue is when booting up my custom board it's not able to mount partition like system, vendor.

0 项奖励
回复
11,117 次查看
dennis3
Contributor V

balaarulsankar@gmail.com‌ if you can boot into u-boot at least and use the command prompt, you an use the mmc command to check/list your partitions.  If you used the commands listed above, your u-boot image won't overwrite your partition table.

0 项奖励
回复
11,117 次查看
balaarulsankar
Contributor II

Thanks Dennis Muhlestein, Now I'm able to mount all partitions and boot my custom board is successful.

0 项奖励
回复
11,119 次查看
dennis3
Contributor V

If anyone else runs into this, the commands that mfgtool uses to create the partitions no an eMMC chip are slightly different than those that are in use by a regular SD card.

1) u-boot is written to the built in mmcblkXboot0 instead of being written over the top of the GPT table at 1k offset.

2) boot0 partition can then be enabled to stream u-boot data to CPU at power on with mmc command that is included in the mmc-utils package.

> dd if=u-boot.imx of=/dev/mmcblkXboot0 bs=1k seek=1

> mmc bootpart enable 1 1 /dev/mmcblkX

Other than that, the image is the same.

0 项奖励
回复
11,117 次查看
b36401
NXP Employee
NXP Employee

You can use MBR instead of GPT for partitioning the device.

0 项奖励
回复
11,117 次查看
dennis3
Contributor V

Not much luck with trying to create an MBR directly.

=> mmc dev 2
switch to partitions #0, OK
mmc2(part 0) is current device
=> mmc part

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

Part Start Sector Num Sectors UUID Type
1 2048 65536 5fb3f54b-01 83
2 67584 65536 5fb3f54b-02 83
3 133120 3145728 5fb3f54b-03 83
4 3278848 3121152 5fb3f54b-04 05 Extd
bad MBR sector signature 0x0000
=> boota mmc2
boota mmc2
can't find partition: boot, dump the partition table
idx 0, ptn 0 name='gpt' start=0 len=2048
idx 1, ptn 0 name='bootloader' start=2 len=2046 // these are eMMC partitions
idx 2, ptn 1 name='mmcsdc1' start=2048 len=65536
idx 3, ptn 2 name='mmcsdc2' start=67584 len=65536
idx 4, ptn 3 name='mmcsdc3' start=133120 len=3145728
boota: cannot find 'boot' partition

I can actually execute the default boot command differently and get it to start the kernel though:

=> boota mmc2 mmcsdc1

This will find the kernel and start the android boot.  As the kernel boots and tries to find all the rest of the Android partitions it will still fail though.

The problem is as I see it, regardless of how I partition the emmc device, I always get the hardware partitions listed from the eMMC device (in red above) that seem to interfere with uboot finding the correct partitions for android.  How does one set uboot env parameters to find the correct partition table?

0 项奖励
回复
11,117 次查看
dennis3
Contributor V

MBR can only have 4 primary partitions... or 3 and and extended w/ more partitions.  Can u-boot work with the primary/extended partitions?  Which Android partitions go in which partition scheme.   Does it matter? I guess I can experiment with this but it seem problematic.

0 项奖励
回复
11,117 次查看
dennis3
Contributor V

Found an old thread that appears to be a similar if not the same problem:

https://community.nxp.com/thread/471393 

It's assumed answered but I didn't see a solution in that thread.

0 项奖励
回复