Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Release 1.4 cramfs

Altera_Forum
Honored Contributor II
1,053 Views

Greetings, 

 

Between version 1.3 and 1.4 there were some several changes to cramfs ... and unfortunately, there is 

some pretty broken code in cramfs/inode.c. Specifically, some new bit manipulation macros 

were added that hose the fs from the get-go. Anyway, for those who use cramfs, here&#39;s a quick fix:<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

#if defined(CRAMFS_LOBOTOMY_COMPLETE) 

/* severe brain damage -- do not use */# define CRAMFS_16(x) le16_to_cpu(x)# define CRAMFS_24(x) ((le32_to_cpu(x)) >> 8)# define CRAMFS_32(x) le32_to_cpu(x) 

# define CRAMFS_GET_NAMELEN(x) (((u8*)(x))[8] & 0x3f)# define CRAMFS_GET_OFFSET(x) ((CRAMFS_24(((u32*)(x))[2] & 0xffffff) << 2) | 

  ((((u32*)(x))[2] & 0xc0000000) >> 30)) 

 

#else 

/* work with nios ii 5.0 -- assume nothing more ;-) */# define CRAMFS_16(x) le16_to_cpu(x)# define CRAMFS_24(x) ((le32_to_cpu(x)) & 0x00ffffff)# define CRAMFS_32(x) le32_to_cpu(x) 

# define CRAMFS_GET_NAMELEN(x) (le32_to_cpu(((u32*)(x))[2]) & 0x03f)# define CRAMFS_GET_OFFSET(x) (le32_to_cpu(((u32*)(x))[2]) >> 6)# endif[/b] 

--- Quote End ---  

 

Regards, 

--Scott
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
272 Views

Thanks scott!

0 Kudos
Reply