Erasing the eMMC Storage

Hi,
I’m trying to erase the eMMC Storage in order to boot from SD card. According to the page http://docs.khadas.com/develop/HowtoEraseEMMC/

Serial Mode(For developers)
Refer this guidance to setup serial tool for VIM.
Make sure again you’ve done the right connections and setup.
Hit any keys at the moment of booting to stop autoboot. This step will let VIM boot into u-boot mode.
Type store init 3 on the terminal of u-boot, and wait the wiping process to complete.

When I’m entering the terminal via serial and type “store init 3”, I’m getting following response:
shell@Vim:/ $ store init 3
/system/bin/sh: store: not found

What I’m doing wrong?

What image are you trying to boot from sd, Linux?

I don’t think you maybe don’t even need to erase the eMMC, i was using this guide, did it with win32 disk imager, everything went great, have a look in this thread, you’ll see a guide from rdfktv member, 3rd-Party Ubuntu ROM for Khadas VIM.

Do not use the guide on the beginning of the topic, this is what you are looking for

Hi, Vitaly

This is store subsytem of U-Boot. You have to connect serial adapter to your PC, start

minicom /dev/ttyUSB0

Turn on power on the board, and press quickly Enter key in the minicom terminal for entering to U-Boot console. And then the store subsystem will be available for you.

kvim# store init 3

Andrey K.

Thank you, Andrey, now it’s OK. Seems I’ve just pressed the ‘enter’ key too late in my previous try.

1 Like

Enter, Escape, Space, Ctrl+C - try all of them!!!

Tommy, according to this, the eMMC must be erased in order to boot from SD card. Did you manage to boot from SD card without wiping out the eMMC?
Anyway, I already erased it :slight_smile:

1 Like

Yes, i did it without erasing Android on eMMC, it looks a little complicated but it isn’t, i am booting Linux from sd card using this method.

I used Win32 disk imager, i think it will work with every app of this type, i didn’t want to use Hdd raw because it can overwrite your Hdd, and this one doesn’t offer me to write on my Windows partitions.

I am always careful when creating images, but who knows, it is better when you don’t have to look where are you writing the image.

I think to be able to boot from SD without erasing the eMMC we have to change procedure described in the CONFIG_EXTRA_ENV_SETTINGS variable in the board/khadas/configs/kvim.h

Something like this mmcboot procedure:

If the SD card is connected then mmcinfo returns true because default mmc dev is 0.
When SD card is not connected them mmcinfo returns false because emmc is an dev 1 and we have to use
kvim# mmc dev 1

to be able read eMMC flash

I use this Technic in my system. You can ask Gouwa for this in the https://github.com/khadas/u-boot repository. But this is not corresponded with Android/ubuntu behavior of original Khadas U-Boot.

Andrey K.

Seems it was my big mistake to erase an eMMC storage… Now I can’t boot even with SD card. :blush:
The only source I found describing how to make a bootable SD card is this one. But when I’m trying to boot from the SD card I’ve made according to the instructions in the link, I’m entering into the endless reboot loop. The log of this is here - http://pastebin.com/wv57u66z

What image are you trying to boot from sd, Linux?
Also please tell us the rom version you installed.
Thanks.

OK, finally I’ve got it working. Again, it was my fault - RTFM :blush: I’ve used dd and 3rd party image burners instead of “Burn Card Maker Tool”. Sorry for wasting your time, guys…

WOW!!!

I had the same loop on the Nexbox A95x (S905 SoC) but never seen that on the Khadas VIM !!!

"Synchronous Abort" handler, esr 0x96000210
ELR:     77f3e50c
LR:      77f0bbfc
x0 : 0000000000000000 x1 : 0000000077f597ac

It say that U-Boot call the do_sync() function when faced with error.

This is a common issue of Amlogic U-Boot from 2016-09-30. Somebody say that it is related to DDR settings. It would be good if somebody who has contacts with Amlogic will investigate this problem.

Andrey K.

The printing log you posted cannot say it’s related in DDR settings, I think would be better for you to post the full u-boot log.

I just copy the part of log from previous post. I only say that I had have the same issue on other chip. On the S905 I have

"Synchronous Abort" handler, esr 0x96000010

esr value.

If you have time to investigate this issue on other chips then please look at following log related to NEXBOX A95X based on S905 SoC. This is body of the loop:

sdio debug board detected 
TE: 338614

