General NAS-Central Forums

Welcome to the NAS community
It is currently Thu Mar 30, 2017 2:32 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Jun 15, 2012 9:31 pm 

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5974
The flash chip of the Homebase has several megabytes free, and the box lacks a lot of features, so I decided to add some features.
New features:
  • dropbear-2012.55 (lightweight ssh server)
  • e2fsprogs-1.42.3
  • fdisk-1.3.0a
  • libmad & madplay
  • mdadm-3.2.5 & raid kernel modules (You always wanted raid5 on the box, didn't you?)
  • nfs-utils-1.1.6 & portmap-6.0
  • strace-4.7
  • bumped busybox to 1.20.1 & added a lot of modules
  • added support for scripts
  • added a lot of kernel modules, among which ext2, ext3, nfs, nfsd, cifs, usb-sound, ...
  • added the possibility to load the rootfs from an usb-disk/stick or an nfs server.
  • The root password is the same as the web interface password.

You can find the firmware here, install it using the web interface.
When an automounted partition contains a script, it will be executed. Two arguments are passed, the device and the mountpoint. Only FAT or NTFS formatted partition are automounted. So if you want an ext2/3 formatted disk to be mounted, add a (small) fat partition, with the script:

ROOTDEVICE=` echo ${PARTITIONDEVICE} | sed 's/[0-9]*//g' `

modprobe ext3

mkdir -p /mnt/mymountpoint
mount -o relatime ${ROOTDEVICE}2 /mnt/mymountpoint
(Assuming the ext3 partition is the 2nd one)
When you need both ext3 and ext2, make sure you first load the ext3 module, and then ext2. Else an ext3 partition will be mounted ext2, unless you explicitly specify ext3.

The script is called by /usr/sbin/, which is called by /usr/sbin/sxsambaconf, which is called each time an usb disk is inserted/pulled.
/usr/sbin/ checks for the existence of an executable /root/, and if it exists, it passes execution to that script. So if you want your own functionality on inserting usb disks, you can hook the script this way.

To share directories using nfs, create a suitable /etc/exports file, and call '/etc/rc.d/rc.nfsd start'

You can mount external nfs shares:
modprobe nfs
mkdir -p /mnt/mymountpoint
mount server:/share /mnt/mymountpoint -o nolock,vers=2
If you need locks, you should first start portmap.

You can mount external samba shares:
modprobe cifs
mkdir -p /mnt/mymountpoint
mount //server/share /mnt/mymountpoint -o user=username,pass=password
When cifs doesn't work, you could try smbfs. Load the module, and specify '-t smbfs'.

booting from usb, nfs (wired only)
You can add a line 'boot=usb' or 'boot=nfs,clientip,gateway,server:/share' to /etc/sysconfig/system.conf. Now press any 'Save' button in the webinterface, and the setting will be stored.
But first create a bootable filesystem. Mount the share or usb-disk (ext2/3), and copy the flash contents:
cp -a /.rootfs/* /mnt/mymountpoint
mkdir -p /mnt/mymountpoint/.rootfs

Now create an executable script /mnt/mymountpoint/boot/

# move the /proc mount
/bin/mount --move /proc /.rootfs/proc

# pivot
cd /.rootfs
pivot_root . .rootfs
# Pass execution to new rootfs
exec /bin/busybox init
When booting from nfs edit /mnt/mymountpoint/etc/rc.d/rc.M, and remove the lines rc.nic and (You don't want to fiddle with the network, when your rootfs is nfs)

On boot /sbin/init (a script) will mount the filesystem on /.rootfs, and if an executable /boot/ exists, execution will be passed to that script.

usb sound
modprobe snd-usb-audio
modprobe snd-pcm-oss
modprobe snd-mixer-oss

madplay music.mp3

Unfortunately I wasn't able to find a suitable optware feed. There are enough feeds for mipsel (little endian), but not for mips.
But I found this. This exact instructions didn't work, for some reason LD_LIBRARY_PATH doesn't work.
But I found a work-around. I created a script, which makes it possible to 'add' the openwrt libraries to /usr/lib and /lib.

An example, installing midnight commander:
Mount an ext2/3 or nfs filesystem on /opt (which is a symlink to /tmpfs/opt):
mkdir -p /tmpfs/opt
mount whatever /opt
Now install the base system:
cd /opt
tar xzf opkg_576-2_ar71xx.ipk
tar xzf data.tar.gz
rm control.tar.gz data.tar.gz opkg_576-2_ar71xx.ipk
tar xzf libc_0.9.30.1-43.29_ar71xx.ipk
tar xzf data.tar.gz
rm control.tar.gz data.tar.gz libc_0.9.30.1-43.29_ar71xx.ipk
tar xzf libgcc_4.3.3\+cs-43.29_ar71xx.ipk
tar xzf data.tar.gz
rm control.tar.gz data.tar.gz libgcc_4.3.3\+cs-43.29_ar71xx.ipk /opt/lib /lib
Create a configuration file /etc/opkg.conf:
src/gz snapshots
dest root /opt
dest ram /tmp
lists_dir ext /tmp/var/opkg-lists
Now you can run
/opt/bin/opkg update
/opt/bin/opkg install mc
This added maybe some new libs to /opt/lib, so lets join again:
Code: /opt/lib /lib
Further some necessary files are installed in /opt/usr/lib and ../share. Let's join:
Code: /opt/usr/lib /usr/lib /opt/usr/share /usr/share
Now run /opt/usr/bin/mc, and enjoy.

On next boot you'll have to rejoin, and re-create the /etc/opkg.conf file. But of course you can use a script for that. (You'll need it anyway to mount the /opt filesystem). You might want to edit /etc/profile to add /opt/bin, /opt/sbin, /opt/usr/bin and /opt/usr/sbin to the PATH.
Joining directories will take some memory. Not much, a tmpfs is mounted on the target directory, containing symlinks to the original files in squashfs, and symlinks to the /opt files are added.
This trick will work until you've got conflicting libraries, or the tmpfs takes too much memory. (You could add swap, of course)

Disabling features
You can disable telnetd, dropbear and/or fun_plug, if desired. Add the line 'disable=telnetd,fun_plug' to /etc/sysconfig/system.conf. Now press any 'Save' button in the webinterface, and the setting will be stored. On reboot telnetd and fun_plug will be disabled.
telnetd and dropbear are disabled by removing their line from /etc/inetd.conf. fun_plug is disabled by creating an empty script /root/
If you disable all, you will have to factory reset to get it back.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group