How can I boot into USB on Edge-V?

Which system do you use? Android, Ubuntu, OOWOW or others?

Factory Android

Which version of system do you use? Khadas official images, self built images, or others?

Edge_Ubuntu-server-bionic_Linux-4.4_arm64_SD-USB_V0.8.3-20200110

Please describe your issue below:

Hello,
I have an Edge-V device. I have used etcher to write Edge_Ubuntu-server-bionic_Linux-4.4_arm64_SD-USB_V0.8.3-20200110 image on a usb device. I can not boot into the usb. It automatically boots into factory-installed android. I have not altered the device and the pre-installed image in any way.

How can I boot into USB?
The documentation on Edge-V only guided through imaging the USB and says nothing about changing the boot order.

Post a console log of your issue below:


kedge# usb dev
USB is stopped. Please issue 'usb start' first.
kedge# usb start
starting USB...
USB0:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
USB1:   Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
USB2:   failed to get usb phy
Port not available.
USB3:   failed to get usb phy
Port not available.
USB4:   USB EHCI 1.00
USB5:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... RKPARM: Invalid parameter part table
2 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 3 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
kedge# usb tree
USB device tree:
  1  Hub (5 Gb/s, 0mA)
     U-Boot XHCI Host Controller 
   
  1  Hub (5 Gb/s, 0mA)
  |  U-Boot XHCI Host Controller 
  |
  +-2  Mass Storage (480 Mb/s, 500mA)
       Lexar USB Flash Drive 0304800000000218
     
  1  Hub (480 Mb/s, 0mA)
     u-boot EHCI Host Controller 
   
  1  Hub (12 Mb/s, 0mA)
      U-Boot Root Hub 
   
kedge# usb dev

IDE device 0: Vendor: Lexar    Rev: 1100 Prod: USB Flash Drive 
            Type: Removable Hard Disk
            Capacity: 29600.0 MB = 28.9 GB (60620800 x 512)
kedge# usbboot usb 0

