how to partition the spiflash to mount rootfs

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to partition the spiflash to mount rootfs

2,722件の閲覧回数
muaxi8
Contributor V

My SpiFlash is 256Mb, how do I partition the space after 64MB?Because I want to mount my root file system, which is now under RAM0, my files are not saved after reboot

bootargs=console=ttyAMA0,115200 root=/dev/ram0

0 件の賞賛
返信
5 返答(返信)

2,715件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

You could use bootargs "mtdparts" to partition xspi flash, please refer to the following example on lx2160ardb.

=> pri bootargs

bootargs=console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 mtdparts=20c0000.spi-1:1m(rcw),15m(u-boot),48m(qspi_Usertest)

root@TinyLinux:~# cat /proc/mtd
dev: size erasesize name
mtd0: 04000000 00020000 "20c0000.spi-0"
mtd1: 00100000 00020000 "rcw"
mtd2: 00f00000 00020000 "u-boot"
mtd3: 03000000 00020000 "qspi_Usertest"

0 件の賞賛
返信

2,707件の閲覧回数
muaxi8
Contributor V

The first 64MB of flash space has been partitioned and is fixed. Can I use the "mtdparts" command to partition the 64MB space?I think I should only partition after 64MB."Root =/dev/ram0" indicates that the root file system is mounted to ram. After the restart, the files I create will be lost.You should also use "rootfstype=?"To specify the root file system type, what is the file system type?

muaxi8_0-1628734547715.png

 

0 件の賞賛
返信

2,701件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

You could specify the bootargs as the following for your XSPI flash.

console=ttyAMA0,115200 root=/dev/mtdblock3 earlycon=pl011,mmio32,0x21c0000 rootfstype=jffs2 mtdparts=20c0000.spi-1:1m(rcw),15m(uboot_andother),240m(qspi_Usertest)

You need to do the following preparation first.

Please enable CONFIG_JFFS2_FS in Linux Kernel configuration file.

root@localhost:~# flash_erase /dev/mtd3 0 0
root@localhost:~# mount -t jffs2 /dev/mtdblock3 /tmp

Then copy rootfs filesystme content to /tmp folder.

0 件の賞賛
返信

2,665件の閲覧回数
muaxi8
Contributor V

=>pri bootargs
bootargs=console=ttyAMA0,115200 root=/dev/mtdblock3 rootfstype=jffs2 rw earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf mtdparts=20c0000.spi-0:1M(rcw)ro,15M(uboot_andother)ro,16M(kernel),32M(rootfs),-(user)

i can see that the partition was successful。But I randomly specify "root=/dev/mtdblock "and the root file system will be found and started correctly

root@TinyLinux:~# cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "rcw"
mtd1: 00f00000 00020000 "uboot_andother"
mtd2: 01000000 00020000 "kernel"
mtd3: 02000000 00020000 "rootfs"
mtd4: 0c000000 00020000 "user"
mtd5: 10000000 00020000 "20c0000.spi-1"

 

flash_erase Command not found 。Is it the reason that my root file system doesn't have this command ?  Can you provide a file system that contains this command。The file I created now will not be saved when I restart again

muaxi8_0-1629378334886.png

 

Then I banned Randisk from the kernel and the following print appeared.I think it's my root file system.

muaxi8_0-1629530020297.png

 

 

 

0 件の賞賛
返信

2,648件の閲覧回数
yipingwang
NXP TechSupport
NXP TechSupport

The tiny rootfs doesn't include flash_erase command. Please use ubuntu:main rootfs filesystem and deploy rootfs filesystem to SD card/USB device.

$ wget https://www.nxp.com/lgfiles/sdk/lsdk2012/rootfs_lsdk2012_ubuntu_main_arm64.tgz

$ flex-installer  -r rootfs_lsdk2012_ubuntu_main_arm64.tgz  -d /dev/sdx

Note:/dev/sdx is SD device

=>setenv bootargs "console=ttyAMA0,115200  root=/dev/mmcblk0p4 rw rootwait earlycon=pl011,mmio32,0x21c0000 mtdparts=20c0000.spi-1:1m(rcw),15m(uboot_andother),240m(qspi_Usertest)"

=>tftp 0xa0000000  Image
=>tftp 0xb0000000 fsl-lx2160a-rdb.dtb

=>booti 0xa0000000 - 0xb0000000

 

0 件の賞賛
返信