Userdata not found during flashing ARM-TF

While flashing the hikey960 board to ARM-TF+Android, I am getting “Couldn’t erase image: Not Found” error.

FastbootTransportUsbRequestReceive, 255, BufferSize:24576
   24576 /    24576 bytes downloaded (100%)
Flashing partition ptable
Done.
Fastboot platform: check for partition-type:xloader
Downloading 154752 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:154752
  154752 /   154752 bytes downloaded (100%)
Flashing partition xloader
Done.
Fastboot platform: check for partition-type:fastboot
Downloading 1179648 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:1179648
 1179648 /  1179648 bytes downloaded (100%)
Flashing partition fastboot
Done.
Fastboot platform: check for partition-type:fip
Downloading 1531904 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:1531904
 1531904 /  1531904 bytes downloaded (100%)
Flashing partition fip
Done.
Fastboot platform: check for partition-type:boot
Fastboot platform: check for partition-type:boot
Downloading 10070016 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:10070016
10070016 / 10070016 bytes downloaded (100%)
Flashing partition boot
Done.
Fastboot platform: check for partition-type:cache
Erasing partition cache
Downloading 57492 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:57492
   57492 /    57492 bytes downloaded (100%)
Flashing partition cache
Done.
Fastboot platform: check for partition-type:system
Erasing partition system
Downloading 134213804 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213804
134213804 / 134213804 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213696 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213696
134213696 / 134213696 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213720 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213720
134213720 / 134213720 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213696 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213696
134213696 / 134213696 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213720 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213720
134213720 / 134213720 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213696 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213696
134213696 / 134213696 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 134213720 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:134213720
134213720 / 134213720 bytes downloaded (100%)
Flashing partition system
Done.
Downloading 35553440 bytes
#FastbootTransportUsbRequestReceive, 255, BufferSize:35553440
35553440 / 35553440 bytes downloaded (100%)
Flashing partition system
Done.
Fastboot platform: check for partition-type:userdata
Erasing partition userdata
Couldn't erase image:  Not Found

I am using prm_ptable.img, sec-xloader.img, l-loader.img, fip.img, boot.img, cache.img etc as told in the github page for flashing hikey960 for ARM-TF.

And If I ignore this error and try to boot the Hikey960 I am getting the below error,

[Bds]Booting Boot from SD
[Bds]Booting Grub
[Bds]Booting Android Boot
add-symbol-file /home/dhiman/colossus5/simAsTpm/edk2/Build/HiKey960/DEBUG_GCC5/AARCH64/EmbeddedPkg/Application/AndroidBoot/AndroidBootApp/DEBUG/AndroidBootApp.dll 0xB9B07000
Loading driver at 0x000B9B06000 EntryPoint=0x000B9B07000 AndroidBootApp.efi
The kernel image is not raw format: Invalid Parameter
ERROR: Device Tree header not valid (err:-9)
Failed to get attached FDT from the end of raw kernel: Invalid Parameter
Failed to boot from partition: Invalid Parameter
Error: Image at 000B9B06000 start failed: Invalid Parameter

I guess the problem is with the ptable I am using. I tried with hisi-ptable.img (generated from android hikey960-userdebug build) which yields no better result. What could be the problem?

But the l-loader currently unable to create the userdata partition. Below is the structure for prm_ptable.img.

Number  Start (sector)    End (sector)  Size       Code  Name                                                                                                                                                                                                                                                           
   1             256             511   1024.0 KiB  0700  vrl                                                                                                                                                                                                                                                               
   2             512            3583   12.0 MiB    0700  fastboot                                                                                                                                                                                                                                                          
   3            3584            5119   6.0 MiB     0700  nvme                                                                                                                                                                                                                                                              
   4            5120            8191   12.0 MiB    8300  fip                                                                                                                                                                                                                                                               
   5            8192           73727   256.0 MiB   0700  cache                                                                                                                                                                                                                                                             
   6           73728           73983   1024.0 KiB  0700  fw_lpm3                                                                                                                                                                                                                                                           
   7           73984           90367   64.0 MiB    EF00  boot                                                                                                                                                                                                                                                              
   8           90368           94463   16.0 MiB    0700  dts                                                                                                                                                                                                                                                               
   9           94464           94975   2.0 MiB     0700  trustfirmware                                                                                                                                                                                                                                                     
  10           94976         1295103   4.6 GiB     8300  system                                                                                                                                                                                                                                                            
  11         1295104         1495807   784.0 MiB   0700  vendor                                                                                                                                                                                                                                                            
  12         1495808         1496063   1024.0 KiB  0700  reserved      

Do you have any idea how to fix this problem?

l-loader : testing/hikey960_v1.2
arm-trusted-firmware : integration
OpenPlatfomrPkg : testing/hikey960_v1.3.4
uefi-tools : master (pulled on August 31 2017)
edk2 : testing/hikey960_v2.5

These are the git branches I am using to build ATF for Android on Hikey960 board.

You’re probably using the ptable for linux. Try the one for android, i.e. ptable-aosp-32g.img.

Hello Victor(@vchong),

I was using the prm_ptable.img file that is written in https://github.com/ARM-software/arm-trustedfirmware/blob/master/docs/plat/hikey960.rst.

If so I would suggest a revision in the github README page.

@dhiman You’re right. The page bit-rotted a bit. Care to send in a Pull Request to https://github.com/ARM-software/arm-trustedfirmware?

@hzhuang1 fyi above

Hello Victor (@vchong),

Does not look like a git repository. Neither the webpage exists (404).

Oops sorry. I copied your typo directly. Should be https://github.com/ARM-software/arm-trusted-firmware.

Hello Victor (@vchong), Haojian(@hzhuang1)

ptable-aosp-32g.img worked fine with the Hikey960.