Create a Bootable MicroSD Card

http://gumstix.org/create-a-bootable-microsd-card.html

Create a Bootable MicroSD Card

Beginners

Note: The following instructions are intended for experienced Gumstix users. Beginners are recommended to use Linaro or Sakoman's daily GNOME builds

Supported MMC/SD Cards

Gumstix DuoVero COMs and Overo COMs "support MMC/SD cards compliant with the Multimedia Card System Specification v4.2 from the MMCA Technical Committee and the SD I/O Card Specification v2.0 from the SD Association. Includes high-capacity (size >2GB) cards: HC-SD and HC MMC", as per the Texas Instruments OMAP specification. (added Feb 6 2012)

Setup

First, insert your microSd card into the development machine's flash card slot. You may need to use a microSD to SD card adapter or a USB card reader. Use the mount or df commands to determine the device name of SD card. Names such as /dev/mmcblk0p1 or /dev/sde1 are typical; /dev/sda is usually your computer's hard drive so be sure not to use this. A 2GB SD available at /dev/mmcblk0 is used as an example for this procedure; you'll need to adjust the commands to match your card. Unmount any mounted partitions of the attached device e.g.

$ sudo umount /dev/mmcblk0p1

Partitions versus Drives

In Linux, a physical block device such as a hard drive or an SD card appears in the '/dev' directory e.g. /dev/hda/dev/sr0, or /dev/mmcblk1. This device file refers to the **whole** physical device. A single physical device can contain multiple individual partitions each with their own file system. These partitions also appear in the '/dev' directory under the same name but include a suffix e.g. /dev/mmcblk1p0 (partition #0 of physical device 'mmcblk1), /dev/sdf1 (partition #1 of physical device 'sdf'). Linux makes the file systems on these partitions available by 'mounting' them to a directory in the existing file system. For removable devices, such 'mount points' are traditionally found in the '/mnt' or '/media' directories.

Calculate Card Size

A special geometry is required to make best use of the underlying SD card memory and for data to be accessible by the DuoVero or Overo boot ROM. Calculate the required number of 'cylinders' for your particular card. Find the card size in first line of the response to this command:

$ sudo fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 2016 MB, 2016411648 bytes

Divide the card size in bytes by 255 heads, 63 sectors and 512 bytes per sector and round down to the nearest integer. E.g. 2016411648/255/63/512 = 245.15 --> 245 cylinders.

Partition the Card

Gumstix COMs require at least two partitions: a FAT partition containing files needed to boot and a Linux partition on which the root file system for the operating system is stored. To start, we clean up any existing partition data e.g.

$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024

The sfdisk tools can perform the required partitioning e.g.

$ sudo sfdisk --force -D -uS -H 255 -S 63 -C 245 /dev/mmcblk0

where the value of the -C parameter is the number of cylinders calculated in previous step. At the sfdisk, type 128,130944,0x0C,* and then press  to set up a 64MB bootable FAT partition. Next, type 131072,,,- and press  three more times to create the Linux partition and complete the partition table. When prompted to write this new partition table, type y to accept. An example session looks like this:

Checking that no-one is using this disk right now ...
OK
[snip]
Input in the following format; absent fields get a default value.
     
Usually you only need to specify  and  (and perhaps ).
/dev/mmcblk0p1 :128,130944,0x0C,*
/dev/mmcblk0p1   *       128    131071     130944   c  W95 FAT32 (LBA)
/dev/mmcblk0p2 :131072,,,-
/dev/mmcblk0p2        131072   3938303    3807232  83  Linux
/dev/mmcblk0p3 :
/dev/mmcblk0p3             0         -          0   0  Empty
/dev/mmcblk0p4 :
/dev/mmcblk0p4             0         -          0   0  Empty
New situation:
Units = sectors of 512 bytes, counting from 0
  Device Boot    Start       End   #sectors  Id  System
/dev/mmcblk0p1   *       128    131071     130944   c  W95 FAT32 (LBA)
/dev/mmcblk0p2        131072   3938303    3807232  83  Linux
/dev/mmcblk0p3             0         -          0   0  Empty
/dev/mmcblk0p4             0         -          0   0  Empty
Warning: partition 1 does not end at a cylinder boundary
Do you want to write this to disk? [ynq] y
Successfully wrote the new partition table
[snip]

Formatting the New Partitions

Format the first partition as a FAT file system (the -n parameter gives it a label of boot).

$ sudo mkfs.vfat -F 32 /dev/mmcblk0p1 -n boot

Note: If your computer is missing the mkfs.vfat program, try installing the dosfsutils package and try again. E.g.

$ sudo apt-get install dosfsutils

Format the second partition for Linux (the -L parameter gives it a label of rootfs):

$ sudo mke2fs -j -L rootfs /dev/mmcblk0p2

Now, mount these partitions.

$ sudo mkdir /media/{boot,rootfs}
$ sudo mount -t vfat /dev/mmcblk0p1 /media/boot
$ sudo mount -t ext3 /dev/mmcblk0p2 /media/rootfs

Installing the Boot Files

The final step is to copy over the software that will run on your Gumstix COM. A matched set of the following files is required:

  • a root file system e.g. rootfs.tar.bz2
  • a kernel binary image e.g. uImage
  • a u-boot bootloader binary image e.g. u-boot.bin
  • a x-loader binary image e.g. MLO (Overo only) Use mlo-updated if using a STORM COM

Prebuilt image can be downloaded or found in the tmp/deploy directory of the OpenEmbedded build system.

Copy the binary files directly to the first partition: Note: Overo only. The x-loader binary must be copied first.

$ sudo cp MLO /media/boot/MLO overo only

For both Overo and verdex pro.

$ sudo cp u-boot.bin /media/boot/u-boot.bin
$ sudo cp uImage /media/boot/uImage

Expand the root file system archive on to the second partition:

$ sudo tar xaf roofs.tar.bz2 -C /media/rootfs
$ sync

Now, unmount these partitions and your card is ready to use:

$ sudo umount /media/boot
$ sudo umount /media/rootfs

U-boot Environment Refresh

U-boot comes with a default set of environment variables that can change as new versions are released. If you are updating u-boot, clear your current set of u-boot environment variables the first time you boot with the new version. Do this by breaking into u-boot and typing the following commands. (Overo COMs with NAND flash only).

# nand erase 240000 20000
# reset

To make additional changes to the environment, break into u-boot again, make the changes and type 'saveenv' to save. This also eliminates the "*** Warning - bad CRC or NAND, using default environment".

Insert your microSD into your verdex pro and power the system on. It may be necessary to change the u-boot environment variables to specify that the kernel should be loaded from the microSD. This can be done with the following commands.

# mmcinit
# fatload mmc 0 a2000000 uimage
# setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk0p2 rw rootdelay=1
# bootm a2000000

Add a saveenv prior to the bootm command to save this setup for future boots.

Tip for Systems Using Nautilus

When a microSD card is inserted into computers using the Nautilus file manager such as Ubuntu, a window typically pops-up showing the contents of the partitions or offering to do some action. This can be a little annoying but can be easily disabled. While browsing a folder in Nautilus, click Edit-->Preferences-->Media, select Never prompt or start programs on media insertion, and ensure Browse media when inserted is de-selected.

 


转自:http://www.cnblogs.com/androidme/p/3259088
2019-03-02 23:55

知识点

相关教程

更多

《wordpress插件制作视频教程》(How to create a wordpress plugin)全5集更新完毕[HDTV]

中文名: wordpress插件制作视频教程    英文名: How to create a wordpress plugin    资源格式: HDTV    主讲人: wordpress花园    版本: 全5集更新完毕    发行日期: 2013年7月9日    地区: 大陆    对白语言: 普通话    文字语言: 简体中文    简介:        内容介绍:         网盘下

《Joomla 2.5 模板教程:宁皓网》(Create a Joomla 2.5 Template)前两章 + 模板资源[光盘镜像]

中文名: Joomla 2.5 模板教程:宁皓网    英文名: Create a Joomla 2.5 Template    别名: Joomla模板视频教程    资源格式: 光盘镜像    学校: 宁皓网    主讲人: 王皓    版本: 前两章 + 模板资源    发行日期: 2012年03月20日    地区: 大陆    对白语言: 普通话    文字语言: 简体中文    简介:

Becoming a data scientist

Data Week: Becoming a data scientist Data Pointed, CouchDB in the Cloud, Launching Strata                                                                                                       Life Adv

She’s Not Carrying A Handbag

Gao Yuanyuan from after 2005 drama " world first" nine times no drama filmed last fall , " Let's get married " is for its regression . Although Gao Yuanyuan acting contrived, but g

javax.imageio.IIOException: Can't create output stream!的解决方案

ImageIO.write(image, "jpeg", response.getOutputStream());修改为JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());encoder.encode(image);就可以了

