How to make a truly bootable SD card?

I’d like to make a bootlabe SD card, that will boot an (Linux) OS when inserted into Khadas VIM PRO regardless the emmc contents. I’m not interested in the widely used “fake boot”, that requires properly set u-boot on the eMMC.

1 Like

When the contents in eMMC is available then will boot from it not SD card. Please check the boot sequence:
7e951924a0d0da8ecf66f7801c93cd0980d0f636_1_690x480

Thanks.

I’m aware of that. However my eMMC is currently completely wiped and I’m still not able to boot virtually any recently released system image except a couple of very old ones. Spent hours reading U-boot docs and trying to make the SD cards bootable, but the boot process allways stucks in either RAM initialisation phase or u-boot commandline.

BTW, is u-boot for khadas even capable to display on the HDMI output like on fruit boards or it is limited to the serial console?

Write the correct u-boot.bin.sd.bin on the Sd card. It is not necessary to erase the entire eMMC, it is enough to erase the /dev/bootloader partition or the first few bytes on the eMMC , then u-boot from the SD card will be automatically started.

OK, but how to obtain the correct u-boot.bin.sd.bin? When i use u-boot 2018.05 from here written to latest rc5 Armibian with 4.18 kernel, I’m getting this:

no sdio debug board detected
TE: 319544

BL2 Built : 15:56:15, Nov 21 2017. gxl gfa7b794 - zhongfu.luo@droid12

set vcck to 1120 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
DDR3 chl: Rank0+1 @ 768MHz
bist_test rank: 0 22 00 45 33 16 51 26 05 47 31 15 4d 25 03 47 2f 12 4c 2a 08 4d 2e 0d 4f 644 rank: 1 23 08 3f 35 18 52 26 0a 42 31 15 4d 22 05 40 30 11 50 29 09 4a 2f 0e 51 644 - PASS

Rank0: 1024MB(auto)-2T-11

Rank1: 1024MB(auto)-2T-11
AddrBus test pass!
Load fip header from SD, src: 0x0000c200, des: 0x01400000, size: 0x00004000
New fip structure!
Load bl30 from SD, src: 0x00010200, des: 0x013c0000, size: 0x0000d600
Load bl31 from SD, src: 0x00020200, des: 0x05100000, size: 0x0003b600
Load bl33 from SD, src: 0x0005c200, des: 0x01000000, size: 0x00066a00
NOTICE: BL3-1: v1.0(release):a75d708
NOTICE: BL3-1: Built : 17:16:24, Nov 22 2017
[BL31]: GXL CPU setup!
NOTICE: BL3-1: GXL normal boot!
mpu_config_enable:ok
[Image: gxl_v1.1.3255-1a77b01 2017-09-15 16:58:02 xiaobo.gu@droid12]
OPS=0x82
d6 e4 4c 23 ab 17 b8 37 73 65 c9 25 [1.852354 Inits done]
secure task start!
high task start!
low task start!
ERROR: Error initializing runtime service opteed_fast

U-Boot 2018.05 (Jul 12 2018 - 17:28:14 +0800) khadas-vim

DRAM: 2 GiB
MMC: mmc@70000: 0, mmc@72000: 1, mmc@74000: 2
In: serial@4c0
Out: serial@4c0
Err: serial@4c0
[BL31]: tee size: 0
[BL31]: tee size: 0
Net:
Warning: ethernet@c9410000 (eth0) using random MAC address - 62:40:75:5f:8a:9e
eth0: ethernet@c9410000
Hit any key to stop autoboot: 0
Card did not respond to voltage select!
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1…
switch to partitions #0, OK
mmc2(part 0) is current device
** No partition table - mmc 2 **
ethernet@c9410000 Waiting for PHY auto negotiation to complete… TIMEOUT !
Could not initialize PHY ethernet@c9410000
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
ethernet@c9410000 Waiting for PHY auto negotiation to complete… TIMEOUT !
etc…

This one won’t work. In this version of Armbian, there is no support for u-boot-2018. You need to add the script " boot.scr " with the correct set of commands, or add a set of files for / extconf. Or you can use the u-boot-2015 version with activated multi-boot.

2 Likes

OK, I got it. Thank you balbes150.

Anyway, I’m still looking for a clear manual how to make a bootable SD card (linux OS) for Khadas.

In Linux, run the commands. Replace “/dev/mmcblk0” with your SD card name on your PC.

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=1 count=442

dd if=u-boot.bin.sd.bin of=/dev/mmcblk0 conv=fsync bs=512 skip=1 seek=1

Thanks, but I know how to save u-boot loader to the card and boot into it. That is the easiest part. And I’m also able to use uboot command line to manualy load dtb, linux kernel + parameters, initrd and then boot it.

But I have no Idea how to make a proper configuration file (boot.scr) and what is the actual difference between 2015 and 2018 u-boot, compatibility issues etc…

U-boot V2015 and V2018 are different, some commands are changed.