OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
> Append Nand Flash Partiton Info, Pass info to kernel via append
louigi600
post Jun 14 2007, 07:10 AM
Post #1





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



Anyone know if it's possible to tell the kernel what the nand flash partition layout is trough an append statement from the boot loader ?

Currently u-boot sends this info to kernel:
console=ttyS0,115200 console=tty1 root=/dev/mtdblock2 rootfstype=jffs2

This only tels the kernel where the root is (nand partition 2) but the nand partition physical layout is hard coded to kernel.

Being able to pass the nand partition layout via boot loader would avoid :
having this info hard coded to kernel sources,
having to rebuild the kernel if you intend to make a different layout.

Ok this goes a bit off topik but is closely related:
Currently the u-boot image used with pdaxrom would need to be rebuilt in order to change this append info but this is not mandatory as u-boot is capable of reading stuff from virtually anywhere (including an ext3 or jffs2 filesystem) but would require work to make it functional on Z.

Currently uboot is being used at about 5% of it's capabilities as it would be possible to:
pick up a kernel from SD/MMC/CF/MicroDrive with fat or ext2 filesystem on it (and other filesystems to but probably not intresting for linux),
pick up the kernel from the jffs2 root image on the onboard nand,
pick up the boot configuration data (which kernel to boot from where and which root filesystem to use ... etc) from a file instead of having it hard coded to the sources (the file could be anywhere just like the kernel),
it could even be possible to have the video and keyboard working at boot time so that one could pass extra parameters without serial console (or doo some debugging without the serial console) like one can do with grub or any conventional boot loader for x86 linux.

All this could mean to a common user not having to flash anything in order to upgrade a kernel or have 2 different releases with 2 different kernels (including the more difficult combinations like beta3 and r198 or 2 different distributions) ... for any advanced user or developer ;-) well only immagination is the limit .

Am I the only one that would find this handy ?
Go to the top of the page
 
+Quote Post
louigi600
post Jun 14 2007, 07:48 AM
Post #2





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



Ok this helps the append parameter:

The format for the command line is as follows:
mtdparts=<mtddef>[;<mtddef]
<mtddef> := <mtd-id>:<partdef>[,<partdef>]
<partdef> := <size>[@offset][<name>][ro]
<mtd-id> := unique name used in mapping driver/device (mtd->name)
<size> := standard linux memsize OR "-" to denote all remaining space
<name> := '(' NAME ')'

Examples:
pdaxrom u-boot ptdparts lauout (1 logical 0->7168k, jffs2 all the rest)
mtdparts=laze-0:7168k(Logical),-(JFFS2)

1 NOR Flash, with 1 single writable partition:
edb7312-nor:-

1 NOR Flash with 2 partitions, 1 NAND with one
edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home)


But still the other off topick stuff is very intresting to me
Go to the top of the page
 
+Quote Post
louigi600
post Jun 14 2007, 11:40 PM
Post #3





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



Ok I've a bit more info and a small correction to the above mtdpart data:

On my C760 there is actually 2 physically different flash chips:

C760,pdaxrom r197:
Sharp SL series flash device: 800000 at 0 (with one defined partition)
sharpsl-flash:6d0000@120000(Boot POM Filesystem)ro
currently defined in drivers/mtd/maps/sharpsl-flash.c

NAND device: Manuf ID: ec, Chip ID: 79 (with 2 or more defined partitions distro dependant)
sharpsl-nand:700000(Logical),-(JFFS2)
currently defined in drivers/mtd/nand/sharpsl.c

So actually the whole mtdpart data would look like this:
mtdparts=sharpsl-flash:6d0000@120000(Boot POM Filesystem)ro;sharpsl-nand:7168k(Logical),-(JFFS2)

If anyone is running something different that beta4 or above on their Z it would be intresting if they could add to this thread the partition layout for theyr model/distro.
Information can be gotten from /var/log/dmesg.
Go to the top of the page
 
+Quote Post
johnsutton
post Jun 15 2007, 03:38 AM
Post #4





Group: Members
Posts: 32
Joined: 28-April 05
From: Wales
Member No.: 7,019



This is surely the right way to go. And maybe the NAND backup/restore problem can also be resolved? This would be good as it is an impediment to the adoption of uboot.

I did some work around this issue some months ago - it seems to me that the partition table for the flash memory (or at least, a copy of it) is held somewhere in the first partition (the first 7Mb) and when the restore routine fails to find it there (because it has been overwritten by uboot) the restore then fails?

You say that "the nand partition physical layout is hard coded to kernel" but I don't understand how this can be true because the same kernel can be run on systems with different layouts, surely?

I wrote a script to mount NAND backup images on a linux desktop and in the course of doing this I tried to find the partition table so that the script could do the mounts automatically. But I couldn't find it so had to hardcode the layout data in to the script ;-(

