Trying to boot imx8mm with u-boot & kernel in nor and root filesystem in eMMC.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to boot imx8mm with u-boot & kernel in nor and root filesystem in eMMC.

8,326 Views
hutchman
Contributor II

I want to boot IMX8 Mini from internal flash without sdcard.  I have dip switches set to:

0110xxxxxx

00100x0010

... to boot from flex spi nor flash.  I have nor flash programmed with imx-boot-imx8mmevk-fspi.bin-flash_evk_flexspi

I want to boot u-boot from nor, load kernel from nor and mount filesystem on eMMC.

I can boot u-boot from nor and mount eMMC root filesystem if sdcard is present with a yocto generated sdcard (I had to modify some environment variables to use mmc 1 instead of mmc 0 in this case).  I programmed kernel image in nor and changed u-boot environment variables to load kernel to 0x40480000 and attempt to boot it (with no sdcard) but when I do I get:

Card did not respond to voltage select!
u-boot=> mmc info
MMC Device 0 not found
no mmc device at slot 0
u-boot=> mmc dev 1
Card did not respond to voltage select!

The eMMC is mmc 1 (which is where my filesystem is) and without the sdcard inserted it appears it's not there.  If I put sdcard in, booting and mounting from eMMC works.

How can I boot from spi nor and yet have access to mmc1 (the eMMC)?

I've been looking for documentation or an example of booting imx8mm-evk from internal flash (no sdcard) and can't find anything.  I want to know how to make each of the images required and flash them manually and not with uuu as we are making custom hardware that needs to be upgraded in the field and nobody will be connecting with board via USB with UUU, it will all be over the network writing images to flash from the target itself.

Thanks for any pointers or examples.

Regards,

Brian

0 Kudos
10 Replies

8,071 Views
hutchman
Contributor II

Hi Igor,

I checked out the section "4.7.1 Running Linux OS from MMC/SD" and unfortunately that isn't helpful.

It states "This scenario assumes that the board is configured to boot U-Boot, that the Linux kernel image is named zImage and is stored
on the SD card in an MSDOS FAT partition, and one or more device tree files are also stored in this partition. The rootfs is
also stored on the SD/MMC card in another partition.
When U-Boot boots up, it detects the slot where it is booting from and automatically sets mmcdev and mmcroot to use the
rootfs on that SD card. In this scenario, the same SD card can be used to boot from any SD card slot on an i.MX 6/7 board,
without changing any U-Boot settings. From the U-Boot command line, type boot to run Linux OS."

Well, in my case, I want to boot from spi nor and if I do that, I can't access mmc 1 (the eMMC) unless the board is booted with a sdcard in the tray.  So either there is a magic dip switch setting that I'm missing or that boot combination isn't supported or something is broken.

Try it.  Flash spi nor with imx-boot-imx8mmevk-fspi.bin-flash_evk_flexspi, change dip switches to boot from spi nor, boot board and stop in u-boot and try to access the eMMC with no sdcard.

u-boot=> mmc dev 1
Card did not respond to voltage select!

How can I access eMMC when booting from spi nor???

Regards,

Brian

0 Kudos

8,072 Views
igorpadykov
NXP Employee
NXP Employee

Hi Brian

had you tried "mmcautodetect" described in sect.4.7.1, also

could you provide full logs (uboot + linux).

Best regards
igor

0 Kudos

8,072 Views
hutchman
Contributor II

Hi Igor,

Yes.  Printenv shows mmcautodetect=yes

Hold on a sec.  I'm stupid.  I see my error. emmc is mmc 2 not 1!

Let me try that now that i've unscrewed myself.

0 Kudos

8,072 Views
hutchman
Contributor II

Ok,  now that I unscrewed myself from brain cramp on which mmc number was actually the eMMC.  I'm trying to boot again and running into:

Bad Linux ARM64 Image magic!

... and can't figure out why.

I haven't totally modified my u-boot environment variables yet ... trying to boot this thing manually.  I took Image and fsl-imx8mm-evk.dtb from my working sdcard FAT partition and flashed them to the spi nor flash.

Then I remove sdcard and boot into u-boot and tried to boot doing the following:

U-Boot SPL 2019.04-4.19.35-1.1.0+g4d377539a1 (Apr 23 2020 - 19:15:00 +0000)
power_bd71837_init
DDRINFO: start DRAM init
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
Normal Boot
Trying to boot from NOR


U-Boot 2019.04-4.19.35-1.1.0+g4d377539a1 (Apr 23 2020 - 19:15:00 +0000)

