Difference between revisions of "Template:Linux-SPIFlash/zh"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(updated by API)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
Creating 1 MTD partitions on "spi0.0":
 
Creating 1 MTD partitions on "spi0.0":
 
0x000000000000-0x000001000000 : "spi-flash"
 
0x000000000000-0x000001000000 : "spi-flash"
<syntaxhighlight>
+
</syntaxhighlight>
  
 
SPI Flash在Linux系统下的使用方法如下:<br>
 
SPI Flash在Linux系统下的使用方法如下:<br>
 
<syntaxhighlight lang="text">
 
<syntaxhighlight lang="text">
# cat /sys/class/mtd/mtd0/size          # 以byte为单位
+
$ cat /sys/class/mtd/mtd0/size          # 以byte为单位
# cat /sys/class/block/mtdblock0/size  # 以sector(512 byte)为单位
+
$ cat /sys/class/block/mtdblock0/size  # 以sector(512 byte)为单位
# apt-get install mtd-utils  
+
$ apt-get install mtd-utils  
# flash_eraseall -j /dev/mtd0          # 格式成jffs2的格式
+
$ flash_eraseall -j /dev/mtd0          # 格式成jffs2的格式
# mount -t jffs2 /dev/mtdblock0 /mnt     
+
$ mount -t jffs2 /dev/mtdblock0 /mnt     
# mkfs.ext4 /dev/mtdblock0              # 格式化为ext4
+
$ mkfs.ext4 /dev/mtdblock0              # 也格式化为ext4
# mount -t ext4 /dev/mtdblock0 /mnt
+
$ mount -t ext4 /dev/mtdblock0 /mnt
<syntaxhighlight>
+
</syntaxhighlight>

Latest revision as of 03:32, 15 January 2019

启动Linux系统时,看到类似下面的启动信息则说明SPI Flash被成功检测到了:

m25p80 spi0.0: mx25l12805d (16384 Kbytes)
1 ofpart partitions found on MTD device spi0.0
Creating 1 MTD partitions on "spi0.0":
0x000000000000-0x000001000000 : "spi-flash"

SPI Flash在Linux系统下的使用方法如下:

$ cat /sys/class/mtd/mtd0/size          # 以byte为单位
$ cat /sys/class/block/mtdblock0/size   # 以sector(512 byte)为单位
$ apt-get install mtd-utils 
$ flash_eraseall -j /dev/mtd0           # 格式成jffs2的格式
$ mount -t jffs2 /dev/mtdblock0 /mnt    
$ mkfs.ext4 /dev/mtdblock0              # 也格式化为ext4
$ mount -t ext4 /dev/mtdblock0 /mnt