BL2 Built : 09:01:42, Oct 11 2016. 
gxb g88b04d6 - haixiang.bao@droid05

set vcck to 1100 mv
set vddee to 1000 mv
Board ID = 1
CPU clk: 1536MHz
DDR chl: Rank0+1 same @ 912MHz
DDR0: 1024MB-2T-13
DataBus test pass!
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x00004000
New fip structure!
Load bl30 from SD, src: 0x00010200, des: 0x01000000, size: 0x0000d460
Sending bl30......................................................OK. 
Run bl30...
Load bl31 from SD, src: 0x00020200, des: 0x10100[00, size: 0x00018190
Image: gxb_v1.1.3135-18177fc 2016-06-24 11:00:09 yun.cai@droid06]
OPS=0x13
1b 31 cf d9 60 4d 5e ae d9 77 46 35 [0.503654 Inits done]
secure task start!
high task start!
low task start!
Load bl33 from SD, src: 0x0003c200, des: 0x01000000, size: 0x0009fd40
NOTICE:  BL3-1: v1.0(debug):bc3419d
NOTICE:  BL3-1: Built : 14:16:22, Aug 15 2016
INFO:    BL3-1: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader
ERROR:   Error initializing runtime service opteed_fast
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address = 0x1000000
INFO:    BL3-1: Next image spsr = 0x3c9


U-Boot 2015.01 (Feb 11 2017 - 19:46:10)

DRAM:  1 GiB
Relocation Offset is: 36ed3000
register usb cfg[0][1] = 0000000037f61640
register usb cfg[0][2] = 0000000037f61660
register usb cfg[2][0] = 0000000037f61680
vpu: error: vpu: check dts: FDT_ERR_BADMAGIC, load default parameters
vpu: clk_level = 7
vpu: set clk: 666667000Hz, readback: 666660000Hz(0x300)
boot_device_flag : 1
Nand PHY Ver:1.01.001.0006 (c) 2013 Amlogic Inc.
init bus_cycle=6, bus_timing=7, system=5.0ns
reset failed
get_chip_type and ret:fffffffe
get_chip_type and ret:fffffffe
chip detect failed and ret:fffffffe
nandphy_init failed and ret=0xfffffff1
MMC:   aml_priv->desc_buf = 0x0000000033ed3770
aml_priv->desc_buf = 0x0000000033ed5a90
SDIO Port B: 0, SDIO Port C: 1
emmc/sd response timeout, cmd8, status=0x3ff2800
emmc/sd response timeout, cmd55, status=0x3ff2800
[mmc_startup] mmc refix success
[mmc_init] mmc init success
mmc read lba=0x14000, blocks=0x400
start dts,buffer=0000000033ed8330,dt_addr=0000000033ed8330
parts: 11
00:      logo	0000000002000000 1
01:  recovery	0000000002000000 1
02:       rsv	0000000000800000 1
03:       tee	0000000000800000 1
04:     crypt	0000000002000000 1
05:      misc	0000000002000000 1
06: instaboot	0000000020000000 1
07:      boot	0000000002000000 1
08:    system	0000000040000000 1
09:     cache	0000000020000000 2
10:      data	ffffffffffffffff 4
get_dtb_struct: Get emmc dtb OK!
Partition table get from SPL is : 
        name                        offset              size              flag
===================================================================================
   0: bootloader                         0            200000                  0
   1: reserved                      400000           4000000                  0
   2: env                          4400000            400000                  0
   3: logo                         4800000           2000000                  1
   4: recovery                     6800000           2000000                  1
   5: rsv                          8800000            800000                  1
   6: tee                          9000000            800000                  1
   7: crypt                        9800000           2000000                  1
   8: misc                         b800000           2000000                  1
   9: instaboot                    d800000          20000000                  1
  10: boot                        2d800000           2000000                  1
  11: system                      2f800000          40000000                  1
  12: cache                       6f800000          20000000                  2
  13: data                        8f800000         142800000                  4