I'd like to get a comprehensive understanding of the boot process, so any comments are welcome!
Go to the top of the page
 
+Quote Post
louigi600
post Jun 15 2007, 07:27 AM
Post #5





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



QUOTE(johnsutton @ Jun 15 2007, 01:38 PM)
This is surely the right way to go.  And maybe the NAND backup/restore problem can also be resolved?  This would be good as it is an impediment to the adoption of uboot.
Probably not because pdaxrom beta4 and above flash layout is too different anyway from that the sharp tool expects
QUOTE
I did some work around this issue some months ago - it seems to me that the partition table for the flash memory (or at least, a copy of it) is held somewhere in the first partition (the first 7Mb) and when the restore routine fails to find it there (because it has been overwritten by uboot) the restore then fails?
u-boot targets the logic partition (mtd1) which is in the samgsung chip ... the firs 7Mb or so are in the sharpsl-flash (that is meant to be managed as read only).
There is however an image of the D+M menu copied into mdt1 and this is the one that fails sometimes (depending on model)
QUOTE
You say that "the nand partition physical layout is hard coded to kernel" but I don't understand how this can be true because the same kernel can be run on systems with different layouts, surely?
It is hard coded to kernel but can be (or at least should be) overridden with the kernel append. Currently pdaxrom does not use this feature (maybe other distro do).
I've not had the time to checkout the theory yet but I will.
QUOTE
I wrote a script to mount NAND backup images on a linux desktop and in the course of doing this I tried to find the partition table so that the script could do the mounts automatically.  But I couldn't find it so had to hardcode the layout data in to the script ;-(

I'd like to get a comprehensive understanding of the boot process, so any comments are welcome!

If you are using something different from beta4+ on any zaurus device could you please supply the info I'm inviting everybody to supply (see a few postings above).
Go to the top of the page
 
+Quote Post
johnsutton
post Jun 16 2007, 12:36 AM
Post #6





Group: Members
Posts: 32
Joined: 28-April 05
From: Wales
Member No.: 7,019



Is beta1 on c1000 interesting? If so, you`ll need to tell me where to find the info. I dumped dmesg to a file immediately after booting but this does not contain any mention of mtd?
Go to the top of the page
 
+Quote Post
louigi600
post Jun 16 2007, 12:46 AM
Post #7





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



QUOTE(johnsutton @ Jun 16 2007, 10:36 AM)
Is beta1 on c1000 interesting?  If so, you`ll need to tell me where to find the info.  I dumped dmesg to a file immediately after booting but this does not contain any mention of mtd?
*

There is no need to dump, the init scripts do that for you (there is a copy in /var/log/dmseg).
The command dmesg reads from kernel cyclic buffer that will eventually start overwriting entries while /var/log/dmsed is a dump ov the kernel buffer right after the boot process has finished.

Well things may look different in beta1 ... I'm not sure what to look for but you should see entries where the 2 flash devices are found and when the partitions in them are layed out.

I've translated the entries I found to make them look like mtdparts append commands; if you are not able to do that just cut and paste the entries in the dmesg and I;ll do the rest.
Go to the top of the page
 
+Quote Post
T3_slider
post Jun 16 2007, 06:21 AM
Post #8





Group: Members
Posts: 125
Joined: 26-December 06
Member No.: 13,449



Here's my output from beta 3:

CODE
Linux version 2.4.20 (sash@pdaX86) (gcc version 2.95.3 20010315 (release)) #1 Sat, 25 Mar 2006 15:03:52 +0000
CPU: XScale-PXA270 revision 7
Machine: SHARP Borzoi
Converting old-style param struct to taglist
Ignoring unrecognised tag 0x00000000
Turbo Mode clock : 416.00MHz (*2.0, active)
Run Mode clock   : 208.00MHz
System bus clock : 208.00MHz (1/1)
Memory clock     : 208.00MHz (1/1)
LCD clock        : 104.00MHz (1/2)
Security risk: creating user accessible mapping for 0x08000000 at 0xf1000000
On node 0 totalpages: 16384
zone(0): 16384 pages.
zone(1): 0 pages.
zone(2): 0 pages.
Kernel command line: console=ttyS0 root=/dev/mtdblock2 mtdparts=sharpsl-nand:7168k@0k(smf),123904k@7168k(root),-(home) jffs2_orphaned_inodes=delete RTC_RESET=1 EQUIPMENT=5 LOGOLANG=1 DEFYEAR=2007 LOGO=1 LAUNCH=q
Console: colour dummy device 80x30
Calibrating delay loop... 415.33 BogoMIPS
Memory: 64MB = 64MB total
Memory: 62212KB available (2071K code, 415K data, 80K init)
Dentry cache hash table entries: 8192 (order: 4, 65536 bytes)
Inode cache hash table entries: 4096 (order: 3, 32768 bytes)
Mount-cache hash table entries: 1024 (order: 1, 8192 bytes)
Buffer-cache hash table entries: 4096 (order: 2, 16384 bytes)
Page-cache hash table entries: 16384 (order: 4, 65536 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
RCSR = 1
full reset !
apm: BIOS version 1.2 Flags 0x02 (Driver version 1.14)
FCS : CCCR = 2000210
enable_irq(120) unbalanced from c000c768
batok installed
Starting kswapd
Journalled Block Device driver loaded
JFFS2 version 2.1. (C) 2001, 2002 Red Hat, Inc., designed by Axis Communications AB.
Sharp SL-Series PXA fb driver initialized.
reset resolution unkown => 480x640
Console: switching to colour frame buffer device 80x30
fb0: SHARPSL_PXAFB frame buffer device
keyboard initilaized.
pty: 256 Unix98 ptys configured
Serial driver version 5.05c (2001-07-08) with no serial options enabled
SharpSL serial driver version 5.05c (2001-07-08) with no serial options enabled
ttyS00 at 0xf8100000x (irq = 22) is a 16550A
ttyS01 at 0xf8700000x (irq = 20) is a 16550A, using IRDA
ttyS02 at 0xf8200000x (irq = 21) is a 16550A
rs_init: IRDA H/W initializaion
sharpled_init: done.
spitz remote controller
Cotulla Real Time Clock driver v1.00
Cotulla Touch Screen driver initialized
Uniform Multi-Platform E-IDE driver Revision: 6.31
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
loop: loaded (max 8 devices)
PPP generic driver version 2.4.2
PPP BSD Compression module registered
SCSI subsystem driver Revision: 1.00
kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2
kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2
kmod: failed to exec /sbin/modprobe -s -k scsi_hostadapter, errno = 2
Spitz audio driver initialize
Sharp SL series flash device: 1000000 at 0
Using static partision definition
Creating 1 MTD partitions on "sharpsl-flash":
0x00140000-0x007f0000 : "Filesystem"
NAND device: Manufacture ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MB 3,3V)
Creating 3 MTD partitions on "NAND 128MB 3,3V":
0x00000000-0x00700000 : "smf"
0x00700000-0x08000000 : "root"
0x08000000-0x08000000 : "home"
mtd: partition "home" is out of reach -- disabled
Linux Kernel Card Services 3.1.31
 options:  [pm]
