How to set booting only from emmc?

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

Ubuntu 18.04

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

self built image

Please describe your issue below:

How to set booting only from emmc?

I can boot from microSD card and Flash drive (connected to USB). I need to boot only from emmc.

I changed CONFIG_AML_SD_EMMC in u-boot/board/khadas/configs/kvim2.h file and u-boot does not compile.

Post a console log of your issue below:


GXM:BL1:dc8b51:76f1a5;FEAT:ADFC318C:80;POC:3;RCY:0;EMMC:0;READ:0;0.0;CHK:0;
TE: 114242

BL2 Built : 12:23:15, May 17 2019. gxl g3e531ea - luan.yuan@droid15-sz

set vdd cpu_a to 1120 mv
set vdd cpu_b to 1050 mv
set vddee to 1000 mv
Board ID = 6
CPU clk: 1200MHz
DQS-corr enabled
DDR scramble enabled
DDR3 chl: Rank0+1 @ 912MHz - FAIL
DDR3 chl: Rank0 @ 912MHz - FAIL
DDR3 chl: Rank0 16bit @ 912MHz - FAIL
DDR4 chl: Rank0+1 @ 1008MHz
bist_test rank: 0 16 0e 1f 2a 1a 3b 18 0f 22 2a 1b 39 1c 10 29 27 15 3a 1a 10 25 24 11 38 698  rank: 1 19 03 2f 29 19 3a 19 05 2e 2b 1c 3a 1c 0a 2f 28 17 39 1a 06 2f 25 11 39 698   - PASS

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

Rank1: 1024MB(auto)-2T-18
AddrBus test pass!
eMMC boot @ 0
sw8 s
emmc switch 3 ok
Authentication key not yet programmed
get rpmb counter error 0x00000007
emmc switch 0 ok
Load fip header from eMMC, src: 0x0000c200, des: 0x01400000, size: 0x00004000, part: 0
New fip structure!
Load bl30 from eMMC, src: 0x00010200, des: 0x013c0000, size: 0x0000d600, part: 0
Load bl31 from eMMC, src: 0x00020200, des: 0x05100000, size: 0x0002b400, part: 0
Load bl33 from eMMC, src: 0x0004c200, des: 0x01000000, size: 0x0006f400, part: 0
NOTICE:  BL3-1: v1.0(release):53f813e
NOTICE:  BL3-1: Built : 15:51:23, May 22 2019
NOTICE:  BL3-1: GXM normal boot!
NOTICE:  BL3-1: BL33 decompress pass
mpu_config_enable:system pre init ok

dmc sec lock

[Image: gxl_v1.1.3389-92241b5 2019-07-02 17:22:35 luan.yuan@droid15-sz]

OPS=0x82

wdt: reset registers!

22 0b 82 00 56 21 be fd d6 e4 05 1e 7e 9a 8e 79 

[0.860751 Inits done]

secure task start!
high task start!
low task start!
ERROR:   Error initializing runtime service opteed_fast


U-Boot 2015.01 (Sep 15 2022 - 15:09:18)

DRAM:  2 GiB
Relocation Offset is: 76e99000
spi_post_bind(spifc): req_seq = 0
register usb cfg[0][1] = 0000000077f4d548
[CANVAS]canvas init
aml_i2c_init_port init regs for 2
MMC:   aml_priv->desc_buf = 0x0000000073e99720
aml_priv->desc_buf = 0x0000000073e9ba60
SDIO Port B: 0, SDIO Port C: 1
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
emmc/sd response timeout, cmd8, status=0x3ff2800
emmc/sd response timeout, cmd55, status=0x3ff2800
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 40000000
[mmc_startup] mmc refix success
init_part() 297: PART_TYPE_AML
[mmc_init] mmc init success
start dts,buffer=0000000073e9e2d0,dt_addr=0000000073e9e2d0
get_partition_from_dts() 91: ret 0
parts: 3
00:      logo	0000000000800000 1
01:   ramdisk	0000000002000000 1
02:    rootfs	ffffffffffffffff 4
init_part() 297: PART_TYPE_AML
eMMC/TSD partition table have been checked OK!
crc32_s:0x1577dad == storage crc_pattern:0x1577dad!!!
crc32_s:0xee152b83 == storage crc_pattern:0xee152b83!!!
crc32_s:0x79f50f07 == storage crc_pattern:0x79f50f07!!!
mmc env offset: 0x6c00000 
In:    serial
Out:   serial
Err:   serial
reboot_mode=cold_boot
[store]To run cmd[emmc dtb_read 0x1000000 0x40000]
_verify_dtb_checksum()-3406: calc 990e43dd, store 990e43dd
_verify_dtb_checksum()-3406: calc 990e43dd, store 990e43dd
dtb_read()-3623: total valid 2
update_old_dtb()-3604: do nothing
vpu: clk_level in dts: 7
vpu: vpu_power_on
vpu: set clk: 666667000Hz, readback: 666666667Hz(0x300)
vpu: vpu_module_init_config
vpp: vpp_init
cvbs: cpuid:0x22
hpd_state=0
cvbs: outputmode[1080p60hz] is invalid
vpp: vpp_matrix_update: 2
set hdmitx VIC = 16
config HPLL = 2970000
HPLL: 0xc000027b
config HPLL done
j = 6  vid_clk_div = 1
hdmitx: set enc for VIC: 16
HDMITX-DWC addr=0x10004006 rd_data=0x40
Error: HDMITX-DWC exp_data=0xff mask=0x9f
rx version is 1.4 or below  div=10
hdmtix: set audio
hdmitx phy setting done
vpp: vpp_pq_load pq val error !!!
Net:   Phy 0 not found
dwmac.c9410000
amlkey_init() enter!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
MACADDR:02:d6:fd:be:21:56(from chipid)