Loading from usb device 0, partition 1: Name: usbda1  Type: U-Boot
BUG at drivers/usb/host/xhci-mem.c:37/xhci_flush_cache()!
BUG!
DDR Version 1.22 20190506
In
soft reset
SRX
channel 0
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 1
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 0 training pass!
channel 1 training pass!
change freq to 416MHz 0,1
Channel 0: LPDDR4,416MHz
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=16 Size=2048MB
Channel 1: LPDDR4,416MHz
Bus Width=32 Col=10 Bank=8 Row=15/15 CS=2 Die Bus-Width=16 Size=2048MB
256B stride
channel 0
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 1
CS = 0
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
CS = 1
MR0=0x19
MR4=0x3
MR5=0x6
MR8=0x8
MR12=0x72
MR14=0x72
MR18=0x0
MR19=0x0
MR24=0x8
MR25=0xFF
channel 0 training pass!
channel 1 training pass!
channel 0, cs 0, advanced training done
channel 0, cs 1, advanced training done
channel 1, cs 0, advanced training done
channel 1, cs 1, advanced training done
change freq to 856MHz 1,0
ch 0 ddrconfig = 0x101, ddrsize = 0x2020
ch 1 ddrconfig = 0x101, ddrsize = 0x2020
pmugrf_os_reg[2] = 0x3AA1FAA1, stride = 0xD
OUT
Boot1: 2019-03-14, version: 1.19
CPUId = 0x0
ChipType = 0x10, 323
SdmmcInit=2 0
BootCapSize=100000
UserCapSize=29820MB
FwPartOffset=2000 , 100000
mmc0:cmd8,20
mmc0:cmd5,20
mmc0:cmd55,20
mmc0:cmd1,20
mmc0:cmd8,20
mmc0:cmd5,20
mmc0:cmd55,20
mmc0:cmd1,20
mmc0:cmd8,20
mmc0:cmd5,20
mmc0:cmd55,20
mmc0:cmd1,20
SdmmcInit=0 1
StorageInit ok = 68741
SecureMode = 0
SecureInit read PBA: 0x4
SecureInit read PBA: 0x404
SecureInit read PBA: 0x804
SecureInit read PBA: 0xc04
SecureInit read PBA: 0x1004
SecureInit read PBA: 0x1404
SecureInit read PBA: 0x1804
SecureInit read PBA: 0x1c04
SecureInit ret = 0, SecureMode = 0
atags_set_bootdev: ret:(0)
GPT part:  0, name:            uboot, start:0x4000, size:0x2000
GPT part:  1, name:            trust, start:0x6000, size:0x2000
GPT part:  2, name:             misc, start:0x8000, size:0x2000
GPT part:  3, name:              dtb, start:0x22000, size:0x2000
GPT part:  4, name:             dtbo, start:0x24000, size:0x2000
GPT part:  5, name:           vbmeta, start:0x26000, size:0x800
GPT part:  6, name:             boot, start:0x26800, size:0x10000
GPT part:  7, name:         recovery, start:0x36800, size:0x20000
GPT part:  8, name:           backup, start:0x56800, size:0x38000
GPT part:  9, name:         security, start:0x8e800, size:0x2000
GPT part: 10, name:            cache, start:0x90800, size:0x100000
GPT part: 11, name:           system, start:0x190800, size:0x500000
GPT part: 12, name:         metadata, start:0x690800, size:0x8000
GPT part: 13, name:           vendor, start:0x698800, size:0x100000
GPT part: 14, name:              oem, start:0x798800, size:0x100000
GPT part: 15, name:              frp, start:0x898800, size:0x400
GPT part: 16, name:         userdata, start:0x898c00, size:0x31a53df
find part:uboot OK. first_lba:0x4000.
find part:trust OK. first_lba:0x6000.
LoadTrust Addr:0x6000
No find bl30.bin
Load uboot, ReadLba = 4000
Load OK, addr=0x200000, size=0xe83d8
RunBL31 0x10000
NOTICE:  BL31: v1.3(debug):51f2096
NOTICE:  BL31: Built : 16:24:31, May  6 2019
NOTICE:  BL31: Rockchip release version: v1.1
INFO:    GICv3 with legacy support detected. ARM GICV3 driver initialized in EL3
INFO:    Using opteed sec cpu_context!
INFO:    boot cpu mask: 0
INFO:    plat_rockchip_pmu_init(1181): pd status 3e
INFO:    BL31: Initializing runtime services
INFO:    BL31: Initializing BL32
INF [0x0] TEE-CORE:init_primary_helper:337: Initializing (1.1.0-195-g8f090d20 #6 Fri Dec  7 06:11:20 UTC 2018 aarch64)

INF [0x0] TEE-CORE:init_primary_helper:338: Release version: 1.2

INF [0x0] TEE-CORE:init_teecore:83: teecore inits done
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9


U-Boot 2017.09-g0bfc064 (Dec 05 2019 - 01:59:10 +0800)

Model: Khadas-RK3399 khadas Board
PreSerial: 2
DRAM:  3.8 GiB
Sysmem: init
Relocation Offset is: f5bdd000
Using default environment

dwmmc@fe320000: 1, sdhci@fe330000: 0
Bootdev(atags): mmc 0
PartType: EFI
boot mode: normal
Load FDT from boot part
DTB: rk-kernel.dtb
ANDROID: fdt overlay OK
I2c speed: 400000Hz
PMIC:  RK808 
vdd_center 900000 uV
vdd_cpu_l 900000 uV
vdd_log 980000 uV
Model: Khadas Board
Rockchip UBOOT DRM driver version: v1.0.1
xfer: num: 2, addr: 0x50
xfer: num: 2, addr: 0x50
Monitor has basic audio support
Could not find baseparameter partition
mode:1280x720
CEA mode used vic=4
final pixclk = 74250000 tmdsclk = 74250000
PHY powered down in 0 iterations
PHY PLL locked 1 iterations
PHY powered down in 0 iterations
PHY PLL locked 1 iterations
sink has audio support
hdmi_set_clk_regenerator: fs=48000Hz ftdms=74.250MHz N=6144 cts=74250
Using display timing dts
Detailed mode clock 120000 kHz, flags[a]
    H: 1088 1192 1196 1323
    V: 1920 1924 1926 1929
bus_format: 100e
final DSI-Link bandwidth: 996 Mbps x 4
CLK: (uboot. arml: enter 816000 KHz, init 816000 KHz, kernel 0N/A)
CLK: (uboot. armb: enter 24000 KHz, init 24000 KHz, kernel 0N/A)
  aplll 816000 KHz
  apllb 24000 KHz
  dpll 856000 KHz
  cpll 120000 KHz
  gpll 800000 KHz
  npll 600000 KHz
  vpll 74000 KHz
  aclk_perihp 133333 KHz
  hclk_perihp 66666 KHz
  pclk_perihp 33333 KHz
  aclk_perilp0 266666 KHz
  hclk_perilp0 88888 KHz
  pclk_perilp0 44444 KHz
  hclk_perilp1 100000 KHz
  pclk_perilp1 50000 KHz
Net:   eth0: ethernet@fe300000
Setting bus to 8
I2c speed: 100000Hz
normal power off
boot wol: enable
detect_board val=203 
board type = Edge-V (2)(val=203)
mac address: c8:63:14:71:1b:e4
Hit any key to stop autoboot:  0 
ANDROID: reboot reason: "(none)"
SecureBoot enabled, AVB verify
read_is_device_unlocked() ops returned that device is UNLOCKED
avb_slot_verify.c:637: ERROR: vbmeta: Error verifying vbmeta image: OK_NOT_SIGNED
FDT load addr 0x10f00000 size 152 KiB
Booting IMAGE kernel at 0x00280000 with fdt at 0x8300000...


## Booting Android Image at 0x0027f800 ...

I had a break through, I used

kedge# usbboot usb 0

but I’m getting this error:

Loading from usb device 0, partition 1: Name: usbda1  Type: U-Boot
BUG at drivers/usb/host/xhci-mem.c:37/xhci_flush_cache()!
BUG!

What I have done and do not know if this is the correct way to do this. Use Krescue on SD and boot from it.

Do a full erase of EMMC with krescue, if you want to install into emmc do so using the wizard.

If you intend to run from external USB device, ssd, thumbrive use Raspberry pi imager and burn the image. In pi imager go into custom OS and go to your .gz image downloaded from dl.khadas.

Be sure to install the SD image not the version for emmc.

Not sure what the issue is with android, it does not want to let users remove it without a fight.

Thanks for your response. I have successfully loaded an image from SD card. Its USB that looks problematic.
If you see the logs, there is an output indicating a BUG. I believe something is wrong with U-Boot and right now I’m trying to build u-boot.bin.

I have used AndroidTool_Release_v2.71 to write Edge_Ubuntu-server-focal_Linux-5.7_arm64_SD-USB_V0.9.1-20200602 to emmc. Now my uboot version is:

U-Boot 2020.04 (Jun 02 2020 - 17:39:25 +0800)

aarch64-linux-gnu-gcc (Linaro GCC 7.3-2018.05) 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701]
GNU ld (Linaro_Binutils-2018.05) 2.28.2.20170706

