openwrt配置动态挂载sd卡(一) -- shell脚本

由于openwrt的存储有限,将一些比较大的文件放到sd卡中,经过sd卡访问。bash

一、经过:make menuconfig 安装sd卡的驱动以及相关的支持,须要配置3个方面:
   ①增长对sd card的驱动程序支持,用于检测sd card插拔和驱动:this

meke menuconfig

 


②增长对vfat文件系统的支持,不然没法挂载sd card:如下2选1执行便可code

meke kernel_menuconfig
标题

③语言设置:
 blog

二、开机自动挂载sd卡实现:进入openwrt_widora/package/base-files/files/etc/找到rc.local文件it

通常来讲这个文件开机自动启动脚本的命令,而实际的脚本存放在openwrt_widora/package/base-files/files/sbin里面io

这里咱们新建一个挂载sd卡的脚本:mount_sd.shclass

#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
mount /dev/mmcblk0p1 /mnt/

在rc.local中加入自动启动脚本的命令:配置

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

# start DLNA services
if [ -e /etc/dlna.sh ]; then
/etc/dlna.sh &
fi
#开机自动启动挂载sd卡的脚本
if [ -e /sbin/mount_sd.sh ]; then
/sbin/mount_sd.sh &
fi
exit 0
标题