upgrade_step=0
reboot_mode:::: cold_boot

amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[mac] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
[OSD]load fb addr from dts:/meson-fb
[OSD]fb_addr for logo: 0x7f800000
[OSD]load fb addr from dts:/meson-fb
[OSD]fb_addr for logo: 0x7f800000
[OSD]VPP_OFIFO_SIZE:0xfff00fff
[CANVAS]addr=0x7f800000 width=3840, height=2160
[OSD]osd_hw.free_dst_data: 0,1919,0,1079

amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[mac] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet
saradc - saradc sub-system

Usage:
saradc saradc open <channel>	- open a SARADC channel
saradc close	- close the SARADC
saradc getval	- get the value in current channel
saradc test	- test the SARADC by channel-7
saradc get_in_range <min> <max>	- return 0 if current value in the range of current channel

gpio: pin GPIOAO_2 (gpio 102) value is 0
detect upgrade key
gpio: pin GPIOAO_2 (gpio 102) value is 1
saradc: 0x201, hw_ver: 0x22 (VIM2.V12)
Product checking: pass! Hardware version: VIM2.V12
reboot_mode=cold_boot
normal power on
boot wol: disable

amlkey_init() enter!
amlkey_init() 71: already init!
[EFUSE_MSG]keynum is 4
[BL31]: tee size: 0
[KM]Error:f[key_manage_query_size]L515:key[usid] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[mac] not programed yet
[KM]Error:f[key_manage_query_size]L515:key[deviceid] not programed yet

card out
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
co-phase 0x2, tx-dly 0, clock 400000
emmc/sd response timeout, cmd8, status=0x1ff2800
emmc/sd response timeout, cmd55, status=0x1ff2800
emmc/sd response timeout, cmd1, status=0x1ff2800
(Re)start USB...
USB0:   USB3.0 XHCI init start
Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... 6 USB Device(s) found
       scanning usb for storage devices... init_part() 282: PART_TYPE_DOS
1 Storage Device(s) found
reading s905_autoscript
10463 bytes read in 38 ms (268.6 KiB/s)
## Executing script at 01020000
Starting S905 autoscript...
saradc: 0x201, hw_ver: 0x22 (VIM2.V12)
[BL31]: tee size: 0

mac address: 98:aa:fc:60:d5:12
uboot type: vendor
Found ddr_size: 2
autoscript loaded from: usb
Scanning usb 0:1...
reading uInitrd
8479399 bytes read in 407 ms (19.9 MiB/s)
reading zImage
29248000 bytes read in 1317 ms (21.2 MiB/s)
reading dtb.img
55532 bytes read in 34 ms (1.6 MiB/s)
reading /boot/env.txt
** Unable to read file /boot/env.txt **
reading env.txt
3646 bytes read in 31 ms (114.3 KiB/s)
Import env.txt
Booting legacy kernel...
Apply dtbo uart4
reading /dtb/overlays/kvim2/uart4.dtbo
228 bytes read in 34 ms (5.9 KiB/s)
fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize                          - Resize fdt to size + padding to 4k addr
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
Apply dtbo pwm_d
reading /dtb/overlays/kvim2/pwm_d.dtbo
225 bytes read in 34 ms (5.9 KiB/s)
fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize                          - Resize fdt to size + padding to 4k addr
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
Apply dtbo i2c0
reading /dtb/overlays/kvim2/i2c0.dtbo
223 bytes read in 33 ms (5.9 KiB/s)
fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize                          - Resize fdt to size + padding to 4k addr
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
Apply dtbo i2s
reading /dtb/overlays/kvim2/i2s.dtbo
328 bytes read in 34 ms (8.8 KiB/s)
fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize                          - Resize fdt to size + padding to 4k addr
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
Apply dtbo watchdog
reading /dtb/overlays/kvim2/watchdog.dtbo
222 bytes read in 34 ms (5.9 KiB/s)
fdt - flattened device tree utility commands

