Trying to flash to EMMC but it's not working


#1

Hello,

I’m currently trying to put Android on the HiKey board.I have successfully built it and I need to run the ./flashall /dev/USB0 command. I have tried to set the following jumpers: jumper 1-2: closed, jumper 3-4: closed, jumper 5-6: open, then I see that /dev/ttyUSB0 shows up. When I run the flash-all script, it just says fails to open serial. Is there some sort of driver for the USB-OTG port?


#2

When I run ./flash-all.sh /dev/USB0, the error says:

±---------------------+
Serial: /dev/ttyUSB0
Image1: ./l-loader.bin
Image2:
±---------------------+

Failed to open serial! /dev/ttyUSB0
< waiting for device >


#3

Hi @jsherman10,

There are two documentation of building and installing AOSP on Hikey.

Official AOSP page:
https://source.android.com/source/devices.html

The old image:
https://github.com/96boards/documentation/wiki/HiKeyGettingStarted#aosp-build-from-source

Please use the official AOSP page.

When connecting Hikey and the PC for flashing emmc from fastboot,
please remove all the USB devices from USB-Type-A connector (I normally remove HDMI cable too) and then connect between PC and HiKey with microUSB cable to the microUSB connector on the HiKey.

Then, check the jumper pins on J15, both 1-2 pin and 3-4 pins closed and 5-6 open.

Then, connect AC adapter and wait for about 30 seconds.

If you have LeMaker HiKey with 8G emmc version then,

$ sudo ./flash-all.sh /dev/ttyUSB0

if you have 4G emmc version then

$ sudo ./flash-all.sh /dev/ttyUSB0 4G

I hope this works for you.


#4

Dear Akira,

Thanks, for the reply. I actually got it, it was a permissions issue. Thanks!, I also have another question. I finally got OP-TEE + Android to run and I can see Android 6.0 on my monitor. However, I don’t see any of the example applications?


#5

How long after power on before you run flash-all.sh? There’s like a 30 (iirc, or 60) seconds timeout before the device goes away so you need to make sure that you run the script before that.


#6

Hi @jsherman10,

It does not require any special OTG driver for the USB-OTG port.
And USB-OTG port will not be recognized if there are other USB devices connected to USB ports.
Have to be only microUSB cable connected to micro USB port and all other USB concenters must be empty on the HiKey to be recognized.


#7

> However, I don’t see any of the example applications?

If you mean trusted applications, the location should be as below. If you don’t find them there, please let us know.
/system/bin/xtest
/system/lib/optee_armtz/*.ta

If you mean regular Android apps pertaining to OP-TEE, I believe nothing is built for that atm.


#8

Thanks for your reply Vchong,

If I wanted to make a regular Android app pertaining to OP-TEE, could I just simply access OP-TEE using the JNI interface or is it more sophisticated than that?


#9

You’re welcome!

I’ve not tried it myself but yes, JNI should be sufficient.


#10

Dear VChong,

To See the terminal output of OP-TEE, I need to hook up the UART port? And just out of curiosity how come there’s not a Android app that uses OP-TEE, since you can build Android + OPTEE.


#11

NOTE: Posted correction to location of trusted applications in comment above.


#12

> To See the terminal output of OP-TEE, I need to hook up the UART port?
Basically yes. There’s currently an ongoing/experimental effort for an alternative, so if you feel adventurous, you can patch optee_os [1] and optee_client [2] and rebuild. I believe this will send the log back to your adb console instead, so you don’t need the serial UARTs. I’m not sure then if both the normal and secure world logs might run over each other and make things hard to read, and/or if they can be nicely filtered via logcat.

[1] https://github.com/OP-TEE/optee_os/pull/810
[2] https://github.com/OP-TEE/optee_client/pull/51

> And just out of curiosity how come there’s not a Android app that uses OP-TEE, since you can build Android + OPTEE.
The point of the build at the moment is not to build apps, but to verify that we can have and run a TEE in Android with OP-TEE, and also allow prototyping (development and testing) of TAs. The rest is up to users like you :). Also feel free to contribute anything that you think might be useful back to the OP-TEE project itself.


#13

Hello,

I encounter also the same problem
Failed to open serial! /dev/ttyUSB0
< waiting for device >

Despite of this message, I wait for ~30sec, and then the green led is on and I have the following message:
sending ‘ptable’ (17 KB)…
FAILED (remote: invalid partition)
finished. total time: 0.000s
sending ‘fastboot’ (1155 KB)…
FAILED (remote: invalid partition)
finished. total time: 0.000s
sending ‘nvme’ (128 KB)…
FAILED (remote: invalid partition)
finished. total time: 0.000s
sending ‘boot’ (19236 KB)…
FAILED (remote: invalid partition)
finished. total time: 0.000s

Does anybody already knows what is wrong in my setup ?

PS: I work on an Ubuntu machine in which I do not have root access.
“sudo python” does not work, so I removed sudo from the flash-all.sh