[PATCH 4/5] Add filetype and detection for squashfs images

Enrico Joerns ejo at pengutronix.de
Thu Oct 6 07:10:36 PDT 2016

Hi Yegor,

On 10/06/2016 03:55 PM, Yegor Yefremov wrote:
> On Tue, Oct 4, 2016 at 12:10 PM, Enrico Jorns <ejo at pengutronix.de> wrote:
>> This adds `filetype_squashfs` to the list of known filetypes and adds a
>> detection for squashfs files to file_detect_type(). This currently
>> matches on the `hsqs` start sequence of an image file.
>> Additionally, the newly introduced filetype is registered as the type of
>> the squashfs_driver which allows, for example, to mount squashfs without
>> the need to specify a type parameter.
>> This changes enable booting a squashfs with the simple `boot` command
>> pointing to the location (device) that holds the squashfs.
>> Note that booting with blspec is limited as the current squashfs driver
>> is not capable of handling symbolic links.
> Glad to see SquashFS will be used not only by myself :-)

glad to see that, too ;)

> Could you explain how one can write a rootfs.sqaushfs to a ubiblock
> from Linux and then what steps are needed in barebox?
> So far I've only found this info about ubiblock:
> http://www.linux-mtd.infradead.org/doc/ubi.html#L_ubiblock, but it
> doesn't say much.

Yes, the informations provided are a bit sparse..

> My actions were:
> ubiattach -p /dev/mtd5
> ubiblock --create /dev/ubi0_0
> ubiupdatevol /dev/ubi0_0 rootfs.squashfs
> Can I mount /dev/ubi0_0 via mount? If yes, what parameters I should use?

The above commands look pretty similar to what I did. Mounting the 
ubiblock device does work too, with a little pitfall, mount will be 
confused by having a read-only file system but nobody told it before.
So you must do

   mount -o ro /dev/ubiblock0_0 /mnt/test

> How can I mount this volume in barebox step-by-step?

Using it in barebox is pretty easy, as the ubiblock layer is not 
required there:

   ubiattach /dev/nand0.root
   ubiupdatevol /dev/nand0.root.ubi.ubivolname rootfs.squashfs
   mkdir /mnt/test
   mount /dev/nand0.root.ubi.ubivolname /mnt/test

To boot via bootspec form a ubi containing a squashfs, you simply need to

   boot /dev/nand0.root.ubi.ubivolname

Hope that helps.

Best regards, Enrico

Pengutronix e.K.                           | Enrico Jörns                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5080 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

More information about the barebox mailing list