mmc read lba=0x2000, blocks=0x2
mmc read lba=0x2002, blocks=0x2
mmc_read_partition_tbl: mmc read partition OK!
eMMC/TSD partition table have been checked OK!
mmc env offset: 0x4400000 
In:    serial
Out:   serial
Err:   serial
reboot_mode=cold_boot
hpd_state=1
set hdmitx VIC = 16
config HPLL = 2970
HPLL: 0xc800023d
config HPLL done
j = 4  vid_clk_div = 1
hdmitx phy setting done
hdmitx: set enc for VIC: 16
rx version is 2.0  div=10
hdmtix: set audio
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
read emmc dtb
ret = 1 .sdio debug board detected, sd card with 1bit mode
[mmc_init] mmc init success
Device: SDIO Port B
Manufacturer ID: 41
OEM: 3432
Name: SD16G 
Tran Speed: 25000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.5 GiB
mmc clock: 25000000
Bus Width: 1-bit
** Unrecognized filesystem type **
Net:   dwmac.c9410000
wipe_data=successful
wipe_cache=successful
upgrade_step=0
[OSD]load fb addr from dts
[OSD]failed to get fb addr for logo
[OSD]use default fb_addr parameters
[OSD]fb_addr for logo: 0x3d800000
[OSD]load fb addr from dts
[OSD]failed to get fb addr for logo
[OSD]use default fb_addr parameters
[OSD]fb_addr for logo: 0x3d800000
[CANVAS]canvas init
[CANVAS]addr=0x3d800000 width=3840, height=2160
Err imgread(L340):Logo header err.
There is no valid bmp file at the given address
amlkey_init() enter!
"Synchronous Abort" handler, esr 0x96000010
ELR:     37f0cf30
LR:      37f0cf1c
x0 : 0000000037fbc000 x1 : 0000000000000001
x2 : 0000000000000000 x3 : 0000000000000000
x4 : 0000000000000000 x5 : 0000000000000020
x6 : ffffff80ffffffc8 x7 : 0000000000000044
x8 : 0000000000000000 x9 : 0000000000000000
x10: 0000000000000000 x11: 0000000000000000
x12: 0000000000000000 x13: 0000000000000000
x14: 0000000000000000 x15: 0000000000000000
x16: 0000000000000000 x17: 0000000000000000
x18: 0000000033ec2e28 x19: 0000000037f418f8
x20: 0000000037f65000 x21: 0000000000000000
x22: 0000000000000003 x23: 0000000037f73128
x24: 0000000000000000 x25: 0000000000000000
x26: 0000000000000000 x27: 0000000000000000
x28: 0000000033ec3310 x29: 0000000033ec25a0

Resetting CPU ...

resetting ...

The U-Boot was built using gxb_p201_v1 configuration.

Andrey K.

Also this issue repeated with different DDR frequencies. The same result when I set 768, 792 in the gxb_p201_v1.h file.

Our company didn’t develop S905 product, I hope some other guys in our community would help you out.

And one more information for your reference:
I’ve got the similar printing on Khadas VIM, but when I plug-in the HDMI cable to boot, this issue didn’t exist. It’s a bug on Amlogic U-Boot, but not related in the DDR:

Resetting CPU …

resetting …

PS: following commit fix up the issue on Khadas VIM:

commit 1a8b66ff223271eac02a39e8080675423070a05a
Author: Gouwa <gouwa@khadas.com>
Date:   Sat Jul 16 10:59:32 2016 +0800

    outputmode: set default value as '1080p60hz' when no hpd and cvbs values
    This fix up repeatedly 'Resetting CPU' printing issue when HDMI cable isn't pluged-in

diff --git a/common/cmd_hdmitx.c b/common/cmd_hdmitx.c
index cbb79f2..5ca80f3 100644
--- a/common/cmd_hdmitx.c
+++ b/common/cmd_hdmitx.c
@@ -35,8 +35,12 @@ static int do_hpd_detect(cmd_tbl_t *cmdtp, int flag, int argc,
 
        if (st) {
                setenv("outputmode", getenv("hdmimode"));
+       #ifdef CONFIG_AML_CVBS
        } else {
                setenv("outputmode", getenv("cvbsmode"));
+       #endif
+       } else {
+               setenv("outputmode", "1080p60hz");
        }
        return st;
 }
~
1 Like

Thanks a lot, Gouwa.

I will double check this (unfortunately on S905 this issue repeated when HDMI cable is plugged in).

Thank you.

Andrey K.

Hi Gouwa,

Thank you again!!! Your patch fixes this issue on the S905 based boards.

When I apply your patch and undef CONFIG_AML_CVBS in the gxb_p201_v1.h file the issue was fixed!!!

Your support is always great!!!

Best Regards,
Andrey K.