EmbeddedRelated.com
Forums

Put jffs2 file system on AT91SAM9263EK

Started by swcareers February 24, 2009
Hi all,

I am using a AT91SAM9263-EK and want to run Linux on it. I have
already downloaded Linux-2.6.27 kernel and built it for ARM. Steps I used:

1. make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-

2. mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000
-n linux-2.6 -d arch/arm/boot/zImage uImage

That gives me uImage.

3. On the AT91SAM9263-EK, I have downloaded Bootstrap and U-Boot using
SAM-BA at addresses 0x0 and 0x20000 respectively. I want to make use
of NAND FLASH.

4. I use tftp to put the uImage on AT91SAM9263EK
tftp 0x21400000 uImage

5. This is U-boot environment

bootargs=console=ttyS0,115200 root=/dev/mtdblock5
mtdparts=at91_nand:128k(bootst
rap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) rw
rootfstype=jffs2
bootcmd=nand read 0x22000000 0xA0000 0x200000; bootm
bootdelay=3
baudrate5200
ethact=macb0
ethaddr:03:04:85:06:07
filesize103C
fileaddr!400000
ipaddr0.10.4.35
serverip0.10.4.43

6. After loading uImage in NAND FLASH when I use bootm to boot it; I
get the message :

"No filesystem could mount root, tried: jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)"

I am surely missing the file system. How can I put the jffs2 file
system in NAND FLASH and at what location? What commands at U-boot do
I use?

I cannot use nfs as I run Linux in VMware on windows host machine.

Thanks for all the help in advance.

Hi,

First of all Did you enable the JFFS2 filesystem in the kernel
configuration?

Browse www.linux4sam.org for the JFFS2 based root filesystem for
AT91SAM9263-EK.Just as you transferred the uImage through tftp similarly you
can transfer the root filesystem and burn the flash.you can use nand write
command from u-boot for that.

Regarding the address where it needs to be fused,refer the following file in
the kernel source .

arch/arm/mach-at91/at91sam9263_devices.c or any file pertaining to
AT91SAM9263EK in which you can find how the nand flash is partitioned and
where you fuse the root filesystem.
Regards
T.V.R.Prasad
On 2/25/09, swcareers wrote:
>
> Hi all,
>
> I am using a AT91SAM9263-EK and want to run Linux on it. I have
> already downloaded Linux-2.6.27 kernel and built it for ARM. Steps I used:
>
> 1. make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
>
> 2. mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000
> -n linux-2.6 -d arch/arm/boot/zImage uImage
>
> That gives me uImage.
>
> 3. On the AT91SAM9263-EK, I have downloaded Bootstrap and U-Boot using
> SAM-BA at addresses 0x0 and 0x20000 respectively. I want to make use
> of NAND FLASH.
>
> 4. I use tftp to put the uImage on AT91SAM9263EK
> tftp 0x21400000 uImage
>
> 5. This is U-boot environment
>
> bootargs=console=ttyS0,115200 root=/dev/mtdblock5
> mtdparts=at91_nand:128k(bootst
> rap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) rw
> rootfstype=jffs2
> bootcmd=nand read 0x22000000 0xA0000 0x200000; bootm
> bootdelay=3
> baudrate5200
> ethact=macb0
> ethaddr:03:04:85:06:07
> filesize103C
> fileaddr!400000
> ipaddr0.10.4.35
> serverip0.10.4.43
>
> 6. After loading uImage in NAND FLASH when I use bootm to boot it; I
> get the message :
>
> "No filesystem could mount root, tried: jffs2
> Kernel panic - not syncing: VFS: Unable to mount root fs on
> unknown-block(0,0)"
>
> I am surely missing the file system. How can I put the jffs2 file
> system in NAND FLASH and at what location? What commands at U-boot do
> I use?
>
> I cannot use nfs as I run Linux in VMware on windows host machine.
>
> Thanks for all the help in advance.
>
Hi,

>From the u-boot environment printed it seems that the rootfilesystem should
be placed at 0x2A0000 in the Nand flash.

Regards
T.V.R.Prasad
On 2/25/09, swcareers wrote:
>
> Hi all,
>
> I am using a AT91SAM9263-EK and want to run Linux on it. I have
> already downloaded Linux-2.6.27 kernel and built it for ARM. Steps I used:
>
> 1. make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
>
> 2. mkimage -A arm -O linux -C none -T kernel -a 20008000 -e 20008000
> -n linux-2.6 -d arch/arm/boot/zImage uImage
>
> That gives me uImage.
>
> 3. On the AT91SAM9263-EK, I have downloaded Bootstrap and U-Boot using
> SAM-BA at addresses 0x0 and 0x20000 respectively. I want to make use
> of NAND FLASH.
>
> 4. I use tftp to put the uImage on AT91SAM9263EK
> tftp 0x21400000 uImage
>
> 5. This is U-boot environment
>
> bootargs=console=ttyS0,115200 root=/dev/mtdblock5
> mtdparts=at91_nand:128k(bootst
> rap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) rw
> rootfstype=jffs2
> bootcmd=nand read 0x22000000 0xA0000 0x200000; bootm
> bootdelay=3
> baudrate5200
> ethact=macb0
> ethaddr:03:04:85:06:07
> filesize103C
> fileaddr!400000
> ipaddr0.10.4.35
> serverip0.10.4.43
>
> 6. After loading uImage in NAND FLASH when I use bootm to boot it; I
> get the message :
>
> "No filesystem could mount root, tried: jffs2
> Kernel panic - not syncing: VFS: Unable to mount root fs on
> unknown-block(0,0)"
>
> I am surely missing the file system. How can I put the jffs2 file
> system in NAND FLASH and at what location? What commands at U-boot do
> I use?
>
> I cannot use nfs as I run Linux in VMware on windows host machine.
>
> Thanks for all the help in advance.
>
Thanks for the reply -

I tried to use the rootfs from

http://www.linux4sam.org/twiki/bin/view/Linux4SAM/BuildRootGet#Buildroot_generic_rootfs_for_SAM
by downloading the file v23434-rootfs.arm_nofpu.jffs2

But it is a big file, i followed the instructions on the same page to
download it on the NAND Flash; that is

U-Boot> tftp 0x21400000 v23434-rootfs.arm_nofpu.jffs2
U-Boot> nand write.jffs2 0x21400000 0x400000 0xyyyyyyyy

Once this is done; where do i put the kernel now? On the same page it
says that the file v23434-rootfs.arm_nofpu.jffs2 includes
"busybox-Unix-like toolkit". So if it has the unix like kernel already
in there then i dont need it because I want to use my own kernel, in
that case where do I get the jffs2 root filesystem from. But if this
the root fs i must use, where do I put the kernel that i have built
for myself.

Another point is, when I print environment in U-Boot it says -
"bootargs=console=ttyS0,115200 root=/dev/mtdblock5
mtdparts=at91_nand:128k(bootst
rap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) rw
rootfstype=j
ffs2"

Please notice root=/dev/mtdblock5
but address 0x21400000 to NAND FLASH at offset 0x400000 is
/dev/mtdblock1. How do I take care of this conflict.

I may sound wierd but I am new at this and need help. Thanks.

Try to get the rootfilesystem from the following URL

http://www.linux4sam.org/twiki/bin/view/Linux4SAM/OpenEmbeddedAngstromGet#Root_file_system_pre_built_image
.
>From the u-boot environment printed there to burn the flash the command you
have to use is :

U-Boot> nand write.jffs2 0x21400000 0x2A0000 0xyyyyyyyy

If this doesn't work please feel free to contact me.

Regards
T.V.R.Prasad
On Wed, Feb 25, 2009 at 8:01 PM, swcareers wrote:

> Thanks for the reply -
>
> I tried to use the rootfs from
> http://www.linux4sam.org/twiki/bin/view/Linux4SAM/BuildRootGet#Buildroot_generic_rootfs_for_SAM
> by downloading the file v23434-rootfs.arm_nofpu.jffs2
>
> But it is a big file, i followed the instructions on the same page to
> download it on the NAND Flash; that is
>
> U-Boot> tftp 0x21400000 v23434-rootfs.arm_nofpu.jffs2
> U-Boot> nand write.jffs2 0x21400000 0x400000 0xyyyyyyyy
>
> Once this is done; where do i put the kernel now? On the same page it
> says that the file v23434-rootfs.arm_nofpu.jffs2 includes
> "busybox-Unix-like toolkit". So if it has the unix like kernel already
> in there then i dont need it because I want to use my own kernel, in
> that case where do I get the jffs2 root filesystem from. But if this
> the root fs i must use, where do I put the kernel that i have built
> for myself.
>
> Another point is, when I print environment in U-Boot it says -
>
> "bootargs=console=ttyS0,115200 root=/dev/mtdblock5
> mtdparts=at91_nand:128k(bootst
> rap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root) rw
> rootfstype=j
> ffs2"
>
> Please notice root=/dev/mtdblock5
> but address 0x21400000 to NAND FLASH at offset 0x400000 is
> /dev/mtdblock1. How do I take care of this conflict.
>
> I may sound wierd but I am new at this and need help. Thanks.
>
>
>
Thanks Vishnu, I appreciate your help. Here is what happened:

