Boot fails with self-build u-boot

Some help from people who are able to test different preloaders is appreciated. What to do:

  1. Take any preloader from this list and install it to resp. boot media. Note the name of preloader you had used and boot media you placed it to (SD or eMMC).
  2. Boot your board into u-boot, good idea would be to capture bootlog. Go to the u-boot command line. Check bootlog to get an idea what was the real bootmedia u-boot was loaded from. Strings to look for: “Load u-boot from SD Card...” or “Load u-boot from eMMC...” or “Boot from SD Card!!” or “Boot from eMMC!!”. Note the string you had found.
  3. In u-boot shell execute “md.b 0x00100048 10”, note the output.
  4. Post the info you had noted to this thread so we can collect and analyze it.

Big thanks to contributors in advance!

We should only use the 2 new preloaders (2019-02-22), because they load entire uboot…

https://github.com/BPI-SINOVOIP/BPI-files/tree/master/SD/100MB.

  • BPI-R2-preloader-DDR1600-20190722-2k.img.gz
  • BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img.gz

Oh my, @sinovoip, it is an epic fail again! Preloaders in files above are bit to bit identical. And if you ungzip BPI-R2-preloader-DDR1600-20190722-2k.img.gz you get a file named BPI-R2-EMMC-boot0-DDR1600-20190722-2k.img - which is exactly what its name implies - BPI-R2-EMMC-boot0-DDR1600-20190722-0k.img prepended with eMMC boot signatures. @sinovoip, why the level of support provided for R2 has to be this bad?

1 Like

I’d say nope, we shouldn’t. It is OK to use older preloaders as long as u-boot binary size is under 300000.

New preloader behavior w.r.t. boot from eMMC/SD is the same as of BPI-R2-720P-DDR1600-2k.img, i.e.: (1) no “eMMC” string at 0x81dffff0 even when u-boot is loaded from eMMC and (2) it always tries to load u-boot from SD card if any SD card is inserted, no matter the position of hardware boot switch. Point (2) is a show-stopper as it breaks the most useful use case for hw bootswitch. The only point in setting hw switch to eMMC position is to force the board to ignore SD card on boot. Having preloader always trying to load u-boot from SD card no matter what makes it impossible.

P.S. It is especially bad for “board set up at some distant location” case. Forgetting to remove SD card from it will lead to a board hang on the next reboot and user having to drive in there just to eject the SD.

@sinovoip

can you please fix the problems described in preloader?

  • load uboot from device where preloader was loaded (maybe make real emmc/sd-preloaders which each load specific device), but better would be let 1 preloader look from which device it was loaded
  • respect boot-switch (can we read out the boot-switch in uboot?)
  • write a string in memory to determine which device was really used to load uboot
  • if the prior bootdevice is no more available, try the other one (needs to be only done if a device-switch is done like now or if first 2 points are conflicting). i don’t know which is done by hardware and which by preloader (does hardware/bootrom read-out the boot-switch and load bootloader from the selected device?)

Hi Frank,

I’m trying to create a Debian Buster image from scratch but I’m having hard time to load u-boot.

What is the latest u-boot that works fine ?

I tried to compile u-boot from this repository https://github.com/frank-w/u-boot/tree/2019-10-bpi-r2

Cross compilation on Debian Buster x64 VM is fine and I get an u-boot.bin file (325K in size) then I ran the below commands to write the preloader and compiled u-boot

gunzip -c BPI-R2-HEAD440-0k.img.gz | dd of=/dev/loop8 bs=1024 seek=0
gunzip -c BPI-R2-HEAD1-512b.img.gz | dd of=/dev/loop8 bs=512 seek=1
sudo dd if=BPI-R2-preloader-DDR1600-20191024-2k.img of=/dev/loop8 bs=1024 seek=2
sudo dd if=u-boot.bin of=/dev/loop8 bs=1024 seek=320

For the preloader I used the latest from BPI repository https://github.com/BPI-SINOVOIP/BPI-files/blob/master/SD/100MB/BPI-R2-preloader-DDR1600-20191024-2k.img.gz. It seems u-boot does not get loaded. These are the last line from the UART boot where is freezes.

Device APC domain init setup:

 bootloader load uboot ,the address of uboot is 81E00000 
[PART]partition name UBOOT 
[PART]partition start block 0x200 
[PART]partition size 0x80000 
[PART]partition blks 0x400 
[PART]partition flags 0x0 
[PART]partition name 0x8 
[bean] part->startblk(0x200) bdev->blksz(0x200) part->part_id(8) hdr(0xFFB50000)
[BlkDev.c 101 ]partition block size 0x200 ,blks:0x7740000
[BlkDev.c 101 ]partition block erase size 0x200 

[PART] load "UBOOT" from 0x0000000000050000 (dev) to 0x81E00000 (mem) [SUCCESS]
[PART] load speed: 6736KB/s, 524288 bytes, 76ms
[BT_SD_PG] device info 0x8590 0x8A00 0xCB01 0x102
0:dram_rank_size:80000000
[PLFM] md_type[0] = 255 
[PLFM] md_type[1] = 253 

[PLFM] boot reason: 0
[PLFM] boot mode: 0
[PLFM] META COM0: 0
[PLFM] <0xFFB7CC10>: 0x0
[PLFM] boot time: 2950ms
[PLFM] DDR reserve mode: enable = 0, success = 0

[BLDR] jump to 0x81E00000
[BLDR] <0x81E00000>=0x0
[BLDR] <0x81E00004>=0x0

Am I missing something ?

You could try using preloader from july…have not tested that from october…only emmc.

The problem seems to be the newer u-boot version 2019-10 release.

I used the preloader from october and compiled u-boot from your default repository (2019-07-bpi-r2) and it booted fine.

I have compiled an custom kernel image from your 5.4-main branch but during loading it throws an kernel panic error

Boot from SD
fatload (uEnv.txt) failed
## Warning: Input data exceeds 1048576 bytes - truncated
## Info: input data size = 1048578 = 0x100002
bootargs=board=bpi-r2 earlyprintk console=tty1 fbcon=map:0 console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait vmalloc=496M debug=7 initcall_debug=0 video=1920x1080 drm.debu7
8249142 bytes read in 412 ms (19.1 MiB/s)
## Booting kernel from Legacy Image at 80200000 ...
   Image Name:   Linux Kernel 5.4.2-main
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    8249078 Bytes = 7.9 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

[    5.138004] printk: console [ttyS0] enabled
[    5.146406] printk: bootconsole [earlycon0] disabled
[    5.177630] 11002000.serial: ttyS1 at MMIO 0x11002000 (irq = 202, base_baud = 1625000) is a ST16650V2
[    5.208108] 11003000.serial: ttyS2 at MMIO 0x11003000 (irq = 203, base_baud = 1625000) is a ST16650V2
[    5.218665] mtk_rng 1020f000.rng: registered RNG driver
[    5.218808] random: fast init done
[    5.224234] [drm:drm_core_init] Initialized
[    5.227558] random: crng init done
[    5.235192] mediatek-drm 14000000.dispsys: Adding component match for /ovl@14007000
[    5.242899] mediatek-drm 14000000.dispsys: Adding component match for /rdma@14008000
[    5.250797] mediatek-drm 14000000.dispsys: Adding component match for /color@1400b000
[    5.258748] mediatek-drm 14000000.dispsys: Adding component match for /rdma@14012000
[    5.266544] mediatek-drm 14000000.dispsys: Adding component match for /dpi@14014000
[    5.276109] mediatek-hdmi-phy 10209100.phy: Using default TX DRV impedance: 4.2k/36
[    5.286292] [drm] hdmi-audio-codec driver bound to HDMI
[    5.302135] loop: module loaded
[    5.305611] [WMT-DETECT][I]wmt_detect_driver_init:driver(major 154) installed success
[    5.313530] [SDIO-DETECT][I]sdio_detect_init:sdio_register_driver() ret=0
[    5.320520] MTK-BTIF[E]hal_btif_clk_get_and_prepare(286):[CCF]clk_btif=b8482d1c
[    5.327883] MTK-BTIF[E]hal_btif_clk_get_and_prepare(292):[CCF]clk_btif_apdma=2b3b0376
[    5.337959] mt6323-regulator mt6323-regulator: Chip ID = 0x2023
[    5.353278] Uniform Multi-Platform E-IDE driver
[    5.357896] ide-gd driver 1.18
[    5.361560] mdio_bus fixed-0: GPIO lookup for consumer reset
[    5.367281] mdio_bus fixed-0: using lookup tables for GPIO lookup
[    5.373398] mdio_bus fixed-0: No GPIO consumer reset found
[    5.378908] libphy: Fixed MDIO Bus: probed
[    5.406304] of_get_named_gpiod_flags: can't parse 'link-gpios' property of node '/ethernet@1b100000/mac@0/fixed-link[0]'
[    5.417452] mdio_bus mdio-bus: GPIO lookup for consumer reset
[    5.423241] mdio_bus mdio-bus: using device tree for GPIO lookup
[    5.429265] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/ethernet@1b100000/mdio-bus[0]'
[    5.439562] of_get_named_gpiod_flags: can't parse 'reset-gpio' property of node '/ethernet@1b100000/mdio-bus[0]'
[    5.449762] mdio_bus mdio-bus: using lookup tables for GPIO lookup
[    5.455960] mdio_bus mdio-bus: No GPIO consumer reset found
[    5.461534] libphy: mdio: probed
[    5.465056] mt7530 mdio-bus:00: GPIO lookup for consumer reset
[    5.470897] mt7530 mdio-bus:00: using device tree for GPIO lookup
[    5.477047] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ethernet@1b100000/mdio-bus/switch@0[0]' - status (0)
[    5.488843] gpio gpiochip0: Persistence not supported for GPIO 33
[    5.495229] mtk_soc_eth 1b100000.ethernet: generated random MAC address ea:a5:a5:1b:6b:17
[    5.503975] mtk_soc_eth 1b100000.ethernet eth0: mediatek frame engine at 0xe14c0000, irq 228
[    5.513654] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    5.518939] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 1
[    5.529769] xhci-mtk 1a1c0000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000210010
[    5.539002] xhci-mtk 1a1c0000.usb: irq 225, io mem 0x1a1c0000
[    5.545903] hub 1-0:1.0: USB hub found
[    5.549720] hub 1-0:1.0: 1 port detected
[    5.554154] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    5.559404] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 2
[    5.566845] xhci-mtk 1a1c0000.usb: Host supports USB 3.0 SuperSpeed
[    5.573236] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    5.582103] hub 2-0:1.0: USB hub found
[    5.585941] hub 2-0:1.0: 1 port detected
[    5.590997] xhci-mtk 1a240000.usb: xHCI Host Controller
[    5.596292] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 3
[    5.607094] xhci-mtk 1a240000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000210010
[    5.616270] xhci-mtk 1a240000.usb: irq 226, io mem 0x1a240000
[    5.623141] hub 3-0:1.0: USB hub found
[    5.626988] hub 3-0:1.0: 1 port detected
[    5.631380] xhci-mtk 1a240000.usb: xHCI Host Controller
[    5.636662] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 4
[    5.644096] xhci-mtk 1a240000.usb: Host supports USB 3.0 SuperSpeed
[    5.650472] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    5.659357] hub 4-0:1.0: USB hub found
[    5.663322] hub 4-0:1.0: 1 port detected
[    5.667970] usbcore: registered new interface driver usb-storage
[    5.674466] mousedev: PS/2 mouse device common for all mice
[    5.681492] mt6397-rtc mt6323-rtc: registered as rtc0
[    5.688688] MTK_WDT_NONRST_REG(0)
[    5.692700] mtk-wdt 10007000.watchdog: Watchdog enabled (timeout=31 sec, nowayout=0)
[    5.701556] device-mapper: ioctl: 4.41.0-ioctl (2019-09-16) initialised: [email protected]
[    5.710473] device-mapper: multipath round-robin: version 1.2.0 loaded
[    5.717049] device-mapper: multipath queue-length: version 0.2.0 loaded
[    5.723686] device-mapper: multipath service-time: version 0.3.0 loaded
[    5.730503] device-mapper: raid: Loading target version 1.14.0
[    5.736892] cpu cpu0: dummy supplies not allowed for exclusive requests
[    5.745863] mtk-msdc 11240000.mmc: GPIO lookup for consumer cd
[    5.751716] mtk-msdc 11240000.mmc: using device tree for GPIO lookup
[    5.758144] of_get_named_gpiod_flags: parsed 'cd-gpios' property of node '/mmc@11240000[0]' - status (0)
[    5.767681] gpio gpiochip0: Persistence not supported for GPIO 261
[    5.773905] mtk-msdc 11240000.mmc: Got CD GPIO
[    5.778355] mtk-msdc 11240000.mmc: GPIO lookup for consumer wp
[    5.784207] mtk-msdc 11240000.mmc: using device tree for GPIO lookup
[    5.790576] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/mmc@11240000[0]'
[    5.799392] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/mmc@11240000[0]'
[    5.808115] mtk-msdc 11240000.mmc: using lookup tables for GPIO lookup
[    5.814660] mtk-msdc 11240000.mmc: No GPIO consumer wp found
[    5.846785] mtk-msdc 11230000.mmc: GPIO lookup for consumer wp
[    5.852639] mtk-msdc 11230000.mmc: using device tree for GPIO lookup
[    5.859061] of_get_named_gpiod_flags: can't parse 'wp-gpios' property of node '/mmc@11230000[0]'
[    5.867895] of_get_named_gpiod_flags: can't parse 'wp-gpio' property of node '/mmc@11230000[0]'
[    5.876625] mtk-msdc 11230000.mmc: using lookup tables for GPIO lookup
[    5.883173] mtk-msdc 11230000.mmc: No GPIO consumer wp found
[    5.914472] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/blue[0]' - status (0)
[    5.923543] gpio gpiochip0: Persistence not supported for GPIO 240
[    5.929729] no flags found for gpios
[    5.933498] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/green[0]' - status (0)
[    5.942575] gpio gpiochip0: Persistence not supported for GPIO 241
[    5.948783] no flags found for gpios
[    5.952490] of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/red[0]' - status (0)
[    5.961422] gpio gpiochip0: Persistence not supported for GPIO 239
[    5.967623] no flags found for gpios
[    5.979434] mmc0: host does not support reading read-only switch, assuming write-enable
[    5.983722] hidraw: raw HID events driver (C) Jiri Kosina
[    5.989840] mmc0: new high speed SDXC card at address 0001
[    5.993015] usbcore: registered new interface driver usbhid
[    5.999675] mmcblk0: mmc0:0001 EC2QT 59.6 GiB 
[    6.003991] usbhid: USB HID core driver
[    6.005374] mtk-iommu-v1 10205000.mmsys_iommu: bound 14010000.larb (ops mtk_smi_larb_component_ops)
[    6.011596]  mmcblk0: p1 p2
[    6.012303] mtk-iommu-v1 10205000.mmsys_iommu: bound 16010000.larb (ops mtk_smi_larb_component_ops)
[    6.033266] mtk-iommu-v1 10205000.mmsys_iommu: bound 15001000.larb (ops mtk_smi_larb_component_ops)
[    6.043576] drop_monitor: Initializing network drop monitor service
[    6.050787] NET: Registered protocol family 10
[    6.056382] Segment Routing with IPv6
[    6.060139] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    6.065723] mmc1: new high speed MMC card at address 0001
[    6.066814] NET: Registered protocol family 17
[    6.072748] mmcblk1: mmc1:0001 8WPD3R 7.28 GiB 
[    6.076058] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    6.081315] mmcblk1boot0: mmc1:0001 8WPD3R partition 1 4.00 MiB
[    6.100248] mmcblk1boot1: mmc1:0001 8WPD3R partition 2 4.00 MiB
[    6.103708] NET: Registered protocol family 41
[    6.106495] mmcblk1rpmb: mmc1:0001 8WPD3R partition 3 512 KiB, chardev (247:0)
[    6.110799] 8021q: 802.1Q VLAN Support v1.8
[    6.122628] ThumbEE CPU extension supported.
[    6.126985] Registering SWP/SWPB emulation handler
[    6.132047] Loading compiled-in X.509 certificates
[    6.158408] mtk-pcie 1a140000.pcie: host bridge /pcie@1a140000 ranges:
[    6.165048] mtk-pcie 1a140000.pcie:    IO 0x1a160000..0x1a16ffff -> 0x1a160000
[    6.172296] mtk-pcie 1a140000.pcie:   MEM 0x60000000..0x6fffffff -> 0x60000000
[    6.224921] mtk-pcie 1a140000.pcie: PCI host bridge to bus 0000:00
[    6.231125] pci_bus 0000:00: root bus resource [bus 00-ff]
[    6.236662] pci_bus 0000:00: root bus resource [io  0x0000-0xffff] (bus address [0x1a160000-0x1a16ffff])
[    6.246170] pci_bus 0000:00: root bus resource [mem 0x60000000-0x6fffffff]
[    6.253094] pci 0000:00:00.0: [14c3:0801] type 01 class 0x060400
[    6.259134] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    6.265496] pci 0000:00:00.0: supports D1
[    6.269509] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    6.275740] pci 0000:00:01.0: [14c3:0801] type 01 class 0x060400
[    6.281786] pci 0000:00:01.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    6.288174] pci 0000:00:01.0: supports D1
[    6.292190] pci 0000:00:01.0: PME# supported from D0 D1 D3hot
[    6.300902] PCI: bus0: Fast back to back transfers disabled
[    6.306529] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    6.314566] pci 0000:00:01.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    6.322772] pci 0000:01:00.0: [14c3:7612] type 00 class 0x028000
[    6.328860] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[    6.335717] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    6.342545] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    6.375878] PCI: bus1: Fast back to back transfers disabled
[    6.381474] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    6.388339] pci 0000:02:00.0: [1b21:0611] type 00 class 0x010185
[    6.394414] pci 0000:02:00.0: reg 0x10: initial BAR value 0x00000000 invalid
[    6.401469] pci 0000:02:00.0: reg 0x10: [io  size 0x0008]
[    6.406898] pci 0000:02:00.0: reg 0x14: initial BAR value 0x00000000 invalid
[    6.413965] pci 0000:02:00.0: reg 0x14: [io  size 0x0004]
[    6.419374] pci 0000:02:00.0: reg 0x18: initial BAR value 0x00000000 invalid
[    6.426441] pci 0000:02:00.0: reg 0x18: [io  size 0x0008]
[    6.431850] pci 0000:02:00.0: reg 0x1c: initial BAR value 0x00000000 invalid
[    6.438917] pci 0000:02:00.0: reg 0x1c: [io  size 0x0004]
[    6.444339] pci 0000:02:00.0: reg 0x20: initial BAR value 0x00000000 invalid
[    6.451391] pci 0000:02:00.0: reg 0x20: [io  size 0x0010]
[    6.456814] pci 0000:02:00.0: reg 0x24: [mem 0x00000000-0x000001ff]
[    6.463105] pci 0000:02:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    6.495850] PCI: bus2: Fast back to back transfers disabled
[    6.501444] pci_bus 0000:02: busn_res: [bus 02-ff] end is updated to 02
[    6.508138] pci 0000:00:00.0: BAR 8: assigned [mem 0x60000000-0x600fffff]
[    6.514957] pci 0000:00:00.0: BAR 9: assigned [mem 0x60100000-0x601fffff pref]
[    6.522188] pci 0000:00:01.0: BAR 8: assigned [mem 0x60200000-0x602fffff]
[    6.528996] pci 0000:00:01.0: BAR 9: assigned [mem 0x60300000-0x603fffff pref]
[    6.536241] pci 0000:00:00.0: BAR 1: assigned [mem 0x60400000-0x6040ffff]
[    6.543051] pci 0000:00:01.0: BAR 1: assigned [mem 0x60410000-0x6041ffff]
[    6.549847] pci 0000:00:01.0: BAR 7: assigned [io  0x1000-0x1fff]
[    6.555967] pci 0000:01:00.0: BAR 0: assigned [mem 0x60000000-0x600fffff 64bit]
[    6.563314] pci 0000:01:00.0: BAR 6: assigned [mem 0x60100000-0x6010ffff pref]
[    6.570545] pci 0000:00:00.0: PCI bridge to [bus 01]
[    6.575530] pci 0000:00:00.0:   bridge window [mem 0x60000000-0x600fffff]
[    6.582324] pci 0000:00:00.0:   bridge window [mem 0x60100000-0x601fffff pref]
[    6.589575] pci 0000:02:00.0: BAR 6: assigned [mem 0x60300000-0x6030ffff pref]
[    6.596820] pci 0000:02:00.0: BAR 5: assigned [mem 0x60200000-0x602001ff]
[    6.603632] pci 0000:02:00.0: BAR 4: assigned [io  0x1000-0x100f]
[    6.609734] pci 0000:02:00.0: BAR 0: assigned [io  0x1010-0x1017]
[    6.615850] pci 0000:02:00.0: BAR 2: assigned [io  0x1018-0x101f]
[    6.621951] pci 0000:02:00.0: BAR 1: assigned [io  0x1020-0x1023]
[    6.628066] pci 0000:02:00.0: BAR 3: assigned [io  0x1024-0x1027]
[    6.634181] pci 0000:00:01.0: PCI bridge to [bus 02]
[    6.639150] pci 0000:00:01.0:   bridge window [io  0x1000-0x1fff]
[    6.645261] pci 0000:00:01.0:   bridge window [mem 0x60200000-0x602fffff]
[    6.652055] pci 0000:00:01.0:   bridge window [mem 0x60300000-0x603fffff pref]
[    6.659525] pcieport 0000:00:00.0: enabling device (0140 -> 0142)
[    6.665884] pcieport 0000:00:00.0: PME: Signaling with IRQ 239
[    6.672122] pcieport 0000:00:00.0: AER: enabled with IRQ 239
[    6.678192] pcieport 0000:00:01.0: enabling device (0140 -> 0143)
[    6.684536] pcieport 0000:00:01.0: PME: Signaling with IRQ 220
[    6.690725] pcieport 0000:00:01.0: AER: enabled with IRQ 220
[    6.696895] ahci 0000:02:00.0: version 3.0
[    6.701016] ahci 0000:02:00.0: enabling device (0140 -> 0143)
[    6.706928] ahci 0000:02:00.0: SSS flag set, parallel bus scan disabled
[    6.713625] ahci 0000:02:00.0: AHCI 0001.0200 32 slots 2 ports 6 Gbps 0x3 impl IDE mode
[    6.721642] ahci 0000:02:00.0: flags: 64bit ncq sntf stag led clo pmp pio slum part ccc sxs 
[    6.731750] scsi host0: ahci
[    6.735420] scsi host1: ahci
[    6.738613] ata1: SATA max UDMA/133 abar m512@0x60200000 port 0x60200100 irq 220
[    6.746077] ata2: SATA max UDMA/133 abar m512@0x60200000 port 0x60200180 irq 220
[    6.753949] mediatek-dpi 14014000.dpi: Found bridge node: /hdmi@14015000
[    6.760970] mediatek-drm 14000000.dispsys: bound 14007000.ovl (ops mtk_disp_ovl_component_ops)
[    6.769658] mediatek-drm 14000000.dispsys: bound 14008000.rdma (ops mtk_disp_rdma_component_ops)
[    6.778479] mediatek-drm 14000000.dispsys: bound 1400b000.color (ops mtk_disp_color_component_ops)
[    6.787465] mediatek-drm 14000000.dispsys: bound 14012000.rdma (ops mtk_disp_rdma_component_ops)
[    6.796309] [drm:drm_connector_init] cmdline mode for connector HDMI-A-1  1920x1080@60Hz
[    6.804437] mediatek-drm 14000000.dispsys: bound 14014000.dpi (ops mtk_dpi_component_ops)
[    6.812701] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    6.819341] [drm] No driver support for vblank timestamp query.
[    6.825302] [drm:drm_minor_register] 
[    6.828968] [drm:drm_minor_register] 
[    6.832955] [drm:drm_minor_register] new minor registered 0
[    6.838724] [drm:drm_sysfs_connector_add] adding "HDMI-A-1" to sysfs
[    6.845109] [drm:drm_sysfs_hotplug_event] generating hotplug event
[    6.851340] [drm] Initialized mediatek 1.0.0 20150513 for 14000000.dispsys on minor 0
[    6.859213] [drm:drm_client_modeset_probe] 
[    6.863420] [drm:drm_mode_object_get] OBJ ID: 32 (2)
[    6.868396] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:32:HDMI-A-1]
[    6.875905] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:32:HDMI-A-1] status updated from unknown to disconnected
[    6.887235] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:32:HDMI-A-1] disconnected
[    6.895872] [drm:drm_client_modeset_probe] No connectors reported connected with modes
[    6.903808] [drm:drm_client_modeset_probe] connector 32 enabled? no
[    6.910083] [drm:drm_client_modeset_probe] Not using firmware configuration
[    6.917065] [drm:drm_client_modeset_probe] picking CRTCs for 4096x4096 config
[    6.924220] [drm:drm_mode_object_put.part.1] OBJ ID: 32 (2)
[    6.929800] [drm:__drm_fb_helper_initial_config_and_unlock] test CRTC 0 primary plane
[    6.937649] [drm:__drm_fb_helper_initial_config_and_unlock] test CRTC 1 primary plane
[    6.945491] [drm] Cannot find any crtc or sizes
[    6.950379] mt7530 mdio-bus:00: GPIO lookup for consumer reset
[    6.956250] mt7530 mdio-bus:00: using device tree for GPIO lookup
[    6.962380] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/ethernet@1b100000/mdio-bus/switch@0[0]' - status (0)
[    6.974179] gpio gpiochip0: Persistence not supported for GPIO 33
[    6.980361] [drm:drm_sysfs_hotplug_event] generating hotplug event
[    6.986633] [drm:drm_client_modeset_probe] 
[    6.990830] [drm:drm_mode_object_get] OBJ ID: 32 (2)
[    6.995829] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:32:HDMI-A-1]
[    7.003341] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:32:HDMI-A-1] disconnected
[    7.011969] [drm:drm_client_modeset_probe] No connectors reported connected with modes
[    7.019917] [drm:drm_client_modeset_probe] connector 32 enabled? no
[    7.026208] [drm:drm_client_modeset_probe] Not using firmware configuration
[    7.033189] [drm:drm_client_modeset_probe] picking CRTCs for 4096x4096 config
[    7.040333] [drm:drm_mode_object_put.part.1] OBJ ID: 32 (2)
[    7.045925] [drm:__drm_fb_helper_initial_config_and_unlock] test CRTC 0 primary plane
[    7.053777] [drm:__drm_fb_helper_initial_config_and_unlock] test CRTC 1 primary plane
[    7.061610] [drm] Cannot find any crtc or sizes
[    7.066161] mediatek-drm 14000000.dispsys: [drm:drm_client_dev_hotplug] fbdev: ret=0
[    7.080839] mdio_bus dsa-0.0: GPIO lookup for consumer reset
[    7.084569] ata1: SATA link down (SStatus 0 SControl 300)
[    7.086541] mdio_bus dsa-0.0: using lookup tables for GPIO lookup
[    7.098022] mdio_bus dsa-0.0: No GPIO consumer reset found
[    7.103930] mdio_bus dsa-0.0:00: GPIO lookup for consumer reset
[    7.109863] mdio_bus dsa-0.0:00: using lookup tables for GPIO lookup
[    7.116251] mdio_bus dsa-0.0:00: No GPIO consumer reset found
[    7.122479] mdio_bus dsa-0.0:01: GPIO lookup for consumer reset
[    7.128438] mdio_bus dsa-0.0:01: using lookup tables for GPIO lookup
[    7.134818] mdio_bus dsa-0.0:01: No GPIO consumer reset found
[    7.141023] mdio_bus dsa-0.0:02: GPIO lookup for consumer reset
[    7.146986] mdio_bus dsa-0.0:02: using lookup tables for GPIO lookup
[    7.153362] mdio_bus dsa-0.0:02: No GPIO consumer reset found
[    7.159562] mdio_bus dsa-0.0:03: GPIO lookup for consumer reset
[    7.165525] mdio_bus dsa-0.0:03: using lookup tables for GPIO lookup
[    7.171886] mdio_bus dsa-0.0:03: No GPIO consumer reset found
[    7.178077] mdio_bus dsa-0.0:04: GPIO lookup for consumer reset
[    7.184036] mdio_bus dsa-0.0:04: using lookup tables for GPIO lookup
[    7.190395] mdio_bus dsa-0.0:04: No GPIO consumer reset found
[    7.196251] libphy: dsa slave smi: probed
[    7.200603] mt7530 mdio-bus:00 wan (uninitialized): PHY [dsa-0.0:00] driver [Generic PHY]
[    7.209857] mt7530 mdio-bus:00 lan0 (uninitialized): PHY [dsa-0.0:01] driver [Generic PHY]
[    7.219144] mt7530 mdio-bus:00 lan1 (uninitialized): PHY [dsa-0.0:02] driver [Generic PHY]
[    7.228478] mt7530 mdio-bus:00 lan2 (uninitialized): PHY [dsa-0.0:03] driver [Generic PHY]
[    7.237748] mt7530 mdio-bus:00 lan3 (uninitialized): PHY [dsa-0.0:04] driver [Generic PHY]
[    7.247041] of_get_named_gpiod_flags: can't parse 'link-gpios' property of node '/ethernet@1b100000/mdio-bus/switch@0/ports/port@6/fixed-link[0]'
[    7.260146] mt7530 mdio-bus:00: configuring for fixed/rgmii link mode
[    7.271805] mt7530 mdio-bus:00: Link is Up - 1Gbps/Full - flow control off
[    7.279576] DSA: tree 0 setup
[    7.283175] mt6397-rtc mt6323-rtc: setting system clock to 2010-01-01T00:00:14 UTC (1262304014)
[    7.292136] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    7.302945] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    7.309978] ALSA device list:
[    7.312955]   No soundcards found.
[    7.316946] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    7.325601] cfg80211: failed to load regulatory.db
[    7.426749] ata2: SATA link down (SStatus 0 SControl 300)
[    7.432310] md: Waiting for all devices to be available before autodetect
[    7.439156] md: If you don't use raid, use raid=noautodetect
[    7.445622] md: Autodetecting RAID arrays.
[    7.449731] md: autorun ...
[    7.452524] md: ... autorun DONE.
[    7.464248] EXT4-fs (mmcblk0p2): mounted filesystem without journal. Opts: (null)
[    7.471824] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    7.480008] devtmpfs: mounted
[    7.486209] Freeing unused kernel memory: 1024K
[    7.533344] Run /sbin/init as init process
[    7.553709] Run /etc/init as init process
[    7.565668] Run /bin/init as init process
[    7.571141] Run /bin/sh as init process
[    7.583469] Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[    7.597670] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.4.2-bpi-r2-main #1
[    7.604545] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    7.610116] Backtrace: 
[    7.612579] [<c010f198>] (dump_backtrace) from [<c010f538>] (show_stack+0x20/0x24)
[    7.620154]  r7:00000000 r6:60000093 r5:00000000 r4:c13c06c4
[    7.625820] [<c010f518>] (show_stack) from [<c0c63114>] (dump_stack+0xc8/0xdc)
[    7.633050] [<c0c6304c>] (dump_stack) from [<c0127db8>] (panic+0x120/0x338)
[    7.640015]  r7:00000000 r6:c0fa3938 r5:00000000 r4:c1409680
[    7.645680] [<c0127c98>] (panic) from [<c0c7b684>] (kernel_init+0x11c/0x124)
[    7.652731]  r3:00000000 r2:2ba7268b r1:00000055 r0:c0fa3938
[    7.658389]  r7:00000000
[    7.660927] [<c0c7b568>] (kernel_init) from [<c01010e8>] (ret_from_fork+0x14/0x2c)
[    7.668500] Exception stack(0xde8fdfb0 to 0xde8fdff8)
[    7.673553] dfa0:                                     00000000 00000000 00000000 00000000
[    7.681736] dfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    7.689918] dfe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    7.696532]  r5:c0c7b568 r4:00000000
[    7.700118] CPU0: stopping
[    7.702833] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.2-bpi-r2-main #1
[    7.709707] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    7.715277] Backtrace: 
[    7.717729] [<c010f198>] (dump_backtrace) from [<c010f538>] (show_stack+0x20/0x24)
[    7.725303]  r7:00000000 r6:60000193 r5:00000000 r4:c13c06c4
[    7.730966] [<c010f518>] (show_stack) from [<c0c63114>] (dump_stack+0xc8/0xdc)
[    7.738196] [<c0c6304c>] (dump_stack) from [<c0112aa4>] (handle_IPI+0x390/0x3c8)
[    7.745596]  r7:00000000 r6:00000000 r5:00000004 r4:c1409500
[    7.751260] [<c0112714>] (handle_IPI) from [<c0102328>] (gic_handle_irq+0x9c/0xa0)
[    7.758837]  r10:c0fadbd4 r9:e1003000 r8:c1301ec8 r7:e1002000 r6:e100200c r5:c13736b8
[    7.766667]  r4:c13056f0
[    7.769203] [<c010228c>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0x90)
[    7.776687] Exception stack(0xc1301ec8 to 0xc1301f10)
[    7.781741] 1ec0:                   00000000 00002a6c df59a074 c01207a0 ffffe000 c1304e68
[    7.789925] 1ee0: c1304eb0 00000001 00000001 c13c8a6f c0fadbd4 c1301f24 c1301f28 c1301f18
[    7.798106] 1f00: c010aa00 c010aa04 60000013 ffffffff
[    7.803161]  r9:c1300000 r8:00000001 r7:c1301efc r6:ffffffff r5:60000013 r4:c010aa04
[    7.810914] [<c010a9bc>] (arch_cpu_idle) from [<c0c81f38>] (default_idle_call+0x38/0x3c)
[    7.819013] [<c0c81f00>] (default_idle_call) from [<c015dbac>] (do_idle+0x120/0x160)
[    7.826765] [<c015da8c>] (do_idle) from [<c015dec4>] (cpu_startup_entry+0x28/0x2c)
[    7.834341]  r10:c127de40 r9:00000001 r8:00000000 r7:c127de40 r6:c1408ec0 r5:c1408f08
[    7.842173]  r4:000000cd r3:c12bb29c
[    7.845753] [<c015de9c>] (cpu_startup_entry) from [<c0c7b560>] (rest_init+0xb4/0xbc)
[    7.853506] [<c0c7b4ac>] (rest_init) from [<c1200b9c>] (arch_call_rest_init+0x18/0x1c)
[    7.861426]  r5:c1408f08 r4:c1304e48
[    7.865004] [<c1200b84>] (arch_call_rest_init) from [<c12010d0>] (start_kernel+0x4b8/0x4e8)
[    7.873362] [<c1200c18>] (start_kernel) from [<00000000>] (0x0)
[    7.879282] CPU2: stopping
[    7.881995] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 5.4.2-bpi-r2-main #1
[    7.888868] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    7.894438] Backtrace: 
[    7.896890] [<c010f198>] (dump_backtrace) from [<c010f538>] (show_stack+0x20/0x24)
[    7.904465]  r7:00000002 r6:60000193 r5:00000000 r4:c13c06c4
[    7.910128] [<c010f518>] (show_stack) from [<c0c63114>] (dump_stack+0xc8/0xdc)
[    7.917358] [<c0c6304c>] (dump_stack) from [<c0112aa4>] (handle_IPI+0x390/0x3c8)
[    7.924758]  r7:00000002 r6:00000000 r5:00000004 r4:c1409500
[    7.930422] [<c0112714>] (handle_IPI) from [<c0102328>] (gic_handle_irq+0x9c/0xa0)
[    7.937998]  r10:c0fadbd4 r9:e1003000 r8:de935f30 r7:e1002000 r6:e100200c r5:c13736b8
[    7.945828]  r4:c13056f0
[    7.948364] [<c010228c>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0x90)
[    7.955848] Exception stack(0xde935f30 to 0xde935f78)
[    7.960901] 5f20:                                     00000000 000037f8 df5c2074 c01207a0
[    7.969085] 5f40: ffffe000 c1304e68 c1304eb0 00000004 00000001 c13c8a6f c0fadbd4 de935f8c
[    7.977267] 5f60: de935f90 de935f80 c010aa00 c010aa04 60000013 ffffffff
[    7.983885]  r9:de934000 r8:00000001 r7:de935f64 r6:ffffffff r5:60000013 r4:c010aa04
[    7.991636] [<c010a9bc>] (arch_cpu_idle) from [<c0c81f38>] (default_idle_call+0x38/0x3c)
[    7.999734] [<c0c81f00>] (default_idle_call) from [<c015dbac>] (do_idle+0x120/0x160)
[    8.007487] [<c015da8c>] (do_idle) from [<c015dec4>] (cpu_startup_entry+0x28/0x2c)
[    8.015063]  r10:00000000 r9:410fc073 r8:8000406a r7:c1409510 r6:10c0387d r5:00000002
[    8.022894]  r4:00000089 r3:00000001
[    8.026474] [<c015de9c>] (cpu_startup_entry) from [<c0111f58>] (secondary_start_kernel+0x16c/0x190)
[    8.035526] [<c0111dec>] (secondary_start_kernel) from [<801027ac>] (0x801027ac)
[    8.042926]  r5:00000051 r4:9e92806a
[    8.046500] CPU1: stopping
[    8.049212] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 5.4.2-bpi-r2-main #1
[    8.056086] Hardware name: Mediatek Cortex-A7 (Device Tree)
[    8.061656] Backtrace: 
[    8.064107] [<c010f198>] (dump_backtrace) from [<c010f538>] (show_stack+0x20/0x24)
[    8.071682]  r7:00000001 r6:60000193 r5:00000000 r4:c13c06c4
[    8.077345] [<c010f518>] (show_stack) from [<c0c63114>] (dump_stack+0xc8/0xdc)
[    8.084574] [<c0c6304c>] (dump_stack) from [<c0112aa4>] (handle_IPI+0x390/0x3c8)
[    8.091976]  r7:00000001 r6:00000000 r5:00000004 r4:c1409500
[    8.097639] [<c0112714>] (handle_IPI) from [<c0102328>] (gic_handle_irq+0x9c/0xa0)
[    8.105215]  r10:c0fadbd4 r9:e1003000 r8:de933f30 r7:e1002000 r6:e100200c r5:c13736b8
[    8.113046]  r4:c13056f0
[    8.115581] [<c010228c>] (gic_handle_irq) from [<c0101a8c>] (__irq_svc+0x6c/0x90)
[    8.123065] Exception stack(0xde933f30 to 0xde933f78)
[    8.128118] 3f20:                                     00000000 00002c1c df5ae074 c01207a0
[    8.136302] 3f40: ffffe000 c1304e68 c1304eb0 00000002 00000001 c13c8a6f c0fadbd4 de933f8c
[    8.144485] 3f60: de933f90 de933f80 c010aa00 c010aa04 60000013 ffffffff
[    8.151103]  r9:de932000 r8:00000001 r7:de933f64 r6:ffffffff r5:60000013 r4:c010aa04
[    8.158854] [<c010a9bc>] (arch_cpu_idle) from [<c0c81f38>] (default_idle_call+0x38/0x3c)
[    8.166953] [<c0c81f00>] (default_idle_call) from [<c015dbac>] (do_idle+0x120/0x160)
[    8.174705] [<c015da8c>] (do_idle) from [<c015dec4>] (cpu_startup_entry+0x28/0x2c)
[    8.182282]  r10:00000000 r9:410fc073 r8:8000406a r7:c1409510 r6:10c0387d r5:00000001
[    8.190114]  r4:00000089 r3:00000001
[    8.193694] [<c015de9c>] (cpu_startup_entry) from [<c0111f58>] (secondary_start_kernel+0x16c/0x190)
[    8.202745] [<c0111dec>] (secondary_start_kernel) from [<801027ac>] (0x801027ac)
[    8.210143]  r5:00000051 r4:9e92806a
[    8.213727] ---[ end Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---

You have kernel panic because you have not set root in bootargs or device is not ready…

For uboot i tested all versions till 2020-01 on my buster-sd but have not changed preloader on my sdcard…it is same as in image.

I just run

BPI-R2> printenv

and i see the this line for the bootargs which I think is points to the SD card for the root partition

bootargs=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait ip=dhcp

Do I need to set the bootargs elsewhere ?

mmcblk0p2

is mounted but no init found…if you use my 5.4-main, mmcblk0 should be sd-card because of swapped mmc (mainline has emmc=0,sd=1)

https://github.com/frank-w/BPI-R2-4.14/commit/7648f8dc4721a0d2227938f8d2304c067d534969

you have valid rootfs on your sd-card (second partition)?

I checked now from U-boot console and it seems the filesystem on the second partition is not recognized

BPI-R2> ls mmc 1:2

Unrecognized filesystem type

I ran these 2 commands when I copied the kernel archive into the rootfs but I guess something went wrong

sudo tar -xzf bpi-r2_5.4.2-main.tar.gz -C /mnt/rootfs/boot --strip-components=1 BPI-BOOT
sudo tar -xzf bpi-r2_5.4.2-main.tar.gz -C /mnt/rootfs --strip-components=1 BPI-ROOT

Partitions output: Disk bpi-r2-buster-cioby.img: 10 GiB, 10737418240 bytes, 20971520 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x3ca77cb6

Device                   Boot  Start      End  Sectors  Size Id Type
bpi-r2-buster-cioby.img1      204800   729087   524288  256M  c W95 FAT32 (LBA)
bpi-r2-buster-cioby.img2      729088 20971519 20242432  9.7G 83 Linux

in Uboot mmc is not swapped (as in old bpi uboot). So still 0=emmc and 1=sd.

you can use mmcinfo command after “mmc dev x”

Yes EMMC is partition 0 and SD is partition 1

BPI-R2> mmc list
mmc@11230000: 0
mmc@11240000: 1 (SD)
BPI-R2> mmc dev
switch to partitions #0, OK
mmc0(part 0) is current device
BPI-R2> mmc dev 1
switch to partitions #0, OK
mmc1 is current device
BPI-R2> mmc dev  
switch to partitions #0, OK
mmc1 is current device
BPI-R2> mmcinfo
Device: mmc@11240000
Manufacturer ID: 1b
OEM: 534d
Name: EC2QT 
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 59.6 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes

imho you can do this in uboot (if ext4-support is compiled in,maybe without file, but then the list is long :wink: )

ls mmc 1:2 /sbin/init
ls mmc 1:2 /bin/sh

both files existing on my stretch device (i’m out-of-home so i cannot look on my buster-sd), you can also try listing content of partition without the path…just to check if rootfs is there.

with uboot 2019-10 i have sata-support included which may grow uboot over the size loaded by older preloader…maybe this bug is again in october preloader…just try the july preloader with newer uboot

I followed the short install guide from your wiki page http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage#sd-card step by step but I was not able to make it work.

The only difference I do besides your install guide is manual creation of partitions. I used parted or cfdisk to manually create the partitions.

I see you are importing a partition table using sfdisk from a file.

sudo sfdisk ${loopdev} < ~/Downloads/parttable.dat

I still receive that kernel crash with init not found and the “Unrecognized filesystem type” message when I ran these 2 commands in u-boot console.

 ls mmc 1:2 /sbin/init
 ls mmc 1:2 /bin/sh

For filesystem type I used vfat (FAT32) for BOOT and ext4 for ROOT. When I mount the SD card to an external Linux PC I see both partitions and the files on them.

where does first partition start? Can you see the initfiles on host pc? Try adding ext4 suport on uboot and look for files there

I have compiled a new u-boot with ext4 support and after that I do not see the “Unrecognized filesystem type” message anymore.

Now I can see in the u-boot console the content of /sbin and /bin folders from the second partition but the kernel freeze still happens The /sbin/init and /bin/sh files appear to be symlinks to systemd and dash shell.

Which system do you have on rootfs? Is executable bit set for target binary? how have you created rootfs? Is it right arch?

I use ext4 on rootfs

BPI-R2> fstype mmc 1:2
ext4

One strange thing is that when I type printenv I see these 2 lines in the output

partition=1:1
root=/dev/mmcblk0p2 rootfstype=ext4 rootwait

Isn’t partition 1:1 mmc and 1:2 sdcard ? Also the root points correctly to partition 2 which is the sdcard.

Sorry I did not understand the question Is executable bit set for target binary? What do I need to check here ?