How to partion eMMc on i.MX6DL properly?

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

How to partion eMMc on i.MX6DL properly?

9,234 Views
arnt
Contributor II

Hi all!

I am trying to flash Android 7 to a i.MX6DL-based design. Our design is really close to the SABRE SD reference design, although we added a larger eMMC. The device has previously been used with Android 4.4.2, thus we know the hardware to be working. 

In Mfgtool/Linux

When I attempt to flash the device, according to the Android Users Guide, using the prebuilt images (including U-Boot), and the UCL2 command included in the Android 7 Mfgtool, I get the following error in the console:


UTP: executing "dd if=$FILE of=/dev/mmcblk3"
67+0 records in
67+0 records out
34304 bytes (34 kB, 34 KiB) copied, 0.014494 s, 2.4 MB/s
UTP: sending Success to kernel for command $ dd if=$FILE of=/dev/mmcblk3.
utp_poll: pass returned.
UTP: received command '$ hdparm -z /dev/mmcblk3'
UTP: executing "hdparm -z /dev/mmcblk3"

/dev/mmcblk3:
 re-reading partition table
Alternate GPT is invalid, using primary GPT.
 mmcblk3: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11
UTP: sending Success to kernel for command $ hdparm -z /dev/mmcblk3.
utp_poll: pass returned.
UTP: received command '$ gdisk -l /dev/mmcblk3 '
UTP: executing "gdisk -l /dev/mmcblk3 "
GPT fdisk (gdisk) version 1.0.1

Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.

Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.

Warning! One or more CRCs don't match. You should repair the disk!

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: damaged

