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
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.
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.
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
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?
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
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.