• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Kernel panic with (newly) fresh install: "No init found" (solved)  (Read 3945 times)
DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« on: May 02, 2009, 12:56:01 AM »

So I managed to do the whole TFTP/NFS boot and overwrite mtd1 and mtd2 with the stock uImage and rootfs respectively but now I can't get it to boot back to normal.  It keeps panicking with this:

Code:
...
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 124K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

I suppose that I could pass an init= option to the kernel, but I wouldn't know what to put in it.  What's more, the instructions told me to "note the number of blocks" that were used in overwriting mtd2 as it would be needed to boot, but it didn't really explain how or why.

The last number that appeared in the write was "87e0000" but I'm not sure if that's what I'm supposed to use or even where to use it... or if that's even my problem.  I'm going to get some sleep, but I thought I might post this here in the hopes that someone would have a knowledge-nugget to share with me.

Oh, and here's the output of my printenv:

Code:
baudrate=115200               
loads_echo=0                   
netmask=255.255.255.0         
CASset=min                     
MALLOC_len=1                   
ethprime=egiga0               
bootargs_end=:::DB88FXX81:eth0:none
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
ethmtu=1500                                                                                                                                                           
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs                                                                                                                       
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500                                                                                                       
usb0Mode=host                                                                                                                                                         
yuk_ethaddr=00:00:00:EE:51:81                                                                                                                                         
nandEcc=1bit                                                                                                                                                         
netretry=no                                                                                                                                                           
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
ethaddr=00:50:43:01:C3:F2
run_diag=no
ipaddr=192.168.1.15
rootpath=/sheevaplug/home
image_name=uImage.sheeva.040309
bootargs_root=root=/dev/nfs rw
arcNumber=2097
console=console=ttyS0,115200
serverip=192.168.1.64
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw root=/dev/mtdblock2
bootcmd=nand read.e 0x800000 0x100000 0x300000; bootm 0x800000
stdin=serial
stdout=serial
stderr=serial
mainlineLinux=no
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
enaAutoRecovery=yes

Environment size: 1260/131068 bytes

My considerable thanks to anyone who can figure this out :-)
« Last Edit: May 03, 2009, 12:06:01 PM by DanielQuinn » Logged

Ral Porcel
Global Moderator
Jr. Member
*****

Karma: 0
Posts: 68


View Profile
« Reply #1 on: May 02, 2009, 03:04:09 AM »

Looks like your jffs2 partition is empty, because its complaining about missing init and initial console.
Logged

DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #2 on: May 02, 2009, 11:42:17 AM »

I really don't think that's it.  I've just gone through the whole process again, this time making sure that (a) the jffs2 partition was written to /dev/mtdblock2 and that (b) /sbin/init is in there.

I think the key is probably in the last bit:

Code:
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
Empty flash at 0x086fd338 ends at 0x086fd800
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 124K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

There was a very long pause between the last md: line and Empty flash... but I don't know if that's normal.

Also on the off chance that I did something wrong during the flash process, I logged it all:

Code:
-sh-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00200000 00020000 "uImage"
mtd2: 1fd00000 00020000 "root"

-sh-3.2# flash_eraseall -j /dev/mtd2
Erasing 128 Kibyte @ 4be0000 -- 14 % complete. Cleanmarker written at 4be0000.
Skipping bad block at 0x04c00000
Erasing 128 Kibyte @ 1fce0000 -- 99 % complete. Cleanmarker written at 1fce0000.

-sh-3.2# nandwrite -p /dev/mtd2 ubuntu-9.0.5.Release.jffs2
Writing data to block 0
Writing data to block 20000
Writing data to block 40000
...
Writing data to block 4bc0000
Writing data to block 4be0000
Writing data to block 4c00000
Bad block at 4c00000, 1 block(s) from 4c00000 will be skipped
Writing data to block 4c20000
Writing data to block 4c40000
Writing data to block 4c60000
...
Writing data to block 8780000
Writing data to block 87a0000
Writing data to block 87c0000
Writing data to block 87e0000

-sh-3.2# mount -t jffs2 /dev/mtdblock2 /mnt1

