AllWinner T113 rootfs只读修改

一、没有使用initramfs

1、在device目录下env.cfg中修改setargs_mmc中增加root=${mmc_root} ro

二、如果使用initramfs文件系统

1、在kernel目录下rootfs.cpio.gz的init脚本中,do_mount 的-o rw 修改成ro

initramfs的配置如下: 

cpio解压方法:
    1.  # gunzip  XXX.cpio.gz
    2. cpio -idmv < XXX.cpio

修改当前目录下init 文件将rw改成ro


# $1: The block device
do_mount()
{
        e2fsck -y $1
        mount -o rw,noatime,nodiratime,norelatime,noauto_da_alloc,barrier=0,data=ordered -t ext4 $1 /mnt
        if [ $? -ne 0 ]; then
                echo [$0]: Failed to mount $1!
        fi
}

pack.sh 


cd temp
find ./* | cpio -H newc -o > rootfs.cpio
gzip rootfs.cpio
cp -f rootfs.cpio.gz ../

cd ../
rm -rf temp

unpack.sh

if [ -e temp ];then
        rm -rf temp
fi

mkdir temp
cd temp
cp ../rootfs.cpio.gz ./
gunzip rootfs.cpio.gz
cpio -idmv < rootfs.cpio
rm -rf ./rootfs.cpio
chmod 777 . -R

rootfs/etc/inittab

# Startup the system
::sysinit:/etc/preinit
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,ro /
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
::sysinit:/bin/mount -a
::sysinit:/sbin/swapon -a
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS

# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L  ttyS0 115200 vt100 # GENERIC_SERIAL
::respawn:-/bin/sh

# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot

# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值