Giter Site home page Giter Site logo

Comments (10)

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
If the vendor distributed the GPL sources for the firmware in question, check 
their
tools to see which version of cramfs is being used, and if its been modified or 
not.
It may be a different version or utilize a different compression algorithm.

Original comment by [email protected] on 19 Aug 2008 at 4:00

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Hi, I find all file referd to cramfs from sdk kit.

I' attached it.

At the first look  the compression looks like gzip but ther's also lzma option.

I compare the default cramfs super-block and the openrg-version.

I found some differences:

1]default cramfs :

#ifndef _CRAMFS_FS_SB
#define _CRAMFS_FS_SB

/*
* cramfs super-block data in memory
*/
struct cramfs_sb_info {
                        unsigned long magic;
                        unsigned long size;
                        unsigned long blocks;
                        unsigned long files;
                        unsigned long flags;
};

static inline struct cramfs_sb_info *CRAMFS_SB(struct super_block *sb)
{
        return sb->s_fs_info;
}

#endif

struct cramfs_info {
        __u32 crc;
        __u32 edition;
        __u32 blocks;
        __u32 files;
};

/*
* Superblock information at the beginning of the FS.
*/
struct cramfs_super {
        __u32 magic;                    /* 0x28cd3d45 - random number */
        __u32 size;                     /* length in bytes */
        __u32 flags;                    /* feature flags */
        __u32 future;                   /* reserved for future use */
        __u8 signature[16];             /* "Compressed ROMFS" */
        struct cramfs_info fsid;        /* unique filesystem info */
        __u8 name[16];                  /* user-defined name */
        struct cramfs_inode root;       /* root inode data */
};

/*
* Feature flags
*
* 0x00000000 - 0x000000ff: features that work for all past kernels
* 0x00000100 - 0xffffffff: features that don't work for past kernels
*/
#define CRAMFS_FLAG_FSID_VERSION_2      0x00000001      /* fsid version #2 */
#define CRAMFS_FLAG_SORTED_DIRS         0x00000002      /* sorted dirs */
#define CRAMFS_FLAG_HOLES               0x00000100      /* support for holes */
#define CRAMFS_FLAG_WRONG_SIGNATURE     0x00000200      /* reserved */
#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400      /* shifted root fs */

/*
/*
* Valid values in super.flags.  Currently we refuse to mount
* if (flags & ~CRAMFS_SUPPORTED_FLAGS).  Maybe that should be
* changed to test super.future instead.
*/
#define CRAMFS_SUPPORTED_FLAGS  ( 0x000000ff \
                                | CRAMFS_FLAG_HOLES \
                                | CRAMFS_FLAG_WRONG_SIGNATURE \
                                | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET )


2]openrg-cramfs super-block

/*
* cramfs super-block data in memory
*/
struct cramfs_sb_info {
                        unsigned long magic;
                        unsigned long size;
                        unsigned long blocks;
                        unsigned long files;
                        unsigned long flags;
                        unsigned long sub_type;
                        void *uncomp_buffer;
                        int uncomp_blk_offset;
                        int uncomp_blk_data_size;
};

static inline struct cramfs_sb_info *CRAMFS_SB(struct super_block *sb)
{
        return sb->s_fs_info;
}

#endif

struct cramfs_info {
        u32 crc;
        u32 edition;
        u32 blocks;
        u32 files;
};

/*
* Superblock information at the beginning of the FS.
*/
struct cramfs_super {
        u32 magic;                      /* 0x28cd3d45 - random number */
        u32 size;                       /* length in bytes */
        u32 flags;                      /* feature flags */
        u32 future;                     /* reserved for future use */
        u8 signature[16];               /* "Compressed ROMFS" */
        struct cramfs_info fsid;        /* unique filesystem info */
        u8 name[16];                    /* user-defined name */
        struct cramfs_inode root;       /* root inode data */
};

/*
* Feature flags
*
* 0x00000000 - 0x000000ff: features that work for all past kernels
* 0x00000100 - 0xffffffff: features that don't work for past kernels
*/
#define CRAMFS_FLAG_FSID_VERSION_2      0x00000001      /* fsid version #2 */
#define CRAMFS_FLAG_SORTED_DIRS         0x00000002      /* sorted dirs */
#define CRAMFS_FLAG_HOLES               0x00000100      /* support for holes */
#define CRAMFS_FLAG_WRONG_SIGNATURE     0x00000200      /* reserved */
#define CRAMFS_FLAG_SHIFTED_ROOT_OFFSET 0x00000400      /* shifted root fs */
#define CRAMFS_FLAG_BLKSZ_MASK          0x00003800      /* Block size mask */
#define CRAMFS_FLAG_COMP_METHOD_MASK    0x0000C000      /* Compression method
                                                         * mask */

#define CRAMFS_FLAG_BLKSZ_SHIFT 11
#define CRAMFS_FLAG_COMP_METHOD_SHIFT 14

#define CRAMFS_FLAG_COMP_METHOD_NONE 0
#define CRAMFS_FLAG_COMP_METHOD_GZIP 1
#define CRAMFS_FLAG_COMP_METHOD_LZMA 2

/*
* Valid values in super.flags.  Currently we refuse to mount
* if (flags & ~CRAMFS_SUPPORTED_FLAGS).  Maybe that should be
* changed to test super.future instead.
*/
#define CRAMFS_SUPPORTED_FLAGS  ( 0x000000ff \
                                | CRAMFS_FLAG_HOLES \
                                | CRAMFS_FLAG_WRONG_SIGNATURE \
                                | CRAMFS_FLAG_SHIFTED_ROOT_OFFSET \
                                | CRAMFS_FLAG_BLKSZ_MASK \
                                | CRAMFS_FLAG_COMP_METHOD_MASK)


It seams that differ for the following flags:

#define CRAMFS_FLAG_BLKSZ_MASK          0x00003800      /* Block size mask */
#define CRAMFS_FLAG_COMP_METHOD_MASK    0x0000C000      /* Compression method * 
mask */

Original comment by [email protected] on 19 Aug 2008 at 4:50

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
The sdk files.

Original comment by [email protected] on 19 Aug 2008 at 4:51

Attachments:

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Thanks for the update. I'm sorry it has taken me so long to notice your 
changes. If 
and when I get a chance, I'll work on adding support for these type of cramfs 
images.  
From what you've provided, it should be easy to add in the support. If anyone 
gets to 
it before I do, feel free to submit patches and I'll get them added on in.

Original comment by [email protected] on 11 Sep 2008 at 5:43

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Hello, I get the same problem on another openrg firmware. Did you make an 
update to
your tool yet ?

Original comment by [email protected] on 15 Feb 2009 at 10:04

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Same problem here.

Original comment by zibree on 1 May 2009 at 12:12

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
[deleted comment]

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I am able to extract files from an openrg LZA-cramfs with the latest SVN code, 
but
all these files contain are zeros. It seems that the LZMA decompression does 
not work.

Original comment by [email protected] on 28 Jun 2009 at 12:18

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
I downloaded the GPL part of an openRG router 
(http://broadband.adbglobal.com/web/support-area/gpl-code/default.page) and 
found that the compression algorithm is based on an old lzma sdk, modified by 
Jungo/OpenRG team.

I created an lzma-uncramfs program, based on cramfs, implementing this 
compression algorithnm and able to extract files from the openrg cramfs image; 
I attach this program with the modified lzma sdk needed to compile it.

Original comment by [email protected] on 23 Feb 2011 at 2:59

Attachments:

from firmware-mod-kit.

GoogleCodeExporter avatar GoogleCodeExporter commented on June 24, 2024
Thanks digiampietro, added this to FMK!

Original comment by [email protected] on 5 Sep 2011 at 3:45

  • Changed state: Fixed

from firmware-mod-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.