added nfsd v3

This commit is contained in:
Jaroslav Kysela 2015-04-21 14:54:49 +02:00
parent 421a594ac0
commit 51d6dacf4b
15 changed files with 226 additions and 18 deletions

101
Makefile
View File

@ -1,4 +1,4 @@
BUILD=7 BUILD=8
VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD) VERSION=$(shell date +%Y%m%d%H%M)-$(BUILD)
CPUS=4 CPUS=4
STLINUX=/opt/STM/STLinux-2.4 STLINUX=/opt/STM/STLinux-2.4
@ -32,6 +32,24 @@ DROPBEAR_BIN_FILES=dbclient dropbearconvert dropbearkey scp
ETHTOOL=ethtool-3.18 ETHTOOL=ethtool-3.18
LIBTIRPC_VERSION=0.2.5
LIBTIRPC=libtirpc-$(LIBTIRPC_VERSION)
RPCBIND_VERSION=0.2.2
RPCBIND=rpcbind-$(RPCBIND_VERSION)
RPCBIND_SBIN_FILES=rpcbind rpcinfo
NFSUTILS_VERSION=1.3.2
NFSUTILS=nfs-utils-$(NFSUTILS_VERSION)
NFSUTILS_SBIN_FILES=utils/showmount/showmount \
utils/exportfs/exportfs \
utils/nfsstat/nfsstat \
utils/mountd/mountd \
utils/statd/start-statd \
utils/statd/sm-notify \
utils/statd/statd \
utils/nfsd/nfsd
# 10087? # 10087?
OSCAM_REV=10619 OSCAM_REV=10619
@ -66,7 +84,7 @@ dist:
# create CPIO # create CPIO
# #
fs.cpio: kernel-modules busybox dropbear ethtool minisatip oscam tools/axehelper fs.cpio: kernel-modules busybox dropbear ethtool minisatip oscam tools/axehelper nfsutils
fakeroot tools/do_min_fs.py \ fakeroot tools/do_min_fs.py \
-r "$(VERSION)" \ -r "$(VERSION)" \
-b "bash strace" \ -b "bash strace" \
@ -79,6 +97,8 @@ fs.cpio: kernel-modules busybox dropbear ethtool minisatip oscam tools/axehelper
$(foreach f,$(DROPBEAR_SBIN_FILES), -e "apps/$(DROPBEAR)/$(f):sbin/$(f)") \ $(foreach f,$(DROPBEAR_SBIN_FILES), -e "apps/$(DROPBEAR)/$(f):sbin/$(f)") \
$(foreach f,$(DROPBEAR_BIN_FILES), -e "apps/$(DROPBEAR)/$(f):usr/bin/$(f)") \ $(foreach f,$(DROPBEAR_BIN_FILES), -e "apps/$(DROPBEAR)/$(f):usr/bin/$(f)") \
-e "apps/$(ETHTOOL)/ethtool:sbin/ethtool" \ -e "apps/$(ETHTOOL)/ethtool:sbin/ethtool" \
$(foreach f,$(RPCBIND_SBIN_FILES), -e "apps/$(RPCBIND)/$(f):usr/sbin/$(f)") \
$(foreach f,$(NFSUTILS_SBIN_FILES), -e "apps/$(NFSUTILS)/$(f):usr/sbin/$(notdir $(f))") \
-e "apps/minisatip/minisatip:sbin/minisatip" \ -e "apps/minisatip/minisatip:sbin/minisatip" \
-e "apps/minisatip/icons/lr.jpg:usr/share/minisatip/icons/lr.jpg" \ -e "apps/minisatip/icons/lr.jpg:usr/share/minisatip/icons/lr.jpg" \
-e "apps/minisatip/icons/lr.png:usr/share/minisatip/icons/lr.png" \ -e "apps/minisatip/icons/lr.png:usr/share/minisatip/icons/lr.png" \
@ -146,7 +166,7 @@ kernel: kernel/arch/sh/boot/uImage.gz
.PHONY: kernel-mrproper .PHONY: kernel-mrproper
kernel-mrproper: kernel-mrproper:
make -C kernel -k ${CPUS} ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- mrproper make -C kernel -j ${CPUS} ARCH=sh CROSS_COMPILE=$(TOOLCHAIN_KERNEL)/bin/sh4-linux- mrproper
define RPM_UNPACK define RPM_UNPACK
@mkdir -p $(1) @mkdir -p $(1)
@ -277,6 +297,81 @@ apps/$(ETHTOOL)/ethtool: apps/$(ETHTOOL)/configure
.PHONY: ethtool .PHONY: ethtool
ethtool: apps/$(ETHTOOL)/ethtool ethtool: apps/$(ETHTOOL)/ethtool
#
# libtirpc
#
apps/$(LIBTIRPC)/configure:
$(call WGET,http://sourceforge.net/projects/libtirpc/files/libtirpc/$(LIBTIRPC_VERSION)/$(LIBTIRPC).tar.bz2,apps/$(LIBTIRPC).tar.bz2)
tar -C apps -xjf apps/$(LIBTIRPC).tar.bz2
apps/$(LIBTIRPC)/src/.libs/libtirpc.a: apps/$(LIBTIRPC)/configure
cd apps/$(LIBTIRPC) && \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2" \
./configure \
--host=sh4-linux \
--prefix=/ \
--disable-shared \
--disable-gssapi \
--disable-ipv6
make -C apps/$(LIBTIRPC)
.PHONY: libtirpc
libtirpc: apps/$(LIBTIRPC)/src/.libs/libtirpc.a
#
# rpcbind
#
apps/$(RPCBIND)/configure:
$(call WGET,http://sourceforge.net/projects/rpcbind/files/rpcbind/$(RPCBIND_VERSION)/$(RPCBIND).tar.bz2,apps/$(RPCBIND).tar.bz2)
tar -C apps -xjf apps/$(RPCBIND).tar.bz2
apps/$(RPCBIND)/rpcbind: apps/$(LIBTIRPC)/src/.libs/libtirpc.a apps/$(RPCBIND)/configure
cd apps/$(RPCBIND) && \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2" \
TIRPC_CFLAGS="-I$(PWD)/apps/$(LIBTIRPC)/tirpc" \
TIRPC_LIBS="-L$(PWD)/apps/$(LIBTIRPC)/src/.libs -Wl,-Bstatic -ltirpc -Wl,-Bdynamic" \
./configure \
--host=sh4-linux \
--prefix=/ \
--with-systemdsystemunitdir=no
make -C apps/$(RPCBIND)
.PHONY: rpcbind
rpcbind: apps/$(RPCBIND)/rpcbind
#
# nfs-utils
#
apps/$(NFSUTILS)/configure:
$(call WGET,http://sourceforge.net/projects/nfs/files/nfs-utils/$(NFSUTILS_VERSION)/$(NFSUTILS).tar.bz2,apps/$(NFSUTILS).tar.bz2)
tar -C apps -xjf apps/$(NFSUTILS).tar.bz2
apps/$(NFSUTILS)/utils/exportfs/exportfs: apps/$(RPCBIND)/rpcbind apps/$(NFSUTILS)/configure
cd apps/$(NFSUTILS) && \
CC=$(TOOLCHAIN)/bin/sh4-linux-gcc \
CFLAGS="-O2" \
TIRPC_CFLAGS="-I$(PWD)/apps/$(LIBTIRPC)/tirpc" \
TIRPC_LIBS="-L$(PWD)/apps/$(LIBTIRPC)/src/.libs -Wl,-Bstatic -ltirpc -Wl,-Bdynamic" \
./configure \
--host=sh4-linux \
--prefix=/ \
--disable-mount \
--disable-nfsdcltrack \
--disable-nfsv4 \
--disable-gss \
--disable-ipv6 \
--disable-uuid \
--without-tcp-wrappers
make -C apps/$(NFSUTILS)
.PHONY: nfsutils
nfsutils: apps/$(NFSUTILS)/utils/exportfs/exportfs
# #
# oscam # oscam
# #

23
dist/README vendored
View File

@ -6,6 +6,7 @@ This directory contains USB and flash firmware for
Update: Update:
- check differences in /etc/config.default against /etc/sysconfig/config - check differences in /etc/config.default against /etc/sysconfig/config
- example: diff -u /etc/config.default /etc/sysconfig/config
Installation: Installation:
@ -40,6 +41,20 @@ Customization:
- inetd.conf file is linked to /etc/sysconfig/inetd.conf - inetd.conf file is linked to /etc/sysconfig/inetd.conf
- oscam configs are in /etc/sysconfig/oscam directory - oscam configs are in /etc/sysconfig/oscam directory
httpd:
- /media tree is exported
ftpd:
- /media tree is exported, use root/satip as login
nfsd:
- only v3 protocol is supported
- to list connected clients 'showmount'
- to list exports 'exportfs'
Minisatip config: Minisatip config:
- you may add extra parameters to MINISATIP_OPTS= in /etc/sysconfig/config - you may add extra parameters to MINISATIP_OPTS= in /etc/sysconfig/config
@ -121,6 +136,14 @@ Bugs:
History: History:
satip-axe-201504211434-8 - Tue Apr 21 2015
- faster boot (approx. 25 seconds from flash)
- tuners - configurable gain (0-16dB) - STV6210_BAMP in config
- enabled inetd/httpd/ftpd/nfsd by default
- added nfsd v3 support
- added ethtool
- extended debug tools for I2C bus (axe-debug, axehelper)
satip-axe-201504142137-7 - Tue Apr 14 2015 satip-axe-201504142137-7 - Tue Apr 14 2015
- minisatip - minisatip
- allow configurable DVR read buffer (-b option) - allow configurable DVR read buffer (-b option)

View File

@ -61,6 +61,12 @@ MINISATIP_OPTS=""
# #
INETD="yes" INETD="yes"
#
# nfsd v3
#
NFSD="yes"
NFSD_HOTPLUG_EXPORT="*" # replace with host or subnet, '*' = world
# #
# oscamd # oscamd
# #

2
fs-add/etc/exports Normal file
View File

@ -0,0 +1,2 @@
# example line:
#/mnt/1 *(ro,insecure,all_squash,no_subtree_check)

23
fs-add/etc/init.d/axe-settings Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
if test -z "$STV6210_BAMP"; then
test -r /etc/sysconfig/config && . /etc/sysconfig/config
fi
val=""
case "$STV6210_BAMP" in
0dB|0|1dB|1) val=0 ;;
2dB|2|3dB|3) val=1 ;;
4dB|4|5dB|5) val=2 ;;
6dB|6|7dB|7) val=3 ;;
8dB|8|9dB|9) val=4 ;;
10dB|10|11dB|11) val=5 ;;
12dB|12|13dB|13) val=6 ;;
14dB|14|15dB|15) val=7 ;;
16dB|16|17dB|17) val=8 ;;
esac
if ! test -z "$val"; then
axe-debug tdump > /tmp/stv6120-init.txt
logger -p local0.notice "Setting STV6210 gain to ${val}"
echo $val > /sys/devices/platform/i2c-stm.0/i2c-0/stv6120_gain
fi

19
fs-add/etc/init.d/nfsd Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
test -r /etc/sysconfig/config && . /etc/sysconfig/config
if test "$NFSD" != "yes"; then
exit 0
fi
if test -r /etc/sysconfig/exports ; then
rm /etc/exports
ln -s /etc/sysconfig/exports /etc/exports
fi
opts="--no-nfs-version 4"
rpcbind &
exportfs -r
nfsd $opts 8 &
exec mountd -F $opts

View File

@ -30,7 +30,8 @@ mv /var /var.2
mkdir /tmp/var mkdir /tmp/var
ln -s /tmp/var /var ln -s /tmp/var /var
rm -rf /var.2 rm -rf /var.2
mkdir -p /tmp/var/run /tmp/var/log /tmp/var/spool mkdir -p /tmp/var/run /tmp/var/log /tmp/var/spool /var/lib/nfs
mount -t nfsd nfsd /proc/fs/nfsd
# sysctl.conf # sysctl.conf
sysctl -q -p sysctl -q -p

View File

@ -6,6 +6,8 @@ ttyAS0::askfirst:/bin/sh
::once:/etc/init.d/network ::once:/etc/init.d/network
# Time Network Protocol # Time Network Protocol
::once:/etc/init.d/ntpd ::once:/etc/init.d/ntpd
# NFSD
::once:/etc/init.d/nfsd
# minisatip # minisatip
::once:/etc/init.d/satip ::once:/etc/init.d/satip
# telnetd # telnetd

5
fs-add/etc/netconfig Normal file
View File

@ -0,0 +1,5 @@
udp tpi_clts v inet udp /dev/udp -
tcp tpi_cots_ord v inet tcp /dev/tcp -
icmp tpi_raw - inet icmp /dev/icmp -
rawip tpi_raw - inet - /dev/rawip -
local tpi_cots_ord - loopback - - -

13
fs-add/etc/nsswitch.conf Normal file
View File

@ -0,0 +1,13 @@
passwd: files
shadow: files
group: files
hosts: files dns
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files
netgroup: files
automount: files
aliases: files

View File

@ -281,3 +281,10 @@ remotefs 556/tcp rfs_server rfs # Brunhoff remote filesystem
socks 1080/tcp # socks proxy server socks 1080/tcp # socks proxy server
socks 1080/udp # socks proxy server socks 1080/udp # socks proxy server
#
# NFSD
#
nfs 2049/tcp
nfs 2049/udp

View File

@ -4,25 +4,29 @@ add() {
BLKID=$(/sbin/blkid /dev/$MDEV) BLKID=$(/sbin/blkid /dev/$MDEV)
eval ${BLKID#*:} eval ${BLKID#*:}
LABEL=$(echo "$LABEL" | sed -e 's/ /_/g')
if [ -n "$LABEL" ]; then if [ -n "$LABEL" ]; then
MOUNT_POINT=/media/$LABEL MOUNT_POINT="/media/$LABEL"
else else
MOUNT_POINT=/media/$MDEV MOUNT_POINT="/media/$MDEV"
fi fi
logger -p local0.notice "Mounting $MDEV : $MOUNT_POINT" logger -p local0.notice "Mounting $MDEV : $MOUNT_POINT"
mkdir -p "$MOUNT_POINT" mkdir -p "$MOUNT_POINT"
for fs_type in vfat msdos ; do for fs_type in vfat msdos ext4 ext3 ext2 ; do
if $(mount -t $fs_type -o umask=0 /dev/$MDEV "$MOUNT_POINT" 2>/dev/null) ; then case "$fs_type" in
logger -p local0.notice "... $MDEV mounted using $fs_type filesystem" vfat|msdos) opts="-o umask=0" ;;
exit 0 *) opts= ;;
esac
if $(mount -t $fs_type $opts /dev/$MDEV "$MOUNT_POINT" 2>/dev/null) ; then
nfs=
if test "$NFSD" = "yes" -a -n "$NFSD_HOTPLUG_EXPORT"; then
exportfs -o rw,nohide,insecure,no_subtree_check "$NFSD_HOTPLUG_EXPORT":"$MOUNT_POINT"
nfs=" (nfsd exported)"
fi fi
done logger -p local0.notice "... $MDEV mounted using $fs_type filesystem${nfs}"
for fs_type in ext4 ext3 ext2 ; do
if $(mount -t $fs_type /dev/$MDEV "$MOUNT_POINT" 2>/dev/null) ; then
logger -p local0.notice "... $MDEV mounted using $fs_type filesystem"
exit 0 exit 0
fi fi
done done
@ -36,8 +40,11 @@ logger -p local0.notice "Unmounting $MDEV"
for MOUNT_POINT in /media/* ; do for MOUNT_POINT in /media/* ; do
if test -d "$MOUNT_POINT"; then if test -d "$MOUNT_POINT"; then
d=$(mountpoint -n "$MOUNT_POINT" 2> /dev/null | cut -d ' ' -f 1) d=$(mountpoint -n "$MOUNT_POINT" 2> /dev/null | cut -d ' ' -f 1)
if test "$d" = "$MDEV" -o "$d" = "UNKNOWN"; then if test "$d" = "$MDEV" -o "$d" = "/dev/$MDEV" -o "$d" = "UNKNOWN"; then
logger -p local0.notice "Unmounting $MDEV : $MOUNT_POINT" logger -p local0.notice "Unmounting $MDEV : $MOUNT_POINT"
if test "$NFSD" = "yes" -a -n "$NFSD_HOTPLUG_EXPORT"; then
exportfs -u "$NFSD_HOTPLUG_EXPORT":"$MOUNT_POINT"
fi
umount -f "$MOUNT_POINT" umount -f "$MOUNT_POINT"
rmdir "$MOUNT_POINT" rmdir "$MOUNT_POINT"
fi fi
@ -46,6 +53,8 @@ done
} }
. /etc/sysconfig/config
case "$ACTION" in case "$ACTION" in
add) add ;; add) add ;;
remove) remove ;; remove) remove ;;

View File

@ -1330,7 +1330,8 @@ CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set # CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set # CONFIG_NFS_V4 is not set
CONFIG_ROOT_NFS=y CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set CONFIG_NFSD=y
CONFIG_NFSD_V3=y
CONFIG_LOCKD=y CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y CONFIG_NFS_COMMON=y

View File

@ -1330,7 +1330,8 @@ CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set # CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set # CONFIG_NFS_V4 is not set
CONFIG_ROOT_NFS=y CONFIG_ROOT_NFS=y
# CONFIG_NFSD is not set CONFIG_NFSD=y
CONFIG_NFSD_V3=y
CONFIG_LOCKD=y CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y CONFIG_NFS_COMMON=y

View File

@ -308,6 +308,7 @@ def gen_fs(lib_list, init_type):
run_cmd('cp -d ' + target_prefix + '/usr/lib/libz.so*' + ' fs/usr/lib/') run_cmd('cp -d ' + target_prefix + '/usr/lib/libz.so*' + ' fs/usr/lib/')
run_cmd('cp -d ' + target_prefix + '/usr/lib/libstdc++.so*' + ' fs/usr/lib/') run_cmd('cp -d ' + target_prefix + '/usr/lib/libstdc++.so*' + ' fs/usr/lib/')
run_cmd('cp -d ' + target_prefix + '/usr/lib/libglib-2.0.so*' + ' fs/usr/lib/') run_cmd('cp -d ' + target_prefix + '/usr/lib/libglib-2.0.so*' + ' fs/usr/lib/')
run_cmd('cp -d ' + target_prefix + '/lib/libnsl*' + ' fs/usr/lib/')
if init_type == 'busybox': if init_type == 'busybox':
setup_busybox() setup_busybox()