Intel PXA250/210 PCMCIA (CS release 3.1.31)
pxa_pcmcia_init(0)
pxa_pcmcia_init(1)
Backlight Driver Initialized.
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 4096 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
NetWinder Floating Point Emulator V0.97 (double precision)
IrCOMM protocol (Dag Brattli)
cramfs: wrong magic
FAT: bogus logical sector size 381
Eep. Child "cookies" (ino #3790) of dir ino #515 doesn't exist!
Inode #512 was a directory with children - removing those too...
Inode #513 was a directory with children - removing those too...
Inode #515 was a directory with children - removing those too...
Cannot remove child "cookies", ino #3790, because it doesn't exist
Inode #518 was a directory with children - removing those too...
Inode #519 was a directory with children - removing those too...
Inode #521 was a directory with children - removing those too...
Inode #522 was a directory with children - removing those too...
Inode #8335 was a directory with children - removing those too...
Inode #4398 was a directory with children - removing those too...
Inode #4399 was a directory with children - removing those too...
Inode #4403 was a directory with children - removing those too...
Inode #4407 was a directory with children - removing those too...
Inode #3781 was a directory with children - removing those too...
Inode #3782 was a directory with children - removing those too...
Inode #3783 was a directory with children - removing those too...
VFS: Mounted root (jffs2 filesystem) readonly.
Freeing init memory: 80K
Warning: unable to open an initial console.
Warning: Remapping obsolete /dev/fb* minor 32 to 1

I moved my /home directory to my hd (I have repartitioned my hd to contain the original 2 9MB partitions, a 256MB swap partition and the rest an ext2 partition if that helps (although I don't think that makes a difference).

I have a lot of inode errors that don't appear to affect anything in any way so I haven't done anything about them.
Go to the top of the page
 
+Quote Post
louigi600
post Jun 16 2007, 12:03 PM
Post #9





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



The intresting information there is:
CODE
Sharp SL series flash device: 1000000 at 0
Using static partision definition
Creating 1 MTD partitions on "sharpsl-flash":
0x00140000-0x007f0000 : "Filesystem"
NAND device: Manufacture ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MB 3,3V)
Creating 3 MTD partitions on "NAND 128MB 3,3V":
0x00000000-0x00700000 : "smf"
0x00700000-0x08000000 : "root"
0x08000000-0x08000000 : "home"
mtd: partition "home" is out of reach -- disabled


Which would translate to:
Sharp SL series flash device: 1000000 at 0
sharpsl-flash:6b0000@140000(Filesystem)

NAND device:
sharpsl-nand:700000(smf),100000@700000(root) .....

Not sure what would happen with the home with this warning:
mtd: partition "home" is out of reach -- disabled

This is robably because you made a custom one in the MD .... but I thinks you wasted a lot of space in the NAND flash.

Thanks for the feedback anyway.
BTW are you using a C3x00/1000 ? ... it does not look like one of the corgi family
Go to the top of the page
 
+Quote Post
pelrun
post Jun 16 2007, 05:10 PM
Post #10





Group: Members
Posts: 369
Joined: 6-September 04
From: Brisbane, Australia
Member No.: 4,488



QUOTE(T3_slider @ Jun 16 2007, 02:21 PM)
I have a lot of inode errors that don't appear to affect anything in any way so I haven't done anything about them.
*


You can't fix them, they aren't real errors. smile.gif That part of the boot process just isn't reading the partition properly. Once it's mounted later on all of those "errors" vanish.

louigi600 - a Borzoi is a 3100.
Go to the top of the page
 
+Quote Post
T3_slider
post Jun 16 2007, 06:31 PM
Post #11





Group: Members
Posts: 125
Joined: 26-December 06
Member No.: 13,449



Actually it's a C3200 which is treated like a C3100 in pdaXrom beta 3. wink.gif It's in my signature.

As for wasting space in NAND, it's actually because I resized the root partition to the full 121 MB, therefore removing any space for the home partition and making it out of reach until the microdrive is mounted properly.
Go to the top of the page
 
+Quote Post
louigi600
post Jun 16 2007, 11:51 PM
Post #12





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



QUOTE(pelrun @ Jun 17 2007, 03:10 AM)
louigi600 - a Borzoi is a 3100.

YEa I guess I should have lokked here
CODE
CPU: XScale-PXA270 revision 7
Machine: SHARP Borzoi
before asking ;-) ... but it appears as if on some devices this is not 100% reliable ...
Since you have a real Borzi can you supply the intresting parts of dmesg too?

QUOTE(T3_slider @ Jun 17 2007, 04:31 AM)
Actually it's a C3200 which is treated like a C3100 in pdaXrom beta 3. wink.gif It's in my signature.

As for wasting space in NAND, it's actually because I resized the root partition to the full 121 MB, therefore removing any space for the home partition and making it out of reach until the microdrive is mounted properly.

Yea I see now I missed a "0" so also the mtdparts stuff was wrong

Sharp SL series flash device: 1000000 at 0
sharpsl-flash:6b0000@140000(Filesystem)

NAND device:
sharpsl-nand:700000(smf),7900000@700000(root),0@8000000(home)
Go to the top of the page
 
+Quote Post
pelrun
post Jun 17 2007, 02:20 AM
Post #13





Group: Members
Posts: 369
Joined: 6-September 04
From: Brisbane, Australia
Member No.: 4,488



Ok, here's my Z's interesting bits (ooo err):

CODE
Kernel command line: console=ttyS0 root=/dev/mtdblock2 mtdparts=sharpsl-nand:7168k@0k(smf),51200k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=4 LOGOLANG=1 DEFYEAR=2006 LOGO=1 LAUNCH=q

Sharp SL series flash device: 1000000 at 0
Using static partision definition
Creating 1 MTD partitions on "sharpsl-flash":
0x00140000-0x007f0000 : "Filesystem"
NAND device: Manufacture ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MB 3,3V)
Creating 3 MTD partitions on "NAND 128MB 3,3V":
0x00000000-0x00700000 : "smf"
0x00700000-0x03900000 : "root"
0x03900000-0x08000000 : "home"


I think I just went with defaults on my install, but I can't be 100% sure.
Go to the top of the page
 
+Quote Post
louigi600
post Jun 17 2007, 05:09 AM
Post #14





Group: Members
Posts: 474
Joined: 21-May 06
Member No.: 9,928



Intresting I did not notice that before .... beta3 is receiving the in the kernel command line also the mtdparts stuff r121 and above (and probably also beta4 and above) do not get any of the mtdparts stuff. Apparently you can express sizes and offset also in decimal with human feesable extensions ;-) ... I missed that too ! (thanks pelrun).

Is this the sharp boot loader passing the kernel command line or is it a dirty kernel source trick ?
Go to the top of the page
 
+Quote Post
pelrun
post Jun 17 2007, 05:27 AM
Post #15





Group: Members
Posts: 369
Joined: 6-September 04
From: Brisbane, Australia
Member No.: 4,488



Can it be a kernel source trick? The values are dependent on what you enter during installation, and there's no compilation going on then.
Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 31st July 2014 - 11:50 PM