Book Report: THE SOUL OF A NEW MACHINE

Book Report: THE SOUL OF A NEW MACHINE Zhengdong Zhang What’s a good man in a storm like? The prologue of the book draws a astonishing picture. The ship is winding in the billows, and the storm is how

Solr: a custom Search RequestHandler

As you know, I've been playing with Solr lately, trying to see how feasible it would be to customize it for our needs. We have been a Lucene shop for a while, and we've built our own search framework

Spring Data: a new perspective of data operations

Spring Data: a new perspective of data operations  Spring Data is an umbrella project from SpringSource Community, which tries to provide a more generic abstraction of data operations for RDBMS, NoSQL

A Great List of Windows Tools

Windowsis an extremely effective and a an efficient operating system. Like any other operating systemwindowstoo needs a good set of development tools which are extremely necessary for the operating sy

How to Start a Business in 10 Days

With an executive staffing venture about to open, a business loan from the in-laws gnawing at her conscience and a new baby to care for, Michelle Fish was already feeling the pressure. But what really

Drupal Forums instead of phpBB or vBulletin: A casestudy

5th Jan, 10    Drupal  drupal advanced forum  drupal forum  drupal forum styles  drupal phpBB  drupal user badge  drupal vBulletin  phpBB  vBulletin  Coding   For years I have been using phpBB for a b

Supra Skytop Shoes All White Gunny are a top performance

The Skytop “Crimson” is an all white leather affair, with white terry lining on the inside, that bleeds in all the right places on the outside: red eyelets, and a red vulcanized sole with red foxing c

Hadoop源码分析HDFS ClientProtocol——create

ClientProtocol负责完成HDFS Client与NameNode之间的交互。本文主要分析一下create方法的具体实现。Create方法在namespace中创建一条entry,实际就是在命名空间中创建一个文件。该方法在命名空间中创建的文件是一个空文件,并且,一旦创建完成,该文件对于其他客户端就是可见的和可用的(visible and available)。 首先让我们思考一下,根据我

merge solr index &&&&& very import create new core

http://wiki.apache.org/solr/MergingSolrIndexes http://localhost:8080/solr/admin/cores?action=CREATE&name=core4&instanceDir=core2&config=solrconfig.xml&schema=schema.xml&dataDir=dat

[转]So You Want To Be A Producer

pro-du-cer n. 1. Someone from a game publisher who will be the liaison between the publisher and the game development team. 2. A furnace that manufactures producer gas.  If you want to learn about fur

最新教程

更多

java线程状态详解(6种)

java线程类为:java.lang.Thread,其实现java.lang.Runnable接口。 线程在运行过程中有6种状态,分别如下: NEW:初始状态,线程被构建,但是还没有调用start()方法 RUNNABLE:运行状态,Java线程将操作系统中的就绪和运行两种状态统称为“运行状态” BLOCK:阻塞状态,表示线程阻塞

redis从库只读设置-redis集群管理

默认情况下redis数据库充当slave角色时是只读的不能进行写操作,如果写入,会提示以下错误:READONLY You can't write against a read only slave.  127.0.0.1:6382> set k3 111  (error) READONLY You can't write against a read only slave. 如果你要开启从库

Netty环境配置

netty是一个java事件驱动的网络通信框架,也就是一个jar包,只要在项目里引用即可。

Netty基于流的传输处理

​在TCP/IP的基于流的传输中,接收的数据被存储到套接字接收缓冲器中。不幸的是,基于流的传输的缓冲器不是分组的队列,而是字节的队列。 这意味着,即使将两个消息作为两个独立的数据包发送,操作系统也不会将它们视为两个消息,而只是一组字节(有点悲剧)。 因此,不能保证读的是您在远程定入的行数据

Netty入门实例-使用POJO代替ByteBuf

使用TIME协议的客户端和服务器示例,让它们使用POJO来代替原来的ByteBuf。

Netty入门实例-时间服务器

Netty中服务器和客户端之间最大的和唯一的区别是使用了不同的Bootstrap和Channel实现

Netty入门实例-编写服务器端程序

channelRead()处理程序方法实现如下

Netty开发环境配置

最新版本的Netty 4.x和JDK 1.6及更高版本

电商平台数据库设计

电商平台数据库表设计:商品分类表、商品信息表、品牌表、商品属性表、商品属性扩展表、规格表、规格扩展表

HttpClient 上传文件

我们使用MultipartEntityBuilder创建一个HttpEntity。 当创建构建器时,添加一个二进制体 - 包含将要上传的文件以及一个文本正文。 接下来,使用RequestBuilder创建一个HTTP请求,并分配先前创建的HttpEntity。

MongoDB常用命令

查看当前使用的数据库    > db    test  切换数据库   > use foobar    switched to db foobar  插入文档    > post={"title":"领悟书生","content":"这是一个分享教程的网站","date":new

快速了解MongoDB【基本概念与体系结构】

什么是MongoDB MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era. MongoDB是一个基于分布式文件存储的数据库。由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案。

windows系统安装MongoDB

安装 下载MongoDB的安装包:mongodb-win32-x86_64-2008plus-ssl-3.2.10-signed.msi,按照提示步骤安装即可。 安装完成后,软件会安装在C:\Program Files\MongoDB 目录中 我们要启动的服务程序就是C:\Program Files\MongoDB\Server\3.2\bin目录下的mongod.exe,为了方便我们每次启动,我

Spring boot整合MyBatis-Plus 之二:增删改查

基于上一篇springboot整合MyBatis-Plus之后,实现简单的增删改查 创建实体类 添加表注解TableName和主键注解TableId import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baom

分布式ID生成器【snowflake雪花算法】

基于snowflake雪花算法分布式ID生成器 snowflake雪花算法分布式ID生成器几大特点: 41bit的时间戳可以支持该算法使用到2082年 10bit的工作机器id可以支持1024台机器 序列号支持1毫秒产生4096个自增序列id 整体上按照时间自增排序 整个分布式系统内不会产生ID碰撞 每秒能够产生26万ID左右 Twitter的 Snowflake分布式ID生成器的JAVA实现方案