Open Source U-Boot Bootloader Now Supports SquashFS Filesystem

Share

SquashFS is one of the most popular compressed read-only filesystems for Linux operating system. It is widely used in embedded systems to compress entire filesystems, inodes, and directories.

In 2009, support for SquashFS merged into the mainline kernel as part of Linux 2.6.9. But so far, open-source Universal Bootloader (U-Boot) did not support SquashFS, leading to an inability to load kernel images or Device Tree Blobs from a SquashFS filesystem in U-Boot.

SquashFS Support To U-Boot

Now, SquashFS support has finally been added to U-Boot owing to a contribution by João Marcos Costa, an intern working at Bootlin company. Support for SquashFS is now available in upstream U-Boot, which you can find in fs/squashfs/ in the U-Boot source code.

SquashFS filesystem support to U-Boot

More specifically, the contribution includes a new SquashFS filesystem driver, commands, support for zlib decompression in the driver, and scripts to test its commands.

To use the SquashFS filesystem, you also first need to enable its support, which in return adds SquashFS driver and provides SquashFS U-Boot commands.

The command includes sqfsls to list files from a typical Linux root filesystem.

=> sqfsls mmc 0:1
            bin/
            boot/
            dev/
            etc/
            lib/
    <SYM>   lib32
    <SYM>   linuxrc
            media/
            mnt/
            opt/
            proc/
            root/
            run/
            sbin/
            sys/
            tmp/
            usr/
            var/
 
2 file(s), 16 dir(s)

And sqfsload to load Linux kernel images and Device Tree blobs from files.

=> sqfsload mmc 0:1 $kernel_addr_r /boot/zImage
6160384 bytes read in 433 ms (13.6 MiB/s)
=> sqfsload mmc 0:1 0x81000000 /boot/am335x-boneblack.dtb
40817 bytes read in 11 ms (3.5 MiB/s)
=> setenv bootargs console=ttyO0,115200n8
=> bootz $kernel_addr_r - 0x81000000
## Flattened Device Tree blob at 81000000
   Booting using the fdt blob at 0x81000000
   Loading Device Tree to 8fff3000, end 8fffff70 ... OK
 
Starting kernel ...
 
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.79 (joaomcosta@joaomcosta-Latitude-E7470) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)) #1 SMP Fri May 29 18:26:39 CEST 2020
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d

Since the SquashFS driver code is new, you may also encounter a few bugs or limitations, which you can report to resolve as soon as possible.

In addition to SquashFS contributions, João has also submitted code to add support for LZO and ZSTD decompression.

Load more...
Sarvottam Kumar

Being a fossbyter, I cover the latest releases, news, information, and trends in the world of Linux and Open source.

Published by

This website uses cookies.