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

cancel
Showing results for 
Search instead for 
Did you mean: 

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

1,542 Views
atli_thrastarso
Contributor II

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=>

pastedImage_5.png

pastedImage_6.png

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

pastedImage_7.png

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.

pastedImage_9.png

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)?pastedImage_19.png

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! 

9 Replies

420 Views
carl_ex
Contributor I

The link above doesn't seem to work. Could it be removed? You don't have the possibility upload it again?

Thank you!
/Carl

0 Kudos

1,004 Views
vijayb1
Contributor II

Hello Atli,

I will be back on this in a couple of weeks. But to give you quick hand, "I know how frustrating it is sit for an answer seems so silly for others";

But to answer your questions "I am on DDR4 version so it is SD boot".

I had modify from u-boot console. When boot fails go the u-boot console and adjust the env.

printenv,

editenv to change to correct mmc.

mmc rescan should give you clue.

u-boot env that worked for me is below

u-boot=> printenv
baudrate=115200
boot_fdt=try
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else booti ${loadaddr} - ${fdt_addr}; fi
bootcmd_mfg=run mfgtool_args;if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else booti ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo "Run fastboot ..."; fastboot 0; fi;
bootdelay=2
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc1,115200 earlycon=ec_imx6q,0x30890000,115200
emmc_dev=1
ethaddr=00:04:9f:06:1d:ac
ethprime=FEC
fastboot_dev=mmc0
fdt_addr=0x43000000
fdt_file=fsl-imx8mm-ddr4-evk.dtb
fdt_high=0xffffffffffffffff
fdtcontroladdr=bc8d0500
image=Image
initrd_addr=0x43800000
initrd_high=0xffffffffffffffff
jh_clk=
jh_mmcboot=mw 0x303d0518 0xff; setenv fdt_file fsl-imx8mm-evk-root.dtb;setenv jh_clk clk_ignore_unused; if run loadimage; then run mmcboot; else run jh_netboot; fi;
jh_netboot=mw 0x303d0518 0xff; setenv fdt_file fsl-imx8mm-evk-root.dtb; setenv jh_clk clk_ignore_unused; run netboot;
kboot=booti
loadaddr=0x40480000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mfgtool_args=setenv bootargs console=${console},${baudrate} rdinit=/linuxrc clk_ignore_unused
mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot}
mmcautodetect=yes
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then booti ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi; else echo wait for boot; fi;
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk1p2 rootwait rw
netargs=setenv bootargs ${jh_clk} console=${console} root=/dev/nfs ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${loadaddr} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if ${get_cmd} ${fdt_addr} ${fdt_file}; then booti ${loadaddr} - ${fdt_addr}; else echo WARN: Cannot load the DT; fi; else booti; fi;
script=boot.scr
sd_dev=0
soc_type=imx8mm

Thanks

Vijay

0 Kudos

1,004 Views
atli_thrastarso
Contributor II

Hello Vijay,

Thank you very much for your response, I think it is towards the right way but I do not understand exactly what I need to do to get there. My environment variables are exactly the same as the ones you posted, except for the mac address and there is an extra space after one of the semi colons in netboot, but I cannot see that making a difference.

I will try and have a further look into this and see where I get to. I will update if I manage to get it to boot.

Kind regards,

Atli

0 Kudos

1,004 Views
vijayb1
Contributor II

Hello Atli,

I got my setup running with local build. It turns out; I had to change the boot env for local built images. Not sure why this got overwritten. As I had not changed the partition for boot image.

Specifically I had to change the boot device to emmc1

jh_mmcboot had wrong dtb  file. So if you correct that it should boot and work just like pre-built images

Thanks

Vijay

0 Kudos

1,004 Views
atli_thrastarso
Contributor II

Hello Vijay and thank you for the reply.

I have wondered about environmental variables and whether it was something like that but I hadn't come to any conclusion which sounded sensible. I had gone through the file found in my example under "sources/meta-fsl-bsp-release/imx/meta-bsp/conf/machine/imx8mmddr4evk.conf". This is as far as I understand the file which sets the variables up using fsl-build-setup as it is the one which is pointed to within the script (using the variables I have given in my bitbake commands).