Usage:
fdt addr [-c]  <addr> [<length>]   - Set the [control] fdt location to <addr>
fdt move   <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active
fdt resize                          - Resize fdt to size + padding to 4k addr
fdt print  <path> [<prop>]          - Recursive print starting at <path>
fdt list   <path> [<prop>]          - Print one level starting at <path>
fdt get value <var> <path> <prop>   - Get <property> and store in <var>
fdt get name <var> <path> <index>   - Get name of node <index> and store in <var>
fdt get addr <var> <path> <prop>    - Get start address of <property> and store in <var>
fdt get size <var> <path> [<prop>]  - Get size of [<property>] or num nodes and store in <var>
fdt set    <path> <prop> [<val>]    - Set <property> [to <val>]
fdt mknode <path> <node>            - Create a new node after <path>
fdt rm     <path> [<prop>]          - Delete the node or <property>
fdt header                          - Display header info
fdt bootcpu <id>                    - Set boot cpuid
fdt memory <addr> <size>            - Add/Update memory node
fdt rsvmem print                    - Show current mem reserves
fdt rsvmem add <addr> <size>        - Add a mem reserve
fdt rsvmem delete <index>           - Delete a mem reserves
fdt chosen [<start> <end>]          - Add/update the /chosen branch in the tree
                                        <start>/<end> - initrd start/end addr
NOTE: Dereference aliases by omiting the leading '/', e.g. fdt print ethernet0.
HDMI: Autodetect: 1080p60hz
## Loading init Ramdisk from Legacy Image at 13000000 ...
   Image Name:   uInitrd
   Image Type:   AArch64 Linux RAMDisk Image (uncompressed)
   Data Size:    8479335 Bytes = 8.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
load dtb from 0x1000000 ......
## Flattened Device Tree blob at 01000000
   Booting using the fdt blob at 0x1000000
   reserving fdt memory region: addr=1000000 size=e000
   Loading Ramdisk to 73670000, end 73e86267 ... OK
   Loading Device Tree to 000000001ffef000, end 000000001fffffff ... OK
fdt_instaboot: no instaboot image

Starting kernel ...

uboot time: 15354068 us
domain-0 init dvfs: 4

domain-1 init dvfs: 4

