zador-blood-stained / h3-fel-mass-storage

Script and binary files for mounting SD/eMMC on sunxi boards over USB OTG connection
51 stars 23 forks source link

eMMC not recognized on new batch of Orange Pi PC Plus #5

Open jerbob92 opened 5 years ago

jerbob92 commented 5 years ago

Hi there,

We have been using this script for a while now to flash the eMMC memory of our Orange Pi PC Plus devices. Recently, we have received a new batch of devices, and this script does not see the eMMC device anymore, only the SD.

Have you perhaps seen this behavior before? Armbian sees the eMMC just fine. Maybe because of some old u-boot version?

jerbob92 commented 5 years ago

After testing with a new U-Boot (2017.03), it does see the eMMC, however, I can't just replace the U-boot, as it will get an error later on. Can you tell me how the binaries are creates so I can create my own?

jerbob92 commented 5 years ago

After some more research, I think it doesn't really matter what U-Boot thinks, as it is only needed to launch FEL mode. After FEL it launches the kernel and the kernel tells me:

[    0.828946] [mmc]: sdc2 power_supply is null
[    0.913097] mmc1: unrecognised EXT_CSD revision 8
[    0.913123] mmc1: error -22 whilst initialising MMC card
[    0.913267] [mmc]: sdc2 power_supply is null
[    0.917436] [mmc]: sdc2 power_supply is null
[    1.007059] mmc1: unrecognised EXT_CSD revision 8
[    1.007079] mmc1: error -22 whilst initialising MMC card
[    1.007200] [mmc]: sdc2 power_supply is null
[    1.011296] [mmc]: sdc2 power_supply is null
[    1.115477] mmc1: unrecognised EXT_CSD revision 8
[    1.115490] mmc1: error -22 whilst initialising MMC card
[    1.115604] [mmc]: sdc2 power_supply is null
[    1.119701] [mmc]: sdc2 power_supply is null
[    1.243860] mmc1: unrecognised EXT_CSD revision 8
[    1.243872] mmc1: error -22 whilst initialising MMC card
[    1.243984] [mmc]: sdc2 power_supply is null

Is it possible that you build a version with a newer kernel? I couldn't get it to work, U-Boot keeps hanging at "Starting kernel ..." every time.

zador-blood-stained commented 5 years ago

Is it possible that you build a version with a newer kernel?

It could be easier to patch and rebuild the old kernel (you can just bypass the CSD check for some revisions: https://github.com/armbian/build/commit/dcedd6c2ec102a9524b140604ce301b67cbbd27a) and initrd. I don't have time or intention to make this work with the mainline kernel anytime soon, as the proper way IMO would be to use u-boot OTG & g_mass_storage (which should be supported on H3 but I failed to make it work last time I briefly tried it)

jerbob92 commented 5 years ago

Thanks for the reply, I tried a lot yesterday building latest Armbian and getting it work, but u-boot always hangs at "Starting kernel ...". Do you perhaps have any docs on how you created the binaries from the H3 folder?

We currently have a workaround by flashing from Armbian on an SD, works fine for now. #linux-sunxi channel gave me some pointers to try fastboot in u-boot, so I might try that soon, but that also requires OTG to work in u-boot for H3.

zador-blood-stained commented 5 years ago

Do you perhaps have any docs on how you created the binaries from the H3 folder?

No, I don't have any docs for the kernel. I just made an Armbian image with a minimalistic kernel, generic script.bin and mass_storage script in /etc/initramfs-tools/scripts/init-premount/, and after making it work just extracted zImage and uInitrd from that installation.

u-boot always hangs at "Starting kernel ...".

on HDMI or serial console? boot.scr sets the kernel output to serial only.

jerbob92 commented 5 years ago

Thanks. Kinda what I tried yesterday, but with the latest Armbian.

on HDMI or serial console? boot.scr sets the kernel output to serial only.

On both. But I think fastboot is maybe the better way to go for now. I'll report my findings here!

marshallmch commented 5 years ago

@jerbob92 any update on your issue? I'm running into the same problem, curious if you found a fix.

jerbob92 commented 5 years ago

@marshallmch not really a fix. Currently we are booting info armbian and then writing the system image from there. I'm working towards a solution that netboots a minimal image and then downloads the image from local server and writes is to the eMMC.

marshallmch commented 5 years ago

@jerbob92 I'm also booting into Armbian and flashing the EMMC, but that is not working anymore due to the new flash chip. Did you do anything to your Armbian install to get it to recognize the EMMC? Here is my version:

BOARD=orangepipcplus BOARD_NAME="Orange Pi PC +" VERSION=5.25 LINUXFAMILY=sun8i BRANCH=default ARCH=arm IMAGE_TYPE=stable

3.4.113-sun8i #10 SMP PREEMPT Thu Feb 23 19:55:00 CET 2017 armv7l GNU/Linux

jerbob92 commented 5 years ago

I'm using the latest version from the Armbian website, it sees the eMMC fine.

You seem to use an old kernel, I'm running 4.14.84, Armbian 5.65.

marshallmch commented 5 years ago

Ohh ok, that could be it.

chrismonks commented 5 years ago

Hi Zador, The "unrecognised EXT_CSD revision 8" is actually fixed in 3.4.113 in mmc.c. But the kernel here is 3.4.112 and as such fails with EMMC 5.1 chips. I've tried building a simple kernel and get it to recognise the EMMC and no more EXT_CSD error. But the OTG is not working. I want to fix this mself but as failing with 1 of 2 things.

  1. Do you have your kernel .config so I can replicate on 3.4.113.
  2. I cannot seem to be able to build a 3.4.112 kernel as its not tagged in git and as such can't build with compile.sh in armbian. Here i wanted to patch mmc.c to check ">8" inthe EXT_CSD part to get around the error. But I'm such trying to get the build working.

Any help would be great, either the kernel config or f you could try to update the kernel on this repo to 3.4.113 that would be great

chrismonks commented 5 years ago

Got a working 3.4.112 with "mmc.c" patched to work with v5.1 EMMC zImage.zip