新闻  |   论坛  |   博客  |   在线研讨会
ramdisk.image.gz 制作,采用脚本实现
lolo84 | 2016-12-28 10:41:35    阅读:1493   发布文章

制作ramdisk.image.gz 一直不成功;

但是步骤都是按照wiki上的步骤来的, 这边先记录一下步骤,并且用脚本实现,不需要每次都输入命令;

脚本如下:mout_auto.sh

#!/bin/sh

#
# tool: mount_sd_and_ramdisk
#
# simple script to mount both the sdcard and ramdisk image
# for the Avnet Zedboard
#
# Written by ZynqGeek
#

# start

# create our two mount point directorys
echo Creating Directories ...
cd /
mkdir sdcard
mkdir ramdisk
echo Done

# mount our sd card
echo Mounting SD-Card ...
umount /media/root/linux_fs
mount  /dev/sdb1 /sdcard
echo ... Done

# make a copy of the compressed ramdisk image locally
echo Copying Ram Disk Image to /tmp ...
cp -f /sdcard/ramdisk.image.gz /tmp/
echo ... Done

# unzip the image, so we can mount it
echo Unzipping the image ...
gunzip -f /tmp/ramdisk.image.gz
echo ... Done

# mount the image to the directory we created
echo Mounting the image to /ramdisk ...
mount -o loop /tmp/ramdisk.image /ramdisk
echo ... Done

# all done!
mount


/*umount_auto.sh*/

#!/bin/sh

#
# tool: umount_sd_and_ramdisk
#
# simple script to unmount, recompress, and move over the ramdisk image,
# to the sd-card as well as unmount the sd-card
#
# Written by ZynqGeek
#

# start

# unmount ramdisk image
echo Unmounting Ram Disk ...
umount -l /ramdisk
echo ... Done

# compress ramdisk image
echo Compressing Ram Disk Image ... this make take a few seconds ...
gzip -9 /tmp/ramdisk8M.image
echo ... done.

# make a back-up on the SD-Card
echo Making Copy of Existing Ram Disk Image ...
cp /sdcard/ramdisk8M.image.gz /sdcard/ramdisk8M.image.gz.orig
echo ... Done

# move the compressed image back to the sd-card
echo Overwriting Existing Compressed Image on SD-Card ...
mv /tmp/ramdisk8M.image.gz /sdcard/ramdisk8M.image.gz.new
echo ... Done

# unmount the sd-card
echo Unmounting SD-Card ...
umount -l /sdcard
echo ... Done

具体制作ramdisk的方案参照 wiki 网址如下:




*博客内容为网友个人发布,仅代表博主个人观点,如有侵权请联系工作人员删除。

参与讨论
登录后参与讨论
推荐文章
最近访客