mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Re: Loading kernel issues
From: Juergen Borleis @ 2016-10-21  8:05 UTC (permalink / raw)
  To: Javier Fileiv; +Cc: barebox
In-Reply-To: <CABvwO2A6_mU3DzbWp9p=9NcvWeZGpni8GPL7x0qaLT2K1vXaog@mail.gmail.com>

Hi Javier,

On Friday 21 October 2016 09:54:04 Javier Fileiv wrote:
> shoul I short them between them, short them to GND or
> short them to VDD?

"short two of them" means between them. D2 and D3 for example...

Cheers,
Juergen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: gianluca @ 2016-10-21  8:02 UTC (permalink / raw)
  To: barebox
In-Reply-To: <CABvwO2A6_mU3DzbWp9p=9NcvWeZGpni8GPL7x0qaLT2K1vXaog@mail.gmail.com>

On 10/21/2016 09:54 AM, Javier Fileiv wrote:
> Thanks Juergen, shoul I short them between them, short them to GND or
> short them to VDD?
>

Short them together. Does not care if they are tied to GND or VCC, the 
results are surely invalid. ;-)

Best regards,
-- 
Eurek s.r.l.                          |
Electronic Engineering                | http://www.eurek.it
via Celletta 8/B, 40026 Imola, Italy  | Phone: +39-(0)542-609120
p.iva 00690621206 - c.f. 04020030377  | Fax:   +39-(0)542-609212

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: Javier Fileiv @ 2016-10-21  7:54 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox
In-Reply-To: <201610210953.45417.jbe@pengutronix.de>

Thanks Juergen, shoul I short them between them, short them to GND or
short them to VDD?

Thank you again

2016-10-21 9:53 GMT+02:00 Juergen Borleis <jbe@pengutronix.de>:
> Hi Javier,
>
> On Friday 21 October 2016 09:41:15 Javier Fileiv wrote:
>> I was looking to buy an ARM9 Jtag because it's what I
>> though... I would need a JTAG.
>>
>> Regarding shorting the data lines... do you know exactly what would I
>> need to do?
>
> Reading the datasheet of the used NAND device, find its datalines, find them on
> the Mini2440, configure the board to boot from NOR, short two of the eight
> datalines and power the board.
>
>> Regarding JTAG, which ones are the steps?
>
> Sorry, no idea. Never used it on Mini2440.
>
> Cheers,
> Juergen
>
> --
> Pengutronix e.K.                              | Juergen Borleis             |
> Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: Juergen Borleis @ 2016-10-21  7:53 UTC (permalink / raw)
  To: barebox; +Cc: Javier Fileiv
In-Reply-To: <CABvwO2C0MZGk2CC-v=67-Og7n4SZqSpdCfiZBz0QZTTfeckp1w@mail.gmail.com>

Hi Javier,

On Friday 21 October 2016 09:41:15 Javier Fileiv wrote:
> I was looking to buy an ARM9 Jtag because it's what I
> though... I would need a JTAG.
>
> Regarding shorting the data lines... do you know exactly what would I
> need to do?

Reading the datasheet of the used NAND device, find its datalines, find them on 
the Mini2440, configure the board to boot from NOR, short two of the eight 
datalines and power the board.

> Regarding JTAG, which ones are the steps?

Sorry, no idea. Never used it on Mini2440.

Cheers,
Juergen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: Javier Fileiv @ 2016-10-21  7:41 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox
In-Reply-To: <201610210939.59537.jbe@pengutronix.de>

Hello Juerguen, I was looking to buy an ARM9 Jtag because it's what I
though... I would need a JTAG.

Regarding shorting the data lines... do you know exactly what would I
need to do?

Regarding JTAG, which ones are the steps?


Thank you so much

2016-10-21 9:39 GMT+02:00 Juergen Borleis <jbe@pengutronix.de>:
> Hi Javier,
>
> On Thursday 20 October 2016 19:59:54 Javier Fileiv wrote:
>> ups... I think Ive broken everything... I just put at the end of the
>> env/config file "boot nand" and now is looping and at some point it
>> says "ERROR: out of memory".
>> Another thing... I changed vivibootloader in NOR for the barebox, and
>> even if I change to NOR it's looping again and again... What do I do?
>> HELP!
>
> Seems you configured your board into a brick. You now can boot from NOR and
> short some data lines pins at the NAND device to make barebox fail to read its
> environment from NAND and fall back to the built-in default environment
> without that loop.
> Or you need some JTAG equipment to make the SoC working again.
>
> Cheers,
> Juergen
>
> --
> Pengutronix e.K.                              | Juergen Borleis             |
> Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: Juergen Borleis @ 2016-10-21  7:39 UTC (permalink / raw)
  To: barebox; +Cc: Javier Fileiv
In-Reply-To: <CABvwO2ByvooXXYw+KKZSKvX0CPf43XABHn1-CUNd+qguCkRTeA@mail.gmail.com>

Hi Javier,

On Thursday 20 October 2016 19:59:54 Javier Fileiv wrote:
> ups... I think Ive broken everything... I just put at the end of the
> env/config file "boot nand" and now is looping and at some point it
> says "ERROR: out of memory".
> Another thing... I changed vivibootloader in NOR for the barebox, and
> even if I change to NOR it's looping again and again... What do I do?
> HELP!

Seems you configured your board into a brick. You now can boot from NOR and 
short some data lines pins at the NAND device to make barebox fail to read its 
environment from NAND and fall back to the built-in default environment 
without that loop.
Or you need some JTAG equipment to make the SoC working again.

Cheers,
Juergen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH] pinctrl: mvebu: fix a comment about mv78460
From: Sascha Hauer @ 2016-10-21  7:18 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox
In-Reply-To: <20161020190355.20181-1-u.kleine-koenig@pengutronix.de>

On Thu, Oct 20, 2016 at 09:03:55PM +0200, Uwe Kleine-König wrote:
> It's pin mpp57 that has function vdd/cpu2-3-pd
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pinctrl/mvebu/armada-xp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/pinctrl/mvebu/armada-xp.c b/drivers/pinctrl/mvebu/armada-xp.c
> index f1bc8b498aac..f2e6b0d38f7b 100644
> --- a/drivers/pinctrl/mvebu/armada-xp.c
> +++ b/drivers/pinctrl/mvebu/armada-xp.c
> @@ -16,7 +16,7 @@
>   * both have 67 MPP pins (more GPIOs and address lines for the memory
>   * bus mainly). The only difference between the mv78260 and the
>   * mv78460 in terms of pin muxing is the addition of two functions on
> - * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two
> + * pins 43 and 57 to access the VDD of the CPU2 and 3 (mv78260 has two
>   * cores, mv78460 has four cores).
>   */
>  
> -- 
> 2.8.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH 2/2] mtd: nand: nand_mxs: Fix readtotal calculation
From: Sascha Hauer @ 2016-10-21  7:18 UTC (permalink / raw)
  To: Christian Hemp; +Cc: barebox, Stefan Lengfeld
In-Reply-To: <1476970807-43811-2-git-send-email-c.hemp@phytec.de>

On Thu, Oct 20, 2016 at 03:40:07PM +0200, Christian Hemp wrote:
> The calculation of readtotal must be bit alligend. If not the bch core
> finds bit flips in every page, because readtotal is too small.
> This bug was mostly introduced since commit "51061a9 mtd: nand: nand_mxs:
> Add subpage read support".

Is this somehow related to:

http://lists.infradead.org/pipermail/linux-mtd/2016-June/068243.html

Or is this another topic?

Sascha

> 
> Tested with:
> nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
> 
> nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
> MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64
> 
> nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND
> 1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64
> 
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> ---
>  drivers/mtd/nand/nand_mxs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> index fe955e8..cba0bee 100644
> --- a/drivers/mtd/nand/nand_mxs.c
> +++ b/drivers/mtd/nand/nand_mxs.c
> @@ -728,15 +728,15 @@ static int __mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand
>  	uint32_t corrected = 0, failed = 0;
>  	uint8_t	*status;
>  	unsigned int  max_bitflips = 0;
> -	int i, ret, readtotal, nchunks, eccstrength, ecc_parity_size;
> +	int i, ret, readtotal, nchunks, eccstrength;
>  
>  	eccstrength = mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize);
>  
>  	readlen = roundup(readlen, MXS_NAND_CHUNK_DATA_CHUNK_SIZE);
>  	nchunks = mxs_nand_ecc_chunk_cnt(readlen);
> -	ecc_parity_size = 13 * eccstrength / 8;
> -	readtotal = MXS_NAND_METADATA_SIZE +
> -		(MXS_NAND_CHUNK_DATA_CHUNK_SIZE + ecc_parity_size) * nchunks;
> +	readtotal =  MXS_NAND_METADATA_SIZE;
> +	readtotal += MXS_NAND_CHUNK_DATA_CHUNK_SIZE * nchunks;
> +	readtotal += DIV_ROUND_UP(13 * eccstrength * nchunks, 8);
>  
>  	mxs_nand_config_bch(mtd, readtotal);
>  
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH 1/2] nand: imx6: Changed default NAND clock
From: Sascha Hauer @ 2016-10-21  7:11 UTC (permalink / raw)
  To: Christian Hemp; +Cc: barebox, Daniel Schultz
In-Reply-To: <1476970807-43811-1-git-send-email-c.hemp@phytec.de>

On Thu, Oct 20, 2016 at 03:40:06PM +0200, Christian Hemp wrote:
> From: Daniel Schultz <d.schultz@phytec.de>
> 
> The Barebox recognized false bad erase blocks while booting from a
> Spansion NAND (1). This error occurred due a to high clock. The
> Kernel sets the default NAND clock to 22Mhz. So, to fix this error and
> to be more identical with the Kernel, the Barebox should be too.

The timing is changed afterwards to a faster mode and the clock is
changed again. Does that work for you properly?

Sascha

> 
> 1: nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
> 
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> Tested-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> ---
>  drivers/mtd/nand/nand_mxs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> index 01aa063..fe955e8 100644
> --- a/drivers/mtd/nand/nand_mxs.c
> +++ b/drivers/mtd/nand/nand_mxs.c
> @@ -2145,7 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
>  
>  	if (mxs_nand_is_imx6(nand_info)) {
>  		clk_disable(nand_info->clk);
> -		clk_set_rate(nand_info->clk, 96000000);
> +		clk_set_rate(nand_info->clk, 22000000);
>  		clk_enable(nand_info->clk);
>  		nand_info->dma_channel_base = 0;
>  	} else {
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH] arm: Baltos: don't invoke baltos_read_eeprom in MLO
From: Sascha Hauer @ 2016-10-21  6:54 UTC (permalink / raw)
  To: yegorslists; +Cc: barebox
In-Reply-To: <1476961248-24425-1-git-send-email-yegorslists@googlemail.com>

On Thu, Oct 20, 2016 at 01:00:48PM +0200, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> EEPROM information is needed in barebox.bin in order to setup MACs and
> select appropriate DTB from kernel-fit.itb, so disable this initcall
> in MLO.
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  arch/arm/boards/vscom-baltos/board.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH 3/5] fs: squashfs: port zlib compression support from kernel
From: Sascha Hauer @ 2016-10-21  6:53 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: barebox, Enrico Jorns
In-Reply-To: <CAGm1_ksWRAVPV3JSzxZvap_B=O7oUFw7CV93druAFF8ZGir4Og@mail.gmail.com>

On Fri, Oct 21, 2016 at 08:04:35AM +0200, Yegor Yefremov wrote:
> Hi Enrico,
> 
> On Tue, Oct 4, 2016 at 9:40 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Tue, Oct 04, 2016 at 12:10:46PM +0200, Enrico Jorns wrote:
> >> As this is the default compression method for squashfs, make this the
> >> default in kconfig selection, too
> >>
> >> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> >> ---
> >>  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
> >>
> >> diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
> >> index d2de168..1cb1ac5 100644
> >> --- a/fs/squashfs/Kconfig
> >> +++ b/fs/squashfs/Kconfig
> >> @@ -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.
> >
> > 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.
> 
> Care to send v2?

Enrico is on holiday, so I just did.

> 
> @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

-- 
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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* [PATCH 6/6] fs: squashfs: Do not default on xz
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20161021065124.7328-1-s.hauer@pengutronix.de>

The default compression algorithm for squashfs is zlib, so only
do a 'default y' there. For xz change to 'default y if the algorithm
is enabled anyway' likke the other compression algorithms do.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/squashfs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 2e28e90..b84ef75 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -60,7 +60,7 @@ config SQUASHFS_LZO
 
 config SQUASHFS_XZ
 	bool "Include support for XZ compressed file systems"
-	default y
+	default y if XZ_DECOMPRESS
 	depends on FS_SQUASHFS
 	select XZ_DECOMPRESS
 	help
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 3/6] fs: squashfs: port zlib compression support from kernel
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161021065124.7328-1-s.hauer@pengutronix.de>

From: Enrico Jorns <ejo@pengutronix.de>

As this is the default compression method for squashfs, make this the
default in kconfig selection, too

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/squashfs/Kconfig        |  13 +++++
 fs/squashfs/Makefile       |   1 +
 fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 146 insertions(+)
 create mode 100644 fs/squashfs/zlib_wrapper.c

diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 9af34c0..2e28e90 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -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 if ZLIB
+	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"
 	default y if LZ4_DECOMPRESS
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 8590b09..7976e3f 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -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
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
new file mode 100644
index 0000000..f422515
--- /dev/null
+++ b/fs/squashfs/zlib_wrapper.c
@@ -0,0 +1,132 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ *
+ * 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.
+ *
+ * zlib_wrapper.c
+ */
+
+
+#include <linux/mutex.h>
+#include <linux/zlib.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+#include "page_actor.h"
+
+static void *zlib_init(struct squashfs_sb_info *dummy, void *buff)
+{
+	z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
+	if (stream == NULL)
+		goto failed;
+	stream->workspace = vmalloc(zlib_inflate_workspacesize());
+	if (stream->workspace == NULL)
+		goto failed;
+
+	return stream;
+
+failed:
+	ERROR("Failed to allocate zlib workspace\n");
+	kfree(stream);
+	return ERR_PTR(-ENOMEM);
+}
+
+
+static void zlib_free(void *strm)
+{
+	z_stream *stream = strm;
+
+	if (stream)
+		vfree(stream->workspace);
+	kfree(stream);
+}
+
+
+static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm,
+	char **bh, int b, int offset, int length,
+	struct squashfs_page_actor *output)
+{
+	int zlib_err, zlib_init = 0, k = 0;
+	z_stream *stream = strm;
+
+	stream->avail_out = PAGE_CACHE_SIZE;
+	stream->next_out = squashfs_first_page(output);
+	stream->avail_in = 0;
+
+	do {
+		if (stream->avail_in == 0 && k < b) {
+			int avail = min(length, msblk->devblksize - offset);
+			length -= avail;
+			stream->next_in = bh[k] + offset;
+			stream->avail_in = avail;
+			offset = 0;
+		}
+
+		if (stream->avail_out == 0) {
+			stream->next_out = squashfs_next_page(output);
+			if (stream->next_out != NULL)
+				stream->avail_out = PAGE_CACHE_SIZE;
+		}
+
+		if (!zlib_init) {
+			zlib_err = zlib_inflateInit(stream);
+			if (zlib_err != Z_OK) {
+				squashfs_finish_page(output);
+				goto out;
+			}
+			zlib_init = 1;
+		}
+
+		zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH);
+
+		if (stream->avail_in == 0 && k < b)
+			kfree(bh[k++]);
+	} while (zlib_err == Z_OK);
+
+	squashfs_finish_page(output);
+
+	if (zlib_err != Z_STREAM_END)
+		goto out;
+
+	zlib_err = zlib_inflateEnd(stream);
+	if (zlib_err != Z_OK)
+		goto out;
+
+	if (k < b)
+		goto out;
+
+	return stream->total_out;
+
+out:
+	for (; k < b; k++)
+		kfree(bh[k]);
+
+	return -EIO;
+}
+
+const struct squashfs_decompressor squashfs_zlib_comp_ops = {
+	.init = zlib_init,
+	.free = zlib_free,
+	.decompress = zlib_uncompress,
+	.id = ZLIB_COMPRESSION,
+	.name = "zlib",
+	.supported = 1
+};
+
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 1/6] fs: squashfs: port lzo compression support from kernel
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List; +Cc: Enrico Jorns

From: Enrico Jorns <ejo@pengutronix.de>

This ports lzo_wrapper from kernel code and adds some minimal adaptions
to make squashfs lzo compression work in barebox.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/squashfs/Kconfig       |  14 +++++
 fs/squashfs/Makefile      |   1 +
 fs/squashfs/lzo_wrapper.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 144 insertions(+)
 create mode 100644 fs/squashfs/lzo_wrapper.c

diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index dc25d93..7a6e5a2 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -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 if LZO_DECOMPRESS
+	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
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index c0d024c..447e15e 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -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
diff --git a/fs/squashfs/lzo_wrapper.c b/fs/squashfs/lzo_wrapper.c
new file mode 100644
index 0000000..834ee29
--- /dev/null
+++ b/fs/squashfs/lzo_wrapper.c
@@ -0,0 +1,129 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2010 LG Electronics
+ * Chan Jeong <chan.jeong@lge.com>
+ *
+ * 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 <common.h>
+#include <linux/mutex.h>
+#include <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
+};
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 2/6] fs: squashfs: port lz4 compression support from kernel
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161021065124.7328-1-s.hauer@pengutronix.de>

From: Enrico Jorns <ejo@pengutronix.de>

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/squashfs/Kconfig       |  14 +++++
 fs/squashfs/Makefile      |   1 +
 fs/squashfs/lz4_wrapper.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+)
 create mode 100644 fs/squashfs/lz4_wrapper.c

diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 7a6e5a2..9af34c0 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -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_LZ4
+	bool "Include support for LZ4 compressed file systems"
+	default y if LZ4_DECOMPRESS
+	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 if LZO_DECOMPRESS
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 447e15e..8590b09 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -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
diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
new file mode 100644
index 0000000..6ca6a32
--- /dev/null
+++ b/fs/squashfs/lz4_wrapper.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2013, 2014
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <types.h>
+#include <linux/mutex.h>
+#include <linux/lz4.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+#include "page_actor.h"
+
+#define LZ4_LEGACY	1
+
+struct lz4_comp_opts {
+	__le32 version;
+	__le32 flags;
+};
+
+struct squashfs_lz4 {
+	void *input;
+	void *output;
+};
+
+
+static void *lz4_comp_opts(struct squashfs_sb_info *msblk,
+	void *buff, int len)
+{
+	struct lz4_comp_opts *comp_opts = buff;
+
+	/* LZ4 compressed filesystems always have compression options */
+	if (comp_opts == NULL || len < sizeof(*comp_opts))
+		return ERR_PTR(-EIO);
+
+	if (le32_to_cpu(comp_opts->version) != LZ4_LEGACY) {
+		/* LZ4 format currently used by the kernel is the 'legacy'
+		 * format */
+		ERROR("Unknown LZ4 version\n");
+		return ERR_PTR(-EINVAL);
+	}
+
+	return NULL;
+}
+
+
+static void *lz4_init(struct squashfs_sb_info *msblk, void *buff)
+{
+	int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
+	struct squashfs_lz4 *stream;
+
+	stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+	if (stream == NULL)
+		goto failed;
+	stream->input = vmalloc(block_size);
+	if (stream->input == NULL)
+		goto failed2;
+	stream->output = vmalloc(block_size);
+	if (stream->output == NULL)
+		goto failed3;
+
+	return stream;
+
+failed3:
+	vfree(stream->input);
+failed2:
+	kfree(stream);
+failed:
+	ERROR("Failed to initialise LZ4 decompressor\n");
+	return ERR_PTR(-ENOMEM);
+}
+
+
+static void lz4_free(void *strm)
+{
+	struct squashfs_lz4 *stream = strm;
+
+	if (stream) {
+		vfree(stream->input);
+		vfree(stream->output);
+	}
+	kfree(stream);
+}
+
+
+static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
+	char **bh, int b, int offset, int length,
+	struct squashfs_page_actor *output)
+{
+	struct squashfs_lz4 *stream = strm;
+	void *buff = stream->input, *data;
+	int avail, i, bytes = length, res;
+	size_t dest_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 = lz4_decompress_unknownoutputsize(stream->input, length,
+					stream->output, &dest_len);
+	if (res)
+		return -EIO;
+
+	bytes = dest_len;
+	data = squashfs_first_page(output);
+	buff = stream->output;
+	while (data) {
+		if (bytes <= PAGE_CACHE_SIZE) {
+			memcpy(data, buff, bytes);
+			break;
+		}
+		memcpy(data, buff, PAGE_CACHE_SIZE);
+		buff += PAGE_CACHE_SIZE;
+		bytes -= PAGE_CACHE_SIZE;
+		data = squashfs_next_page(output);
+	}
+	squashfs_finish_page(output);
+
+	return dest_len;
+}
+
+const struct squashfs_decompressor squashfs_lz4_comp_ops = {
+	.init = lz4_init,
+	.comp_opts = lz4_comp_opts,
+	.free = lz4_free,
+	.decompress = lz4_uncompress,
+	.id = LZ4_COMPRESSION,
+	.name = "lz4",
+	.supported = 1
+};
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 5/6] fs: squashfs: append linux rootarg for ubi volume
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161021065124.7328-1-s.hauer@pengutronix.de>

From: Enrico Jorns <ejo@pengutronix.de>

If squashfs runs from an ubi volume, append appropriate root kernel
options.

Note that ubiblock support is required in the kernel for that.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/squashfs/squashfs.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index 6d04681..c4d0bac 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -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:
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 4/6] Add filetype and detection for squashfs images
From: Sascha Hauer @ 2016-10-21  6:51 UTC (permalink / raw)
  To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161021065124.7328-1-s.hauer@pengutronix.de>

From: Enrico Jorns <ejo@pengutronix.de>

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.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/filetype.c      | 4 ++++
 fs/squashfs/squashfs.c | 1 +
 include/filetype.h     | 1 +
 3 files changed, 6 insertions(+)

diff --git a/common/filetype.c b/common/filetype.c
index 4728f87..8d72933 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -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)
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index d00dee6..6d04681 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -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,
diff --git a/include/filetype.h b/include/filetype.h
index cde73c1..65bd6ef 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -16,6 +16,7 @@ enum filetype {
 	filetype_uimage,
 	filetype_ubi,
 	filetype_jffs2,
+	filetype_squashfs,
 	filetype_gzip,
 	filetype_bzip2,
 	filetype_oftree,
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: [PATCH 3/5] fs: squashfs: port zlib compression support from kernel
From: Yegor Yefremov @ 2016-10-21  6:04 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, Enrico Jorns
In-Reply-To: <20161004194020.vmmm35546csmbvnv@pengutronix.de>

Hi Enrico,

On Tue, Oct 4, 2016 at 9:40 PM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Tue, Oct 04, 2016 at 12:10:46PM +0200, Enrico Jorns wrote:
>> As this is the default compression method for squashfs, make this the
>> default in kconfig selection, too
>>
>> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
>> ---
>>  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
>>
>> diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
>> index d2de168..1cb1ac5 100644
>> --- a/fs/squashfs/Kconfig
>> +++ b/fs/squashfs/Kconfig
>> @@ -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.
>
> 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.

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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* [PATCH] pinctrl: mvebu: fix a comment about mv78460
From: Uwe Kleine-König @ 2016-10-20 19:03 UTC (permalink / raw)
  To: barebox

It's pin mpp57 that has function vdd/cpu2-3-pd

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pinctrl/mvebu/armada-xp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mvebu/armada-xp.c b/drivers/pinctrl/mvebu/armada-xp.c
index f1bc8b498aac..f2e6b0d38f7b 100644
--- a/drivers/pinctrl/mvebu/armada-xp.c
+++ b/drivers/pinctrl/mvebu/armada-xp.c
@@ -16,7 +16,7 @@
  * both have 67 MPP pins (more GPIOs and address lines for the memory
  * bus mainly). The only difference between the mv78260 and the
  * mv78460 in terms of pin muxing is the addition of two functions on
- * pins 43 and 56 to access the VDD of the CPU2 and 3 (mv78260 has two
+ * pins 43 and 57 to access the VDD of the CPU2 and 3 (mv78260 has two
  * cores, mv78460 has four cores).
  */
 
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: Loading kernel issues
From: Javier Fileiv @ 2016-10-20 17:59 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox
In-Reply-To: <CABvwO2DgadsiAhdVaSb+teN8MPJMwpLNF0RXWyvOf98=hOSo9Q@mail.gmail.com>

ups... I think Ive broken everything... I just put at the end of the
env/config file "boot nand" and now is looping and at some point it
says "ERROR: out of memory".
Another thing... I changed vivibootloader in NOR for the barebox, and
even if I change to NOR it's looping again and again... What do I do?
HELP!

2016-10-20 11:17 GMT+02:00 Javier Fileiv <javier.fileiv@gmail.com>:
> Thank you very much.... maybe I just to put on /env/config a "boot nand" line...
>
> I'll try it.
>
> Regards
>
> 2016-10-20 11:13 GMT+02:00 Juergen Borleis <jbe@pengutronix.de>:
>> Hi Javier,
>>
>> On Wednesday 19 October 2016 20:18:38 Javier Fileiv wrote:
>>> just in case...my /env/config as well
>>> [...]
>>
>> Sorry, no idea. I do not even have the hardware anymore, so I cannot test it.
>>
>> Keep a look into the "env/bin/boot" script, what it tries to do with the
>> configuration from your "env/config". Maybe it could help you to make it work
>> again.
>>
>> Cheers,
>> Juergen
>>
>> --
>> Pengutronix e.K.                              | Juergen Borleis             |
>> Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* [PATCH 1/2] nand: imx6: Changed default NAND clock
From: Christian Hemp @ 2016-10-20 13:40 UTC (permalink / raw)
  To: barebox; +Cc: Daniel Schultz

From: Daniel Schultz <d.schultz@phytec.de>

The Barebox recognized false bad erase blocks while booting from a
Spansion NAND (1). This error occurred due a to high clock. The
Kernel sets the default NAND clock to 22Mhz. So, to fix this error and
to be more identical with the Kernel, the Barebox should be too.

1: nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
S34ML08G2), 1024MiB, page size: 2048, OOB size: 128

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Tested-by: Stefan Lengfeld <s.lengfeld@phytec.de>
Signed-off-by: Christian Hemp <c.hemp@phytec.de>
---
 drivers/mtd/nand/nand_mxs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index 01aa063..fe955e8 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -2145,7 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
 
 	if (mxs_nand_is_imx6(nand_info)) {
 		clk_disable(nand_info->clk);
-		clk_set_rate(nand_info->clk, 96000000);
+		clk_set_rate(nand_info->clk, 22000000);
 		clk_enable(nand_info->clk);
 		nand_info->dma_channel_base = 0;
 	} else {
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 2/2] mtd: nand: nand_mxs: Fix readtotal calculation
From: Christian Hemp @ 2016-10-20 13:40 UTC (permalink / raw)
  To: barebox; +Cc: Stefan Lengfeld
In-Reply-To: <1476970807-43811-1-git-send-email-c.hemp@phytec.de>

The calculation of readtotal must be bit alligend. If not the bch core
finds bit flips in every page, because readtotal is too small.
This bug was mostly introduced since commit "51061a9 mtd: nand: nand_mxs:
Add subpage read support".

Tested with:
nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
S34ML08G2), 1024MiB, page size: 2048, OOB size: 128

nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64

nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND
1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64

Signed-off-by: Christian Hemp <c.hemp@phytec.de>
Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
---
 drivers/mtd/nand/nand_mxs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
index fe955e8..cba0bee 100644
--- a/drivers/mtd/nand/nand_mxs.c
+++ b/drivers/mtd/nand/nand_mxs.c
@@ -728,15 +728,15 @@ static int __mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand
 	uint32_t corrected = 0, failed = 0;
 	uint8_t	*status;
 	unsigned int  max_bitflips = 0;
-	int i, ret, readtotal, nchunks, eccstrength, ecc_parity_size;
+	int i, ret, readtotal, nchunks, eccstrength;
 
 	eccstrength = mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize);
 
 	readlen = roundup(readlen, MXS_NAND_CHUNK_DATA_CHUNK_SIZE);
 	nchunks = mxs_nand_ecc_chunk_cnt(readlen);
-	ecc_parity_size = 13 * eccstrength / 8;
-	readtotal = MXS_NAND_METADATA_SIZE +
-		(MXS_NAND_CHUNK_DATA_CHUNK_SIZE + ecc_parity_size) * nchunks;
+	readtotal =  MXS_NAND_METADATA_SIZE;
+	readtotal += MXS_NAND_CHUNK_DATA_CHUNK_SIZE * nchunks;
+	readtotal += DIV_ROUND_UP(13 * eccstrength * nchunks, 8);
 
 	mxs_nand_config_bch(mtd, readtotal);
 
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] arm: Baltos: don't invoke baltos_read_eeprom in MLO
From: yegorslists @ 2016-10-20 11:00 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

