linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* cramfs mpc8xx 2.4.18
@ 2004-02-13 18:32 Lokesh Kumar
  2004-02-13 19:59 ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Lokesh Kumar @ 2004-02-13 18:32 UTC (permalink / raw)
  To: linuxppc-embedded


Hi Gurus,

I have a custom board running 2.4.18 with initrd. Now, I want to make cramfs
as root filesystem. When I built cramfs support in the kernel and gave it
root=/dev/mtdblock1 (where my cramfs in correct endian order is stored on
flash) rootfstype=cramfs, the kernel hangs. MTD support is built in the
kernel. If I build cramfs as module, then boot my kernel with initrd (ext2)
and then mount it (on say /mnt), I can read cramfs correctly.

I also looked at rd.c file in drivers/block and noticed that this is does
not have cramfs initrd support. Do I need this? What am I doing wrong?
Please help

Lokesh Kumar


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: cramfs mpc8xx 2.4.18
@ 2004-02-13 19:31 Ruhland, Paul
  0 siblings, 0 replies; 8+ messages in thread
From: Ruhland, Paul @ 2004-02-13 19:31 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1552 bytes --]

Without more information I can't really tell what is wrong.  Did you create
an mtd partition map for your flash (need this to use the mtdblock devices)?

I used to mount cramfs images from flash, but ran into problems every so
often with the cramfs root not decompressing correctly while reprogramming
other sectors.  So I switched to mounting the cramfs image as a ramdisk.
You just build the cramfs image as usual but mount is as a ramdisk when
booting the kernel (I use u-boot so I used mkimage to prep it for that
also).

I've attached a patch against linuxppc_2_4_devel (2.4.23) which adds this
capability, if your interested.  It simply changes the ramdisk blocksize to
match cramfs blocksize if its mounting a cramfs root image.


-----Original Message-----
From: Lokesh Kumar [mailto:kumar.lokesh@wrx-us.com]
Sent: Friday, February 13, 2004 1:33 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: cramfs mpc8xx 2.4.18



Hi Gurus,

I have a custom board running 2.4.18 with initrd. Now, I want to make cramfs
as root filesystem. When I built cramfs support in the kernel and gave it
root=/dev/mtdblock1 (where my cramfs in correct endian order is stored on
flash) rootfstype=cramfs, the kernel hangs. MTD support is built in the
kernel. If I build cramfs as module, then boot my kernel with initrd (ext2)
and then mount it (on say /mnt), I can read cramfs correctly.

I also looked at rd.c file in drivers/block and noticed that this is does
not have cramfs initrd support. Do I need this? What am I doing wrong?
Please help

Lokesh Kumar




[-- Attachment #2: linuxppc_2_4_devel-cramfs_ramdisk.patch --]
[-- Type: application/octet-stream, Size: 2085 bytes --]

diff -u -p -r1.1.1.1 -r1.2
--- drivers/block/rd.c	11 Jan 2004 17:36:58 -0000	1.1.1.1
+++ drivers/block/rd.c	16 Jan 2004 21:53:25 -0000	1.2
@@ -73,6 +73,8 @@ int initrd_in_ram;
 int initrd_below_start_ok;
 #endif
 
+void rd_adjust_blocksize( unsigned int new_blocksize );
+
 /* Various static variables go here.  Most are used only in the RAM disk code.
  */
 
@@ -476,6 +478,28 @@ static int __init rd_init (void)
 	return 0;
 }
 
+/*
+ * cramfs probably has a different blocksize--adjust the
+ * ramdisk's block size to accomodate
+ * FIXME: should have a way to determine the cramfs
+ * blocksize (if it's going to be variable.....)
+ */
+void rd_adjust_blocksize( unsigned int new_blocksize )
+{
+	if (rd_blocksize != new_blocksize) {
+		int i;
+
+		rd_blocksize = new_blocksize;
+		for (i = 0; i < NUM_RAMDISKS; i++) {
+			rd_hardsec[i] = rd_blocksize;
+			rd_blocksizes[i] = rd_blocksize;
+		}
+		printk(KERN_NOTICE "RAMDISK: overriding ramdisk block "
+				"size to %d for cramfs filesystem\n",
+				rd_blocksize);
+	}
+}
+
 module_init(rd_init);
 module_exit(rd_cleanup);

diff -u -p -r1.1.1.1 -r1.2
--- init/do_mounts.c	11 Jan 2004 17:36:00 -0000	1.1.1.1
+++ init/do_mounts.c	16 Jan 2004 21:50:43 -0000	1.2
@@ -33,6 +33,9 @@ extern asmlinkage long sys_mknod(const c
 extern asmlinkage long sys_umount(char *name, int flags);
 extern asmlinkage long sys_ioctl(int fd, int cmd, unsigned long arg);
 
+/* to change ramdisk blocksize (ie. for cramfs) */
+extern asmlinkage void rd_adjust_blocksize( unsigned int new_blocksize );
+
 #ifdef CONFIG_BLK_DEV_INITRD
 unsigned int real_root_dev;	/* do_proc_dointvec cannot handle kdev_t */
 static int __initdata mount_initrd = 1;
@@ -531,6 +534,8 @@ identify_ramdisk_image(int fd, int start
 		printk(KERN_NOTICE
 		       "RAMDISK: cramfs filesystem found at block %d\n",
 		       start_block);
+		/* cramfs has blocksize of PAGE_CACHE_SIZE */
+		rd_adjust_blocksize(PAGE_CACHE_SIZE);
 		nblocks = (cramfsb->size + BLOCK_SIZE - 1) >> BLOCK_SIZE_BITS;
 		goto done;
 	}


^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: cramfs mpc8xx 2.4.18
@ 2004-02-13 19:42 Ruhland, Paul
  0 siblings, 0 replies; 8+ messages in thread
From: Ruhland, Paul @ 2004-02-13 19:42 UTC (permalink / raw)
  To: linuxppc-embedded


Just want to add:

The code in that patch was adapted for the 2.4.23 kernel from the
'linux-2.4' srctree on the denx site (see 'linux-2.4/drivers/block/rd.c').

-----Original Message-----
From: Ruhland, Paul [mailto:PRuhland@microwavedata.com]
Sent: Friday, February 13, 2004 2:31 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: RE: cramfs mpc8xx 2.4.18


Without more information I can't really tell what is wrong.  Did you create
an mtd partition map for your flash (need this to use the mtdblock devices)?

I used to mount cramfs images from flash, but ran into problems every so
often with the cramfs root not decompressing correctly while reprogramming
other sectors.  So I switched to mounting the cramfs image as a ramdisk.
You just build the cramfs image as usual but mount is as a ramdisk when
booting the kernel (I use u-boot so I used mkimage to prep it for that
also).

I've attached a patch against linuxppc_2_4_devel (2.4.23) which adds this
capability, if your interested.  It simply changes the ramdisk blocksize to
match cramfs blocksize if its mounting a cramfs root image.


-----Original Message-----
From: Lokesh Kumar [mailto:kumar.lokesh@wrx-us.com]
Sent: Friday, February 13, 2004 1:33 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: cramfs mpc8xx 2.4.18



Hi Gurus,

I have a custom board running 2.4.18 with initrd. Now, I want to make cramfs
as root filesystem. When I built cramfs support in the kernel and gave it
root=/dev/mtdblock1 (where my cramfs in correct endian order is stored on
flash) rootfstype=cramfs, the kernel hangs. MTD support is built in the
kernel. If I build cramfs as module, then boot my kernel with initrd (ext2)
and then mount it (on say /mnt), I can read cramfs correctly.

I also looked at rd.c file in drivers/block and noticed that this is does
not have cramfs initrd support. Do I need this? What am I doing wrong?
Please help

Lokesh Kumar


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: cramfs mpc8xx 2.4.18
@ 2004-02-28  0:03 Lokesh Kumar
  2004-02-29 16:31 ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Lokesh Kumar @ 2004-02-28  0:03 UTC (permalink / raw)
  To: 'Wolfgang Denk', Lokesh Kumar; +Cc: linuxppc-embedded


Sorry gentlemen,
I got stuck with some other issues, but I am back to my problem. Here is
what is happening.

booting image at 00400000 ...
   Image Name:   Linux Kernel
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    554008 Bytes = 541 kB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Current stack ends at 0x01FB9C10 => set upper limit to 0x00800000
## cmdline at 0x007FFF00 ... 0x007FFF39
bd address  = 0x01FB9FC4
memstart    = 0x00000000
memsize     = 0x02000000
flashstart  = 0xF8000000
flashsize   = 0x00800000
flashoffset = 0x00020200
sramstart   = 0x00000000
sramsize    = 0x00000000
immr_base   = 0x80000000
bootflags   = 0x00000001
intfreq     = 49.152 MHz
busfreq     = 49.152 MHz
ethaddr     = 00:50:C2:02:C4:02
IP addr     = 192.4.88.20
baudrate    =   9600 bps
No initrd
## Transferring control to Linux (at address 00000000) ...
Linux version 2.4.18 (root@test) (gcc version 2.95.3 20010315 (release))
#437 Fri Feb 27 19:11:03 EST 2004
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: root=/dev/mtdblock1 rootfstype=cramfs console=ttyS0,
9600
Decrementer Frequency = 184320000/60
Calibrating delay loop... 48.94 BogoMIPS
Memory: 30688k available (1052k kernel code, 408k data, 40k init, 0k
highmem)
Dentry-cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode-cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer-cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Starting kswapd
CPM UART driver version 0.03
ttyS00 at 0x0280 is a SMC
ttyS01 at 0x0380 is a SMC
ttyS02 at 0x0000 is a SCC
pty: 256 Unix98 ptys configured
block: 64 slots per queue, batch=16
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
eth0: FEC ENET Version 0.2, FEC irq 5, addr 00:50:c2:02:c4:02
PPP generic driver version 2.4.1
PPP Deflate Compression module registered
init_wrx_mtd: chip probing count 0
  Feature/Command Support: CE000000
     - Chip Erase:         unsupported
     - Suspend Erase:      unsupported
     - Suspend Program:    unsupported
     - Legacy Lock/Unlock: unsupported
     - Queued Erase:       unsupported
     - Instant block lock: unsupported
     - Protection Bits:    unsupported
     - Page-mode read:     unsupported
     - Synchronous read:   unsupported
     - Unknown Bit 19:      supported
     - Unknown Bit 1A:      supported
     - Unknown Bit 1B:      supported
     - Unknown Bit 1E:      supported
     - Unknown Bit 1F:      supported
  Supported functions after Suspend: 01
     - Program after Erase Suspend: supported
  Block Status Register Mask: 0100
     - Lock Bit Active:      no
     - Valid Bit Active:     no
     - Unknown Bit 8 Active: yes
  Vcc Logic Supply Optimum Program/Erase Voltage: 0.3 V
init_wrx_mtd: bank1, name:WRXFLASH0, size:8388608bytes
WRX flash0: Using Static image partition definition
Creating 2 MTD partitions on "WRXFLASH0":
0x00000000-0x00040000 : "ppcboot"
mtd: Giving out device 0 to ppcboot
0x00040000-0x007e0000 : "cramfs"
mtd: Giving out device 1 to cramfs
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP, IGMP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 2048)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
mtdblock_open
ok
mtdblock_open
mtdblock: read on "cramfs" at 0x0, size 0x1000
mtdblock: read on "cramfs" at 0x1000, size 0x1000
mtdblock: read on "cramfs" at 0x2000, size 0x1000
mtdblock: read on "cramfs" at 0x3000, size 0x1000
mtdblock_release

And after this, I do not get the prompt back, and the target hangs. My
cramfs rootfilesystem has

/bin, /dev, /etc, /sbin, /lib and /usr/sbin

Please help....

Lokesh Kumar

-----Original Message-----
From: Wolfgang Denk [mailto:wd@denx.de]
Sent: Friday, February 13, 2004 3:00 PM
Subject: Re: cramfs mpc8xx 2.4.18

In message <294FD9D3403A0340BDAC38E48DCEFFDCA729@RES-EXCH> you wrote:
>
> I have a custom board running 2.4.18 with initrd. Now, I want to make
> cramfs as root filesystem. When I built cramfs support in the kernel
> and gave it root=/dev/mtdblock1 (where my cramfs in correct endian
> order is stored on flash) rootfstype=cramfs, the kernel hangs. MTD
> support is built in the kernel. If I build cramfs as module, then boot
> my kernel with initrd (ext2) and then mount it (on say /mnt), I can
> read cramfs correctly.

Where does the kernel hang? Which exact boot messages are printed?

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: cramfs mpc8xx 2.4.18
@ 2004-03-01  0:58 Lokesh Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Lokesh Kumar @ 2004-03-01  0:58 UTC (permalink / raw)
  To: 'Wolfgang Denk ', Lokesh Kumar
  Cc: 'linuxppc-embedded@lists.linuxppc.org '



Yes, I can boot the system with initrd, and mount the cramfs and access all
the files. I also did use -r option to build the filesystem image.

I do not have proc built inside the kernel and no /proc directory. I do not
have any /var and /tmp directories in the cramfs. How do I mount /var or
/tmp inside the ram?

What else should I check? I have 2.4.18 stock kernel. Am I supposed to apply
any patch for cramfs to work?

Lokesh

-----Original Message-----
From: Wolfgang Denk
To: Lokesh Kumar
Cc: linuxppc-embedded@lists.linuxppc.org
Sent: 2/29/04 11:31 AM
Subject: Re: cramfs mpc8xx 2.4.18

In message <294FD9D3403A0340BDAC38E48DCEFFDCA751@RES-EXCH> you wrote:
>
> Kernel command line: root=/dev/mtdblock1 rootfstype=cramfs
console=ttyS0,9600
...
> ok
> mtdblock_open
> mtdblock: read on "cramfs" at 0x0, size 0x1000
> mtdblock: read on "cramfs" at 0x1000, size 0x1000
> mtdblock: read on "cramfs" at 0x2000, size 0x1000
> mtdblock: read on "cramfs" at 0x3000, size 0x1000
> mtdblock_release
>
> And after this, I do not get the prompt back, and the target hangs. My
> cramfs rootfilesystem has
>
> /bin, /dev, /etc, /sbin, /lib and /usr/sbin

Are you sure? Can you mount the same  filesystem  when  running  with
root filesystem mounted over NFS or from a ramdisk?

Did you remember  that  you  might  need  the  "-r"  option  (reverse
endian-ness of filesystem) when creating the filesystem?

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
I distrust all systematisers, and avoid them. The will  to  a  system
shows a lack of honesty.
- Friedrich Wilhelm Nietzsche _Götzen-Dämmerung [The Twilight of  the
Idols]_ ``Maxims and Missiles'' no. 26

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: cramfs mpc8xx 2.4.18
@ 2004-03-05 13:31 Lokesh Kumar
  0 siblings, 0 replies; 8+ messages in thread
From: Lokesh Kumar @ 2004-03-05 13:31 UTC (permalink / raw)
  To: Lokesh Kumar, 'Wolfgang Denk '
  Cc: 'linuxppc-embedded@lists.linuxppc.org '


I have cramfs working now. There was a problem with MTD in 2.4.18 kernel, in
mtdblock_release function. It calles invalidate_device, and I went through
mtd mailing list and found that problem and that fixed the hang at the end
part of booting.

However, when I enable the tmpfs support in kernel, it still crashes. Need
to find that problem still.

Lokesh

-----Original Message-----
From: Lokesh Kumar
Sent: Monday, March 01, 2004 2:19 PM
To: Lokesh Kumar; 'Wolfgang Denk '
Cc: 'linuxppc-embedded@lists.linuxppc.org '
Subject: RE: cramfs mpc8xx 2.4.18


What are the options of MTD which I have to enable for cramfs? There is
something called MTD for read only and when I enable that, the kernel starts
crashing in inet_add_protocol. Does that function try to write something to
any location? What about /etc/mtab?

Lokesh

-----Original Message-----
From: Lokesh Kumar
Sent: Sunday, February 29, 2004 7:58 PM
To: 'Wolfgang Denk '; Lokesh Kumar
Cc: 'linuxppc-embedded@lists.linuxppc.org '
Subject: RE: cramfs mpc8xx 2.4.18



Yes, I can boot the system with initrd, and mount the cramfs and access all
the files. I also did use -r option to build the filesystem image.

I do not have proc built inside the kernel and no /proc directory. I do not
have any /var and /tmp directories in the cramfs. How do I mount /var or
/tmp inside the ram?

What else should I check? I have 2.4.18 stock kernel. Am I supposed to apply
any patch for cramfs to work?

Lokesh

-----Original Message-----
From: Wolfgang Denk
To: Lokesh Kumar
Cc: linuxppc-embedded@lists.linuxppc.org
Sent: 2/29/04 11:31 AM
Subject: Re: cramfs mpc8xx 2.4.18

In message <294FD9D3403A0340BDAC38E48DCEFFDCA751@RES-EXCH> you wrote:
>
> Kernel command line: root=/dev/mtdblock1 rootfstype=cramfs
console=ttyS0,9600
...
> ok
> mtdblock_open
> mtdblock: read on "cramfs" at 0x0, size 0x1000
> mtdblock: read on "cramfs" at 0x1000, size 0x1000
> mtdblock: read on "cramfs" at 0x2000, size 0x1000
> mtdblock: read on "cramfs" at 0x3000, size 0x1000
> mtdblock_release
>
> And after this, I do not get the prompt back, and the target hangs. My
> cramfs rootfilesystem has
>
> /bin, /dev, /etc, /sbin, /lib and /usr/sbin

Are you sure? Can you mount the same  filesystem  when  running  with
root filesystem mounted over NFS or from a ramdisk?

Did you remember  that  you  might  need  the  "-r"  option  (reverse
endian-ness of filesystem) when creating the filesystem?

Best regards,

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
I distrust all systematisers, and avoid them. The will  to  a  system
shows a lack of honesty.
- Friedrich Wilhelm Nietzsche _Götzen-Dämmerung [The Twilight of  the
Idols]_ ``Maxims and Missiles'' no. 26

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-03-05 13:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-13 18:32 cramfs mpc8xx 2.4.18 Lokesh Kumar
2004-02-13 19:59 ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2004-02-13 19:31 Ruhland, Paul
2004-02-13 19:42 Ruhland, Paul
2004-02-28  0:03 Lokesh Kumar
2004-02-29 16:31 ` Wolfgang Denk
2004-03-01  0:58 Lokesh Kumar
2004-03-05 13:31 Lokesh Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).