OpenWRT: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
Строка 1: Строка 1:
 
=Тут заметки по OpenWRT=
 
=Тут заметки по OpenWRT=
 
Делать по-уму зачастую лень, потому часто будет костыль на костыле.
 
Делать по-уму зачастую лень, потому часто будет костыль на костыле.
  +
==USB DRIVE==
  +
Место мало, включил старую флешку. Т.к. это страый usbplayer - монтирую его в /player
  +
  +
===Поставить софт для работы с USB===
  +
<PRE>
  +
opkg update; opkg install kmod-usb-storage kmod-fs-ext4.
  +
</PRE>
  +
Теперь можно монтировать.
  +
<PRE>
  +
mount /dev/sda1 /player
  +
</PRE>
  +
  +
<PRE>
  +
/etc/config/fstab:
  +
  +
config global automount
  +
option from_fstab 1
  +
option anon_mount 1
  +
  +
config global autoswap
  +
option from_fstab 1
  +
option anon_swap 0
  +
  +
config mount
  +
option target /player
  +
option device /dev/sda1
  +
# option uuid "????#
  +
option fstype ext4
  +
option options rw,sync
  +
option enabled 1
  +
option enabled_fsck 1
  +
#
  +
#config swap2
  +
# option device /dev/sda2
  +
# option enabled 0
  +
</PRE>
  +
Свап мне пока-что не нужен, потому закоментарю.
  +
<BR>
  +
Если хочется по id а не по имени устройства (что по-хорошему, более верно) - то как-то так:
  +
<PRE>
  +
blkid
  +
/dev/sda1: UUID="4cef7658-8834-46b4-b523-0d4aa06c1d53"
  +
</PRE>
  +
  +
В инете я наталкивался на совет:
  +
<PRE>
  +
rm -f /etc/fstab
  +
ln -s /tmp/fstab /etc/fstab
  +
/etc/init.d/fstab enable
  +
/etc/init.d/fstab start
  +
</PRE>
  +
Но мне фактически пришлось выполнить только 2 последние комманды
  +
<BR>
  +
Еще совет:
  +
If the last command freezes for some reason, run rm /var/lock/fstab.lck before it. If all goes well, now you have your flash drive automounting if it’s plugged in.
  +
  +
  +
==Установка пакетов на USB==
  +
немного гимморойно, но это ерунда вобщем-то
  +
  +
Поправить: /etc/opkg.conf
  +
<PRE>
  +
src/gz packages http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages
  +
dest root /
  +
dest ram /tmp
  +
dest player /player
  +
lists_dir ext /var/opkg-lists
  +
option overlay_root /overlay
  +
</PRE>
  +
Естественно держать в голове что тут надо указывать нужную весию src
  +
  +
  +
After that you can install packages using the drive this way: opkg install -d pendrive packagename.
  +
  +
It’s usefule to add the bin and sbin directories on the flash drive to the PATH, so edit it in /etc/profile:
  +
1
  +
  +
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/pendrive1/bin:/mnt/pendrive1/sbin:/mnt/pendrive1/usr/bin:/mnt/pendrive1/usr/sbin
  +
  +
You’ll need to configure ldconfig for the dynamic libraries on the drive to work, if you don’t have ldconfig yet, install it: opkg install -d pendrive ldconfig
  +
  +
Add these lines to ld.so.conf:
  +
1
  +
2
  +
  +
/mnt/pendrive1/lib
  +
/mnt/pendrive1/usr/lib
  +
  +
And then run ldconfig every time you install a lib.
  +
Installing Midnight Commander on OpenWRT
  +
  +
It’s nice to have mc on the router, so let’s install it:
  +
1
  +
2
  +
3
  +
4
  +
5
  +
  +
opkg install -d pendrive mc librpc
  +
ln -s /mnt/pendrive1/etc/mc /etc/mc
  +
touch /etc/mc/sfs.ini
  +
mkdir -p /usr/lib/mc/extfs.d
  +
touch /root/.mc/cedit/Syntax
  +
  +
If mc says error opening terminal: xterm, then make sure you have these lines in /etc/profile:

Версия 16:32, 17 марта 2013

Тут заметки по OpenWRT

Делать по-уму зачастую лень, потому часто будет костыль на костыле.

USB DRIVE

Место мало, включил старую флешку. Т.к. это страый usbplayer - монтирую его в /player

Поставить софт для работы с USB

opkg update; opkg install kmod-usb-storage kmod-fs-ext4. 

Теперь можно монтировать.

mount /dev/sda1 /player
/etc/config/fstab:
	
config global automount
    option from_fstab 1
    option anon_mount 1

config global autoswap
    option from_fstab 1
    option anon_swap 0

config mount
    option target   /player
    option device   /dev/sda1
#    option uuid "????#
    option fstype   ext4
    option options  rw,sync
    option enabled  1
    option enabled_fsck 1
#
#config swap2
#    option device   /dev/sda2
#    option enabled  0

Свап мне пока-что не нужен, потому закоментарю.
Если хочется по id а не по имени устройства (что по-хорошему, более верно) - то как-то так:

blkid
/dev/sda1: UUID="4cef7658-8834-46b4-b523-0d4aa06c1d53"

В инете я наталкивался на совет:

	
rm -f /etc/fstab
ln -s /tmp/fstab /etc/fstab
/etc/init.d/fstab enable
/etc/init.d/fstab start

Но мне фактически пришлось выполнить только 2 последние комманды
Еще совет: If the last command freezes for some reason, run rm /var/lock/fstab.lck before it. If all goes well, now you have your flash drive automounting if it’s plugged in.


Установка пакетов на USB

немного гимморойно, но это ерунда вобщем-то

Поправить: /etc/opkg.conf

src/gz packages http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages
dest root /
dest ram /tmp
dest player /player
lists_dir ext /var/opkg-lists
option overlay_root /overlay

Естественно держать в голове что тут надо указывать нужную весию src


After that you can install packages using the drive this way: opkg install -d pendrive packagename.

It’s usefule to add the bin and sbin directories on the flash drive to the PATH, so edit it in /etc/profile: 1

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/pendrive1/bin:/mnt/pendrive1/sbin:/mnt/pendrive1/usr/bin:/mnt/pendrive1/usr/sbin

You’ll need to configure ldconfig for the dynamic libraries on the drive to work, if you don’t have ldconfig yet, install it: opkg install -d pendrive ldconfig

Add these lines to ld.so.conf: 1 2

/mnt/pendrive1/lib /mnt/pendrive1/usr/lib

And then run ldconfig every time you install a lib. Installing Midnight Commander on OpenWRT

It’s nice to have mc on the router, so let’s install it: 1 2 3 4 5

opkg install -d pendrive mc librpc ln -s /mnt/pendrive1/etc/mc /etc/mc touch /etc/mc/sfs.ini mkdir -p /usr/lib/mc/extfs.d touch /root/.mc/cedit/Syntax

If mc says error opening terminal: xterm, then make sure you have these lines in /etc/profile: