Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The rootfs is a squashfs image and my bootloader is loading it into some address in SDRAM. What parameters do I need to pass to the kernel so It can mount the rootfs from there? Squashfs support is built-in and it already works with

root=/dev/mtdblock2 rootfstype=squashfs  

for booting from the flash.

EDIT: This is a MIPS based embedded device, using a custom bootloader. Normally, the bootloader extracts the compressed kernel from the flash into the SDRAM, and then kernel mounts /dev/mtdblock2 as the rootfs. I am trying to improve the bootloader so it can download an image to its RAM and boot without writing to the flash.

I cannot figure out how to make Linux mount a filesystem image in the RAM as the rootfs.

share|improve this question
Please describe better, what are you trying to achieve, if you already know squashfs works. How do you you know that it works? What happens? And most importantly, what doesn't work the way you want? – rozcietrzewiacz Dec 21 '11 at 10:17
Also, what bootloader does the device use? – rozcietrzewiacz Dec 21 '11 at 10:20
I think if you use memdisk (from SYSLINUX) as kernel, it loads the whole image in memory and then boots from it – golimar Apr 12 '12 at 8:03
up vote 4 down vote accepted

I would use an initramfs. (http://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt)

Many linux distributions use an initramfs (not to be confused with an initrd, they are different) during the boot process, mostly to be able to start userspace programs very early in the boot process. However you can use it for whatever you want.

The benefit of an initramfs over an initrd is that an initramfs uses a tmpfs filesystem while an initrd uses a ram block device. The key difference here is that an initrd you must preallocate all the space for the filesystem, even if youre not going to use all that space. So if you dont use the filesystem space, you waste ram, which on an embedded device, is often a scarce resource. Tmpfs is a filesystem which runs out of ram, but only uses as much ram as is currently in use on the filesystem. So if you delete a file from a tmpfs, that ram is immediately freed up.

Now normally an initramfs is temporary, only used to run some programs extremely early in the boot process. After those programs run, control is turned over to the real filesystem running on a physical disk. However you do not have to do that. There is nothing stopping you from running out of the initramfs indefinitely.

share|improve this answer
So I've actually been trying to setup a system that runs "out of the initramfs indefinitely". The system is up for the most part, but I've had some problems - I'm wondering if you might be able to shed some light? Question posted here – dtmland Jul 1 '15 at 17:18

Are the rd_start and rd_size options sufficient?

It seems the ARM port may have a syntax for the initrd option:

root=/dev/ram0 rw initrd=0x87000000,8M 
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.