android 根文件系统,嵌入式Linux/Android根文件系统制作的几种方法(未完)

这时候test目录下就是解压完成的ramdisk文件压缩:假设被压缩的目录为test,压缩完成的rd是r-u.img#mkdir /mnt/loop

#dd if=/dev/zero of=/tmp/loop_tmp bs=1k count=15360

#mke2fs –F –v –m 0 /tmp/loop_tmp

#mount –o loop /tmp/loop_tmp /mnt/loop

#cp -af test/* /mnt/loop

#umount /mnt/loop

#gzip –v9 /tmp/loop_tmp

#mv /tmp/loop_tmp ramdisk.img

#mkimage -A arm -O linux -T ramdisk -C none -a 0x51000000 -e 0x51000040 -n "ramdisk" -d ramdisk.img r-u.img3、ubi文件系统的制作命令命令解析flash_eraseall /dev/mtd7使用这个命令擦除,可能会提示这个命令过时了。可以用flash_erase替换ubiattach -m 7 -O 2048将mtd7 关联到/dev/ubi0 VID offset 为2048ubimkvol /dev/ubi0 -N rootfs -S 1900制作ubi系统逻辑卷 卷名rootfs  LEB个数为1900mount -t ubifs /dev/ubi0_0 /mnt将ubi文件系统(ubifs)挂载到/mnt目录下Linux启动时的参数列表的设置root=uib0:rootfs rw ubi.mtd=7,2048就可以挂载为根4、使用busybox方法制作#!/bin/bash

#yuanxin.yang develop 2015-07-05

#文件系统和Busybox的路径====>可自己定制

FILESYSTEM=/Softwave/filesystem #定义自己制作的文件系统存放的位置

BUSYBOX=/Softwave/arm/busybox-1.17.2 #Busybox源码包的位置,上网下载然后解压

LIBS=/usr/local/arm/4.5.1/arm-none-linux-gnueabi #交叉编译相关的库文件的位置,使用自己下载的版本

#判断文件是否存在 如果存在 就删除

if [ -d $FILESYSTEM ]

then

rm -rf $FILESYSTEM &>/dev/null

mkdir $FILESYSTEM &>/dev/null

else

mkdir $FILESYSTEM &>/dev/null

fi

#拷贝busybox相关的文件

if ! cp -rf $BUSYBOX/_install/* $FILESYSTEM &>/dev/null

then

echo "cp busybox failed..."

exit 1

fi

#拷贝库

if ! cp -rf $LIBS/lib/ $FILESYSTEM/ &>/dev/null

then

echo "copy libs fair...."

exit 1

fi

#拷贝etc

if ! cp -rf $BUSYBOX/examples/bootfloppy/etc $FILESYSTEM &>/dev/null

then

echo "copy etc fair..."

exit 1

fi

#创建Linux相关目录

cd $FILESYSTEM &>/dev/null

mkdir boot mnt root sys var net proc tmp dev home opt &>/dev/null

#修改配置文件

echo > $FILESYSTEM/etc/fstab

#修改etc/profile文件

echo "# /etc/profile: system-wide .profile file for the Bourne shells" > $FILESYSTEM/etc/profile

echo "echo "==========================="" >> $FILESYSTEM/etc/profile

echo "echo "Welcom to Linux System"" >> $FILESYSTEM/etc/profile

echo "echo "==========================="" >> $FILESYSTEM/etc/profile

echo "export PS1="[yuanxin@Linux W] # "" >> $FILESYSTEM/etc/profile

#修改 etc/init.d/rcS

echo "#! /bin/sh" > $FILESYSTEM/etc/init.d/rcS

echo "/bin/mount -n -t proc none /proc" >> $FILESYSTEM/etc/init.d/rcS

echo "/bin/mount -n -t sysfs none /sys " >> $FILESYSTEM/etc/init.d/rcS

echo "/bin/mount -t ramfs none /dev " >> $FILESYSTEM/etc/init.d/rcS

echo "/bin/mount -n -t ramfs none /tmp " >> $FILESYSTEM/etc/init.d/rcS

echo "/sbin/mdev -s" >> $FILESYSTEM/etc/init.d/rcS

#配置nfs服务

if ! grep "$FILESYSTEM" /etc/exports &>/dev/null

then

echo "/filesystem *(rw,sync,no_root_squash)" >> /etc/exports

fi

#启动服务

iptables -F &>/dev/null

service rpcbind restart

service nfs restart

echo "make filesystem ok....."

exit 0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值