I still get the same error running usbboot usb 0 and the following error when using run usb_boot

kedge# run usb_boot 
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3c0000: USB EHCI 1.00
Bus dwc3: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus dwc3: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found

IDE device 0: Vendor: Lexar    Rev: 1100 Prod: USB Flash Drive 
            Type: Removable Hard Disk
            Capacity: 29600.0 MB = 28.9 GB (60620800 x 512)
** Bad device specification usb -bootable **
Scanning usb :1...
Found U-Boot script /boot.scr
5250 bytes read in 3 ms (1.7 MiB/s)
## mkimage Script run a:0a500000 l:5178
Run Khadas boot script
board type = Edge-V (2)
Uboot loaded from eMMC.
** Invalid partition 7 **
** Invalid partition 7 **
** Invalid partition 7 **
Rootfs UUID mismatch! Set rootfs part to default: /dev/mmcblk2p7
DTB: /boot/dtb/rockchip/rk3399-khadas-edge-v.dtb
mac address: c8:63:14:71:1b:e4
Scanning usb :1...
9660505 bytes read in 224 ms (41.1 MiB/s)
23175680 bytes read in 535 ms (41.3 MiB/s)
SCRIPT FAILED: continuing...
56085 bytes read in 5 ms (10.7 MiB/s)
kedge#

examining the script:

if test ${devnum} = 0; then
	echo "Uboot loaded from eMMC.";
	if test -e mmc ${devnum}:${emmc_root_part} zImage; then
		setenv imagetype "EMMC";
		setenv boot_env_part ${emmc_boot_part};
		setenv root_part ${emmc_root_part};
		setenv mark_prefix "boot/";
	else
		setenv imagetype "EMMC_MBR";
		setenv boot_env_part ${emmc_mbr_boot_part};
		setenv root_part ${emmc_mbr_root_part};
		setenv mark_prefix "";
	fi;

	if test -e mmc ${devnum}:${boot_env_part} ${mark_prefix}.next; then
		setenv default_rootdev "/dev/mmcblk2p${root_part}"
	else
		setenv default_rootdev "/dev/mmcblk1p${root_part}"
	fi
else if test ${devnum} = 1; then
	echo "Uboot loaded from SD.";
	setenv boot_env_part ${sd_boot_part};
	setenv root_part ${sd_root_part}
	setenv mark_prefix ""
	if test -e mmc ${devnum}:${boot_env_part} ${mark_prefix}.next; then
		setenv default_rootdev "/dev/mmcblk1p${sd_root_part}"
	else
		setenv default_rootdev "/dev/mmcblk0p${sd_root_part}"
	fi
	setenv imagetype "SD-USB";
fi;fi;

Apparently there is no option for USB! Only for emmc or SD.

What type of device are you using ssd or stick?

I’m using stick. USB 3.

In boot.scr we only check for 2 possibilities in those ifs:

if test ${devnum} = 0;

and

else if test ${devnum} = 1;

Just so we can get on the same page.
Do a full erase of the USB stick
Use Pi imager to install Ubuntu desktop SD version.
Let Pi imager installer verify the image before proceeding forward.
Do you have a different USB stick to use, we did find one brand has one that did not work on our boards.

FYI the Pi Imager works perfectly on Ubuntu OS x86 or ARM, it does have issues with Win 10 version. Some times it works fine others not so fine.

It does appear that it is finding the USB drive

My assumption would be data corruption??? Possibly an issue with the USB stick?

Hi. Thank you so much for caring. In my previous message I have quoted from a thread regarding the same issue. Apparently you need for example uboot that comes from armbian image in sd card. Then writing uboot from SD card to emmc. With that U-Boot you can boot from USB. I have done this and I was successful. The downside is you will loose KBI.

1 Like