OK335x mksd.sh hacking
#! /bin/sh
# mk3PartSDCard.sh v0.
# Licensed under terms of GPLv2 # 参考文档:
# . sfidsk创建可启动分区问题
# http://segmentfault.com/a/1190000002493628
# . sfdisk 中文手册
# http://blog.csdn.net/hnmsky/article/details/7650964
# . linux sfdisk partition
# http://blog.csdn.net/shell_albert/article/details/8425530
# . How to Make Partition SD Card
# http://processors.wiki.ti.com/index.php/How_to_Make_3_Partition_SD_Card if [ $# -ne ]; then
echo "USAGE:"
echo " $0 <device node>"
exit -;
fi # 获取SD卡设备节点,并擦除分区表
DRIVE=$
dd if=/dev/zero of=$DRIVE bs= count= # 获取SD卡大小,并在terminal中显示字节大小
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes # 计算磁柱数
# 每一个柱面的大小为255**=,, Bytes
CYLINDERS=`echo $SIZE/// | bc` # Usage:
# sfdisk [options] <device> [...]
#
# Options:
# -s, --show-size list size of a partition
# -c, --id change or print partition Id
# --change-id change Id
# --print-id print Id
# -l, --list list partitions of each device
# -d, --dump idem, but in a format suitable for later input
# -i, --increment number cylinders etc. from instead of from
# -u, --unit <letter> units to be used; <letter> can be one of
# S (sectors), C (cylinders), B (blocks), or M (MB)
# -, --one-only reserved option that does nothing currently
# -T, --list-types list the known partition types
# -D, --DOS for DOS-compatibility: waste a little space
# -E, --DOS-extended DOS extended partition compatibility
# -R, --re-read make the kernel reread the partition table
# -N <number> change only the partition with this <number>
# -n do not actually write to disk
# -O <file> save the sectors that will be overwritten to <file>
# -I <file> restore sectors from <file>
# -V, --verify check that the listed partitions are reasonable
# -v, --version display version information and exit
# -h, --help display this help text and exit
#
# Dangerous options:
# -f, --force disable all consistency checking
# --no-reread do not check whether the partition is in use
# -q, --quiet suppress warning messages
# -L, --Linux do not complain about things irrelevant for Linux
# -g, --show-geometry print the kernel's idea of the geometry
# -G, --show-pt-geometry print geometry guessed from the partition table
# -A, --activate[=<device>] activate bootable flag
# -U, --unhide[=<dev>] set partition unhidden
# -x, --show-extended also list extended partitions in the output,
# or expect descriptors for them in the input
# --leave-last do not allocate the last cylinder
# --IBM same as --leave-last
# --in-order partitions are in order
# --not-in-order partitions are not in order
# --inside-outer all logicals inside outermost extended
# --not-inside-outer not all logicals inside outermost extended
# --nested every partition is disjoint from all others
# --chained like nested, but extended partitions may lie outside
# --onesector partitions are mutually disjoint
#
# Override the detected geometry using:
# -C, --cylinders <number> set the number of cylinders to use
# -H, --heads <number> set the number of heads to use
# -S, --sectors <number> set the number of sectors to use
# # sfdisk的-D参数指定与DOS兼容,并自动在每个分区前预留空间,以存放MBR(Master Boot Record);
#
# <start>, <size>, <id>, <bootable>
#
# bootable 可以指定为[*|-]格式,默认值是"-"也就是没有可引导标记。
# 这个标记仅对DOS有意义:DOS会给带有可引导标记的主分区分配 C: 盘符
#
# id 应该以无"0x"前缀的格式给出其十六进制值,或者[E|S|L]简写字母:
# L()是默认值;
# S(,LINUX_SWAP);
# E(,扩展分区)。
#
# 第一行分区描述,,0x0C,* 自动分配起始柱面,数量为9,分区ID为0x0C(表示FAT32分区),<bootable>为*, 表示可启动分区。
# 第二行分区描述10,,,- 同样自动分配起柱面,数量为115,其它为默认。
# 第三行分区描述126,,,- 同样自动分配起柱面,剩下所有的数量,其它为默认。
sfdisk -D -H -S -C $CYLINDERS $DRIVE << EOF
,,0x0C,*
,,,-
,,,-
EOF # 这里可以得到一张FAT32分区的SD卡,我有时候我们就只需要一张这样的卡
# sfdisk -D -H -S -C $CYLINDERS $DRIVE << EOF
# ,,0x0C,*
# EOF # 格式化各个分区,格式化完卸载对应的分区
mkfs.vfat -F -n "boot" ${DRIVE}
umount ${DRIVE}
mkfs.ext3 -L "rootfs" ${DRIVE}
umount ${DRIVE}
mkfs.ext3 -L "START_HERE" ${DRIVE}
OK335x mksd.sh hacking的更多相关文章
- Woobuntu woobuntu_build.sh hacking
# Woobuntu woobuntu_build.sh hacking # 说明: # 有时候因为一些需求,我们需要定制一些系统,包括Ubuntu系统,于是 # 我们自然需要知道如何去解包一个Ubu ...
- OK335xS psplash make-image-header.sh hacking
/***************************************************************************** * OK335xS psplash mak ...
- ti processor sdk linux am335x evm setup.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm setup.sh hacking # 说明: # 本文主要对TI的sdk中的setup.sh脚本进行解读 ...
- ti processor sdk linux am335x evm /bin/setup-host-check.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-host-check.sh hacking # 说明: # 本文主要对TI的sdk ...
- 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中 ...
- ti processor sdk linux am335x evm /bin/unshallow-repositories.sh hacking
#!/bin/bash # # ti processor sdk linux am335x evm /bin/unshallow-repositories.sh hacking # 说明: # 本文主 ...
- ti processor sdk linux am335x evm /bin/setup-package-install.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-package-install.sh hacking # 说明: # 本文主要对T ...
- ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-uboot-env.sh hacking # 说明: # 本文主要对TI的sdk中 ...
- ti processor sdk linux am335x evm /bin/setup-minicom.sh hacking
#!/bin/sh # # ti processor sdk linux am335x evm /bin/setup-minicom.sh hacking # 说明: # 本文主要对TI的sdk中的s ...
随机推荐
- VirtualBox安装RedHat7
软件准备 VirtualBox-5.2.8-121009-Win.exe rhel-server-7.4-x86_64-dvd.iso 安装环境 win10 安装步骤: 1.先在win10系统中安装V ...
- HA-web-services
一.HA部署 本次实验的程序选型为heartbeat v1 + hearesources.资源有IP和httpd,filesystem 配置HA集群的前提: (1)各节点资源一致,硬件或软件环境一致 ...
- mybatis批量保存的两种方式(高效插入)
知识点:mybatis中,批量保存的两种方式 1.使用mybatis foreach标签 2.mybatis ExecutorType.BATCH 参考博客:https://www.jb51.net/ ...
- mybatis的sql映射文件—增删改查
前提:需要的包log4j.jar,mybatis-3.4.1.jar,mysql-connector-java-5.1.37-bin.jar 1.基本类 员工类 package com.hand.my ...
- IPFS星际节点网站 IPNS域名解析教程
IPNS星际文件系统IPFS提供的域名命名空间,相当于经典HTTP协议中的DNS.只不过是,IPNS是将内容寻址的哈希值(HASH值)转换为域名,而DNS是将IP地址转换为域名. 前段时间,IPFS协 ...
- 转载- ACM常见的各种说法
from : http://blog.csdn.net/qq_15015129/article/details/52738184 1.答案错误 —— wrong answer 就是最常见的.这个没办法 ...
- web.config文件配置解决网站上传大文件限制
Asp.Net网站对上传文件的大小,请求执行的时间都做了限制,上传的文件如果超过限制或者执行上传时间超出, 文件上传都将失败. 因此,需要配置web.config来增加最大文件上传的大小和执行超时时间 ...
- canvas实现鼠标拖拽矩形移动改变大小
项目的一个新需求,动态生成矩形框,鼠标点击拖动改变矩形框的位置,并可以调整大小. 之前做过一个小demo,需求类似,但是在canvas内只有一个矩形框,拖动移动,当时记得是用isPointInPath ...
- 项目管理工具:Maven
Maven是什么,作用是什么? Maven是项目管理工具,主要有两大作用:项目构建和依赖管理.项目构建就是项目编译.测试.集成发布实现自动化,依赖管理是很方便的功能,只要把当前项目所依赖的构件(jar ...
- maven笔记(4)
项目管理利器(Maven)——依赖范围(classPath:编译,运行,测试)1.compile:默认范围,编译测试运行都有效2.provided:在编译和测试时有效3.runtime:在测试和运行时 ...