[LEDE-DEV] [PATCH 3/5] mtd: add fixwrgg command

Rafał Miłecki zajec5 at gmail.com
Sun Sep 11 14:16:48 PDT 2016


On 11 September 2016 at 18:12, Stijn Tintel <stijn at linux-ipv6.be> wrote:
> Based on fixseama.

And that way you could inherit some issues from seama support. So it's
not just your fault that much ;)


> @@ -53,6 +53,7 @@
>
>  #define TRX_MAGIC              0x48445230      /* "HDR0" */
>  #define SEAMA_MAGIC            0x5ea3a417
> +#define WRGG03_MAGIC           0x20080321
>
>  #if !defined(__BYTE_ORDER)
>  #error "Unknown byte order"
> @@ -61,9 +62,11 @@
>  #if __BYTE_ORDER == __BIG_ENDIAN
>  #define cpu_to_be32(x) (x)
>  #define be32_to_cpu(x) (x)
> +#define le32_to_cpu(x) bswap_32(x)
>  #elif __BYTE_ORDER == __LITTLE_ENDIAN
>  #define cpu_to_be32(x) bswap_32(x)
>  #define be32_to_cpu(x) bswap_32(x)
> +#define le32_to_cpu(x)  (x)
>  #else
>  #error "Unsupported endianness"
>  #endif

I'm not sure if this works at all with musl and without endian.h. See
my question at musl ML:
Using __BYTE_ORDER without endian.h
http://www.openwall.com/lists/musl/2015/06/22/3


> @@ -0,0 +1,189 @@
> +/*
> + * wrgg.c
> + *
> + * Copyright (C) 2005 Mike Baker
> + * Copyright (C) 2008 Felix Fietkau <nbd at nbd.name>
> + * Copyright (C) 2011-2012 Gabor Juhos <juhosg at openwrt.org>
> + * Copyright (C) 2016 Stijn Tintel <stijn at linux-ipv6.be>
> + *
> + * 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
> + * of the License, 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, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
> + */

Is this OK to include physical address of the foundation? I think it
has already changed once and I *think* it was recommended not to
include it.


> +#if __BYTE_ORDER == __BIG_ENDIAN
> +#define STORE32_LE(X)           ((((X) & 0x000000FF) << 24) | (((X) & 0x0000FF00) << 8) | (((X) & 0x00FF0000) >> 8) | (((X) & 0xFF000000) >> 24))
> +#elif __BYTE_ORDER == __LITTLE_ENDIAN
> +#define STORE32_LE(X)           (X)
> +#else
> +#error unknown endianness!
> +#endif

Same here: does it work?



More information about the Lede-dev mailing list