EEPROM information is needed in barebox.bin in order to setup MACs and
select appropriate DTB from kernel-fit.itb, so disable this initcall
in MLO.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 arch/arm/boards/vscom-baltos/board.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boards/vscom-baltos/board.c b/arch/arm/boards/vscom-baltos/board.c
index dc08ed5..fea992d 100644
--- a/arch/arm/boards/vscom-baltos/board.c
+++ b/arch/arm/boards/vscom-baltos/board.c
@@ -47,6 +47,7 @@ static struct omap_barebox_part baltos_barebox_part = {
 	.nand_size = 0x1e0000,
 };
 
+#ifndef CONFIG_OMAP_BUILD_IFT
 struct bsp_vs_hwparam {
 	uint32_t Magic;
 	uint32_t HwRev;
@@ -111,6 +112,7 @@ static int baltos_read_eeprom(void)
 	return 0;
 }
 environment_initcall(baltos_read_eeprom);
+#endif
 
 static int baltos_devices_init(void)
 {
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: Loading kernel issues
From: Javier Fileiv @ 2016-10-20  9:17 UTC (permalink / raw)
  To: Juergen Borleis; +Cc: barebox
In-Reply-To: <201610201113.08285.jbe@pengutronix.de>

Thank you very much.... maybe I just to put on /env/config a "boot nand" line...

I'll try it.

Regards

2016-10-20 11:13 GMT+02:00 Juergen Borleis <jbe@pengutronix.de>:
> Hi Javier,
>
> On Wednesday 19 October 2016 20:18:38 Javier Fileiv wrote:
>> just in case...my /env/config as well
>> [...]
>
> Sorry, no idea. I do not even have the hardware anymore, so I cannot test it.
>
> Keep a look into the "env/bin/boot" script, what it tries to do with the
> configuration from your "env/config". Maybe it could help you to make it work
> again.
>
> Cheers,
> Juergen
>
> --
> Pengutronix e.K.                              | Juergen Borleis             |
> Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: Loading kernel issues
From: Juergen Borleis @ 2016-10-20  9:13 UTC (permalink / raw)
  To: Javier Fileiv; +Cc: barebox
In-Reply-To: <CABvwO2BZoNwdZJsWmygcjsAUXsmexDPU5cTpEoVd-sW9y5T_Rw@mail.gmail.com>

Hi Javier,

On Wednesday 19 October 2016 20:18:38 Javier Fileiv wrote:
> just in case...my /env/config as well
> [...]

Sorry, no idea. I do not even have the hardware anymore, so I cannot test it.

Keep a look into the "env/bin/boot" script, what it tries to do with the 
configuration from your "env/config". Maybe it could help you to make it work 
again.

Cheers,
Juergen

-- 
Pengutronix e.K.                              | Juergen Borleis             |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox