Eu tenho um sistema de arquivos que estou tentando colocar na partição mtd3 de memória flash. Inicializo primeiro usando o uboot e depois faço o run sdboot
boot usando o cartão SD, como mostrado abaixo:
U-Boot-PetaLinux>
U-Boot-PetaLinux> printenv mtdparts
mtdparts=mtdparts=0:5M(boot),128K(bootenv),10752K(image),4M(spare)
U-Boot-PetaLinux>run sdboot
Agora eu tenho um sistema linux em execução.
.
.
.
.
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)
Então, por que isso mostra:
nandwrite: error !: O arquivo de entrada não cabe no dispositivo
Você pode ver minhas variáveis ambientais na primeira linha, forneci espaço suficiente de 4 MB. Por que uma imagem do tamanho 3513340 bytes (3,35 MB) não cabe em um dispositivo? E de onde isso
tamanho do dispositivo 393216 bytes chegando?
informação adicional
#cat /proc/cmdline
console=ttyPS0,115200
mtdinfo:
Count of MTD devices: 4
Present MTD devices: mtd0, mtd1, mtd2, mtd3
Sysfs interface supported: yes
partições
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"
também pode ser visto que:
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
Sistema
petalinux rodando no córtex ARM A9
http://www.wiki.xilinx.com/Linux
Árvore de dispositivos http://git.yoctoproject.org/cgit/cgit.cgi/meta-xilinx/plain/conf/machine/boards/zedboard/zedboard-zynq7-board.dtsi
Partição na ferramenta de configuração Essa é a ferramenta de configuração que utilizo antes da criação do image.ub. Veja o tamanho do jffs2 que é maior que o tamanho real do arquivo rootfs.jffs2.
/ 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:~#
drivers mmc
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
Solução
Eu o resolvi usando a ferramenta de configuração e fazendo as seguintes seleções que não foram selecionadas anteriormente.
File systems --->
-*- Native language support --->
<*> Codepage 437 (United States, Canada)
...
<*> NLS ISO 8859-1 (Latin 1; Western European Languages)
...
Flash Partition Table
, mas estritamente não existe para mtd
dispositivos - os tamanhos das partições são definidos pelo kernel, não armazenados no dispositivo.
/sys/class/mtd
. Se você postar a saída de lsmod
, eu devo saber qual driver você está usando e procurar mtd->name
.