AnsweredAssumed Answered

iMX6 - filesystem as RAMdisk

Question asked by andrea pizzato on Mar 13, 2014
Latest reply on Mar 14, 2014 by andrea pizzato

Hello,

 

on my custom board with iMX6, I'm trying to launch a Linux filesystem from on-board MMC to RAM-disk; MMC if formatted as below:

   Units = sectors of 1 * 512 = 512 bytes

   Device Boot               Start           End        Blocks    Id    System

   /dev/mmcblk0p1       40960      655359        307200    83    Linux

   /dev/mmcblk0p2     655360    1064959        204800    83    Linux

   /dev/mmcblk0p3   1064960   30535679    14735360    83    Linux

 

U-boot and kernel are stored in /dev/mmcblk0

 

The rootfs.ext2.gz and rootfs.ext2.gz.uboot files was created with LTIB with this configuration:

   General setup > initial ram filesystem and ram disk support --> CONFIG_BLK_DEV_INITRD=y, CONFIG_RD_GZIP=y

   Device drivers > block devices > ram block device support --> CONFIG_BLK_DEV_RAM=y, CONFIG_BLK_DEV_RAM_COUNT=16, CONFIG_BLK_DEV_RAM_SIZE=4096

 

The rootfs.ext2.gz was copied in MMC in the second partition, using the command:

   dd if=rootfs.ext2.gz of=/dev/mmcblk0p2 conv=fsync

thus it is stored at address 655360, that is 0xA0000.

 

Then, I changed the U-boot parameters:

   setenv bootcmd_mmc 'run bootargs_base bootargs_mmc; mmc dev 3; mmc read ${loadaddr} 0x2000 0x2000; mmc read 0x13000000 0xA0000 0xC000; bootm'

      (the compressed rootfs is read from MMC starting from 0xA0000 and stored in memory at 0x13000000)

   setenv bootargs_mmc 'setenv bootargs ${bootargs} root=/dev/ram0 rw initrd=0x13000000,200M'

      (the root device is /dev/ram0; the compressed rootfs is read starting from address 0x13000000; 200MB was allocated for ram-file-system)

 

Executing the boot, the kernel is correctly launched but, at time to mount the file-system, these messages are displayed on the console:

   RAMDISK: gzip image found

   Uncompression error

   VFS: mounted root (ext2 filesystem) on device 1:0

   EXT2-fs (ram0): error: ... ...

   Kernel panic ...

 

After this, I repeated the same procedure using the file rootfs.ext2.gz.uboot (instead of rootfs.ext2.gz); in this case, executing the boot, on console appear

   RAMDISK: Couldn't find valid RAM disk image

   Kernel panic ...

 

 

Any suggestions?

Thank you very much!

Andrea

Outcomes