My problem is: I cannot use compressed rootfs (the kernel crashes during boot) but uncompressed ones work fine.

What I did: I'm using Buildroot 2013.11 to generate Images for my embedded Linux (2.6.39) ARM 9 system, booting from SD card.

I'm "dd"ing the Images (e.g. ext4) to the 2nd partition of the SD card with

sudo dd if=/path-to/rootfs.ext4 of=/dev/sdb2 bs=2048

and enable the driver in linux-menuconfig, that is

File systems
- <*> The Extended 4 (ext4) filesystem
- [*] Use ext4 for ext2/ext3 file systems
- [*] Ext4 extended attributes

Now when I like to use the compressed ext4 (e.g. with lzo), buildroot generates an rootfs.ext4.lzo when "dd"ing here with

sudo dd if=/path-to/rootfs.ext4.lzo of=/dev/sdb2 bs=2048

the command is executed without any error but from this point "sdb2" isn't accessible anymore until it is formated again. When using this SD to boot the system the kernel crashes telling me it was trying to interpret the partition with ext4 but he wasn't able to read it.

Where am I going wrong?


You've omitted a lot of information, but what you show here doesn't make sense. If you create a compressed filesystem image, you need to load it into memory and uncompress it, so that it is then used uncompressed in memory. It seems that you're trying to access the compressed image as if it was a filesystem — but it isn't, a compressed ext4 filesystem is not an ext4 filesystem and cannot be mounted.

If you want to use that filesystem from flash (i.e. load and unload the files as they're needed), it needs to be uncompressed. If you want to use that filesystem from memory, better make it an initramfs: you don't waste memory on empty parts of the filesystem, you can erase files at runtime if you want to free the memory, and you need less infrastructure to build it and boot from it.

  • I already thought it's not possible to mount a compressed rootfs (like rootfs.ext4.lzo) but, then I wondered why does Buildroot make this an option at all? Unfortunately I haven't find anything in the documentation. – user3085931 Apr 25 '14 at 6:40
  • @user3085931 The root filesystem can be loaded into memory and uncompressed there. It used to be common before initramfs existed, but nowadays I don't see any advantage over initramfs. – Gilles 'SO- stop being evil' Apr 25 '14 at 15:12
  • Well I've measured, that an ext4 rootfs-partition boots in ~ 4 s and Initramfs in ~ 8 s, on my platform. If this is already that efficient, I believe it could still get better with a compressed ext4 rootfs. However, if a filesystem can be put into memory and get uncompressed there, is this an option for the rootfs, with which the System boots? Or is it just for the filesystems, that can be mounted later on ? – user3085931 Apr 28 '14 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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