一板网电子技术论坛

发表于: 2016-2-22 11:53:26 | 显示全部楼层

SD卡


当SD卡用作USB存储设备测试时,你可以按照类似的方法。可以列出连接的存储设备:

  1. # fdisk -l
  2. Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
  3. 81 heads, 10 sectors/track, 19165 cylinders, total 15523840 sectors
  4. Units = sectors of 1 * 512 = 512 bytes
  5. Sector size (logical/physical): 512 bytes / 512 bytes
  6. I/O size (minimum/optimal): 512 bytes / 512 bytes
  7. Disk identifier: 0x00000000

  8.         Device Boot      Start         End      Blocks   Id  System
  9. /dev/mmcblk0p1              10    15523649     7761820   83  Linux
复制代码

准备SD卡文件系统

这些步骤描述了OpenRex板在新的SD卡建立一个文件系统。下载文件系统。请确保使用最新的文件。将所有的文件复制到主机(我们使用的是Ubuntu 9.04),可以在这里准备SD卡。

检查SD卡是否成功插入。

  1. # dmesg | tail
  2. [813850.046729] sd 7:0:0:0: [sdb] Write Protect is off
  3. [813850.046732] sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
  4. [813850.046733] sd 7:0:0:0: [sdb] Assuming drive cache: write through
  5. [813850.054749] sd 7:0:0:0: [sdb] 15523840 512-byte hardware sectors: (7.94 GB/7.40 GiB)
  6. [813850.061263] sd 7:0:0:0: [sdb] Write Protect is off
  7. [813850.061265] sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
  8. [813850.061267] sd 7:0:0:0: [sdb] Assuming drive cache: write through
  9. [813850.061272]  sdb: sdb1
  10. [813850.072395] sd 7:0:0:0: [sdb] Attached SCSI removable disk
  11. [813850.072443] sd 7:0:0:0: Attached scsi generic sg2 type 0
复制代码

确保已经挂载SD卡。现在运行分区管理工具(本例中SD卡映射为/dev/sdb),并且建立一个新分区。

  1. # fdisk /dev/sdb

  2. The number of cylinders for this disk is set to 19165.
  3. There is nothing wrong with that, but this is larger than 1024,
  4. and could in certain setups cause problems with:
  5. 1) software that runs at boot time (e.g., old versions of LILO)
  6. 2) booting and partitioning software from other OSs
  7.    (e.g., DOS FDISK, OS/2 FDISK)

  8. Command (m for help): p

  9. Disk /dev/sdb: 7948 MB, 7948206080 bytes
  10. 81 heads, 10 sectors/track, 19165 cylinders
  11. Units = cylinders of 810 * 512 = 414720 bytes
  12. Disk identifier: 0x00000000

  13.    Device Boot      Start         End      Blocks   Id  System
  14. /dev/sdb1               1       19165     7761820   83  Linux

  15. Command (m for help): d
  16. Selected partition 1

  17. Command (m for help): n
  18. Command action
  19.    e   extended
  20.    p   primary partition (1-4)
  21. p
  22. Partition number (1-4): 1
  23. First cylinder (1-19165, default 1):
  24. Using default value 1
  25. Last cylinder, +cylinders or +size{K,M,G} (1-19165, default 19165):
  26. Using default value 19165

  27. Command (m for help): w
  28. The partition table has been altered!

  29. Calling ioctl() to re-read partition table.
  30. Syncing disks.
复制代码

格式化该分区。

  1. # mkfs.ext3 /dev/sdb1
  2. mke2fs 1.41.4 (27-Jan-2009)
  3. Filesystem label=
  4. OS type: Linux
  5. Block size=4096 (log=2)
  6. Fragment size=4096 (log=2)
  7. 485760 inodes, 1940455 blocks
  8. 97022 blocks (5.00%) reserved for the super user
  9. First data block=0
  10. Maximum filesystem blocks=1988100096
  11. 60 block groups
  12. 32768 blocks per group, 32768 fragments per group
  13. 8096 inodes per group
  14. Superblock backups stored on blocks:
  15.     32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

  16. Writing inode tables: done                           
  17. Creating journal (32768 blocks): done
  18. Writing superblocks and filesystem accounting information: done

  19. This filesystem will be automatically checked every 39 mounts or
  20. 180 days, whichever comes first.  Use tune2fs -c or -i to override.
复制代码

现在SD卡已经准备好复制文件。挂载SD卡。

  1. mount /dev/sdb1 /media/sdcard
  2. cd /media/sdcard
复制代码

解压文件系统。

  1. tar -pxvzf /home/fedevel/imx6rex-xubuntu-13-04-production-04-AUG-2014.tar
复制代码

将内核复制到SD卡中。

  1. cp -prv /home/fedevel/openrex/uImage .
复制代码

卸载USB设备,同时SD卡准备好工作了。

  1. cd
  2. umount /media/sdcard
复制代码

可以去掉SD卡并且在OpenRex板上测试。


在u-boot中列出SD卡文件

可以使用以下命令在u-boot中检查SD卡的内容。

  1. mmc dev 0; ext2ls mmc 0
复制代码
跳转到指定楼层
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题 14 | 回复: 22



Archiver|手机版|小黑屋|

GMT+8, 2019-8-23 18:58 , Processed in 0.031250 second(s), 28 queries . Powered by Discuz! X3.4

YiBoard一板网 © 2015-2018 地址:河北省石家庄市长安区高营大街 ( 冀ICP备18020117号 )

快速回复 返回顶部 返回列表