I copied the jffs2 the way you suggested. -

U-Boot> tftp 0x21400000 Angstrom-x11-image-demo-glibc-at91.rootfs.jffs2
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
Using macb0 device
TFTP from server 150.10.4.43; our IP address is 150.10.4.35
Filename 'Angstrom-x11-image-demo-glibc-at91.rootfs.jffs2'.
Load address: 0x21400000
Loading: #################################################################
#################################################################
#################################################################
....
#################################################################
################################################################
done
Bytes transferred = 27131904 (19e0000 hex)

U-Boot> nand write.jffs2 0x21400000 0x2A0000 0x19e0000
NAND write: device 0 offset 0x2a0000, size 0x19e0000
Writing data at 0x1c7f800 -- 100% complete.
27131904 bytes written: OK

After that I copied my image (i hope i did it right) and gave boot command

U-Boot> tftp 0x21400000 uImage
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
Using macb0 device
TFTP from server 150.10.4.43; our IP address is 150.10.4.35
Filename 'uImage'.
Load address: 0x21400000
Loading: #################################################################
#############################
done
Bytes transferred = 1373024 (14f360 hex)

U-Boot> bootm
## Booting kernel from Legacy Image at 21400000 ...
Image Name: linux-2.6
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1372960 Bytes = 1.3 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing
Linux.............................................................
Linux version 2.6.27 (root@ubuntu) (gcc version 4.2.0 20070413 (prerelease)
(Co9
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr053177
Machine: Atmel AT91SAM9263-EK
Ignoring unrecognised tag 0x54410008
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 199 MHz, master 99 MHz, main 16.367 MHz
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 in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyS0,115200 root=/dev/mtdblock5
mtdparts=at91_nan2
AT91: 160 gpio irqs in 5 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] enabled
.....
.....
.....
TCP cubic registered
NET: Registered protocol family 17
List of all partitions:
1f00 4096 mtdblock0 (driver?)
1f01 61440 mtdblock1 (driver?)
1f02 196608 mtdblock2 (driver?)
No filesystem could mount root, tried: jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)

It did not boot but i guess now the problem is with the bootargs:

here is U-boot environment:

bootargs=console=ttyS0,115200 root=/dev/mtdblock5
mtdparts=at91_nand:128k(bootstrap)ro,256k(uboot)ro,128k(env1)ro,128k(env2)ro,2M(linux),-(root)
rwrootfstype=jffs2
bootcmd=nand read 0x22000000 0xA0000 0x200000; bootm
If you notice the kernel lists only three partitions - mtdblock0, mtdblock1
and mtdblock2 where as in bootargs it looks at root=/dev/mtdblock5
I guess my partitions are not listed correctly. it also says - (driver?). I
guess here is the issue.

I will appreciate your suggestions.

Thanks.
Updating my previous message. please read it in continuation with the
previous. Thanks

Here is what happens when image was copied to 0x22000000 (aftre the jffs2
was copied to NAND as said in previous message) and bootm was given. The
partitions are listed for NAND flash and are highlighted in red. But I still
dont know what partitions it talks about at the end:
U-Boot> tftp 0x22000000 uImage
macb0: link up, 100Mbps full-duplex (lpa: 0x45e1)
Using macb0 device
TFTP from server 150.10.4.43; our IP address is 150.10.4.35
Filename 'uImage'.
Load address: 0x22000000
Loading: #################################################################
#############################
done
Bytes transferred = 1374608 (14f990 hex)

U-Boot> bootm
## Booting kernel from Legacy Image at 22000000 ...
Image Name: linux-2.6
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1374544 Bytes = 1.3 MB
Load Address: 20008000
Entry Point: 20008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing
Linux.............................................................
Linux version 2.6.27 (root@ubuntu) (gcc version 4.2.0 20070413 (prerelease)
(Co9
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr053177
Machine: Atmel AT91SAM9263-EK
Ignoring unrecognised tag 0x54410008
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 199 MHz, master 99 MHz, main 16.367 MHz
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 in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: console=ttyS0,115200 root=/dev/mtdblock5
mtdparts=at91_nan2
AT91: 160 gpio irqs in 5 banks
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttyS0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 62028KB available (2532K code, 198K data, 104K init)
Calibrating delay loop... 99.73 BogoMIPS (lpjI8688)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 288 bytes
NET: Registered protocol family 16
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
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 121
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_lcdfb atmel_lcdfb.0: backlight control is not available
atmel_lcdfb atmel_lcdfb.0: 150KiB frame buffer at 23940000 (mapped at
ffc00000)
atmel_lcdfb atmel_lcdfb.0: fb0: Atmel LCDC at 0x00700000 (mapped at
c485c000), 6
atmel_usart.0: ttyS0 at MMIO 0xfeffee00 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfff8c000 (irq = 7) is a ATMEL_SERIAL
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfffbc000 irq 21 (02:03:04:85:06:07)
eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy_addrffffff:00,
irq=)
Driver 'sd' needs updating - please use bus_type methods
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V
8-bi)
AT91 NAND: 8-bit, net ECC
Scanning device for bad blocks
Creating 3 MTD partitions on "atmel_nand":
0x00000000-0x00400000 : "Bootstrap"
0x00400000-0x04000000 : "Partition 1"
0x04000000-0x10000000 : "Partition 2"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xfffa4000 (irq 14)
usbmon: debugfs is not available
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 29, io mem 0x00a00000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usb usb1: New USB device found, idVendor6b, idProduct01
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: AT91 OHCI
usb usb1: Manufacturer: Linux 2.6.27 ohci_hcd
usb usb1: SerialNumber: at91
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
ads7846 spi0.3: touchscreen, irq 31
input: ADS784x Touchscreen as
/devices/platform/atmel_spi.0/spi0.3/input/input0
i2c /dev entries driver
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.17.
AC97C regs = FFFA0000
AC97C irq = 18
at91-ac97: codec write timeout
<4>at91-ac97: codec write timeout
<4>at91-ac97: codec write timeout
<4>at91-ac97: codec write timeout
<6>ALSA device list:
#0: Atmel AC97 Controller at 0xfffa0000, irq 18
TCP cubic registered
NET: Registered protocol family 17
List of all partitions:
1f00 4096 mtdblock0 (driver?)
1f01 61440 mtdblock1 (driver?)
1f02 196608 mtdblock2 (driver?)
No filesystem could mount root, tried: jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)
Ok, I have got the rootfs mounted now.

I changed the bootargs like this:

bootargs memdM console=ttyS0,115200 root=mtd2 rw rootfstype=jffs2

Because as in previous message the address 0x21400000 lies in the third
partition in NAND flash (0x04000000-0x10000000 : "Partition 2") so I used
root=mtd2
Now while booting the kernel, at the end it shows:

VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 104K
Warning: unable to open an initial console.
Kernel panic - not syncing: No init found. Try passing init= option to
kernel.

It appears that the file system is mounted but it is not finding init. How
do I fix this now???

Thanks in the advance my friend. Sorry for the spam.
Hai,

You forgot to put the console = option in the bootargs which is the cause of
the error you have mentioned.

Regards
T.V.R.Prasad

On Fri, Feb 27, 2009 at 1:03 AM, Amandeep Bhullar wrote:

> Ok, I have got the rootfs mounted now.
>
> I changed the bootargs like this:
>
> bootargs memdM console=ttyS0,115200 root=mtd2 rw rootfstype=jffs2
>
> Because as in previous message the address 0x21400000 lies in the third
> partition in NAND flash (0x04000000-0x10000000 : "Partition 2") so I used
> root=mtd2
> Now while booting the kernel, at the end it shows:
>
> VFS: Mounted root (jffs2 filesystem).
> Freeing init memory: 104K
> Warning: unable to open an initial console.
> Kernel panic - not syncing: No init found. Try passing init= option to
> kernel.
>
> It appears that the file system is mounted but it is not finding init. How
> do I fix this now???
>
> Thanks in the advance my friend. Sorry for the spam.
>
>
>
No, if you take a closer look i have passed console=ttyS0,115200

Thanks