How to Boot Linux from RAM using U-Boot (Sometimes Works)

I am trying to boot COl iMX6DL board on the Colibri Evaluation board. Under U-boot, I load the kernel image, the device tree and the RAM drive into memory (0x10800000, 0x12000000, 0x12100000). I set the bootargs environmental variable manually (setenv bootargs enable_wait_mode=off galcore.contiguousSize=50331648 fec_mac=00:14:2d:4a:4d:0e consoleblank=0 no_console_suspend=1 console=tty1 console=ttymxc0,115200n8 ip=dhcp root=/dev/ram0), then perform a bootm. On one board the kernel boots successfully, on three others it hangs (output attached).


I didn’t observe such a thing.

If I build a then 5 out of 5 powercycles and 5 out of 5 resets boot the image fine to the command prompt.

e.g. to build and deploy the rootfs I used a V2.6 Beta2 version of our image:

  • added meta-linaro/meta-linaro to conf/bblayers.conf
  • added util-linux to IMAGE_INSTALL in meta-linaro/recipes-linaro/images/
  • MACHINE=colibri-imx6 bitbake linaro-image-minimal-initramfs
  • copied and renamed the resulting Angstrom-linaro-image-minimal-initramfs-glibc-ipk-v2015.12-colibri-imx6.rootfs.cpio.gz.u-boot to the Colibri-iMX6 to /media/mmcblk0p1/initramfs.cpio.gz.u-boot

Then I set the following U-Boot environment variables:

Colibri iMX6 # setenv ramargs ip=off
Colibri iMX6 # setenv ramboot 'run setup; setenv bootargs ${defargs} ${ramargs} ${setupargs} ${vidargs};run emmcdtbload; load mmc 0:1 ${kernel_addr_r} ${boot_file} && load mmc 0:1 ${ramdisk_addr_r} initramfs.cpio.gz.u-boot && bootm ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}'
Colibri iMX6 # setenv bootmode run ramboot
Colibri iMX6 # saveenv

Then the kernel starts booting as follows and passes control to the /init script:

U-Boot 2015.04+fslc+g10bc451 (Jun 29 2016 - 16:36:06)

CPU:   Freescale i.MX6DL rev1.2 at 792 MHz
CPU:   Temperature 55 C
Reset cause: POR
I2C:   ready
DRAM:  512 MiB
PMIC: device id: 0x10, revision id: 0x11
PMIC: programmed
auto-detected panel vga-rgb
Display: vga-rgb (640x480)
In:    serial
Out:   serial
Err:   serial
Model: Toradex Colibri iMX6 DualLite 512MB IT V1.0A, Serial# 04823092
Net:   using PHY at 0
Normal Boot
Hit any key to stop autoboot:  0
reading imx6dl-colibri-eval-v3.dtb
43853 bytes read in 19 ms (2.2 MiB/s)
reading uImage
4713096 bytes read in 198 ms (22.7 MiB/s)
reading initramfs.cpio.gz.u-boot
7860452 bytes read in 326 ms (23 MiB/s)
## Booting kernel from Legacy Image at 11000000 ...
   Image Name:   Linux-3.14.52-v2.6b2+g7c83cef
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4713032 Bytes = 4.5 MiB
   Load Address: 10008000
   Entry Point:  10008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 12100000 ...
   Image Name:   Angstrom-linaro-image-minimal-in
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7860388 Bytes = 7.5 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 12000000
   Booting using the fdt blob at 0x12000000
   Loading Kernel Image ... OK
   Using Device Tree in place at 12000000, end 1200db4c

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.14.52-v2.6b2+g7c83cef ( (gcc version 5.2.1 20151005 (Linaro GCC 5.2-2015.11-2) ) #1 SMP Wed Jun 29 16:37:11 CEST 2016
[    0.000000] CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Toradex Colibri iMX6DL/S on Colibri Evaluation Board V3
[    0.000000] cma: CMA: reserved 256 MiB at 20000000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] PERCPU: Embedded 7 pages/cpu @8fb46000 s7936 r8192 d12544 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
[    0.000000] Kernel command line: enable_wait_mode=off galcore.contiguousSize=50331648 ip=off fec_mac=00:14:2d:49:98:34 consoleblank=0 no_console_suspend=1 console=tty1 console=ttymxc0,115200n8 video=mxcfb0:dev=lcd,640x480M@60,if=RGB666 video=mxcfb1:off fbmem=8M
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)


[    3.889556] rtc-ds1307 2-0068: setting system clock to 2016-07-04 14:49:17 UTC (1467643757)
[    3.903107] ALSA device list:
[    3.903115]   #0: imx6-colibri-sgtl5000
[    4.210751] Freeing unused kernel memory: 312K (807e7000 - 80835000)
linaro-test [rc=0]#

@rayimx Could you give with what versions of things you did what and what exactly happens when it hangs?


Thanks for looking into this Max. The fundamental starting point of my problem is that I am taking over a project that was half-complete and documented. Assumptions I have made about the development and deployment environment have proved wrong, and I’m mostly stumbling around in the dark. But I have been able to boot the system consistently on the development board, so I built out a ram drive without init, enabling the command line on the serial terminal. I was able to use that platform to make a dd copy of the good board’s MMC. That fixes my problem for now (in the long run I’ll build out my own operating environment and deprecate the legacy work, but I need to show results now). Once again, Thanks!!!