加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mkramdisk_p1.sh 1.23 KB
一键复制 编辑 原始数据 按行查看 历史
kaikuo 提交于 2015-03-26 08:34 . update mkramdisk
#!/bin/bash
#########################################################################
# Author : zkk@crscd.com.cn
# Created Time: Thu 26 Mar 2015 05:33:39 AM PDT
# File Name : mkramdisk_p1.sh
# Description :
#########################################################################
RDSIZE=20000
BLKSIZE=1024
ROOTFS=rootfs-basic
echo ""
echo "Script to generate initial ramdisk for embedde linux -- Part 1"
echo "Script will copy $ROOTFS and generate a ramdisk"
echo ""
# check the rootfs-basic
echo ""
echo "rootfs-basic exist. start to release it!"
echo ""
# Create an empty ramdisk image
echo "dd if=/dev/zero of=/tmp/ramdisk.img bs=$BLKSIZE count=$RDSIZE"
dd if=/dev/zero of=/tmp/ramdisk.img bs=$BLKSIZE count=$RDSIZE
echo ""
# Make it an ext2 mountable file system
echo "/sbin/mke2fs -F -m 0 -b $BLKSIZE /tmp/ramdisk.img $RDSIZE"
/sbin/mke2fs -F -m 0 -b $BLKSIZE /tmp/ramdisk.img $RDSIZE
echo ""
# Mount it so that we can populate
echo "mount /tmp/ramdisk.img ./new -t ext2 -o loop=/dev/loop1"
mount /tmp/ramdisk.img ./new -t ext2 -o loop=/dev/loop1
echo ""
# copy from old to new
echo "cp ./$ROOTFS/* ./new/ -r"
cp -a -r ./$ROOTFS/* ./new/
echo ""
echo "Finished Part 1"
echo "Now make changes as you like in ./new, then run the Part 2"
echo ""
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化