HK1 doesn't boot from eMMC

Hi,

I have a HK1 TV Box S905X3 4GB RAM.

I installed Coreelec 19.5 using the ceemmc -x command and everything works fine. I can shutdown and reboot the tv box and it always boot fine.

But if I boot a Batocera image from a SD card and after that, I try to reboot Coreelec from eMMC it doesn’t boot.

To solve it I’m forced to boot coreelec from a SD card and run the ceemmc -x command again.to flash the flash partition.

Any idea what could be the problem?

Thanks!!

Looks like Batocera image changes the boot environment on device itself. And it is not compatible with CE.

I will try to get an answer on the Batocera forum because I don’t understand why a SD Card image changes the boot environment of the device…

Thanks for your answer!

Because CE also does it https://github.com/CoreELEC/CoreELEC/blob/coreelec-20/projects/Amlogic-ce/devices/Amlogic-ng/bootloader/scripts/aml_autoscript.src

Thanks for the info. Clearly my assumtion was not correct… :wink:

And is there anything I could do change this behaviour apart from re-run the ceemmc -x command from a SD Coreelec image?

Hard to tell. Show what you get by fw_printenv command when you run Batocera.

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.