[    0.000000@0] Reserved memory: unable to setup CMA region
[    0.419244@0] codec_mm_module_init
[    0.432038@0] clkmsr c110875c.meson_clk_msr: failed to get msr ring reg0
[    0.695854@0] dmi: Firmware registration failed.
[    1.220146@1] mtdoops: mtd device (mtddev=name/number) must be supplied
[    1.372391@1] c81004c0.serial: clock gate not found
[    1.398867@1] c11084c0.serial: clock gate not found
[    1.404899@1] amlogic-new-usb3 d0078080.usb3phy: This phy has no usb port
[    1.421859@1] meson-remote c8100580.rc: don't find the node <led_blink>
[    1.422839@1] meson-remote c8100580.rc: don't find the node <led_blink_frq>
[    1.436165@1] ge2d: register address resource is not found
[    1.569425@6] get fclk_div5 err
[    1.569461@6] vdin_drv_probe: vdin cannot get msr clk !!!
[    1.573353@6] get fclk_div5 err
[    1.575438@6] vdin_drv_probe: vdin cannot get msr clk !!!
[    1.586306@5] amlvideo2 probe called
[    1.586837@4] amlvideo2 probe called
[    1.588796@0] Reserved memory: failed to init DMA memory pool at 0x0000000074800000, size 0 MiB
[    1.603942@0] meson-mmc: >>>>>>>>hostbase ffffff8008784000, dmode 
[    1.646607@5] meson-mmc: >>>>>>>>hostbase ffffff80087c2000, dmode 
[    1.690013@4] meson-mmc: >>>>>>>>hostbase ffffff80087cc000, dmode 
[    1.729904@4] cectx c810023c.aocec: cec driver date:2019/6/13:early suspend not report pw status
[    1.729904@4] 
[    1.735346@4] cectx c810023c.aocec: compatible:amlogic, amlogic-aocec
[    1.741156@4] cectx c810023c.aocec: cecb_ver:0x0
[    1.745790@4] cectx c810023c.aocec: line_reg:0x0
[    1.750289@0] cectx c810023c.aocec: line_bit:0x8
[    1.754881@0] cectx c810023c.aocec: ee_to_ao:0x0
[    1.759929@0] cectx c810023c.aocec: not find 'port_num'
[    1.764594@0] cectx c810023c.aocec: using cec:0
[    1.769176@0] cectx c810023c.aocec: get sleep state error!
[    1.774484@0] cectx c810023c.aocec: no hdmirx regs
[    1.779189@0] cectx c810023c.aocec: no hhi regs
[    1.783796@0] cectx c810023c.aocec: no periphs regs
[    1.788584@0] cectx c810023c.aocec: not find 'output'
[    1.796787@0] cectx c810023c.aocec: irq cnt:1
[    1.798763@0] cectx c810023c.aocec: wakeup_reason:0x0
[    1.802933@0] cectx c810023c.aocec: cev val1: 0x0;val2: 0x0
[    1.808353@0] cectx c810023c.aocec: aml_cec_probe success end
[    1.822970@4] meson-mmc: Tuning transfer error: nmatch=0 tuning_err:0xffffffb6
[    2.288092@6] spdif-dit spdif_codec: audio_spdif_in_mute can't get pinctrl
[    2.289334@6] spdif-dit spdif_codec: audio_spdif_in can't get pinctrl
[    2.506751@4] aml_meson_snd_card aml_sound_meson: ASoC: no source widget found for LOUTL
[    2.509303@4] aml_meson_snd_card aml_sound_meson: ASoC: Failed to add route LOUTL -> direct -> Ext Spk
[    2.518472@4] aml_meson_snd_card aml_sound_meson: ASoC: no source widget found for LOUTR
[    2.526461@4] aml_meson_snd_card aml_sound_meson: ASoC: Failed to add route LOUTR -> direct -> Ext Spk
[    3.074949@0] hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
[    3.076856@0] usb usb2: Unsupported the hub
[    3.081392@0] rtc-hym8563 1-0051: hctosys: unable to read the hardware clock
[    3.205639@0] thermal: read num_of_pp failed
[    5.251466@2] sd 0:0:0:0: [sda] No Caching mode page found
[    5.251506@2] sd 0:0:0:0: [sda] Assuming drive cache: write through
SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.31:  No such file or directory
[    8.698953@4] cgroup: cgroup2: unknown option "nsdelegate"
[   10.420048@1] snd_i2s_dai: Fine tdm clk setting range (0~2000000), 12287985
[   10.420071@1] snd_spdif_dai: Fine spdif sysclk setting range(0~2000000), 24575970
[   10.424810@0] meson-mmc: sdio: resp_timeout,vstat:0xa3ff2800,virqc:3fff
[   10.424814@0] meson-mmc: sdio: err: wait for irq service, bus_fsm:0x8
[   10.425928@0] meson-mmc: sdio: resp_timeout,vstat:0xa3ff2800,virqc:3fff
[   10.425931@0] meson-mmc: sdio: err: wait for irq service, bus_fsm:0x8
[   10.430623@0] meson-mmc: sdio: resp_timeout,vstat:0xa3ff2800,virqc:3fff
[   10.430627@0] meson-mmc: sdio: err: wait for irq service, bus_fsm:0x8
[   10.650783@0] meson-mmc: Tuning transfer error: nmatch=16 tuning_err:0xffffffac
[   10.678974@1] Amlogic A/V streaming port init
[   15.535146@2] snd_i2s_dai: Fine tdm clk setting range (0~2000000), 12287985
[   15.536617@2] snd_spdif_dai: Fine spdif sysclk setting range(0~2000000), 24575970
[   22.126089@5] meson-mmc: Tuning transfer error: nmatch=0 tuning_err:0xffffffac


Ubuntu 18.04.6 LTS Khadas ttyS0

Khadas login: 

The default boot mode is from eMMC, what you realy want to do?

I know that the default boot mode is from emmc.
But if you have a bootable flash drive and press F while booting, you can boot from the flash drive and read data from emmc.
I want to prevent to read data from emmc.