AnsweredAssumed Answered

i.MX 8M Mini EVK DDR4 not booting into Linux

Question asked by Atli Thrastarson on May 2, 2020
Latest reply on Jun 24, 2020 by Atli Thrastarson

Hello,

 

I was hoping someone could point me in the right direction with my boot sequence. I have an 8MMINID4-EVK and have been playing around with it in android for a bit. But now I wanted to start it up in Linux I am finding it very troublesome. I first tried to download the example Linux files but none of them worked for me. When starting they failed their DDR4 memory initialisation (see training log below but instead of PASSED it went FAILED). I realised, through playing with the DDR tool, that this was due to them not being compiled for the DDR4 version, but rather the LPDDR4 version. 

 

This leads me to my first question, where can I find pre-compiled Linux systems for the DDR4 version?

 

I did get past this to try and boot into something by compiling my own version. For that I used the following commands on a fresh installation of Ubuntu 18.04 on a virtual machine, set up through VirtualBox with guest utils added, and a USB filter to make the SD card go through to the VM. The SD card gets recognised as /dev/sdb.

 

sudo apt-get update

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev curl python xterm

 

mkdir ~/bin

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo

chmod a+x ~/bin/repo export PATH=~/bin:$PATH

 

git config --global user.name "XXXXXXXXXXXX"

git config --global user.email "XXXXXXXXXXXX@example.com"

 

mkdir git

cd git

mkdir imx-yocto-bsp-ddr4

 

repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-sumo -m imx-4.14.98-2.0.0_ga.xml

repo sync

 

DISTRO=fsl-imx-wayland MACHINE=imx8mmddr4evk source fsl-setup-release.sh -b build

bitbake fsl-image-validation-imx

 

 

cd ~/git/imx-yocto-bsp-ddr4/build/tmp/deploy/images/imx8mmddr4evk

bunzip2 -dk -f fsl-image-validation-imx-imx8mmddr4evk.sdcard.bz2

 

sudo dd if=fsl-image-validation-imx-imx8mmddr4evk.sdcard of=/dev/sdb bs=1M && sync

 

After this I then plug in the SD card and make sure my EVK is set to SW1101 [0110110010] and SW1102 [0001101000]. I then start the board by giving it power and flicking the on switch. The following then comes through on my debug interface.

U-Boot SPL 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df5e4 (May 01 2020 - 08:06:42 +0000)
power_bd71837_init
DRAM PHY training for 2400MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 400MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 100MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
DRAM PHY training for 2400MTS
check ddr4_pmu_train_imem code
check ddr4_pmu_train_imem code pass
check ddr4_pmu_train_dmem code
check ddr4_pmu_train_dmem code pass
Training PASS
Normal Boot
Trying to boot from MMC1


U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df5e4 (May 01 2020 - 08:06:42 +0000)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 29C
Reset cause: POR
Model: FSL i.MX8MM DDR4 EVK board
DRAM: 2 GiB
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x52]
Power supply on USB2
TCPC: Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
NAND: 0 MiB
MMC: FSL_SDHC: 0
Loading Environment from MMC... *** Warning - No block device, using default environment

Failed (-5)
No panel detected: default to MIPI2HDMI
Display: MIPI2HDMI (1920x1080)
Video: 1920x1080x24
In: serial
Out: serial
Err: serial

BuildInfo:
- ATF 1cb68fa
- U-Boot 2018.03-imx_v2018.03_4.14.98_2.0.0_ga+g87a19df5e4

flash target is MMC:0
MMC card init failed!
** Block device MMC 0 not supported
Net:
Warning: ethernet@30be0000 using MAC address from ROM
eth0: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
Bad Linux ARM64 Image magic!
u-boot=>

In other words it looks like it cannot find the image in the correct place (or it is malformed) (or it cannot read the SD card). If I mount the SD card onto my computer I can see what I would expect, pictures below.

I also tried renaming the Image to zImage as per the assumption in 4.7.1 of the Linux User guide. And lastly under 4.7 I tried running some of the commands suggested, below is the command line prompt, which again suggest a problem with the card.

u-boot=> saveenv
Saving Environment to MMC... !No block device
Failed (1)
u-boot=> run bootcmd
Bad Linux ARM64 Image magic!
u-boot=>

 

 

For more information I have also ran fdisk below to show the partitions.

 

 

I thought for a moment here that this might be due to the filesystem not being in the correct place as I am using a 32GB SD card or some similar reason. So I went through 4.3 in the Linux user guide Rev. L4.14.98-2.0.0_ga from 4.3.3 onwards. The partitions there are slightly different and I made the card as described (there was one thing I wasn't sure about which was the name of the <U-Boot Image> I used "u-boot-imx8mmddr4evk.bin-sd", and also "u-boot-spl.bin-imx8mmddr4evk-sd"). This way of preparing the card never gave me anything on the debug interface, i.e. it never got into the U-Boot.

 

Below are the commands I used to prepare the card in the way that didn't do anything. The partition numbers are directly from the Linux User guide chapter 4.3.3

sudo umount /dev/sdb1

sudo umount /dev/sdb2

 

sudo fdisk /dev/sdb

p

d

1

d

n

p

1

20480

1024000

n

p

2

1228800

<enter>

p

w

I have made a break here to show the output of the last partition table list, the commands carry on below. The offset of seek is set as 33 for the i.MX 8M Mini.

 

cd /home/user/git/imx-yocto-bsp-ddr4/build/tmp/deploy/images/imx8mmddr4evk

sudo dd if=u-boot-spl.bin-imx8mmddr4evk-sd of=/dev/sdb bs=1k seek=33 conv=fsync

 

sudo mkfs.ext4 /dev/sdb2

mkdir /home/user/mountpoint

sudo mount /dev/sdb2 /home/user/mountpoint

 

mkdir /home/user/rootfs

cd /home/user/rootfs

tar -jxvf /home/user/git/imx-yocto-bsp-ddr4/build/tmp/deploy/images/imx8mmddr4evk/fsl-image-validation-imx-imx8mmddr4evk-20200501075143.rootfs.tar.bz2

 

sudo cp -a * /home/user/mountpoint

sudo umount /home/user/mountpoint

sync

 

 

 

 

So for my second question. How can I fix the MMC card init failed when using the dd without the partionining.

 

 

 

 

For my third question. Where have I gone wrong in preparing the card manually in the partition table, i.e. why does it not go into the U-Boot and at least get to the same place as the previous one? Bonus question, what is the <U-Boot Image> name (ls output below)?

 

My thought on the third question was the dtb, however that is never mentioned in the Linux User guide under the SD card preparation chapter. There is also no mention of populating the first partition, which as far as I can tell should be populated with at least the Image, dtb etc. files.

 

 

I have used a Ubuntu version which isn't recommended, but as it built fine I thought that wouldn't matter, I am more than happy to be corrected on that if it means this will work. I also welcome any pointers of what I could do better/what I have done wrong.

 

Apologies if I have left anything obvious off, this is my first time compiling a Linux system like this.

Thank you very much in advance! 

Outcomes