****************************************************************************
Caution: Found protective or hybrid MBR and corrupt GPT. Using GPT, but disk
verification and recovery are STRONGLY recommended.
****************************************************************************
Disk /dev/mmcblk3: 30777344 sectors, 14.7 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): CFF91002-E965-4B01-AD31-B9AB2DC9C7ED
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 29360094
Partitions will be aligned on 2048-sector boundaries
Total free space is 4029 sectors (2.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048           67583   32.0 MiB    FFFF  boot
   2           67584          133119   32.0 MiB    8300  recovery
   3          133120         3278847   1.5 GiB     FFFF  system
   4         3278848         4327423   512.0 MiB   FFFF  cache
   5         4327424         4343807   8.0 MiB     FFFF  device
   6         4343808         4351999   4.0 MiB     FFFF  misc
   7         4352000         4356095   2.0 MiB     FFFF  datafooter
   8         4356096         4360191   2.0 MiB     FFFF  metadata
   9         4360192         4362239   1024.0 KiB  FFFF  presistdata
  10         4362240        29356031   11.9 GiB    FFFF  userdata
  11        29356032        29358079   1024.0 KiB  0700  fbmisc
UTP: sending Success to kernel for command $ gdisk -l /dev/mmcblk3 .

The corresponding UCL commands are

    <CMD state="Updater" type="push" body="send" file="files/android/%folder%/partition-table.img" >Sending and writting partition-table.img</CMD>
    <CMD state="Updater" type="push" body="$ dd if=$FILE of=/dev/mmcblk%mmc%">write gpt table to mmc</CMD>
    <CMD state="Updater" type="push" body="$ hdparm -z /dev/mmcblk%mmc%">Dectecting emmc partition</CMD>
    <CMD state="Updater" type="push" body="$ gdisk -l /dev/mmcblk%mmc% ">List emmc partition</CMD>

I have tried fixing the GPT using the repair tools in "gdisk -l /dev/mmcblk3 ", but I didt not have any luck.
--------------------------------------------------------------------------------------------------------

In U-Boot

The partitions are found by U-Boot, and I can ls, but it can't find the 'boot' partition:

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

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

Part    Start LBA       End LBA         Name
        Attributes
        Type GUID
        Partition GUID
  1     0x00000800      0x000107ff      "boot"
        attrs:  0x0000000000000000
        type:   bb499290-b57e-49f6-bf41-190386693794
        guid:   11e6daa8-fe04-4d0f-9baf-31d2863a0c3f
  2     0x00010800      0x000207ff      "recovery"
        attrs:  0x0000000000000000
        type:   0fc63daf-8483-4772-8e79-3d69d8477de4
        guid:   d042a9a0-3543-4b61-aac8-857f9ca188e3
  3     0x00020800      0x003207ff      "system"
        attrs:  0x0000000000000000
        type:   0f2778c4-5cc1-4300-8670-6c88b7e57ed6
        guid:   d4237e41-0dd2-43e2-98ec-5a76195ca291
  4     0x00320800      0x004207ff      "cache"
        attrs:  0x0000000000000000
        type:   aa3434b2-ddc3-4065-8b1a-18e99ea15cb7
        guid:   7eca1e29-fb4b-42d2-a667-3b2eb2fb5e04
  5     0x00420800      0x004247ff      "device"
        attrs:  0x0000000000000000
        type:   1fd63daf-8583-4772-8e79-3d69d8477de5
        guid:   2aa3f905-e815-4ce7-ab95-3d4f75b55c55
  6     0x00424800      0x004267ff      "misc"
        attrs:  0x0000000000000000
        type:   6b2378b0-0fbc-4aa9-a4f6-4d6e17281c47
        guid:   515bd199-3e38-4186-a49e-556176a759df
  7     0x00426800      0x004277ff      "datafooter"
        attrs:  0x0000000000000000
        type:   314f99d5-b2bf-4883-8d03-e2f2ce507d6a
        guid:   dc98ed0e-01ea-4ea7-bc70-6abbd33e3cf1
  8     0x00427800      0x004287ff      "metadata"
        attrs:  0x0000000000000000
        type:   b598858a-5fe3-418e-b8c4-824b41f4adfc
        guid:   a15b907e-a02b-4ff8-8eff-e1becb14c1f8
  9     0x00428800      0x00428fff      "presistdata"
        attrs:  0x0000000000000000
        type:   e99d84d7-2c1b-44cf-8c58-effae2dc2558
        guid:   1cdaf5fc-7b54-4e94-b851-82f8eec93ff9
 10     0x00429000      0x01bfefff      "userdata"
        attrs:  0x0000000000000000
        type:   0bb7e6ed-4424-49c0-9372-7fbab465ab4c
        guid:   c4f6a963-6fd8-4257-ac62-1e2807bd788e
 11     0x01bff000      0x01bff7ff      "fbmisc"
        attrs:  0x0000000000000000
        type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
        guid:   c3336e60-a380-476e-b256-f8c845b736f6
=> ext4ls mmc 2:1
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
=> ext4ls mmc 2:3
<DIR>       4096 .
<DIR>       4096 ..
<DIR>       4096 lost+found
<DIR>       4096 app
<DIR>       8192 bin
            2284 build.prop
<DIR>       4096 etc
<DIR>       4096 fake-libs
<DIR>       8192 fonts
<DIR>       4096 framework
<DIR>      12288 lib
<DIR>       4096 media
<DIR>       4096 priv-app
<DIR>       4096 usr
<DIR>       4096 vendor
<DIR>       4096 xbin
=> boota mmc2
boota mmc2
can't find partition: boot, dump the partition table
boota: cannot find 'boot' partition
The reported U-Boot version is
U-Boot 2017.03 (Dec 15 2017 - 22:25:16 +0800)
--------------------------------------------------------------------------------------------------------
How can I fix this issue? Is there something wrong with the partitioning in the Linux environment from Mfgtools, or is this a U-Boot issue? Does anyone have any tips as to what I should check next?
Labels (3)
13 Replies

4,125 Views
diegoadrian
NXP Employee
NXP Employee

Hello,


Don't you have the partition table image that corresponds to the memory size of your eMMC? For example, you can have an image named partition-table-28GB.img or partition-table-image-7GB.img.


Best Regards,

Diego.

0 Kudos

4,125 Views
justingregory
Contributor II

Hello Diego, and thanks for helping us out.

Where would we find these partition table image files for various mmc sizes?  They don't appear to be included with MFGTool.

0 Kudos

4,125 Views
diegoadrian
NXP Employee
NXP Employee

Hello,


Those images are located in the zip file of the image that you downloaded or if you built the Android image, the partition images are located in the output directory.


Best regards,

Diego.

0 Kudos

4,125 Views
arnt
Contributor II

Does not my answer to Diego, cover the questions you ask here?

arnt wrote:

I tried both the partition-table.img that was included in the prebuilt files, and I created my own. The one I created was done by setting the correct size in  device/fsl/common/partition/device-partitions.bpt, and then doing a build as described in the Android User's Manual.

 

Changing partition-table.img with the correct size did not appear to have any influence on the issues I described above, although I was able to confirm that the userdata partition had grown, and that the partitions now fills the memory.

0 Kudos

4,125 Views
diegoadrian
NXP Employee
NXP Employee

Hello,


Not at all, you will need the partition table according to your specifications. This is because our manufacturing tool and the script works with the images that we provide. If you are using another image, you will need to modify the .xml or the script file according to your requirements.


Best Regards,

Diego. 

0 Kudos

4,125 Views
justingregory
Contributor II

I'm in the same boat, but on i.MX6SL.  Nougat build system, custom partition-table.img made by changing the size of the one from device/fsl/common/partition/device-partitions.bpt.  "mmc part" is able to see the partitions, but "boota" cannot.

0 Kudos

4,125 Views
arnt
Contributor II

I think your hunch is a step in the right direction, and I will investigate the boota command next. There does not seem to be any documentation available, so I guess that means I'll read the code. If anyone has any documentation that would be greatly appreciated. 

0 Kudos

4,125 Views
justingregory
Contributor II

I've had success setting 

CONFIG_DM_MMC=n

in the bootloader config file.  "boota" can now read the partition table and boot.

0 Kudos

4,125 Views
justingregory
Contributor II

I decided to try partitioning with the old mksdcard-android.sh script, which uses sfdisk/MBR instead of gdisk/GPT.  The result was the same (output below).  Makes me think it's a problem specifically with the boota command.

U-Boot 2017.03-00001-g3bd4f62-dirty (Mar 14 2018 - 19:48:47 +0000)

CPU:   Freescale i.MX6SL rev1.3 996 MHz (running at 792 MHz)

CPU:   Commercial temperature grade (0C to 95C) at 51C

Reset cause: POR

Model: Freescale i.MX6 SoloLite EVK Board

Board: Lochinvar Page RevG

DRAM:  1 GiB

MMC:   FSL_SDHC: 0

MMC Device 2 not found

*** Warning - No MMC card found, using default environment

In:    serial

Out:   serial

Err:   serial

flash target is MMC:2

MMC Device 2 not found

MMC Device 2 not found

** Block device MMC 2 not supported

Net:   

Warning: ethernet@02188000 using MAC address from ROM

eth0: ethernet@02188000 [PRIME]

Detecting VOL_DOWN+POWER key for recovery(0:0) ...

MMC Device 2 not found

Block device mmc 2 not supported

bcb_rw_block, get_block_size return 0

read_bootctl, bcb_rw_block read failed

read command failed

Fastboot: Normal

watchdog added.........

Hit any key to stop autoboot:  0

boota mmc2

MMC Device 2 not found

boota: cannot find '2' mmc device

=> mmc dev

switch to partitions #0, OK

mmc0(part 0) is current device

=> mmc part

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

Part    Start Sector    Num Sectors     UUID            Type

  1     16384           65536           7fe9222b-01     83

  2     83968           65536           7fe9222b-02     83

  3     149504          4313088         7fe9222b-03     05 Extd

  4     4462592         3090432         7fe9222b-04     83

  5     151552          3145728         7fe9222b-05     83

  6     3299328         1048576         7fe9222b-06     83

  7     4349952         16384           7fe9222b-07     83

  8     4368384         8192            7fe9222b-08     83

  9     4378624         4096            7fe9222b-09     83

10     4384768         4096            7fe9222b-0a     83

11     4390912         2048            7fe9222b-0b     83

12     4395008         2048            7fe9222b-0c     83

=> boota mmc0

boota mmc0

can't find partition: boot, dump the partition table

boota: cannot find 'boot' partition

=> boota mmc0 1

boota mmc0 1

can't find partition: 1, dump the partition table

boota: cannot find '1' partition

=>

4,125 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Are you using Android Nougat or Android KitKat?

Best regards,

Diego.

0 Kudos

4,125 Views
arnt
Contributor II

Nougat

The images for the iMX6DL are extracted from a file android_N7.1.2_2.0.0_image_6dqpsabresd.tar.gz, and the Mfgtools from  android_N7.1.2_2.0.0_tools.tar.gz

Thanks for helpig me  Diego!

0 Kudos

4,125 Views
diegoadrian
NXP Employee
NXP Employee

Hello,


Which partition table image are you using?


Remember that you need the respective partition table image according to the size of your eMMC memory.


Best regards,

Diego.

0 Kudos

4,125 Views
arnt
Contributor II

I tried both the partition-table.img that was included in the prebuilt files, and I created my own. The one I created was done by setting the correct size in  device/fsl/common/partition/device-partitions.bpt, and then doing a build as described in the Android User's Manual.

Changing partition-table.img with the correct size did not appear to have any influence on the issues I described above, although I was able to confirm that the userdata partition had grown, and that the partitions now fills the memory.

0 Kudos