-sh-3.2# ls -l /mnt1
drwxr-xr-x    2 root     root            0 Nov 14 23:41 bin
drwxr-xr-x    2 root     root            0 Jan 25 11:48 boot
drwxr-xr-x    9 root     root            0 Jan  8 18:46 dev
drwxr-xr-x   56 root     root            0 Jan 13 23:48 etc
drwxr-xr-x    2 root     root            0 Dec 23 19:13 home
drwxr-xr-x   11 root     root            0 Jan 12 18:12 lib
drwxr-xr-x    2 root     root            0 Jan 19 17:06 media
drwxr-xr-x    2 root     root            0 Jan 26 18:44 mnt
drwxr-xr-x    2 root     root            0 Jan 19 17:06 opt
dr-xr-xr-x    2 root     root            0 Jan  1  1970 proc
drwxr-xr-x    4 root     root            0 Jan 20 05:06 root
drwxr-xr-x    2 root     root            0 Mar 18  2009 sbin
drwxr-xr-x    2 root     root            0 Nov 13 16:15 selinux
drwxr-xr-x    2 root     root            0 Jan 19 17:06 srv
drwxr-xr-x    2 root     root            0 Jan  1  1970 sys
drwxr-xr-x    5 root     root            0 Jan 26 18:00 tmp
drwxr-xr-x   15 root     root            0 Nov 13 10:52 usr
drwxr-xr-x   13 root     root            0 Dec 23 19:13 var

-sh-3.2# find mnt1/ -name init
mnt1/lib/init
mnt1/usr/share/initramfs-tools/init
mnt1/sbin/init

-sh-3.2# reboot
The system is going down NOW!
Sending SIGTERM to all processes
Requesting system reboot
md: stopping all md devices.
Restarting system.
Reseting !!

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Mar 19 2009 - 16:06:59) Marvell version: 3.4.16

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CEE80

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Flash:  0 kB
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0
Marvell>> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw root=/dev/mtdblock2'
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> setenv bootcmd 'nand read.e 0x800000 0x100000 0x300000; bootm 0x800000'
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> reset

...

USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME], egiga1
Hit any key to stop autoboot:  0

NAND read: device 0 offset 0x100000, size 0x300000

Reading data from 0x3ff800 -- 100% complete.
 3145728 bytes read: OK
## Booting image at 00800000 ...
   Image Name:   Linux-2.6.22.18
   Created:      2009-04-04   1:49:44 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2070252 Bytes =  2 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux...
Linux version 2.6.22.18 (root@localhost.localdomain) (gcc version 4.2.0 20070413 (prerelease)) #1 Fri Apr 3 18:49:38 PDT 2009
CPU: ARM926EJ-S [56251311] revision 1 (ARMv5TE), cr=00053177
Machine: Feroceon-KW
Using UBoot passing parameters structure
Memory policy: ECC disabled, Data cache writeback
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
Built 1 zonelists.  Total pages: 130048
Kernel command line: console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw2
PID hash table entries: 2048 (order: 11, 8192 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 256MB 256MB 0MB 0MB = 512MB total
Memory: 515584KB available (3772K code, 258K data, 124K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16

CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 256MB
SDRAM_CS1 ....base 10000000, size 256MB
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e8000000, size 128MB
PEX0_IO ....base f2000000, size   1MB
INTER_REGS ....base f1000000, size   1MB
NFLASH_CS ....base fa000000, size   2MB
SPI_CS ....base f4000000, size  16MB
BOOT_ROM_CS ....no such
DEV_BOOTCS ....no such
CRYPT_ENG ....base f0000000, size   2MB

  Marvell Development Board (LSP Version KW_LSP_4.2.7_patch2)-- SHEEVA PLUG  Soc: 88F6281 A0 LE

 Detected Tclk 200000000 and SysClk 400000000
MV Buttons Device Load
Marvell USB EHCI Host controller #0: c08b0600
PEX0 interface detected no Link.
PCI: bus0: Fast back to back transfers enabled
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
Time: kw_clocksource clocksource has been installed.
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
RTC registered
Use the XOR engines (acceleration) for enhancing the following functions:
  o RAID 5 Xor calculation
  o kernel memcpy
  o kenrel memzero
Number of XOR engines to use: 4
cesadev_init(c00117e4)
mvCesaInit: sessions=640, queue=64, pSram=f0000000
Warning: TS unit is powered off.
MV Buttons Driver Load
JFFS2 version 2.2. (NAND) . 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
serial8250.0: ttyS1 at MMIO 0xf1012100 (irq = 34) is a 16550A
RAMDISK driver initialized: 20 RAM disks of 4096K size 4096 blocksize
Loading Marvell Ethernet Driver:
  o Cached descriptors in DRAM
  o DRAM SW cache-coherency
  o Single RX Queue support - ETH_DEF_RXQ=0
  o Single TX Queue support - ETH_DEF_TXQ=0
  o TCP segmentation offload enabled
  o Receive checksum offload enabled
  o Transmit checksum offload enabled
  o Network Fast Processing (Routing) supported
  o Driver ERROR statistics enabled
  o Driver INFO statistics enabled
  o Proc tool API enabled
  o Rx descripors: q0=128
  o Tx descripors: q0=532
  o Loading network interface(s):
    o eth0, ifindex = 1, GbE port = 0
    o eth1, ifindex = 2, GbE port = 1

mvFpRuleDb (dfd20000): 16384 entries, 65536 bytes
Intel(R) PRO/1000 Network Driver - version 7.3.20-k2-NAPI
Copyright (c) 1999-2006 Intel Corporation.
e100: Intel(R) PRO/100 Network Driver, 3.5.17-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation

Warning Sata is Powered Off
NFTL driver: nftlcore.c $Revision: 1.98 $, nftlmount.c $Revision: 1.41 $
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 632 at 0x04f00000
mtd: bad character after partition (r)
3 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 3 MTD partitions on "nand_mtd":
0x00000000-0x00100000 : "u-boot"
0x00100000-0x00400000 : "uImage"
0x00400000-0x20000000 : "rootfs"
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00, driver 10 Dec 2004
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
USB Universal Host Controller Interface driver v3.0
usbcore: registered new interface driver usblp
drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
Linux telephony interface: v1.00
Marvell Telephony Driver:
mvBoardVoiceAssembleModeGet: TDM not supported(boardId=0x9)
assembly=-1,irq=-1
mp_check_config: Error, invalid voice assembley mode
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
raid6: int32x1     97 MB/s
raid6: int32x2    123 MB/s
raid6: int32x4    125 MB/s
raid6: int32x8    111 MB/s
raid6: using algorithm int32x4 (125 MB/s)
md: raid6 personality registered for level 6
md: raid5 personality registered for level 5
md: raid4 personality registered for level 4
raid5: measuring checksumming speed
   arm4regs  :  1084.000 MB/sec
   8regs     :   754.800 MB/sec
   32regs    :   900.000 MB/sec
raid5: using function: arm4regs (1084.000 MB/sec)
device-mapper: ioctl: 4.11.0-ioctl (2006-10-12) initialised: dm-devel@redhat.com
dm_crypt using the OCF package.
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mvsdmmc: irq =28 start f1090000
mvsdmmc: no IRQ detect
usbcore: registered new interface driver usbhid
drivers/hid/usbhid/hid-core.c: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.14 (Thu May 31 09:03:25 2007 UTC).
mvCLAudioCodecRegGet: Error while reading register!
mvCLAudioCodecInit: Error - Invalid Cirrus Logic chip/rev ID!
Error - Cannot initialize audio decoder.at address =0xff<6>ALSA device list:
  #0: Marvell mv88fx_snd ALSA driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
md: Autodetecting RAID arrays.
md: autorun ...
md: ... autorun DONE.
Empty flash at 0x086fd338 ends at 0x086fd800
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 124K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

So given that init appears to be there, should I be passing init=/sbin/init to the kernel or something?
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #3 on: May 02, 2009, 11:57:57 AM »

It looks like your mtdparts is different when you are trying to boot from flash than it was when you wrote the flash.

Quote
-sh-3.2# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00200000 00020000 "uImage"
mtd2: 1fd00000 00020000 "root"

Here the mtd0 size is 0x00100000, mtd1 size is 0x00200000 so mtd2 would start at 0x00300000 and would have a size of be 0x1fd00000.

When you boot to try to run from flash you are passing this information in the bootargs
Quote
Marvell>> setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw root=/dev/mtdblock2'

This sets mtd0 size to 0x00100000 starting at 0x00000000, mtd1 size to 0x00300000 starting at 0x00100000 and mtd2 starts at 0x00400000 with a size of 0x1fc00000.

You need to make sure the mtdparts in the bootargs used when you boot up to flash the device are the same as they will be when you bootup to run from  the flash.
« Last Edit: May 02, 2009, 12:01:39 PM by kilowatt » Logged

DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #4 on: May 02, 2009, 12:17:31 PM »

Ah!  I think I understand now.  At least, it would appear that I do since it booted up :-)

Here's what I used after considering your logic above:

Code:
setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x300000@0x100000(uImage)ro,0x1fC00000@0x400000(rootfs)rw root=/dev/mtdblock2'
Logged

DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #5 on: May 02, 2009, 04:37:47 PM »

You know, I'd love to close this thread, but I can't because something else is broken and the results are the same.

After my previous success of being able to boot I followed the howto here:

http://www.openplug.org/plugwiki/index.php/Compiling_Linux_Kernel_for_the_Plug_Computer

...to create a custom kernel.  Without wanting to accidentally mangle anything, I just ran "make ARCH=arm kirkwood_defconfig", compiled and then used nandwrite to put it onto /dev/mtd1.  Then, I loaded the following into u-boot:

Code:
setenv arcNumber 2097
setenv mainlineLinux yes
setenv bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x100000@0x00000(u-boot),0x200000@0x100000(uImage)ro,0x1fd00000@0x300000(rootfs)rw root=/dev/mtdblock2 rootfstype=jffs2'
saveenv
setenv bootcmd 'nand read.e 0x800000 0x100000 0x300000; bootm 0x800000'
saveenv
reset

But it failed with:

Code:
rtc-mv rtc-mv: setting system clock to 2009-01-26 18:36:53 UTC (1232995013)
VFS: Mounted root (jffs2 filesystem) on device 31:2.
Freeing init memory: 112K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.
[<c002975c>] (unwind_backtrace+0x0/0xd8) from [<c02fc144>] (panic+0x58/0x128)
[<c02fc144>] (panic+0x58/0x128) from [<c0024534>] (init_post+0xd4/0xfc)
[<c0024534>] (init_post+0xd4/0xfc) from [<c00085a8>] (kernel_init+0xc0/0xe8)
[<c00085a8>] (kernel_init+0xc0/0xe8) from [<c0037d78>] (do_exit+0x0/0x70c)
[<c0037d78>] (do_exit+0x0/0x70c) from [<00000000>] (0x0)

To be honest, I don't really understand what all of the values mean, so I really appreciate any explanations like the one above.  Given that this error is very much like the previous one, I'm thinking that it must have something to do with the start/size values, but the output of cat /proc/mtd hasn't changed so I'm lost again.
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #6 on: May 02, 2009, 06:19:06 PM »

Well you changed the size of the uImage partition since your last attempt.  Did you rewrite the file system since you caused the rootfs partition to move?

You should pick a partition scheme and stick with it.

I suggest

mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x300000@0x100000(uImage),0x1fc00000@0x400000(rootfs)

Some kernel builds seem to be just over 0x200000 in size.  So if you allocate 0x300000 for uImage you should have plenty of room for whatever kernel you choose to use.  The 'ro' after (u-boot) sets that partition to read only which helps prevent you from corrupting it.  You need to keep the partitions size definitions consistent or you must rewrite the kernel and file system to the new partitions you create when ever you change it.

There is no partition table for the flash so what you pass to the kernel is the partition definition.

You can add 'ro' after (uImage) to set that partition to read only.  That would prevent you from accidently writing over the kernel.  You would need to remove it inorder to enable writing a new kernel.

The bootcmd your using should work.
nand read.e 0x800000 0x100000 0x300000
says to read 0x300000 bytes from flash starting at address 0x100000 (the start of the kernel partition) and write it into system memory at 0x800000. this copies the kernel to memory.

bootm 0x800000
boots the kernel from memory starting at address 0x800000 (where you just wrote the kernel).
« Last Edit: May 02, 2009, 06:43:56 PM by kilowatt » Logged

DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #7 on: May 02, 2009, 09:29:28 PM »

Alright, here's the part I don't understand.  As I'm used to using fdisk to setup a partition table, the whole act of using the commandline to set the partitions on a whim seems a little strange.  So what you're saying is that when I boot from tftp/nfs using this as my mtdparts variable:

Code:
mtdparts=:0x100000@0x000000(u-boot),0x300000@0x100000(uImage),0x1fc00000@0x400000(rootfs)rw

I'm essentially partitioning at that point?  'Cause when I'm in the tftp/nfs environment, I just write to /dev/mtdblock1 and /dev/mtdblock2 which is defined by the above arguments?

In my working to figure this out, I popped into the #openplug IRC channel and lennert there spotted the discrepency between my commandline mtdparts and the assumptions made by the kernel:

Code:
0x000000000000-0x000000100000 : "u-boot"
0x000000100000-0x000000500000 : "uImage"
0x000000500000-0x000020000000 : "root"

He had me edit arch/arm/mach-kirkwood/sheevaplug-setup.c, replace "SZ_4M" with "SZ_2M" and then recompile.  More details here: http://ddevnet.net/irclogs/openplug/index.php?date=2009-05-03.

However, if you're telling me that I just need to have the "right" mtdparts in the command line both for my tftp/nfs boot and my "boot after compiling a custom kernel", then wouldn't it be better to use what's in the kernel by default this for mtdparts?:

Code:
mtdparts=:0x100000@0x000000(u-boot),0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)rw

