I have a files system that I am trying to put in flash memory mtd3 partition.
I first boot using uboot and then do run sdboot
to boot using SD card as shown below:
U-Boot-PetaLinux>
U-Boot-PetaLinux> printenv mtdparts
mtdparts=mtdparts=0:5M(boot),128K(bootenv),10752K(image),4M(spare)
U-Boot-PetaLinux>run sdboot
Now I have a running linux system.
.
.
.
.
root@Xilinx-ZC702-14_7:/mnt/flashboot# nandwrite -p /dev/mtd3 rootfs.jffs2
Image 3513340 bytes, NAND page 1 bytes, OOB area 0 bytes, device size 393216 bytes
nandwrite: error!: Input file does not fit into device
error 0 (Success)
nandwrite: error!: Data was only partially written due to error
error 0 (Success)
So why it shows:
nandwrite: error!: Input file does not fit into device
You can see my environmental variables in first line, I have given sufficient space of 4MB, so why an image of size 3513340 bytes (3.35 MB) won't fit in a device ? And from where this
device size 393216 bytes coming?
Additional info
#cat /proc/cmdline
console=ttyPS0,115200
mtdinfo:
Count of MTD devices: 4
Present MTD devices: mtd0, mtd1, mtd2, mtd3
Sysfs interface supported: yes
partitions
root@Xilinx-ZC702-14_7:/# cat /proc/mtd
dev: size erasesize name
mtd0: 00500000 00010000 "boot"
mtd1: 00020000 00010000 "bootenv"
mtd2: 00a80000 00010000 "image"
mtd3: 00060000 00010000 "spare"
also it can be seen that:
root@Xilinx-ZC702-14_7:/mnt/flash# mtdinfo /dev/mtd0
mtd0
Name: boot
Type: nor
Eraseblock size: 65536 bytes, 64.0 KiB
Amount of eraseblocks: 80 (5242880 bytes, 5.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:0
Bad blocks are allowed: false
Device is writable: true
root@Xilinx-ZC702-14_7:/mnt/flash# mtdinfo /dev/mtd1
mtd1
Name: bootenv
Type: nor
Eraseblock size: 65536 bytes, 64.0 KiB
Amount of eraseblocks: 2 (131072 bytes, 128.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:2
Bad blocks are allowed: false
Device is writable: true
root@Xilinx-ZC702-14_7:/mnt/flash# mtdinfo /dev/mtd2
mtd2
Name: image
Type: nor
Eraseblock size: 65536 bytes, 64.0 KiB
Amount of eraseblocks: 168 (11010048 bytes, 10.5 MiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:4
Bad blocks are allowed: false
Device is writable: true
root@Xilinx-ZC702-14_7:/mnt/flash# mtdinfo /dev/mtd3
mtd3
Name: spare
Type: nor
Eraseblock size: 65536 bytes, 64.0 KiB
Amount of eraseblocks: 6 (393216 bytes, 384.0 KiB)
Minimum input/output unit size: 1 byte
Sub-page size: 1 byte
Character device major/minor: 90:6
Bad blocks are allowed: false
Device is writable: true
System
petalinux running on ARM cortex A9
http://www.wiki.xilinx.com/Linux
Partition in Configuration Tool This is the tool for configuration I use prior to building image.ub. See the size of jffs2 which is greater than the actual size of rootfs.jffs2 file.
/sys/class/mtd
root@Xilinx-ZC702-14_7:/sys/class/mtd# ls -ld *
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd0 -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd0
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd0ro -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd0ro
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd1 -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd1
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd1ro -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd1ro
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd2 -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd2
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd2ro -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd2ro
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd3 -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd3
lrwxrwxrwx 1 root root 0 Jan 1 00:00 mtd3ro -> ../../devices/amba.0/e000d000.ps7-qspi/spi_master/spi32766/spi32766.0/mtd/mtd3ro
root@Xilinx-ZC702-14_7:/sys/class/mtd#
Drivers
root@Xilinx-ZC702-14_7:~# ls /sys/bus/*/drivers
/sys/bus/amba/drivers:
/sys/bus/clocksource/drivers:
/sys/bus/cpu/drivers:
/sys/bus/hid/drivers:
hid-generic
/sys/bus/i2c/drivers:
at24 dummy pca954x
/sys/bus/mdio_bus/drivers:
Generic PHY
/sys/bus/mmc/drivers:
mmcblk
/sys/bus/platform/drivers:
alarmtimer vexpress-sysreg xilinx-gpio xusbps-dr
of-flash xadcps xilinx_emaclite xusbps-ehci
physmap-flash xdevcfg xqspips xusbps-otg
sdhci-zynq xemacps xslcr xusbps-udc
uio_pdrv_genirq xgpiops xsmcps xwdtps
vexpress-reset xi2cps xuartps zynq_remoteproc
/sys/bus/rpmsg/drivers:
rpmsg_proto rpmsg_server_sample
/sys/bus/scsi/drivers:
ch osst sd sr st
/sys/bus/sdio/drivers:
/sys/bus/serio/drivers:
/sys/bus/spi/drivers:
m25p80
/sys/bus/usb/drivers:
hub usb usb-storage usbfs usbhid
/sys/bus/virtio/drivers:
virtio_rpmsg_bus
root@Xilinx-ZC702-14_7:~#
mmc drivers
root@Xilinx-ZC702-14_7:/# cd /sys/bus/mmc/drivers/mmcblk/
root@Xilinx-ZC702-14_7:/sys/bus/mmc/drivers/mmcblk# ls
bind mmc0:1234 uevent unbind
root@Xilinx-ZC702-14_7:/sys/bus/mmc/drivers/mmcblk# cd mmc0\:1234/
root@Xilinx-ZC702-14_7:/sys/devices/amba.0/e0100000.ps7-sdio/mmc_host/mmc0/mmc0:1234# ls
cid hwrev scr
csd manfid serial
date name subsystem
driver oemid type
erase_size power uevent
fwr
Solution
I solved it by using configuration tool , and by making the following selections which were unslected earlier.
File systems --->
-*- Native language support --->
<*> Codepage 437 (United States, Canada)
...
<*> NLS ISO 8859-1 (Latin 1; Western European Languages)
...
Flash Partition Table
, but strictly there is no such thing formtd
devices - the partition sizes are defined by the kernel, not stored on the device. – Graeme Mar 25 '14 at 11:55/sys/class/mtd
. If you post the output oflsmod
, I should be able to tell which driver you are using and lookmtd->name
. – Graeme Mar 26 '14 at 11:31/proc/bus/pci/devices
should show some of the driverslspci
would. – Graeme Mar 26 '14 at 13:28ls /sys/bus/pci/drivers
should show a list of drivers in use. – Graeme Mar 26 '14 at 13:34mtd->name
can be looked up manually in the kernel source, since there seems to be no way to do this on a running system. I will update with what has been discovered so far. Otherwise if there is no pci, thenls /sys/bus/*/drivers
should show all drivers. – Graeme Mar 26 '14 at 14:23