借花献佛参考这个: https://emlinuxwork.blogspot.com/2016/06/made-sd-card-usb-mass-storage-automount.html (可能要番蔷)
buildroot 生成根文件系统之后,
修改 /etc/mdev.conf, 末尾添加:
sd[a-z][0-9] 0:0 660 */etc/init.d/automount.sh
mmcblk[0-9]p[0-9] 0:0 660 */etc/init.d/automount.sh
新建文件 /etc/init.d/automount.sh
#!/bin/sh
/bin/touch /var/plog
if [ "$MDEV" == "" ]; then
echo "automount unknow error!" >> /var/plog
exit 1
elif [ "$MDEV" == "mmcblk0p1" ]; then
mmtype=sdcard
elif [ "$MDEV" == "sda1" ]; then
mmtype=usb
else
echo "automount unknow dev:" >> /var/plog
echo $MDEV >> /var/plog
exit 1
fiecho $mmtype >> /var/plog
case "$ACTION" in
add|"")
echo “Add device $MDEV” >> /var/plog
mkdir -p /mnt/$mmtype
mount -t vfat /dev/$MDEV /mnt/$mmtype
;;
remove)
echo “remove device $MDEV” >> /var/plog
umount /mnt/$mmtype
rm /mnt/$mmtype -rf
;;
esac
离线
挂载成功:
# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 11776 4524 7252 38% /
devtmpfs 19268 0 19268 0% /dev
tmpfs 27972 0 27972 0% /dev/shm
tmpfs 27972 324 27648 1% /tmp
tmpfs 27972 12 27960 0% /run
/dev/mmcblk0p1 1920672 32 1920640 0% /mnt/sdcard
/dev/sda1 16334 9108 7226 56% /mnt/usb
最近编辑记录 还能这么玩 (2019-08-07 17:23:03)
离线
/proc/sys/kernel/hotplug 有可能是只写文件, 不能读?
离线