...but then how do you know what the size value should be for the rootfs?  I'm just trying to wrap my brain around all of this.
« Last Edit: May 02, 2009, 11:40:12 PM by DanielQuinn » Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #8 on: May 03, 2009, 07:21:39 AM »

The kernel is compiled with default partitioning values for mtdparts.

You can override these on the kernel command line as most people are doing with the mtdparts=... which gets passed to the kernel command line from the u-boot bootargs.

You can modify the default partition scheme by modifying arch/arm/mach-kirkwood/sheevaplug-setup.c and compiling a kernel.

Since there is no partition table in the NAND-flash the kernel must be told how you want to partition it.  You can't use fdisk to partition the NAND-Flash.

Once you have picked a partitioning scheme you want to use for the internal nand-flash you must stick with it or rewrite the data to the partitions when it changes just like you would with a disk drive.

the mtdparts command line defines the partitions with a list of   'Size@StartingLocation(Name)[ro]'  so if the size of your u-boot partition is 0x00100000 then the start of your uImage partition should be 0x00100000.  If the size of your uImage partition is 0x00300000 then the start of the rootfs partition should be 0x00400000 (u-boot + uImage Size) the size of the rootfs partition will be the size of the flash 0x02000000 - the size of the other two partitions (0x02000000 - 0x00100000 - 0x00300000 = 0x01fc00000).

If the kernel you are booting with has your partition definition compiled in you could leave out the definition in the bootargs.  If you boot then with a different kernel you will need to make sure the bootargs specifies the partition scheme you have been using in order to access your flash properly.  So what is important is that you pick a partition scheme and make sure the kernel you boot knows what it is either through the bootargs you supply in u-boot or by compiling it into the kernel.

Note that there seems to be a difference between the name given to the name used for file system partition in the bootargs most people are using "rootfs" and the name compiled into the kernel "root".  I don't think this makes much difference except with what shows up when you 'cat /proc/mtd'
Logged

kilowatt
Global Moderator
Full Member
*****

Karma: 3
Posts: 106


View Profile
« Reply #9 on: May 03, 2009, 07:49:02 AM »

Also note that compiling with SZ_2M is setting the uImage partition to 2MB.  Your kernel image is probably very close to this size.  Some kernels I have compiled are larger than that.  I think this is why they bumped it up to SZ_4M or 4MB.  This is why I have suggested using either 3MB (0x00300000) or 4MB (0x00400000) for your uImage partition.

mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x200000@0x100000(uImage),0x1fd00000@0x300000(rootfs) will give you 1MB(u-boot),2MB(uImage),509MB(rootfs)

mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x300000@0x100000(uImage),0x1fc00000@0x400000(rootfs) will give you 1MB(u-boot),3MB(uImage),508MB(rootfs)

mtdparts=nand_mtd:0x100000@0x000000(u-boot)ro,0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) will give you 1MB(u-boot),4MB(uImage),507MB(rootfs)

I'm not sure if SZ_3M is defined for using in sheevaplug-setup.c but you could also justs use the hex number 0x00300000 if you want this size partition.
« Last Edit: May 03, 2009, 12:11:14 PM by kilowatt » Logged

DanielQuinn
Newbie
*

Karma: 0
Posts: 9


View Profile
« Reply #10 on: May 03, 2009, 12:05:43 PM »

Thanks so much for all this explanation.  It all makes sense now :-)
Logged

Pages: [1]
Print
Jump to: