SquashFS is one of the most popular read-only compressed file systems for the Linux operating system. It is widely used in embedded systems to compress entire file systems, inodes, and directories.
In 2009, support for SquashFS merged into the main kernel as part of Linux 2.6.9. But until now, open-source Universal Bootloader (U-Boot) did not support SquashFS which prevented loading kernel images or device tree blobs from a file system. SquashFS in U-Boot.
SquashFS support for U-Boot
Now SquashFS support has finally been added to U-Boot thanks to a contribution from João Marcos Costa, an intern working at Bootlin Company. SquashFS support is now available in U-Boot upstream, which you can find in fs / squashfs / in the U-Boot source code.
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 must also first enable its support, which in turn adds the SquashFS driver and provides SquashFS U-Boot commands.
The order includes sqfsls to list the files of 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 ([email protected]) (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 the SquashFS contributions, João also submitted code to add support for LZO and ZSTD decompression.
