Author Topic: Append Nand Flash Partiton Info  (Read 9010 times)

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« on: June 14, 2007, 11:10:50 am »
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 ?
« Last Edit: June 14, 2007, 12:06:17 pm by louigi600 »
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #1 on: June 14, 2007, 11:48:51 am »
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
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #2 on: June 15, 2007, 03:40:59 am »
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.
« Last Edit: June 15, 2007, 03:53:49 am by louigi600 »
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

johnsutton

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • http://
Append Nand Flash Partiton Info
« Reply #3 on: June 15, 2007, 07:38:36 am »
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!
C1000 running beta1, Ambicom WL1100C-CF WiFi card, infrared connection to Nokia 6310i for GPRS (ssh, vnc client) and GSM (minicom) comms.

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #4 on: June 15, 2007, 11:27:31 am »
Quote
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).
« Last Edit: June 15, 2007, 11:28:53 am by louigi600 »
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

johnsutton

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • http://
Append Nand Flash Partiton Info
« Reply #5 on: June 16, 2007, 04:36:28 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?
C1000 running beta1, Ambicom WL1100C-CF WiFi card, infrared connection to Nokia 6310i for GPRS (ssh, vnc client) and GSM (minicom) comms.

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #6 on: June 16, 2007, 04:46:39 am »
Quote
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?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=163281\"][{POST_SNAPBACK}][/a][/div]
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.
« Last Edit: June 16, 2007, 04:54:27 am by louigi600 »
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

T3_slider

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Append Nand Flash Partiton Info
« Reply #7 on: June 16, 2007, 10:21:36 am »
Here's my output from beta 3:

Code: [Select]
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.
Conics SL-C3200 running pdaXrom beta3 and XFCE with a Planex WiFi CF card.

Slackware rules!

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #8 on: June 16, 2007, 04:03:02 pm »
The intresting information there is:
Code: [Select]
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
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

pelrun

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • http://
Append Nand Flash Partiton Info
« Reply #9 on: June 16, 2007, 09:10:28 pm »
Quote
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.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=163294\"][{POST_SNAPBACK}][/a][/div]

You can't fix them, they aren't real errors.  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.
SL-C3100 with usb power mod running debian eabi
pdaXii13 still on the NAND for dualbooting
16GB SDHC! (a new one, after I sat on the old one and it went kaput)
D-Link 660 wifi, Socket Bluetooth rev H
External 9800mAh LiIon battery and slimline dvd drive
Homebrew microphone and remote

T3_slider

  • Full Member
  • ***
  • Posts: 125
    • View Profile
Append Nand Flash Partiton Info
« Reply #10 on: June 16, 2007, 10:31:49 pm »
Actually it's a C3200 which is treated like a C3100 in pdaXrom beta 3.  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.
« Last Edit: June 16, 2007, 10:35:24 pm by T3_slider »
Conics SL-C3200 running pdaXrom beta3 and XFCE with a Planex WiFi CF card.

Slackware rules!

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #11 on: June 17, 2007, 03:51:35 am »
Quote
louigi600 - a Borzoi is a 3100.
YEa I guess I should have lokked here
Code: [Select]
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
Actually it's a C3200 which is treated like a C3100 in pdaXrom beta 3.  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)
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

pelrun

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • http://
Append Nand Flash Partiton Info
« Reply #12 on: June 17, 2007, 06:20:31 am »
Ok, here's my Z's interesting bits (ooo err):

Code: [Select]
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.
« Last Edit: June 17, 2007, 09:23:07 am by pelrun »
SL-C3100 with usb power mod running debian eabi
pdaXii13 still on the NAND for dualbooting
16GB SDHC! (a new one, after I sat on the old one and it went kaput)
D-Link 660 wifi, Socket Bluetooth rev H
External 9800mAh LiIon battery and slimline dvd drive
Homebrew microphone and remote

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Append Nand Flash Partiton Info
« Reply #13 on: June 17, 2007, 09:09:48 am »
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 ?
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

pelrun

  • Sr. Member
  • ****
  • Posts: 366
    • View Profile
    • http://
Append Nand Flash Partiton Info
« Reply #14 on: June 17, 2007, 09:27:10 am »
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.
SL-C3100 with usb power mod running debian eabi
pdaXii13 still on the NAND for dualbooting
16GB SDHC! (a new one, after I sat on the old one and it went kaput)
D-Link 660 wifi, Socket Bluetooth rev H
External 9800mAh LiIon battery and slimline dvd drive
Homebrew microphone and remote