Extend squashfs support
cover Extend squashfs support
This adds missing compression methods: lz4, lzo, zlib
It also creates missing links in driver and detection code in order to allow using squashfs with those nice barebox autodetection features and especially for bootspec booting.
The appendroot mechanism currently (only) supports booting form an ubi volume.
Enrico Jorns (5):
fs: squashfs: port lzo compression support from kernel
fs: squashfs: port lz4 compression support from kernel
fs: squashfs: port zlib compression support from kernel Add filetype and detection for squashfs images
fs: squashfs: append linux rootarg for ubi volume
common/filetype.c | 4 ++ fs/squashfs/Kconfig | 45 +++++++++++++++ fs/squashfs/Makefile | 3 + fs/squashfs/lz4_wrapper.c | 140 +++++++++++++++++++++++++++++++++++++++++++++ fs/squashfs/lzo_wrapper.c | 128 +++++++++++++++++++++++++++++++++++++++++ fs/squashfs/squashfs.c | 32 +++++++++++ fs/squashfs/zlib_wrapper.c | 132 ++++++++++++++++++++++++++++++++++++++++++ include/filetype.h | 1 + include/linux/lzo.h | 47 +++++++++++++++ 9 files changed, 532 insertions(+) create mode 100644 fs/squashfs/lz4_wrapper.c create mode 100644 fs/squashfs/lzo_wrapper.c create mode 100644 fs/squashfs/zlib_wrapper.c create mode 100644 include/linux/lzo.h
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/5 fs: squashfs: port lzo compression support from kernel
This ports lzo_wrapper from kernel code and adds some minimal adaptions to make squashfs lzo compression work in barebox.
--- fs/squashfs/Kconfig | 14 +++++ fs/squashfs/Makefile | 1 + fs/squashfs/lzo_wrapper.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/lzo.h | 47 +++++++++++++++++ 4 files changed, 190 insertions(+) create mode 100644 fs/squashfs/lzo_wrapper.c create mode 100644 include/linux/lzo.h
fs/squashfs/Kconfig +14 -0
@@ -17,6 +17,20 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_LZO + bool "Include support for LZO compressed file systems" + default y + depends on FS_SQUASHFS + select LZO_DECOMPRESS + help + Saying Y here includes support for reading Squashfs file systems + compressed with LZO compression. LZO compression is mainly + aimed at embedded systems with slower CPUs where the overheads + of zlib are too high. + + LZO is not the standard compression used in Squashfs and so most + file systems will be readable without selecting this option. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default y
fs/squashfs/Makefile +1 -0
@@ -11,3 +11,4 @@ obj-y += inode.o obj-y += namei.o obj-y += super.o obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o +obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
fs/squashfs/lzo_wrapper.c new file +128 -0
128 lines not on this page · raw message
include/linux/lzo.h new file +47 -0
47 lines not on this page · raw message
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 1/5] fs: squashfs: port lzo compression support from kernel
include/linux/lzo.h
Quoted 182 lines · Enrico Jorns
This ports
lzo_wrapperfrom kernel code and adds some minimal adaptions to make squashfs lzo compression work in barebox.Signed-off-by Enrico Jorns <[email protected]>--- fs/squashfs/Kconfig | 14 +++++ fs/squashfs/Makefile | 1 + fs/squashfs/lzo_wrapper.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/lzo.h | 47 +++++++++++++++++ 4 files changed, 190 insertions(+) create mode 100644 fs/squashfs/lzo_wrapper.c create mode 100644 include/linux/lzo.hfs/squashfs/Kconfig +14
-0@@ -17,6 +17,20 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_LZO + bool "Include support for LZO compressed file systems" + default y + depends on FS_SQUASHFS + select LZO_DECOMPRESS + help + Saying Y here includes support for reading Squashfs file systems + compressed with LZO compression. LZO compression is mainly + aimed at embedded systems with slower CPUs where the overheads + of zlib are too high. + + LZO is not the standard compression used in Squashfs and so most + file systems will be readable without selecting this option. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default yfs/squashfs/Makefile +1
-0@@ -11,3 +11,4 @@ obj-y += inode.o obj-y += namei.o obj-y += super.o obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o +obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.ofs/squashfs/lzo_wrapper.c new file +128
-0@@ -0,0 +1,128 @@ +/* +* Squashfs - a compressed read only filesystem for Linux +* +* Copyright (c) 2010 LG Electronics +* Chan Jeong <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2, +* or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* lzo_wrapper.c +*/ + +#include <linux/mutex.h> +#include <linux/lzo.h> +#include <types.h> + +#include "squashfs_fs.h" +#include "squashfs_fs_sb.h" +#include "squashfs.h" +#include "decompressor.h" +#include "page_actor.h" + +struct squashfs_lzo { +void *input; +void *output; +}; + +static void *lzo_init (struct squashfs_sb_info *msblk,void *buff) +{ +int block_size =max_t (int, msblk->block_size,SQUASHFS_METADATA_SIZE ); + +struct squashfs_lzo *stream =kzalloc (sizeof (*stream),GFP_KERNEL ); +if (stream ==NULL ) + goto failed; + stream->input =vmalloc (block_size); +if (stream->input ==NULL ) + goto failed; + stream->output =vmalloc (block_size); +if (stream->output ==NULL ) + goto failed2; + +return stream; + +failed2: +vfree (stream->input); +failed: +ERROR ("Failed to allocate lzo workspace\n" ); +kfree (stream); +return ERR_PTR (-ENOMEM ); +} + + +static void lzo_free (void *strm) +{ +struct squashfs_lzo *stream = strm; + +if (stream) { +vfree (stream->input); +vfree (stream->output); + } +kfree (stream); +} + + +static int lzo_uncompress (struct squashfs_sb_info *msblk,void *strm, +char **bh,int b,int offset,int length, +struct squashfs_page_actor *output) +{ +struct squashfs_lzo *stream = strm; +void *buff = stream->input, *data; +int avail, i, bytes = length, res; +size_t out_len = output->length; + +for (i =0 ; i < b; i++) { + avail =min (bytes, msblk->devblksize - offset); +memcpy (buff, bh[i] + offset, avail); + buff += avail; + bytes -= avail; + offset =0 ; +kfree (bh[i]); + } + + res =lzo1x_decompress_safe (stream->input, (size_t )length, + stream->output, &out_len); +if (res !=LZO_E_OK ) + goto failed; + + res = bytes = (int )out_len; + data =squashfs_first_page (output); + buff = stream->output; +while (data) { +if (bytes <=PAGE_CACHE_SIZE ) { +memcpy (data, buff, bytes); +break ; + }else { +memcpy (data, buff,PAGE_CACHE_SIZE ); + buff +=PAGE_CACHE_SIZE ; + bytes -=PAGE_CACHE_SIZE ; + data =squashfs_next_page (output); + } + } +squashfs_finish_page (output); + +return res; + +failed: +return -EIO ; +} + +const struct squashfs_decompressor squashfs_lzo_comp_ops = { + .init = lzo_init, + .free = lzo_free, + .decompress = lzo_uncompress, + .id =LZO_COMPRESSION , + .name ="lzo" , + .supported =1 +};include/linux/lzo.h +0
-0
We already have include/lzo.h with the same content, no need to add it again.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Yegor Yefremov
Tested-byRe: [PATCH 1/5] fs: squashfs: port lzo compression support from kernel
Quoted 5 lines · Sascha Hauer
Quoted 4 lines · Enrico Jorns
This ports
lzo_wrapperfrom kernel code and adds some minimal adaptions to make squashfs lzo compression work in barebox.Signed-off-by Enrico Jorns <[email protected]>
Quoted 190 lines
include/linux/lzo.h
Quoted 178 lines
--- fs/squashfs/Kconfig | 14 +++++ fs/squashfs/Makefile | 1 + fs/squashfs/lzo_wrapper.c | 128 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/lzo.h | 47 +++++++++++++++++ 4 files changed, 190 insertions(+) create mode 100644 fs/squashfs/lzo_wrapper.c create mode 100644 include/linux/lzo.hfs/squashfs/Kconfig +14
-0@@ -17,6 +17,20 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_LZO + bool "Include support for LZO compressed file systems" + default y + depends on FS_SQUASHFS + select LZO_DECOMPRESS + help + Saying Y here includes support for reading Squashfs file systems + compressed with LZO compression. LZO compression is mainly + aimed at embedded systems with slower CPUs where the overheads + of zlib are too high. + + LZO is not the standard compression used in Squashfs and so most + file systems will be readable without selecting this option. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default yfs/squashfs/Makefile +1
-0@@ -11,3 +11,4 @@ obj-y += inode.o obj-y += namei.o obj-y += super.o obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o +obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.ofs/squashfs/lzo_wrapper.c new file +128
-0@@ -0,0 +1,128 @@ +/* +* Squashfs - a compressed read only filesystem for Linux +* +* Copyright (c) 2010 LG Electronics +* Chan Jeong <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2, +* or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +* +* lzo_wrapper.c +*/ + +#include <linux/mutex.h> +#include <linux/lzo.h> +#include <types.h> + +#include "squashfs_fs.h" +#include "squashfs_fs_sb.h" +#include "squashfs.h" +#include "decompressor.h" +#include "page_actor.h" + +struct squashfs_lzo { +void *input; +void *output; +}; + +static void *lzo_init (struct squashfs_sb_info *msblk,void *buff) +{ +int block_size =max_t (int, msblk->block_size,SQUASHFS_METADATA_SIZE ); + +struct squashfs_lzo *stream =kzalloc (sizeof (*stream),GFP_KERNEL ); +if (stream ==NULL ) + goto failed; + stream->input =vmalloc (block_size); +if (stream->input ==NULL ) + goto failed; + stream->output =vmalloc (block_size); +if (stream->output ==NULL ) + goto failed2; + +return stream; + +failed2: +vfree (stream->input); +failed: +ERROR ("Failed to allocate lzo workspace\n" ); +kfree (stream); +return ERR_PTR (-ENOMEM ); +} + + +static void lzo_free (void *strm) +{ +struct squashfs_lzo *stream = strm; + +if (stream) { +vfree (stream->input); +vfree (stream->output); + } +kfree (stream); +} + + +static int lzo_uncompress (struct squashfs_sb_info *msblk,void *strm, +char **bh,int b,int offset,int length, +struct squashfs_page_actor *output) +{ +struct squashfs_lzo *stream = strm; +void *buff = stream->input, *data; +int avail, i, bytes = length, res; +size_t out_len = output->length; + +for (i =0 ; i < b; i++) { + avail =min (bytes, msblk->devblksize - offset); +memcpy (buff, bh[i] + offset, avail); + buff += avail; + bytes -= avail; + offset =0 ; +kfree (bh[i]); + } + + res =lzo1x_decompress_safe (stream->input, (size_t )length, + stream->output, &out_len); +if (res !=LZO_E_OK ) + goto failed; + + res = bytes = (int )out_len; + data =squashfs_first_page (output); + buff = stream->output; +while (data) { +if (bytes <=PAGE_CACHE_SIZE ) { +memcpy (data, buff, bytes); +break ; + }else { +memcpy (data, buff,PAGE_CACHE_SIZE ); + buff +=PAGE_CACHE_SIZE ; + bytes -=PAGE_CACHE_SIZE ; + data =squashfs_next_page (output); + } + } +squashfs_finish_page (output); + +return res; + +failed: +return -EIO ; +} + +const struct squashfs_decompressor squashfs_lzo_comp_ops = { + .init = lzo_init, + .free = lzo_free, + .decompress = lzo_uncompress, + .id =LZO_COMPRESSION , + .name ="lzo" , + .supported =1 +};include/linux/lzo.h +0
-0We already have
include/lzo.hwith the same content, no need to add it again.Sascha
--
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/5 fs: squashfs: port lz4 compression support from kernel
In reply to Enrico Jorns--- fs/squashfs/Kconfig | 13 +++++ fs/squashfs/Makefile | 1 + fs/squashfs/lz4_wrapper.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 fs/squashfs/lz4_wrapper.c
fs/squashfs/Kconfig +13 -0
@@ -17,6 +17,19 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_LZ4 + bool "Include support for LZ4 compressed file systems" + depends on FS_SQUASHFS + select LZ4_DECOMPRESS + help + Saying Y here includes support for reading Squashfs file systems + compressed with LZ4 compression. LZ4 compression is mainly + aimed at embedded systems with slower CPUs where the overheads + of zlib are too high. + + LZ4 is not the standard compression used in Squashfs and so most + file systems will be readable without selecting this option. + config SQUASHFS_LZO bool "Include support for LZO compressed file systems" default y
fs/squashfs/Makefile +1 -0
@@ -12,3 +12,4 @@ obj-y += namei.o obj-y += super.o obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o +obj-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o
fs/squashfs/lz4_wrapper.c new file +140 -0
140 lines not on this page · raw message
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/5 fs: squashfs: port zlib compression support from kernel
In reply to Enrico JornsAs this is the default compression method for squashfs, make this the default in kconfig selection, too
--- fs/squashfs/Kconfig | 20 ++++++- fs/squashfs/Makefile | 1 + fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 fs/squashfs/zlib_wrapper.c
fs/squashfs/Kconfig +19 -1
@@ -17,6 +17,19 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_ZLIB + bool "Include support for ZLIB compressed file systems" + depends on FS_SQUASHFS + select ZLIB + default y + help + ZLIB compression is the standard compression used by Squashfs + file systems. It offers a good trade-off between compression + achieved and the amount of CPU time and memory necessary to + compress and decompress. + + If unsure, say Y. + config SQUASHFS_LZ4 bool "Include support for LZ4 compressed file systems" depends on FS_SQUASHFS
@@ -30,9 +43,10 @@ config SQUASHFS_LZ4 LZ4 is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_LZO bool "Include support for LZO compressed file systems" - default y depends on FS_SQUASHFS select LZO_DECOMPRESS help
@@ -44,6 +58,8 @@ config SQUASHFS_LZO LZO is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default y
@@ -57,3 +73,5 @@ config SQUASHFS_XZ XZ is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + + If unsure, say N.
fs/squashfs/Makefile +1 -0
@@ -13,3 +13,4 @@ obj-y += super.o obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o obj-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o +obj-$(CONFIG_SQUASHFS_ZLIB) += zlib_wrapper.o
fs/squashfs/zlib_wrapper.c new file +132 -0
132 lines not on this page · raw message
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/5] fs: squashfs: port zlib compression support from kernel
Quoted 57 lines · Enrico Jorns
As this is the default compression method for squashfs, make this the default in kconfig selection, too
Signed-off-by Enrico Jorns <[email protected]>--- fs/squashfs/Kconfig | 20 ++++++- fs/squashfs/Makefile | 1 + fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 fs/squashfs/zlib_wrapper.cfs/squashfs/Kconfig +17
-1@@ -17,6 +17,19 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_ZLIB + bool "Include support for ZLIB compressed file systems" + depends on FS_SQUASHFS + select ZLIB + default y + help + ZLIB compression is the standard compression used by Squashfs + file systems. It offers a good trade-off between compression + achieved and the amount of CPU time and memory necessary to + compress and decompress. + + If unsure, say Y. + config SQUASHFS_LZ4 bool "Include support for LZ4 compressed file systems" depends on FS_SQUASHFS@@ -30,9 +43,10 @@ config SQUASHFS_LZ4 LZ4 is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_LZO bool "Include support for LZO compressed file systems" - default y depends on FS_SQUASHFS select LZO_DECOMPRESS help@@ -44,6 +58,8 @@ config SQUASHFS_LZO LZO is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default y
fs/squashfs/Kconfig config SQUASHFS_XZ · line 77
Quoted 5 lines
fs/squashfs/Kconfig +2
-0@@ -57,3 +73,5 @@ config SQUASHFS_XZ XZ is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + + If unsure, say N.
Here unrelated Kconfig entries are changed. Also in the end we get "default y" for SQUASHFS_XZ along with the help "If unsure, say N." which seems inconsistent.
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/5] fs: squashfs: port zlib compression support from kernel
Hi Enrico,
Quoted 59 lines · Sascha Hauer
Quoted 58 lines · Enrico Jorns
As this is the default compression method for squashfs, make this the default in kconfig selection, too
Signed-off-by Enrico Jorns <[email protected]>--- fs/squashfs/Kconfig | 20 ++++++- fs/squashfs/Makefile | 1 + fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 fs/squashfs/zlib_wrapper.cfs/squashfs/Kconfig +17
-1@@ -17,6 +17,19 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_ZLIB + bool "Include support for ZLIB compressed file systems" + depends on FS_SQUASHFS + select ZLIB + default y + help + ZLIB compression is the standard compression used by Squashfs + file systems. It offers a good trade-off between compression + achieved and the amount of CPU time and memory necessary to + compress and decompress. + + If unsure, say Y. + config SQUASHFS_LZ4 bool "Include support for LZ4 compressed file systems" depends on FS_SQUASHFS@@ -30,9 +43,10 @@ config SQUASHFS_LZ4 LZ4 is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_LZO bool "Include support for LZO compressed file systems" - default y depends on FS_SQUASHFS select LZO_DECOMPRESS help@@ -44,6 +58,8 @@ config SQUASHFS_LZO LZO is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default y@@ -57,3 +73,5 @@ config SQUASHFS_XZ
Quoted 8 lines
fs/squashfs/Kconfig config SQUASHFS_XZ · line 77
Quoted 4 lines
fs/squashfs/Kconfig +2
-0XZ is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + + If unsure, say N.Here unrelated
Kconfigentries are changed. Also in the end we get "default y" forSQUASHFS_XZalong with the help "If unsure, say N." which seems inconsistent.
Care to send v2?
@Sascha what is the plan as to the default compression selection? Leave XZ or set it to ZLIB? I'm open for both options.
Thanks.
Yegor
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 3/5] fs: squashfs: port zlib compression support from kernel
Quoted 71 lines · Yegor Yefremov
Hi Enrico,
Quoted 59 lines · Sascha Hauer
Quoted 58 lines · Enrico Jorns
As this is the default compression method for squashfs, make this the default in kconfig selection, too
Signed-off-by Enrico Jorns <[email protected]>--- fs/squashfs/Kconfig | 20 ++++++- fs/squashfs/Makefile | 1 + fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 fs/squashfs/zlib_wrapper.cfs/squashfs/Kconfig +17
-1@@ -17,6 +17,19 @@ menuconfig FS_SQUASHFS embedded systems where low overhead is needed. Further information and tools are available from http://squashfs.sourceforge.net. +config SQUASHFS_ZLIB + bool "Include support for ZLIB compressed file systems" + depends on FS_SQUASHFS + select ZLIB + default y + help + ZLIB compression is the standard compression used by Squashfs + file systems. It offers a good trade-off between compression + achieved and the amount of CPU time and memory necessary to + compress and decompress. + + If unsure, say Y. + config SQUASHFS_LZ4 bool "Include support for LZ4 compressed file systems" depends on FS_SQUASHFS@@ -30,9 +43,10 @@ config SQUASHFS_LZ4 LZ4 is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_LZO bool "Include support for LZO compressed file systems" - default y depends on FS_SQUASHFS select LZO_DECOMPRESS help@@ -44,6 +58,8 @@ config SQUASHFS_LZO LZO is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + If unsure, say N. + config SQUASHFS_XZ bool "Include support for XZ compressed file systems" default y@@ -57,3 +73,5 @@ config SQUASHFS_XZQuoted 8 lines
fs/squashfs/Kconfig config SQUASHFS_XZ · line 77
Quoted 4 lines
fs/squashfs/Kconfig +2
-0XZ is not the standard compression used in Squashfs and so most file systems will be readable without selecting this option. + + If unsure, say N.Here unrelated
Kconfigentries are changed. Also in the end we get "default y" forSQUASHFS_XZalong with the help "If unsure, say N." which seems inconsistent.
Quoted 1 line
Care to send v2?
Enrico is on holiday, so I just did.
Quoted 3 lines
@Sascha what is the plan as to the default compression selection? Leave XZ or set it to ZLIB? I'm open for both options.
In the new series I enabled zlib as default since this is what the kconfig help text says. For the others I chose a "Enable it when the algorithm is enabled anyway"
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/5 Add filetype and detection for squashfs images
In reply to Enrico JornsThis 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.
--- common/filetype.c | 4 ++++ fs/squashfs/squashfs.c | 1 + include/filetype.h | 1 + 3 files changed, 6 insertions(+)
common/filetype.c +4 -0
@@ -40,6 +40,7 @@ static const struct filetype_str filetype_str[] = { [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" }, + [filetype_squashfs] = { "Squashfs image", "squashfs" }, [filetype_gzip] = { "GZIP compressed", "gzip" }, [filetype_bzip2] = { "BZIP2 compressed", "bzip2" }, [filetype_oftree] = { "open firmware Device Tree flattened Binary", "dtb" },
@@ -278,6 +279,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (buf8[0 ] ==0xfd && buf8[1 ] ==0x37 && buf8[2 ] ==0x7a && buf8[3 ] ==0x58 && buf8[4 ] ==0x5a && buf8[5 ] ==0x00 )return filetype_xz_compressed; +if (buf8[0 ] =='h' && buf8[1 ] =='s' && buf8[2 ] =='q' && + buf8[3 ] =='s' ) +return filetype_squashfs;if (buf[0 ] ==be32_to_cpu (0xd00dfeed ))return filetype_oftree;if (strncmp (buf8,"ANDROID!" ,8 ) ==0 )
fs/squashfs/squashfs.c +1 -0
@@ -353,6 +353,7 @@ static struct fs_driver_d squashfs_driver = { .readdir = squashfs_readdir, .closedir = squashfs_closedir, .stat = squashfs_stat, + .type = filetype_squashfs, .drv = { .probe = squashfs_probe, .remove = squashfs_remove,
include/filetype.h +1 -0
@@ -16,6 +16,7 @@ enum filetype { filetype_uimage, filetype_ubi, filetype_jffs2, + filetype_squashfs, filetype_gzip, filetype_bzip2, filetype_oftree,
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 4/5] Add filetype and detection for squashfs images
Hi Enrico,
Quoted 8 lines · Enrico Jorns
This adds
filetype_squashfsto the list of known filetypes and adds a detection for squashfs files tofile_detect_type(). This currently matches on thehsqsstart sequence of an image file.Additionally, the newly introduced filetype is registered as the type of the
squashfs_driverwhich allows, for example, to mount squashfs without the need to specify a type parameter.
Quoted 5 lines
This changes enable booting a squashfs with the simple
bootcommand 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 :-)
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.
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?
How can I mount this volume in barebox step-by-step?
Thanks.
Yegor
Quoted 57 lines
Signed-off-by Enrico Jorns <[email protected]>--- common/filetype.c | 4 ++++ fs/squashfs/squashfs.c | 1 + include/filetype.h | 1 + 3 files changed, 6 insertions(+)common/filetype.c +4
-0@@ -40,6 +40,7 @@ static const struct filetype_str filetype_str[] = { [filetype_uimage] = { "U-Boot uImage", "u-boot" }, [filetype_ubi] = { "UBI image", "ubi" }, [filetype_jffs2] = { "JFFS2 image", "jffs2" }, + [filetype_squashfs] = { "Squashfs image", "squashfs" }, [filetype_gzip] = { "GZIP compressed", "gzip" }, [filetype_bzip2] = { "BZIP2 compressed", "bzip2" }, [filetype_oftree] = { "open firmware Device Tree flattened Binary", "dtb" },@@ -278,6 +279,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)if (buf8[0 ] ==0xfd && buf8[1 ] ==0x37 && buf8[2 ] ==0x7a && buf8[3 ] ==0x58 && buf8[4 ] ==0x5a && buf8[5 ] ==0x00 )return filetype_xz_compressed; +if (buf8[0 ] =='h' && buf8[1 ] =='s' && buf8[2 ] =='q' && + buf8[3 ] =='s' ) +return filetype_squashfs;if (buf[0 ] ==be32_to_cpu (0xd00dfeed ))return filetype_oftree;if (strncmp (buf8,"ANDROID!" ,8 ) ==0 )fs/squashfs/squashfs.c +1
-0@@ -353,6 +353,7 @@ static struct fs_driver_d squashfs_driver = { .readdir = squashfs_readdir, .closedir = squashfs_closedir, .stat = squashfs_stat, + .type = filetype_squashfs, .drv = { .probe = squashfs_probe, .remove = squashfs_remove,include/filetype.h +1
-1@@ -16,6 +16,7 @@ enum filetype { filetype_uimage, filetype_ubi, filetype_jffs2, + filetype_squashfs, filetype_gzip, filetype_bzip2, filetype_oftree, --2.9.3
Quoted 4 lines
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 4/5] Add filetype and detection for squashfs images
Hi Yegor,
Quoted 9 lines · Yegor Yefremov
Quoted 8 lines · Enrico Jorns
This adds
filetype_squashfsto the list of known filetypes and adds a detection for squashfs files tofile_detect_type(). This currently matches on thehsqsstart sequence of an image file.Additionally, the newly introduced filetype is registered as the type of the
squashfs_driverwhich allows, for example, to mount squashfs without the need to specify a type parameter.
Quoted 7 lines
Quoted 5 lines
This changes enable booting a squashfs with the simple
bootcommand 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 ;)
Quoted 6 lines
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..
Quoted 7 lines
My actions were:
ubiattach -p
/dev/mtd5
ubiblock --create/dev/ubi0_0
ubiupdatevol/dev/ubi0_0rootfs.squashfsCan I mount
/dev/ubi0_0via 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
Quoted 1 line
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
Signature · 10 lines
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 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Yegor Yefremov
Tested-byRe: [PATCH 4/5] Add filetype and detection for squashfs images
Hi Enrico,
Quoted 64 lines · Enrico Joerns
Hi Yegor,
Quoted 11 lines · Yegor Yefremov
Quoted 9 lines · Enrico Jorns
This adds
filetype_squashfsto the list of known filetypes and adds a detection for squashfs files tofile_detect_type(). This currently matches on thehsqsstart sequence of an image file.Additionally, the newly introduced filetype is registered as the type of the
squashfs_driverwhich allows, for example, to mount squashfs without the need to specify a type parameter.Quoted 8 lines
Quoted 5 lines
This changes enable booting a squashfs with the simple
bootcommand 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 ;)
Quoted 6 lines
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..
Quoted 7 lines
My actions were:
ubiattach -p
/dev/mtd5
ubiblock --create/dev/ubi0_0
ubiupdatevol/dev/ubi0_0rootfs.squashfsCan I mount
/dev/ubi0_0via 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 domount -o ro
/dev/ubiblock0_0/mnt/testQuoted 1 line
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.ubivolnamerootfs.squashfs mkdir/mnt/test
mount/dev/nand0.root.ubi.ubivolname/mnt/test
Quoted 6 lines
To boot via bootspec form a ubi containing a squashfs, you simply need to
boot
/dev/nand0.root.ubi.ubivolnameHope that helps.
Everything is working like a charm. I just had a problem with my ccache and hence both my kernel and barebox got compiled without squashfs support :-)
So here is my:
Thanks.
Yegor
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/5 fs: squashfs: append linux rootarg for ubi volume
In reply to Enrico JornsIf squashfs runs from an ubi volume, append appropriate root kernel options.
Note that ubiblock support is required in the kernel for that.
--- fs/squashfs/squashfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
fs/squashfs/squashfs.c +31 -0
@@ -9,12 +9,16 @@#include <linux/fs.h> #include <linux/stat.h> #include <linux/pagemap.h> +#include <linux/mtd/ubi.h> +#include <linux/mtd/mtd.h> #include "squashfs_fs.h" #include "squashfs_fs_sb.h" #include "squashfs_fs_i.h" #include "squashfs.h" +struct ubi_volume_desc ; +char *squashfs_devread (struct squashfs_sb_info *fs,int byte_offset,int byte_len) {
@@ -108,6 +112,31 @@ static struct inode *squashfs_findfile(struct super_block *sb,return NULL ; } +void squashfs_set_rootarg (struct squashfs_priv *priv,struct fs_device_d *fsdev) +{ +struct ubi_volume_desc *ubi_vol; +struct ubi_volume_info vi = {}; +struct ubi_device_info di = {}; +struct mtd_info *mtd; +char *str; + + ubi_vol =ubi_open_volume_cdev (fsdev->cdev,UBI_READONLY ); + +if (IS_ERR (ubi_vol)) +return ; + +ubi_get_volume_info (ubi_vol, &vi); +ubi_get_device_info (vi.ubi_num, &di); + mtd = di.mtd; + + str =basprintf ("root=/dev/ubiblock%d_%d ubi.mtd=%s ubi.block=%d,%d rootfstype=squashfs" , + vi.ubi_num, vi.vol_id, mtd->cdev.partname, vi.ubi_num, vi.vol_id); + +fsdev_set_linux_rootarg (fsdev, str); + +free (str); +} +static int squashfs_probe (struct device_d *dev) {struct fs_device_d *fsdev;
@@ -130,6 +159,8 @@ static int squashfs_probe(struct device_d *dev) goto err_out; } +squashfs_set_rootarg (priv, fsdev); +return 0 ; err_out:
Signature · 7 lines
2.9.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox