找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 18209|回复: 11

让Openwrt在U盘运行

[复制链接]
发表于 2014-10-7 02:19 | 显示全部楼层 |阅读模式
本帖最后由 a765058024 于 2014-10-7 14:15 编辑

让Openwrt在U盘运行

1、 前提条件:
具有USB接口,拥有USB存储设备;
2、 所需组件:
kmod-usb-ohci         对应usb1.1
kmod-usb2              对应USB2.0
kmod-usb-uhci         对应部分intel和VIA的usb控制器
kmod-usb-stroage    对应USB硬盘设备,如U盘、USB移动硬盘。

3、 执行命令
opkg  update                                         #更新软件列表
opkg install block-extroot
opkg  install block-mount block-hotplug     #自动挂载
opkg  install block-extroot                       #USB启动
opkg  install kmod-fs-ext3                       #ext3文件系统支持
opkg  install e2fsprogs                            #格式化工具
mkfs.ext3/dev/sda1                              #将sda1格式化为ext3
mkfs.ext4/dev/sda1                              #将sda1格式化为ext4
cat  /proc/mounts                                  #查看已挂载的文件系统
mount /dev/sda1 /mnt
mkdir /tmp/root
mount -o bind / /tmp/root                      #挂载并同步
cp /tmp/root/* /mnt -a
umount /tmp/root
echo"Boot from USB" >> /mnt/etc/banner #添加标记用于判断USB启动

4、 编辑配置文件
修改/etc/config/fstab文件
config mount
          option target /home                #本行可以+#
          option device /dev/sda1
          option fstype ext3
          option options rw,sync
          option enabled 1                     #需修改
          option is_rootfs 1                    #需修改
          option enabled_fsck 1
然后输入一下命令:

echo option force_space >> /mnt/etc/opkg.confumount /mnt
reboot


我的恩山、我的无线 The best wifi forum is right here.
发表于 2014-10-7 05:42 | 显示全部楼层
你这帖子不行吖
这哪里是U盘运行呀
论坛openwrt 优盘运行有两种方法
1.把usb storage驱动编译进入内核 然后uboot 指定root=/dev/sda1启动
2.让内核支持kexec功能 然后利用kexec 热切换内核启动
另外你的fstab似乎和我的不太相同
一般是把优盘挂在到overlay目录或者/目录
而且你为啥不用uuid的方式挂载
你这样 如果有多个设备 可能就完蛋了

点评

正好,求一个方便快捷的通过UUID来挂载外设的方法,或者代码 谢谢~  详情 回复 发表于 2014-10-9 10:10
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-9 00:11 | 显示全部楼层
这个很方便啊,支持下
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-9 00:25 | 显示全部楼层
备用,收藏
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-9 10:08 | 显示全部楼层
高手,学习了
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-9 10:10 | 显示全部楼层
guo4qing 发表于 2014-10-7 05:42
你这帖子不行吖
这哪里是U盘运行呀
论坛openwrt 优盘运行有两种方法

正好,求一个方便快捷的通过UUID来挂载外设的方法,或者代码
谢谢~

点评

config mount option enable '1' option target '/usb' option uuid '4e64aee3-bf9b-42ca-9a2b-ace299bbebe0' option fstype 'ext4' option options rw,sync config  详情 回复 发表于 2014-10-10 01:59
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-10 01:59 | 显示全部楼层
njim 发表于 2014-10-9 10:10
正好,求一个方便快捷的通过UUID来挂载外设的方法,或者代码
谢谢~

config mount
        option enable '1'
        option target '/usb'
        option uuid '4e64aee3-bf9b-42ca-9a2b-ace299bbebe0'
        option fstype 'ext4'
        option options rw,sync
config swap
        option enabled '1'
        option uuid 'b79eed-a8a1-4ace-9a8f-d8a83212fd9b'
一个例子  openwrt需要安装blkid  然后用blkid /dev/sda1 来获取uuid

点评

多谢,我在想怎么用代码来实现。 libuuid有api可在代码里调用的么?我得去看看源码  详情 回复 发表于 2014-10-11 08:45
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-11 08:45 | 显示全部楼层
guo4qing 发表于 2014-10-10 01:59
config mount
        option enable '1'
        option target '/usb'

多谢,我在想怎么用代码来实现。 libuuid有api可在代码里调用的么?我得去看看源码

点评

貌似我编译过c c trunk版2014年9 月 openwrt固件 那货刷上去之后 直接在luci界面就能看到插入的优盘的uuid 然后直接设置一下挂载点就ok了 不过我后来 还是用了 官方的imagebuilder定制了bb版本的 bb 14.07 rc3  详情 回复 发表于 2014-10-12 03:15
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-12 03:15 | 显示全部楼层
njim 发表于 2014-10-11 08:45
多谢,我在想怎么用代码来实现。 libuuid有api可在代码里调用的么?我得去看看源码

貌似我编译过c c  trunk版2014年9 月  openwrt固件
那货刷上去之后 直接在luci界面就能看到插入的优盘的uuid 然后直接设置一下挂载点就ok了
不过我后来 还是用了 官方的imagebuilder定制了bb版本的
bb 14.07 rc3版本不能luci显示uuid  不过安装了blkid之后 很快就设置好了

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-15 23:40 | 显示全部楼层
12.04的不能
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-16 01:02 | 显示全部楼层
这是OPENWRT 运行在U盘上   还是OPENWRT挂载U盘啊............
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2014-10-16 11:28 | 显示全部楼层
这个是成功了吗?df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
rootfs                   29408       881     27010   3% /
/dev/root                    2         2         0 100% /rom
tmpfs                       30         1        29   2% /tmp
/dev/sda1                29408       881     27010   3% /overlay
overlayfs:/overlay       29408       881     27010   3% /
tmpfs                        1         0         1   0% /dev

我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-25 06:16

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表