As I was looking through this file I do not see anything that jumps out. I have included the file below for clarity.

pastedImage_1.png

pastedImage_2.png

vijayb‌ when you say you had to change the boot variable are you booting from the onboard eMMC or from the SD card? Also when you are talking about the variable are you referring to changing it in u-boot or before the build?

I have ran through it all again re-doing the build and going through the two methods of writing to the SD card presented in the Linux user guide, but I always arrive at the same conclusion, unable to read the kernel image on the SD card.

radhika.somaiya@volansystech.com‌ you mentioned using the pre-built images with the ddr4 names. I have tried creating an SD card using those, however as they aren't as straight forward as a pre-made SD card image I cannot rule out that my process to turn them into a bootable SD card is somehow wrong. Are there any guides on how one should do this? The last thing I tried was to do the commands as:

sudo dd if=fsl-image-validation-imx-imx8mmevk.sdcard of=/dev/sdb bs=1M && sync
sudo dd if=imx-boot-imx8mmddr4evk-sd.bin-flash_ddr4_evk of=/dev/sdb bs=1k seek=33 conv=fsync

Thinking that by writing the file system as per the sdcard image and then later replacing the bootloader section that would help but it came to the same conclusion as everything else I have tried, i.e. the MMC init failed message and only booting into U-Boot.

I ran through some MMC commands on the U-boot to add to the information provided in case it helps someone spot the error. The logs can be seen below. 

u-boot=> mmc part
u-boot=> mmc rescan
u-boot=> mmc dev 0
u-boot=> mmc part
u-boot=> mmc dev 1
MMC Device 1 not found
no mmc device at slot 1
u-boot=> mmc dev 3
MMC Device 3 not found
no mmc device at slot 3
u-boot=> mmc dev 2
MMC Device 2 not found
no mmc device at slot 2
u-boot=> mmc list
FSL_SDHC: 0
u-boot=> mmc dev 0
u-boot=> mmc part

Again I hope someone is able to lend a hand with pointing me in the right direction.

Kind regards,

Atli

0 Kudos

1,004 Views
vijayb1
Contributor II

Hello Atli Thrastarson,

I have same issue, did you get any update for the flashing your local built images. In my case i am building core-image instead of fsl, does not make much difference. I tried using pre-built u-boot image, as I am interested in zImage(uImage) and filesystem from local build. Stuck with dtb missing.

Thanks

Vijay

0 Kudos

1,004 Views
atli_thrastarso
Contributor II

Hello Vijay,

I haven't still got it to do what I want it to do with the local built images. The comment from radhika.somaiya@volansystech.com above helped me to get both builds to the same place, i.e. the u-boot loads but then it cannot read the SD card.

I tried quite a few things to get it to boot, including all of the techniques shown in the Linux user guide. No matter what I do I keep hitting the same error of stuck in u-boot with the SD card not being read (I am suspecting the partition table at the moment but I don't know how to fix that). Next time I get a chance I was going to look through what is required to be there for u-boot to understand the table, I was also going to get another SD card to check it wasn't something silly like that, although I don't have any problem with reading the partition table or the contents on my computer so I know I am grasping at straws.

If anyone has any suggestions I am kind of at a loss with this still and would love any help I can get with getting it to actually boot into the Linux, or even just recognise the SD card at this point.

Kind regards,

Atli

0 Kudos

1,004 Views
radhikasomaiya
Senior Contributor II

Hi Atli Thrastarson ,

 

For first question:

You are using i.MX8MMINID4-EVK, So when you download the images you need to choose the u-boot and all other images with ddr4.

 

Replace:     

         imx-boot-imx8mmevk-sd.bin-flash_evk 

with:

         imx-boot-imx8mmddr4evk-sd.bin-flash_ddr4_evk

 

You can download prebuilt images from below link.

https://www.nxp.com/webapp/Download?colCode=L4.14.98_2.0.0_MX8MM&appType=license 

 

For steps to flash images you can refer attached Linux user's guide(section 4.3.2 and 4.3.4.).

  

Regards,

Radhika Somaiya.   

0 Kudos

416 Views
carl_ex
Contributor I

The link you have shared has stopped working. Could you upload the image again?

Thank you!

Br,

/Carl

0 Kudos