Maybe you forgot what to include in /src/scripts/mod/sumversion.c,
it was include linux/limits.h
in the makefile of hostTools I had to add -lm option to LDOPTIONS
Last edit: Frank 2012-12-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
let me understand.
Are you able now to build full working bin image through this procedure?
Have you tested it?
The next step to automatically start modfs is to add to firmware:
loop.ko, ext3.ko, mbcache.ko, jbd.ko kernel module (I can compile for you)
then add losetup to /bin (you can use that is in modfs wag320 bin dir)
The generic script to found mod_image.bin on a usb device and boot modfs
is:
shares="root path where usb device are mounted"
loopdev="/dev/loop0"
ls $shares | while read line; do
image=ls $shares/$line/mod_image.bin 2>&1
if ; then
insmod $shares/$line/jbd.ko
insmod $shares/$line/mbcache.ko
insmod $shares/$line/ext3.ko
mknod $loopdev b 7 0
$shares/$line/losetup $loopdev $image
mountpath="/tmp/modfs"
mkdir -p $mountpath
mount -t ext3 $loopdev $mountpath
$mountpath/boot.sh $mountpath
These steps have to be tested one by one in order to find the correct form for
wag320n and create the right script to add to rcS.
This for example is to dgn2200 script added at the end of rcS for start modfs
The build is tested on my router.. I was able to put a 'patata' file inside
/usr/bin directory ..
I am starting on Friday night.. so ,yes.. I will do what you said..
ah.. the list of built-in modules is: (I'll need you to compile the ones you
said..)
I have not modified rcS yet, because it's painful to rebuild everytime I need
to test the bootscript.. Here's a ready-to-use source code tarball (it compiles perfectly on Debian
Squeeze) (if you delete kernel/vmlnuz.a and kernel/src/vmlinux , 'make auto'
will invoke 'make menuconfig ' so you must add built-in ext3 and jbd support
to kernel (remember, ncurses-dev is needed for make menufconfig).. in fact the
Makefile tends to delete old .config kernel file)... whilst tk/apps/busybox
.config is not overwritten.. hmm.. in fact busybox .config is configurable by
make menuconfig also ..(invoke manually).
aaand.. the shell interpreter of the firmware seems to not understand an 'if'
(it says 'if [ not found' ) so I had to remove the loop ...
Also I had to make a symlink 'cut' to busybox by hand .. (it's placed in /tmp)
.. /dev is not modifiable during runtime .. so I added the nodes for
/dev/loop1 and /dev/loop2 in target.tgz before compiling ..
ah.. and this is a script that works .. (an example)
So here's the firmware (for
testing firmware images .. not end version..)
Hi,
great work,
I'm glad to see your progress.
The guy who made the porting had managed the problem of /dev in a way like
this:
# Copy move /dev to ramfs to make it executable
if [ -e /tmp/tmp2 ]; then
rm -rf /tmp/tmp2
fi
mkdir /tmp/tmp2
cp -a /dev/* /tmp/tmp2/
mount -n -t ramfs ramfs /dev
cp -a /tmp/tmp2/* /dev
rm -rf /tmp/tmp2
This is a snipet from boot.sh inside modfs, but I think it made something
similar also before to setup and mount the loop device.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok, so.. here's a totally working alpha
firmware ..(It is an alpha
release.. please use at your own risk)
and another snapshot of the used
source
If you need a mod_image.bin (for test purposes), get it here ,,
and here's what I added to /rcS (it's extremely similar to the one you
provided me )
# Copy move /dev to ramfs to make it executable
/bin/rm -rf /tmp/tmp2
/bin/mkdir /tmp/tmp2
/bin/cp -a /dev/* /tmp/tmp2/
/bin/mount -n -t ramfs ramfs /dev
/bin/cp -a /tmp/tmp2/* /dev
/bin/rm -rf /tmp/tmp2
#Mounting and executing ModFS
#export PATH="/sbin:/bin:/usr/sbin:/usr/bin::"
basepath="/tmp/mod"
devmountpath="$basepath/dev"
modmountpath="$basepath/modfs"
modules="/lib/modules/mod"
loopdev="/dev/loop0"
sleep 45
oldfat32="" counter=1
mkdir -p $devmountpath
while [ $counter -le 30 ]; do
fat32=`fdisk -l | grep "FAT32" | cut -d' ' -f1`
if [ "$fat32" != "$oldfat32" ]; then
# FAT32 partitions
for dev in $fat32; do
mount -t vfat $dev $devmountpath
sleep 2
image="$devmountpath/mod_image.bin"
if [ -f $image ]; then echo "Found on $dev"
insmod $modules/mbcache.ko
insmod $modules/jbd.ko
insmod $modules/ext3.ko
insmod $modules/loop.ko
mknod $loopdev b 7 0
losetup $loopdev $image
mkdir -p $modmountpath
mount -t ext3 $loopdev $modmountpath
sleep 1
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/sbin/scripts $modmountpath/boot.sh $modmountpath
fi
echo "Not found on $dev"
umount $dev
sleep 2
done
fi
oldfat32=$fat32
counter=`expr $counter + 1`
sleep 1
done
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
#!/bin/sh# wait until nvram is availablewhile[1];dores=`param get http_passwd`if["$res" !=""];thenbreakfi
sleep 1doneSLEEP_SECONDS=25#get SNR Retrain Limit valueRETRAIN_MIN_SNR=`nvram get adsl_retrain_min_snr`if["$RETRAIN_MIN_SNR"=""];then#value not available, first time running this script set value to 5
nvram setadsl_retrain_min_snr=5fi#get SNR Retrain Upper LimitRETRAIN_MAX_SNR=`nvram get adsl_retrain_max_snr`if["$RETRAIN_MAX_SNR"=""];then#value not available, first time running this script set value to 100
nvram setadsl_retrain_max_snr=100fiPREVIOUS_PING=0#infinite loopwhile[1];do#get retrain_script variableRETRAIN_SCRIPT=`nvram get adsl_retrain_script`#if retrain_script not setif["$RETRAIN_SCRIPT" !="1"];then#retrain script is not active, quitexit0fi
sleep $SLEEP_SECONDSMUST_RETRAIN=0#get SNR Margin valueSNR=`adslctl info --show | grep SNR | awk '{ print $3 }'| cut -d'.' -f1`if["$SNR"=""];then#SNR Margin not available, maybe router is training linePREVIOUS_PING=0continuefi#get ping IPPING_IP=`nvram get adsl_retrain_ip`if["$PING_IP" !=""];then#ping an address to check network connection
ping -c 1$PING_IPPING_RESULT="$?"if["$PING_RESULT" !="0"];thenif[$PREVIOUS_PING -eq 0];thenPREVIOUS_PING=1elseMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"$PING_IP unreachable...training line" >> /tmp/retrain.log
PREVIOUS_PING=0fielsePREVIOUS_PING=0fifi#get SNR Retrain Lower LimitRETRAIN_MIN_SNR=`nvram get adsl_retrain_min_snr`#get SNR Retrain Upper LimitRETRAIN_MAX_SNR=`nvram get adsl_retrain_max_snr`if[$SNR -lt $RETRAIN_MIN_SNR];thenMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"SNR Margin is $SNR dB and allowed range is [$RETRAIN_MIN_SNR - $RETRAIN_MAX_SNR]...training line" >> /tmp/retrain.log
fiif[$SNR -gt $RETRAIN_MAX_SNR];thenMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"SNR Margin is $SNR dB and allowed range is [$RETRAIN_MIN_SNR - $RETRAIN_MAX_SNR]...training line" >> /tmp/retrain.log
fiif[$MUST_RETRAIN -eq 1];then#keep in log only the last twenty retrains
cat /tmp/retrain.log | tail -n 40 > /tmp/retrain.log.tmp
mv /tmp/retrain.log.tmp /tmp/retrain.log
adslctl start
fidone
Uses values stored in nvram through adsl settings package in modfs.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is the actual script that applies adsl settings
A script with name xdslctl that replaces the original xdslctl renamed in
xdslctl.original instead.
#!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/sbin/scripts
# wait until nvram is available while[1];dores=`nvram show`if["$res" !=""];thenbreakfi
sleep 1doneSLEEP_SECONDS=25#get SNR Retrain Limit value RETRAIN_MIN_SNR=`nvram get adsl_retrain_min_snr | cut -d'=' -f2`if["$RETRAIN_MIN_SNR"=""];then#value not available, first time running this script set value to 5
nvram setadsl_retrain_min_snr=5fi#get SNR Retrain Upper Limit RETRAIN_MAX_SNR=`nvram get adsl_retrain_max_snr | cut -d'=' -f2`if["$RETRAIN_MAX_SNR"=""];then#value not available, first time running this script set value to 100
nvram setadsl_retrain_max_snr=100fiPREVIOUS_PING=0#infinite loop while[1];do#get retrain_script variable RETRAIN_SCRIPT=`nvram get adsl_retrain_script | cut -d'=' -f2`#if retrain_script not set if["$RETRAIN_SCRIPT" !="1"];then#retrain script is not active, quit exit0fi
sleep $SLEEP_SECONDSMUST_RETRAIN=0#get SNR Margin value SNR=`adslctl info --show | grep SNR | awk '{ print $3 }'| cut -d'.' -f1`if["$SNR"=""];then#SNR Margin not available, maybe router is training line PREVIOUS_PING=0continuefi#get ping IP PING_IP=`nvram get adsl_retrain_ip | cut -d'=' -f2`if["$PING_IP" !=""];then#ping an address to check network connection
ping -c 1$PING_IPPING_RESULT="$?"if["$PING_RESULT" !="0"];thenif[$PREVIOUS_PING -eq 0];thenPREVIOUS_PING=1elseMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"$PING_IP unreachable...training line" >> /tmp/retrain.log
PREVIOUS_PING=0fielsePREVIOUS_PING=0fifi#get SNR Retrain Lower Limit RETRAIN_MIN_SNR=`nvram get adsl_retrain_min_snr | cut -d'=' -f2`#get SNR Retrain Upper Limit RETRAIN_MAX_SNR=`nvram get adsl_retrain_max_snr | cut -d'=' -f2`if[$SNR -lt $RETRAIN_MIN_SNR];thenMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"SNR Margin is $SNR dB and allowed range is [$RETRAIN_MIN_SNR - $RETRAIN_MAX_SNR]...training line" >> /tmp/retrain.log
fiif[$SNR -gt $RETRAIN_MAX_SNR];thenMUST_RETRAIN=1
date >> /tmp/retrain.log
echo"SNR Margin is $SNR dB and allowed range is [$RETRAIN_MIN_SNR - $RETRAIN_MAX_SNR]...training line" >> /tmp/retrain.log
fiif[$MUST_RETRAIN -eq 1];then#keep in log only the last twenty retrains
cat /tmp/retrain.log | tail -n 40 > /tmp/retrain.log.tmp
mv /tmp/retrain.log.tmp /tmp/retrain.log
adslctl start
fidone
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm very keen to see the WAG320N altered / modified. If you need anyone to
help give me a shout. Had a play mostly using the web page exploit / script
and been trying to get Telnet installed on there, but this seems a very
interesting way of accomplishing the same.
Been following this thread for a couple of weeks, hopefully people are still
working on this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
sagbohan I forgot to tell you that in order to be able to access to ssh and
telnet
this script is needed to be added to rcS.
I don't know if you have already solved in some manner.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh# wait until nvram is availablewhile[1];dores=`param get http_passwd`if["$res" !=""];thenbreakfi
sleep 1doneecho"nobody:*:0:0:nobody:/:/bin/sh" > /etc/passwd
echo"admin:$res:0:0:admin:/:/bin/sh" >> /etc/passwd
echo"guest:guest:0:0:guest:/:/bin/nologin" >> /etc/passwd
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems /etc/passwd is writable ..
but sshd nor telnetd accept these credentials
here's the content of /etc/passwd after boot (with the script you gave me)
I didn't understand the problem on the wag320n very well, I have only
forwarded to you this question from some users that are not able to login to
ssh.
On the dgn3500 works in other way, I don't need this script that is specific
to the dgn2200 issue, because initially the root user has no password, so I
login in telnet with the root user and no password and then I set the password
through passwd command and I can save this just modified /etc/passwd file to
modfs partition, in order to recopy again it to /etc on the boot.
After that I'm able to access to ssh with root user too.
No other problems with other users, the original /etc/passwd file works well.
Other question,
it seems that on the wag320n, as on dgn3500 and despite dgn2200, it's possible
to boot mod_image.bin on ntfs , can you try to test it? In this way,you will
be able to use usb disks that can store larger files, in sight of the
trasmission torrent package, that we are preparing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
here's an image that boots mod_image.bin from ntfs (minor changes to the /rcS
) .. and I have added an /opt folder ,, also.. http://www.mediafire.com/?0swtr6xscc5z88r
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Source code: http://www.mediafire.com/?qpyp3mhou91nl4m
Edit kernel/src/scripts/mod/sumversion.c and add #include <limits.h> on the
first line
File System (replace target.tgz in source code) http://www.mediafire.com/?um1
n9eo3tp33c26 ...
Modify the new target.tgz as you wish...
make clean_all
make clean
make auto .
¡Voilà!
Maybe you forgot what to include in /src/scripts/mod/sumversion.c,
it was include linux/limits.h
in the makefile of hostTools I had to add -lm option to LDOPTIONS
Last edit: Frank 2012-12-13
Hi,
let me understand.
Are you able now to build full working bin image through this procedure?
Have you tested it?
The next step to automatically start modfs is to add to firmware:
loop.ko, ext3.ko, mbcache.ko, jbd.ko kernel module (I can compile for you)
then add losetup to /bin (you can use that is in modfs wag320 bin dir)
The generic script to found mod_image.bin on a usb device and boot modfs
is:
ls $shares | while read line; do
image=
ls $shares/$line/mod_image.bin 2>&1
if ; then
insmod $shares/$line/jbd.ko
insmod $shares/$line/mbcache.ko
insmod $shares/$line/ext3.ko
mknod $loopdev b 7 0
$shares/$line/losetup $loopdev $image
mountpath="/tmp/modfs"
mkdir -p $mountpath
mount -t ext3 $loopdev $mountpath
$mountpath/boot.sh $mountpath
These steps have to be tested one by one in order to find the correct form for
wag320n and create the right script to add to rcS.
This for example is to dgn2200 script added at the end of rcS for start modfs
basepath="/tmp/mod"
devmountpath="$basepath/dev"
modmountpath="$basepath/modfs"
modules="/lib/modules/mod"
loopdev="/dev/loop0"
sleep 45
oldfat32=""
counter=1
mkdir -p $devmountpath
while ; do
fat32=
fdisk -l | grep "FAT32" | cut -d' ' -f1
if ; then
FAT32 partitions
for dev in $fat32; do
mount -t vfat $dev $devmountpath
sleep 2
image="$devmountpath/mod_image.bin"
if ; then
echo "Found on $dev"
insmod $modules/mbcache.ko
insmod $modules/jbd.ko
insmod $modules/ext3.ko
insmod $modules/loop.ko
losetup $loopdev $image
mkdir -p $modmountpath
mount -t ext3 $loopdev $modmountpath
sleep 1
exec $modmountpath/boot.sh $modmountpath
fi
echo "Not found on $dev"
umount $dev
sleep 2
done
fi
oldfat32=$fat32
counter=
expr $counter + 1
sleep 1
done
The build is tested on my router.. I was able to put a 'patata' file inside
/usr/bin directory ..
I am starting on Friday night.. so ,yes.. I will do what you said..
ah.. the list of built-in modules is: (I'll need you to compile the ones you
said..)
sorry.. these ones too
it's " adsl_phy.bin "
I will build the modules myself ;)
I have not modified rcS yet, because it's painful to rebuild everytime I need
to test the bootscript..
Here's a ready-to-use source code tarball
(it compiles perfectly on Debian
Squeeze) (if you delete kernel/vmlnuz.a and kernel/src/vmlinux , 'make auto'
will invoke 'make menuconfig ' so you must add built-in ext3 and jbd support
to kernel (remember, ncurses-dev is needed for make menufconfig).. in fact the
Makefile tends to delete old .config kernel file)... whilst tk/apps/busybox
.config is not overwritten.. hmm.. in fact busybox .config is configurable by
make menuconfig also ..(invoke manually).
aaand.. the shell interpreter of the firmware seems to not understand an 'if'
(it says 'if [ not found' ) so I had to remove the loop ...
Also I had to make a symlink 'cut' to busybox by hand .. (it's placed in /tmp)
.. /dev is not modifiable during runtime .. so I added the nodes for
/dev/loop1 and /dev/loop2 in target.tgz before compiling ..
ah.. and this is a script that works .. (an example)
So here's the firmware (for
testing firmware images .. not end version..)
Hi,
great work,
I'm glad to see your progress.
The guy who made the porting had managed the problem of /dev in a way like
this:
This is a snipet from boot.sh inside modfs, but I think it made something
similar also before to setup and mount the loop device.
ok, so.. here's a totally working alpha
firmware ..(It is an alpha
release.. please use at your own risk)
and another snapshot of the used
source
If you need a mod_image.bin (for test purposes), get it here
,,
and here's what I added to /rcS (it's extremely similar to the one you
provided me )
Great job!
If you want to automatically apply adsl settings like snr margin at boot
you can modify and adapt those from dgn2200
Here retrain.sh :
Uses values stored in nvram through adsl settings package in modfs.
Here is the actual script that applies adsl settings
A script with name xdslctl that replaces the original xdslctl renamed in
xdslctl.original instead.
OK, I'll try to build another version with this adsl script, during the
weekend ;) .. Thx :D
done .. but adslctl will need some testing, though.
http://www.mediafire.com/?078snh25zhuh2pu
/usr/sbin/xdslctl
/usr/sbin/retrain.sh& (invoked in rcS )
I'm looking for recruiting some testers :D
Id love to test it guys, infact im reading all this trying to make a bit more
sense of it so i can
any chance somebody can throw up just a basic how to just to get me get a
better understanding of this
Cheers
source code of the latest build I made
http://www.mediafire.com/?z8pea88dzdzop8e
I'm very keen to see the WAG320N altered / modified. If you need anyone to
help give me a shout. Had a play mostly using the web page exploit / script
and been trying to get Telnet installed on there, but this seems a very
interesting way of accomplishing the same.
Been following this thread for a couple of weeks, hopefully people are still
working on this.
sagbohan I forgot to tell you that in order to be able to access to ssh and
telnet
this script is needed to be added to rcS.
I don't know if you have already solved in some manner.
thanks, gnommo ..
I'm going to make another build (I'm also adding the /opt folder) ..
gnommo, /etc is not writable ....¿any solution? maybe boot.sh should be
modified..
OK, OK .. I'll create a symlink of /etc/passwd to /tmp/etc/passwd ;)
It seems /etc/passwd is writable ..
but sshd nor telnetd accept these credentials
here's the content of /etc/passwd after boot (with the script you gave me)
I didn't understand the problem on the wag320n very well, I have only
forwarded to you this question from some users that are not able to login to
ssh.
On the dgn3500 works in other way, I don't need this script that is specific
to the dgn2200 issue, because initially the root user has no password, so I
login in telnet with the root user and no password and then I set the password
through passwd command and I can save this just modified /etc/passwd file to
modfs partition, in order to recopy again it to /etc on the boot.
After that I'm able to access to ssh with root user too.
No other problems with other users, the original /etc/passwd file works well.
Other question,
it seems that on the wag320n, as on dgn3500 and despite dgn2200, it's possible
to boot mod_image.bin on ntfs , can you try to test it? In this way,you will
be able to use usb disks that can store larger files, in sight of the
trasmission torrent package, that we are preparing.
here's an image that boots mod_image.bin from ntfs (minor changes to the /rcS
) .. and I have added an /opt folder ,, also..
http://www.mediafire.com/?0swtr6xscc5z88r