HK1 doesn't boot from eMMC

If I execute fw_printenv command I get a command not found error.

But if I execute printenv, I get that:

[root@BATOCERA /userdata/system]# printenv
SHELL=/bin/bash
EDITOR=/bin/vi
PWD=/userdata/system
LOGNAME=root
HOME=/userdata/system
SSH_CONNECTION=192.168.1.232 57413 192.168.1.242 22
TERM=xterm
USER=root
SHLVL=1
XDG_RUNTIME_DIR=/var/run
PS1=[\u@\h $PWD]$
SSH_CLIENT=192.168.1.232 57413 22
PATH=/bin:/sbin:/usr/bin:/usr/sbin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket
SSH_TTY=/dev/pts/0
_=/bin/printenv
[root@BATOCERA /userdata/system]#

No, this doesn’t help.

Then execute fw_printenv on CE, run Batocera, run again CE from USB/SD and execute fw_printenv again. And post both results.

Here the fw_printenv command booting Coreelec from eMMC

And here booting Coreelec from SD card after booting Batocera image

I don’t see anything wrong.
What is the symptoms after Batocera SD card is removed and you want to boot CE from eMMC?

Coreelec doesn’t boot. The box is stuck on the logo screen.

Before I was using dual boot system in eMMC (Android+Coreelec) and only Android booted fine.

Then I changed to single boot from eMMC (only Coreelec) and with that scenario Coreelec still doesn’t boot after booting Batocera from SD.

Then I boot coreelec from SD, run command ceemmc -x to flash again data on flash partition and then Coreelec boots fine again until I run Batocera again.

boot CoreELEC from eMMC and run this commands to allows booting Batocera from USB stick

fw_setenv start_usb_autoscript 'for usbdev in 0 1 2 3; do if fatload usb ${usbdev} ${loadaddr} s905_autoscript; then autoscr ${loadaddr}; fi; done;'
fw_setenv start_mmc_autoscript 'if fatload mmc 0 ${loadaddr} s905_autoscript; then autoscr ${loadaddr}; fi;'
fw_setenv bootfromusb 'usb start 0; run cfgloadusb; run start_usb_autoscript; if fatload usb 0 ${loadaddr} kernel.img; then run usbdtb; setenv bootargs ${bootargs} bootfromusb; bootm; fi'
fw_setenv bootfromsd 'if mmcinfo; then run cfgloadsd; run start_mmc_autoscript; if fatload mmc 0 ${loadaddr} kernel.img; then run sddtb; setenv bootargs ${bootargs} bootfromsd; bootm; fi; fi'

create Batocera USB/SD
download archive BATOCERA.ZIP and inside is file u-boot.ext (of course this file is probably only for GT-King Pro)
copy this file to your Batocera USB/SD

device will boot CoreELEC from eMMC without USB/SD attached and from USB/SD with Batocera or CoreELEC

Maybe I made some typo above. If it doesn’t work let me know.

Maybe would be just enough to copy s905_autoscript to cfgload and then it would boot without any modifications anywhere. Should test on virgin CE device …

1 Like

It works!!

Now I am able to boot Batocera from a USB device and after I remove the USB, I can boot Coreelec from the eMMC.

Now when I boot Coreelec I see those messages on the screen. I post them here just in case they could give you some extra info,

What was the problem? and is something that could be fixed on the Coreelec or Batocera images?

Thaks a lot for you help! Really apreciated.

I think this message comes from u-boot USB stack. Because the order is SD then USB and last eMMC. And to get USB booting USB stack needs to be initialized.

I didn’t check if I got this message when I was testing.

But I assume CE and Batocera now boots fine?

Yes, Coreelec and Batocera boots fine now.

1 Like

Maybe would be just enough to copy s905_autoscript to cfgload and then it would boot without any modifications anywhere. Should test one day…

If you explain me how to do that, I could try.

As I wrote after making Batocera USB/SD just copy file s905_autoscript to cfgload. Because file cfgload is used by CoreELEC.

But first boot CE from eMMC and type this 2 commands to restore original bootloader variables.

fw_setenv start_usb_autoscript
fw_setenv start_mmc_autoscript
fw_setenv bootfromusb 'usb start 0; run cfgloadusb; if fatload usb 0 ${loadaddr} kernel.img; then run usbdtb; setenv bootargs ${bootargs} bootfromusb; bootm; fi'
fw_setenv bootfromsd 'if mmcinfo; then run cfgloadsd; if fatload mmc 0 ${loadaddr} kernel.img; then run sddtb; setenv bootargs ${bootargs} bootfromsd; bootm; fi; fi'

I’m sorry to ask. But I’m not sure where to find this s905_autoscript and the cfgload folder.

Are the on the Coreelec installation or in the batocera USB? and where exactly?

s905_autoscript file is on Batocera USB/SD. And this file must be copied to new filename cfgload.
So you will have 2 equal files: original s905_autoscript and new cfgload.

Is not working, but probably if done something wrong.

I’ve executed fw_printenv just in case you could check if I’ve executed your commans right.

I copied file s905_autoscript to cfgload and add mentioned u-boot.ext file and it booted.

That u-boot.ext file shoud work with Batocera v34 and v35?

I’m asking that because this second method works when I boot Batocera v34 from an USB, but it doesn’t when I boot Batocera v35 from a SD. Does it makes any sense?

I was testing with batocera-s922x-gtkingpro-35-20220911.img.gz. Booting Batocera from USB and SD and it works in both cases.

I think u-boot.ext is universal for the device and doesn’t matter which image is booting.

I’m lost…

I’ve made two batocera v34 stable images following your instructions. One one a USB and the second one on a SD.

They both boot Batocera fine, but for the one from the SD to boot I have to press several times the reset button of the tv box.

And after I boot Batocera from the USB, Coreelec from eMMC boots fine, but when I boot Batocera from the SD, Coreelec doesn’t boot the next time…

In order to fix Coreelec booting from the eMMC, I have to boot Coreelec from a SD and after that Coreelec boots fine from the eMMC also.

Any idea?

No idea what is going on. I only did few tests and maybe I missed something. Booting other images is not really on todo list for CE :slight_smile: