Ramdisk image is corrupt or invaild, Ramdisk image is corrupt or invaild

Hi,

I’ve been trying to build, for VIM3, Ubuntu Server with Linux mainline by following the steps listed in Build Ubuntu/Debian Image

I am able to build debs and image successful, but not able to boot the new build with the following error message:

Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid

How can I diagnose this problem ?

~Sting

Please provide your build configurations: make info

sting@52-000D300-10:~/khadas/vim3/project/fenix$ make info

Version: 1.0.5
Current environment:

#KHADAS_BOARD=VIM3
#VENDOR=Amlogic
#CHIP=A311D
#LINUX=mainline
#UBOOT=mainline
#DISTRIBUTION=Ubuntu
#DISTRIB_RELEASE=focal
#DISTRIB_TYPE=server
#DISTRIB_ARCH=arm64
#INSTALL_TYPE=SD-USB

===========================================

What’s your build host? And please provide all the boot logs.

My build host machine is: x86_64 GNU/Linux

Distributor ID:Ubuntu
Description:Ubuntu 20.04.2 LTS
Release:20.04
Codename:focal

sting@52-0A00566-10:/mnt/sting@D3-BUILD-Z10PE-D16-WS/khadas/vim3/images$ minicom

Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Dec 23 2019, 02:06:26.
Port /dev/ttyUSB0, 14:35:48

Press CTRL-A Z for help on special keys

BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
G12B:BL:6e7c85:2a3b91;FEAT:E0F83180:402000;POC:F;RCY:0;EMMC:0;READ:0;0.
bl2_stage_init 0x01
bl2_stage_init 0x81
hw id: 0x0000 - pwm id 0x01
bl2_stage_init 0xc1
bl2_stage_init 0x02

L0:00000000
L1:20000703
L2:00008067
L3:14000000
B2:00402000
B1:e0f83180

TE: 174370

BL2 Built : 15:22:05, Aug 28 2019. g12b g1bf2b53 - luan.yuan@droid15-sz

Board ID = 8
Set A53 clk to 24M
Set A73 clk to 24M
Set clk81 to 24M
A53 clk: 1200 MHz
A73 clk: 1200 MHz
CLK81: 166.6M
smccc: 0002f100
eMMC boot @ 0
sw8 s
DDR driver_vesion: LPDDR4_PHY_V_0_1_18 build time: Aug 28 2019 15:22:01
board id: 8
Load FIP HDR from eMMC, src: 0x00010200, des: 0xfffd0000, size: 0x00004000, part: 0
fw parse done
Load ddrfw from eMMC, src: 0x00060200, des: 0xfffd0000, size: 0x0000c000, part: 0
Load ddrfw from eMMC, src: 0x00038200, des: 0xfffd0000, size: 0x00004000, part: 0
PIEI prepare done
fastboot data load
00000000
emmc switch 1 ok
ddr saved addr:00016000
Load ddr parameter from eMMC, src: 0x02c00000, des: 0xfffd0000, size: 0x00001000, part: 0
00000000
emmc switch 0 ok
fastboot data verify
verify result: 267
Cfg max: 4, cur: 1. Board id: 255. Force loop cfg
LPDDR4 probe
ddr clk to 1608MHz
Load ddrfw from eMMC, src: 0x0003c200, des: 0xfffd0000, size: 0x0000c000, part: 0

dmc_version 0001
Check phy result
INFO : End of CA training
INFO : End of initialization
INFO : Training has run successfully!
Check phy result
INFO : End of initialization
INFO : End of read enable training
INFO : End of fine write leveling
INFO : End of Write leveling coarse delay
INFO : Training has run successfully!
Check phy result
INFO : End of initialization
INFO : End of read dq deskew training
INFO : End of MPR read delay center optimization
INFO : End of write delay center optimization
INFO : End of read delay center optimization
INFO : End of max read latency training
INFO : Training has run successfully!
1D training succeed
Load ddrfw from eMMC, src: 0x00048200, des: 0xfffd0000, size: 0x0000c000, part: 0
Check phy result
INFO : End of initialization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D read delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : End of 2D write delay Voltage center optimization
INFO : Training has run successfully!

channel==0
RxClkDly_Margin_A0==77 ps 8
TxDqDly_Margin_A0==97 ps 10
RxClkDly_Margin_A1==77 ps 8
TxDqDly_Margin_A1==106 ps 11
TrainedVREFDQ_A0==26
TrainedVREFDQ_A1==27
VrefDac_Margin_A0==27
DeviceVref_Margin_A0==26
VrefDac_Margin_A1==27
DeviceVref_Margin_A1==27

channel==1
RxClkDly_Margin_A0==87 ps 9
TxDqDly_Margin_A0==106 ps 11
RxClkDly_Margin_A1==87 ps 9
TxDqDly_Margin_A1==106 ps 11
TrainedVREFDQ_A0==26
TrainedVREFDQ_A1==25
VrefDac_Margin_A0==26
DeviceVref_Margin_A0==25
VrefDac_Margin_A1==28
DeviceVref_Margin_A1==25

dwc_ddrphy_apb_wr((0<<20)|(2<<16)|(0<<12)|(0xb0):0004

soc_vref_reg_value 0x 00000026 00000026 00000027 00000026 00000026 00000026 00000024 00000026 00000025 00000028 00000028 00000024 00000026 0000003
2D training succeed
aml_ddr_fw_vesion: LPDDR4_PHY_V_0_1_18 build time: Aug 28 2019 13:54:19
auto size-- 65535DDR cs0 size: 2048MB
DDR cs1 size: 2048MB
DMC_DDR_CTRL: 00e00024DDR size: 3928MB
cs0 DataBus test pass
cs1 DataBus test pass
cs0 AddrBus test pass
cs1 AddrBus test pass

100bdlr_step_size ps== 398
result report
boot times 0Enable ddr reg access
00000000
emmc switch 3 ok
Authentication key not yet programmed
get rpmb counter error 0x00000007
00000000
emmc switch 0 ok
Load FIP HDR from eMMC, src: 0x00010200, des: 0x01700000, size: 0x00004000, part: 0
Load BL3X from eMMC, src: 0x00078200, des: 0x01768000, size: 0x000a8000, part: 0
0.0;M3 CHK:0;cm4_sp_mode 0
MVN_1=0x00000000
MVN_2=0x00000000
[Image: g12b_v1.1.3390-6ac5299 2019-09-26 14:10:05 luan.yuan@droid15-sz]
OPS=0x10
ring efuse init
chipver efuse init
29 0b 10 00 01 0b 20 00 00 05 37 30 4e 42 4e 50
[0.018959 Inits done]
secure task start!
high task start!
low task start!
run into bl31
NOTICE: BL31: v1.3(release):4fc40b1
NOTICE: BL31: Built : 15:58:17, May 22 2019
NOTICE: BL31: G12A normal boot!
NOTICE: BL31: BL33 decompress pass
ERROR: Error initializing runtime service opteed_fast

U-Boot 2021.01 (May 06 2021 - 11:05:21 +0800) khadas-vim3

Model: Khadas VIM3
SoC: Amlogic Meson G12B (A311D) Revision 29:b (10:2)
DRAM: 3.8 GiB
MMC: sd@ffe03000: 0, sd@ffe05000: 1, mmc@ffe07000: 2
Loading Environment from FAT… detect… booted from emmc…
OK
DISPLAY: setup failsave FullHD mode
In: serial
Out: serial
Err: serial
fusb302_init: Device ID: 0x91
CC connected in 1 as UFP
fusb302 detect chip.port_num = 0
Net: eth0: ethernet@ff3f0000
Failed to load ‘splash.bmp’
Failed to load ‘splash.bmp’
1080138 bytes read in 51 ms (20.2 MiB/s)
starting USB…
Bus usb@ff500000: Register 3000140 NbrPorts 3
Starting the controller
USB XHCI 1.10
scanning bus usb@ff500000 for devices… 2 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
Setting bus to 0
Hit SPACE in 1 seconds to stop autobootSF: Detected w25q128fw with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x160000, size 0x8000
SF: 32768 bytes @ 0x160000 Read: OK
** Script wrong header **

Device 0: unknown device
Card did not respond to voltage select! : -110
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1…
Found U-Boot script /boot.ini
10005 bytes read in 2 ms (4.8 MiB/s)

Script run a:08000000 l:9986 c:0

Starting boot.ini…
Setting bus to 0
saradc: 0x0, hw_ver: 0x32 (VIM3.V12)
uboot type: mainline
Scanning mmc 0:1…
Card did not respond to voltage select! : -110
Scanning mmc 0:5…
Card did not respond to voltage select! : -110
Scanning mmc 1:1…
11971430 bytes read in 512 ms (22.3 MiB/s)
36780544 bytes read in 1570 ms (22.3 MiB/s)
51762 bytes read in 4 ms (12.3 MiB/s)
Failed to load ‘/boot/env.txt’
4195 bytes read in 2 ms (2 MiB/s)
Import env.txt
Set default mac address to ethaddr: ce:6b:ba:4c:27:cf!
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Apply dtbo uart3
Failed to load ‘/dtb/overlays/kvim3/uart3.dtbo’
Apply dtbo pwm_f
Failed to load ‘/dtb/overlays/kvim3/pwm_f.dtbo’
Apply dtbo i2c3
Failed to load ‘/dtb/overlays/kvim3/i2c3.dtbo’
Apply dtbo i2s
Failed to load ‘/dtb/overlays/kvim3/i2s.dtbo’
Apply dtbo os08a10
Failed to load ‘/dtb/overlays/kvim3/os08a10.dtbo’
Apply dtbo watchdog
Failed to load ‘/dtb/overlays/kvim3/watchdog.dtbo’
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 1:5…
** Invalid partition 5 **
Scanning mmc 2:1…
** No partition table - mmc 2 **
Scanning mmc 2:5…
** No partition table - mmc 2 **
Scanning usb 0:1…
Scanning usb 1:1…
Scanning usb 2:1…
Scanning usb 3:1…
SCRIPT FAILED: continuing…
Found U-Boot script /boot.scr
10323 bytes read in 2 ms (4.9 MiB/s)

mkimage Script run a:08000000 l:10251

Starting S905 autoscript…
Setting bus to 0
saradc: 0x0, hw_ver: 0x32 (VIM3.V12)
uboot type: mainline
Scanning mmc 0:1…
Card did not respond to voltage select! : -110
Scanning mmc 0:5…
Card did not respond to voltage select! : -110
Scanning mmc 1:1…
11971430 bytes read in 512 ms (22.3 MiB/s)
36780544 bytes read in 1570 ms (22.3 MiB/s)
51762 bytes read in 4 ms (12.3 MiB/s)
Failed to load ‘/boot/env.txt’
4195 bytes read in 2 ms (2 MiB/s)
Import env.txt
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Apply dtbo uart3
Failed to load ‘/dtb/overlays/kvim3/uart3.dtbo’
Apply dtbo pwm_f
Failed to load ‘/dtb/overlays/kvim3/pwm_f.dtbo’
Apply dtbo i2c3
Failed to load ‘/dtb/overlays/kvim3/i2c3.dtbo’
Apply dtbo i2s
Failed to load ‘/dtb/overlays/kvim3/i2s.dtbo’
Apply dtbo os08a10
Failed to load ‘/dtb/overlays/kvim3/os08a10.dtbo’
Apply dtbo watchdog
Failed to load ‘/dtb/overlays/kvim3/watchdog.dtbo’
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 1:5…
** Invalid partition 5 **
Scanning mmc 2:1…
** No partition table - mmc 2 **
Scanning mmc 2:5…
** No partition table - mmc 2 **
Scanning usb 0:1…
Scanning usb 1:1…
Scanning usb 2:1…
Scanning usb 3:1…
SCRIPT FAILED: continuing…
51762 bytes read in 6 ms (8.2 MiB/s)
switch to partitions #0, OK
mmc2(part 0) is current device
Scanning mmc 2:1…
Found U-Boot script /boot.ini
8282 bytes read in 1 ms (7.9 MiB/s)

Script run a:08000000 l:8263 c:0

Starting boot.ini…
Setting bus to 0
saradc: 0x0, hw_ver: 0x32 (VIM3.V12)
uboot type: mainline
Scanning mmc 0:1…
Card did not respond to voltage select! : -110
Scanning mmc 0:5…
Card did not respond to voltage select! : -110
Scanning mmc 1:1…
11971430 bytes read in 512 ms (22.3 MiB/s)
36780544 bytes read in 1570 ms (22.3 MiB/s)
51762 bytes read in 4 ms (12.3 MiB/s)
Failed to load ‘/boot/env.txt’
4195 bytes read in 2 ms (2 MiB/s)
Import env.txt
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 1:5…
** Invalid partition 5 **
Scanning mmc 2:1…
8872704 bytes read in 371 ms (22.8 MiB/s)
39062016 bytes read in 1631 ms (22.8 MiB/s)
51497 bytes read in 3 ms (16.4 MiB/s)
Failed to load ‘/boot/env.txt’
2808 bytes read in 1 ms (2.7 MiB/s)
Import env.txt
Found custom ethmac: ce:6b:ba:4c:27:cf, overwrite eth_mac!
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Remove eMMC vendor partitions…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 2:5…
** Invalid partition 5 **
Scanning usb 0:1…
Scanning usb 1:1…
Scanning usb 2:1…
Scanning usb 3:1…
SCRIPT FAILED: continuing…
Found U-Boot script /boot.scr
8600 bytes read in 2 ms (4.1 MiB/s)

mkimage Script run a:08000000 l:8528

Starting S905 autoscript…
Setting bus to 0
saradc: 0x0, hw_ver: 0x32 (VIM3.V12)
uboot type: mainline
Scanning mmc 0:1…
Card did not respond to voltage select! : -110
Scanning mmc 0:5…
Card did not respond to voltage select! : -110
Scanning mmc 1:1…
11971430 bytes read in 512 ms (22.3 MiB/s)
36780544 bytes read in 1570 ms (22.3 MiB/s)
51762 bytes read in 4 ms (12.3 MiB/s)
Failed to load ‘/boot/env.txt’
4195 bytes read in 2 ms (2 MiB/s)
Import env.txt
Found custom ethmac: ce:6b:ba:4c:27:cf, overwrite eth_mac!
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 1:5…
** Invalid partition 5 **
Scanning mmc 2:1…
8872704 bytes read in 371 ms (22.8 MiB/s)
39062016 bytes read in 1631 ms (22.8 MiB/s)
51497 bytes read in 3 ms (16.4 MiB/s)
Failed to load ‘/boot/env.txt’
2808 bytes read in 1 ms (2.7 MiB/s)
Import env.txt
Found custom ethmac: ce:6b:ba:4c:27:cf, overwrite eth_mac!
Booting mainline kernel…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Setting bus to 0
port mode is usb3.0
Remove eMMC vendor partitions…
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
Wrong Ramdisk Image Format
Ramdisk image is corrupt or invalid
Scanning mmc 2:5…
** Invalid partition 5 **
Scanning usb 0:1…
Scanning usb 1:1…
Scanning usb 2:1…
Scanning usb 3:1…
SCRIPT FAILED: continuing…
51497 bytes read in 4 ms (12.3 MiB/s)
Speed: 1000, full duplex
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4

Your logs seems different from my side. Have you modify the source code yourself?

Have you ever change the boot mode to SPI?

And here is a prebuild image you can check:

http://build.khadas.com/khadas/fenix/images/VIM3_Ubuntu-server-focal_Linux-5.12_arm64_SD-USB_V1.0.5-210430.img.xz

  • I’m able to boot the image downloaded from build.khadas.com
  • I’m able to boot the mainline image build from CLEAN khadas fenix checkout
  • Have you ever change the boot mode to SPI? – > seems not

I’m trying extend current khadas fenix to build AOSP VIM3 kernel 5.10 with some specific patches from “packages/linux-mainline/patches/5.10-rc6”, the debs, images can be built successfully, but booting with Ramdisk format issues…

We haven’t tested kernel from AOSP and it is different from mainline kernel, maybe some patches or configurations are missing.

I’ve found that

  • the /boot/zImage in Linux mainline is a REAL zImage, but …
  • the /boot/zImage in my Linux is FAKE zImage, by using the following command

$ file BOOT/zImage
BOOT/zImage: MS-DOS executable PE32+ executable (EFI application) Aarch64 (stripped to external PDB), for MS Windows

Do you know how I can make REAL zImage for ARM64 platform in fenix ???