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.
Create a Bootable MicroSD Card的更多相关文章
- create a bootable USB stick on Ubuntu
https://tutorials.ubuntu.com/tutorial/tutorial-create-a-usb-stick-on-ubuntu?_ga=2.141187314.17572770 ...
- [Angular] Using directive to create a simple Credit card validator
We will use 'HostListener' and 'HostBinding' to accomplish the task. The HTML: <label> Credit ...
- How to install Armbian on Orange Pi Plus 2e
bian on Orange Pi Plus 2e How to install Armbian on Orange Pi Plus 2e Armbian on the microSD You jus ...
- TI的AM3359的sd卡分区以及sd卡启动说明
[1]sd 卡分区: ti提供了自己的分区shell脚本create-sdcard.sh 脚本目录在:ti-sdk-am335x-evm-05.06.00.00/bin/ (1)插入sd卡(若是笔记 ...
- ti processor sdk linux am335x evm /bin/create-sdcard.sh hacking
#!/bin/bash # # ti processor sdk linux am335x evm /bin/create-sdcard.sh hacking # 说明: # 本文主要对TI的sdk中 ...
- UEFI Bootable USB Flash Drive - Create in Windows(WIN7 WIN8)
How to Create a Bootable UEFI USB Flash Drive for Installing Windows 7, Windows 8, or Windows 8.1 In ...
- 【雕爷学编程】Arduino动手做(52)---MicroSD卡读写模块
37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止37种 的.鉴于本人手头积累了一些传感器和模块,依照实践(动手试试)出真知的理念,以学习和交流为目的,这里准 ...
- 利用VMware虚拟机(Android-x86 2.2)和eclipse,调试安卓代码
下载 android-x86-2.2-generic.iso (这里包含eth0) http://www.android-x86.org/download XP32位 只能使用 VMware Wor ...
- [OrangePi] Booting from USB drive
You can also boot from USB drive partition. The file named cmdline.txt must exist on BOOT (fat) part ...
随机推荐
- VS2010 远程调试
1.在客户端电脑建一个账户,账户名和密码和调试端的账户密码一样 2.在客户端电脑进入 管理工具-本地安全策略-本地策略-安全选项 网络访问:本地账户的共享和安全模式”,改为“经典-本地用户以自己的身份 ...
- C#.Net中的非托管代码清理
帮助其它项目组Review代码过程,发现有些地方实现了IDispose接口,同时也发现了一些关于IDispose的问题: 1.A类型实现了IDispose接口,B类型里面含有A类型的字段,B类型没有实 ...
- ASP.NET服务器控件在IE10浏览器(非兼容模式)下报脚本错误的可能解决办法
关于IE10出现LinkButton点击无效的情况: 一般高配置的系统如Win7旗舰版SP1系统不会出现这种情况,针对家庭普通版和专业版的用户通过测试都有这种情况,对于开发人员要解决不同 ...
- Swift 实现Bitmask Option(Enum)
在Swift中实现ObjC中的NS_OPTION不是通过enum,而是通过conform RawOptionSetType protocol的struct来实现的. 代码如下: struct Test ...
- DCEF3 相关资料
DCEF3 调用 js http://www.cnblogs.com/Delphi-Farmer/p/4103708.html interface uses ceflib;//其它 type //这里 ...
- 记录一下centos安装httpd+php+mysql的过程
1.安装apache httpd 这个貌似安装完centos后自带了,如果没有,也可以用yum安装 yum -y install httpd 2.安装php yum -y install php ph ...
- 用iframe设置代理解决ajax跨域请求问题
面对ajax跨域请求的问题,想用代理的方式来解决这个跨域问题.在服务器端创建一个静态的代理页面,在客户端用iframe调用这个代理 今天在项目中需要做远程数据加载并渲染页面,直到开发阶段才意识到aja ...
- Codeforces Gym 100015G Guessing Game 差分约束
Guessing Game 题目连接: http://codeforces.com/gym/100015/attachments Description Jaehyun has two lists o ...
- pjsip视频通信开发(上层应用)之EditText重写
我们经常使用手机的打电话功能,当我们按键盘的时候,有一个地方显示我们按键的内容,当我们的手点击那个地方的时候,并没有弹出软件盘,所以我们再有数字键盘的时候,要屏蔽系统的软件盘. 我们分析一下,软件盘弹 ...
- C++ 内存泄露处理方法 (转)
1.可以显示内存泄露情况,但无法找到具体的文件位置写法 包含头文件#include <crtdbg.h> 然后在需要检测内存泄露的位置加上语句 _CrtDumpMemoryLeaks(); ...