Why doesn't the BPI-R2 board not even power if no SD card?

Does anyone know why does the BPI-R2 board not even power on if there is no SD card inserted in the SD slot. I followed the procedure below to get the system to boot from EMMC: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage#install_os_on_emmc

But it seems that the board won’t even power on when I push the power button unless the SD card is inserted. There is nothing on the serial from the preloader or anything else… just dead

You have changed partition config and burn preloader to boot0?

Yes, I have. Here are the commands I ran:

	$ mmc extcsd read /dev/mmcblk0 | grep PARTITION_CONFIG
	Boot configuration bytes [PARTITION_CONFIG: 0x00]
	$ mmc bootpart enable 1 1 /dev/mmcblk0
	$ mmc extcsd read /dev/mmcblk0 | grep PARTITION_CONFIG
	Boot configuration bytes [PARTITION_CONFIG: 0x48]
	$ echo 0 > /sys/block/mmcblk0boot0/force_ro
	$ gunzip -c BPI-R2-EMMC-boot0-DDR1600-0k-0905.img.gz | dd of=/dev/mmcblk0boot0 bs=1024 seek=0
	$ dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0 bs=10M

When this didn’t work, I also did:

	$ dd if=BPI-R2-720P-2k.img of=/dev/mmcblk0 bs=1k seek=2 count=1022

Reboot, and board wouldn’t boot without the SD card, then I followed instructions from here:

1. Copy EMMC image to a running system which is on SD card
2. Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0
3. Unlock EMMC boot0 block: echo 0 > /sys/block/mmcblk0boot0/force_ro
4. Program preloader to EMMC boot0 block:
     dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0boot0 bs=1M count=1
5. Change the Partition configurion of EMMC is 48h: reboot the system which is running SD, and enter the 
    U-boot command line, run command
          _emmc pconf 48_
6. Power off, remove SD card, and then power on R2 board.

Well this worked, now the board boots with no SD card.

Maybe preloader has to be also on mmcblk0…(step 2 of garys tutorial)

looked on my running system:

0x1B8 => partitiontable
0x600 => Uboot (stringdata)

after that next data comes at 0x1600, maybe its the code of uboot/preloader

make sure mmcblk0 is really your emmc and not your sd-card…in a running system (e.g. ubuntu or debian) mmcblk0 is the sd-card…in uboot these may be swapped (default kernel-order)

Yes, 100% mmcblk0 is emmc and not sdcard. My SD card and eMMC differ in size so this is easy to spot regardless of the setting.

I will setup another brand new board and see if the step 2 is what makes it work or if it’s the emmc pconf 48 in uboot… as in doing it in openwrt with mmc tools maybe didn’t work.

Hi @frank-w,

I checked the steps and it’s this step that is crucial:

This puts the preloader & the uboot into the 4M mmcblk0boot0 partition, that’s what brings up the board to the point where you get the uboot prompt from eMMC. From there you can load the uimage, from say mmcblk0 location 0x1000 (which is 2M offset, 0x1000 * 512 block size).

So that’s what I do now, I load the pre-loader and uboot from mmcblk0boot0, then load the uimage from mmcblk0:0x1000 and then mount root from an sda ext4 partition during boot.

This gets around that pesky squashfs corruption issue I’m hitting.

I’ve added support for ext4 tools in uboot because I want to eliminate loading the uimage from emmc, I want to load the uimage straight from the sda. But I’m currently having issues getting SATA working under uboot.

I only know debian/ubuntu-way on emmc…theres is only preloader is flashed to boot0. Uboot (+preloader) is on mmcblk0 beginning on position 2k (imho 0x800).

Yeah, that’s what’s a bit frustrating. There are two different uboot versions and I guess preloader as well. The one that is released as part of the BSP seems to offset pad emmc access and the one that is released as part of openwrt is not doing that. I’ve been beating my head for a week trying to unwind what the code is doing so I could customize the boot process and get around the squashfs corruption issue.

I wish the preloader was a bit more documented, or source available.

i have modified uboot (for debian/ubuntu) a bit (in my clone of official 4.4 repo), but i don’t know if it is possible to boot openwrt/lede with it…i’m not experienced with lede/openwrt

Btw. Preloader is under NDA…see https://github.com/BPI-SINOVOIP/BPI-R2-bsp/issues/15

How did you format your emmc? Did you just use linux fdisk or did you use mmc tools. The emmc shows that there are 4 partitions available on mmcblk0, but it seems that uboot needs it to be formated with mmc tools instead of fdisk. Is that correct?

Thanks

You can create partitions with uboot and mmc-utils. Fdisk can not crete this structure

Any links with good examples on how to create the partitions on BPI-R2 emmc?

imho only in my wiki: https://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage

But its only to create boot0/boot1…other is same as on any other system…with fdisk

Does fatls and fatload work under your uboot?

do you mind pasting output of:

BPI-R2> part list mcc 0
BPI-R2> part list mmc 1
BPI-R2> fatls mmc 0
BPI-R2> fatls mmc 1
BPI-R2> mmc dev 0
BPI-R2> mmc part
BPI-R2> mmc dev 1
BPI-R2> mmc part

None of those utilities seem to work on openwrt uboot

in uboot command for partitioning is named emmc. mmc is command in ubuntu…i don’t know if it is included in openwrt. fatload seems to work in my uboot

Hi Frank-

The mmc command in particular actually is what is used to boot openrwt through “mmc read ${kerneladr}” 1000 6000

All those commands I pasted are present in openwrt uboot except they don’t seem to all work. That’s why I was asking for output, to compare what works what doesn’t.

The “emmc” command doesn’t seem to format anything, it’s simply meant to read or write onto a partition. I don’t see how you could format anything with it. It just doesn’t seem to have any switches for that.

BPI-IoT> emmc pconf 0x48

Oh I see, that’s not the problem. I did that under linux. It’s the uboot commands that I am having problems with seeing the regular partitions.

Sorry don’t know if that is possible in uboot