CPU: Freescale i.MX8MMQ rev1.0 1800 MHz (running at 1200 MHz)
CPU: Commercial temperature grade (0C to 95C) at 46C
Reset cause: POR
Model: FSL i.MX8MM EVK board
DRAM: 2 GiB
tcpc_init: Can't find device id=0x52
setup_typec: tcpc port2 init failed, err=-19
tcpc_init: Can't find device id=0x50
setup_typec: tcpc port1 init failed, err=-19
MMC: FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from SPI Flash... SF: Detected n25q256ax1 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
OK
No panel detected: default to MIPI2HDMI
adv7535_init: Can't find device id=0x3d, on bus 1
Display: MIPI2HDMI (1920x1080)
Video: 1920x1080x24
In: serial
Out: serial
Err: serial

BuildInfo:
- ATF 70fa7bc
- U-Boot 2019.04-4.19.35-1.1.0+g4d377539a1

Net:
Error: ethernet@30be0000 address not set.

Error: ethernet@30be0000 address not set.
eth-1: ethernet@30be0000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot: 0
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=2
ethprime=FEC
fdt_addr=0x43000000
fdt_file=fsl-imx8mm-evk.dtb
fdt_high=0xffffffffffffffff
fdtcontroladdr=bc917758
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=2
mmcpart=1
mmcroot=/dev/mmcblk2p1 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}; t;
script=boot.scr
sd_dev=1
serial#=082bca09dab45d9e
soc_type=imx8mm

Environment size: 2305/4092 bytes
u-boot=> run mmcargs
u-boot=> sf probe
SF: Detected n25q256ax1 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
u-boot=> sf read 0x40480000 0x400000 0x1157200
device 0 offset 0x400000, size 0x1157200
SF: 18182656 bytes @ 0x400000 Read: OK
u-boot=> sf read 0x43000000 0x1540000 0x8f43
device 0 offset 0x1540000, size 0x8f43
SF: 36675 bytes @ 0x1540000 Read: OK
u-boot=> booti ${loadaddr} - ${fdt_addr}
Bad Linux ARM64 Image magic!
u-boot=>

0 Kudos

8,072 Views
igorpadykov
NXP Employee
NXP Employee

"Bad Linux ARM64 Image magic!" may be due to incompatible

uboot and linux versions. Please try to rebuild all image from scratch, use

Yocto Guide included in Linux 4.19.35_1.1.0 Documentation

For U-Boot 2019.04-4.19.35-1.1.0 should be used

linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos

8,072 Views
hutchman
Contributor II

The hint would be I stated it's the same Image (kernel) from the same build I built the sdcard image from ... that works.

Regards,

Brian

0 Kudos

8,072 Views
igorpadykov
NXP Employee
NXP Employee

could you try to reproduce issue on IMX8 Mini EVK with that image.

Best regards
igor

0 Kudos

8,072 Views
hutchman
Contributor II

I finally figured out what my problem was.  It's kind of funny looking back.  When I would do "saveenv" it would corrupt my kernel image (but didn't immediately recognize that's what was going on) and when I would flash the kernel I would corrupt the CRC of the u-boot environment variable space and it would go back to defaults.

It's booting now after I finally realized what was going on.

Regards,

Brian

0 Kudos

8,072 Views
hutchman
Contributor II

Thanks igor, I will check it out.

I did clone my sdcard to the eMMC and to keep things simple I first tried to make minimal changes to u-boot env (basically just changing a few variables from mmc 0 to mmc 1) and can boot with dip switches set to spi nor boot and board would boot u-boot from nor but get fdt, Image and root filesystem from mmc 1 ... but the sdcard had to be in the tray.  If I take out the sdcard then I get the mmc voltage messages I mentioned.

Thanks for the info.

Regards,

Brian

0 Kudos

8,072 Views
igorpadykov
NXP Employee
NXP Employee

Hi Brian

for case when filesystem is located on different device one can look at

sect.4.7.1 Running Linux OS from MMC/SD, Table 46. Linux uSDHC relationships

Linux Guide included in Linux 4.19.35_1.1.0 Documentation

Procedure using network for writing images is not supported by nxp in its

bsps, for developing it one can proceed with help of Commercial Support and Engineering Services | NXP 

If not using uuu, one can try procedure described in sect.4.3.2 Copying the full SD card image.

Also may be useful to verify that uboot version corresponds to linux version (this is described in

Release Notes in Linux 4.19.35_1.1.0 Documentation), for example for  L4.19.35_1.1.0

should be used uboot imx_v2019.04 :

uboot-imx - i.MX U-Boot 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos