remote syslog + top + OHCI

84 views
Skip to first unread message

Augusto Bott

unread,
Dec 13, 2010, 6:54:43 AM12/13/10
to al...@googlegroups.com
Hi there!

Here's a few tweaks/enhancements on Alt-F v0.1b5 I've implemented for my own needs that could be useful and/or interesting for other people (and... even become part of future Alt-F releases - who knows! ;-)

- remote syslog:
As you probably are aware, many embedded systems (including Alt-F) record/store syslog messages on a memory area (which is limited and non-persistent). This usually means we don't get a chance to keep any kind of history and... when/if the box (or syslogd) crashes and/or restarts... everything logged so far is gone. So... it can be quite handy/useful to store/record/keep logs somewhere else ;-)

- top:
Currently 'top' is configured to show integer values on columns %MEM and %CPU (rounding up to the next integer value). I've changed this behaviour so it would show values with one decimal digit.(i.e. shows values like 0.8%  instead of rounding up to 1%)

- OHCI:
I noticed the stock D-link software does have it enabled (but Alt-F apparently doesn't). I'm not sure if OHCI is actually required, but since I've been fiddling and testing USB-related things, seemed a good idea to have it enabled.

Files attached:
- busybox-1.15.3.config.diff
enable remote logging and decimal values on top

- linux-2.6.35.7.config.diff
enable OHCI support in kernel

- loadsave_settings.diff
patches /usr/sbin/loadsave_settings to include the (new) /etc/syslog.conf configuration file

- syslog.cgi and syslog_proc.cgi
scripts to configure syslog on the web interface (should be copied to SRC/customroot/usr/www/cgi-bin, see below)

- S10syslog
handles startup/shutdown of syslog according to settings (or uses defaults, if no config file is found)

After grabbing all 6 attachments, here's how I built:

# clean-up
cd ~/dev/dns323
rm -rf ~/dev/dns323/alt-f-read-only
export BLDDIR=~/dev/dns323/alt-f-build
rm -rf $BLDDIR

# fetch source

cd ~/dev/dns323/alt-f-read-only

# enable OHCI in kernel
patch local/dns323/linux-2.6.35.7.config ~/dev/dns323/linux-2.6.35.7.config.diff
# enable decimal values in top, remote syslogd capatilibies
patch local/dns323/busybox-1.15.3.config ~/dev/dns323/busybox-1.15.3.config.diff

# adds scripts to configure/control service and persist/save settings
cp ~/dev/dns323/syslog/syslog.cgi customroot/usr/www/cgi-bin/syslog.cgi
chmod 755 customroot/usr/www/cgi-bin/syslog.cgi
cp ~/dev/dns323/syslog/syslog_proc.cgi customroot/usr/www/cgi-bin/syslog_proc.cgi
chmod 755 customroot/usr/www/cgi-bin/syslog_proc.cgi
cp ~/dev/dns323/syslog/S10syslog customroot/etc/init.d/S10syslog
chmod 755 customroot/etc/init.d/S10syslog
patch customroot/usr/sbin/loadsave_settings ~/dev/dns323/syslog/loadsave_settings.diff

# remove binaries from source tree
rm package/config/mconf
rm package/config/qconf

./mkprepare.sh

make O=$BLDDIR menuconfig

make O=$BLDDIR

Enjoy!

--
Augusto Bott

busybox-1.15.3.config.diff
linux-2.6.35.7.config.diff
loadsave_settings.diff
syslog.cgi
syslog_proc.cgi
S10syslog

Joao Cardoso

unread,
Dec 13, 2010, 11:26:20 AM12/13/10
to al...@googlegroups.com
On Monday, December 13, 2010 11:54:43 Augusto Bott wrote:
> Hi there!
>
> Here's a few tweaks/enhancements on Alt-F v0.1b5 I've implemented for my
> own needs that could be useful and/or interesting for other people (and...
> even become part of future Alt-F releases - who knows! ;-)

Excelent! The very first code contribution to Alt-F! Congratulations Augusto.

I will certainly apply some of those changes to Alt-F.

But I have some questions :-)

> - remote syslog:
> As you probably are aware, many embedded systems
> (including Alt-F) record/store syslog messages on a memory area (which is
> limited and non-persistent). This usually means we don't get a chance to
> keep any kind of history and... when/if the box (or syslogd) crashes and/or
> restarts... everything logged so far is gone. So... it can be quite
> handy/useful to store/record/keep logs somewhere else ;-)

-Could you please add a two lines Copyright and Licence to the relevant files?
The Licence can refer, if applicable, to the COPYING file located in the
root of the rootfs and source code.
-And can you in fact see the startup/shutdown sequence using it?
-Can you supply a test setup? or at least a fragment of the startup/shutdown
remote log?
-How much more memory is actually needed?
in B6:

629596 Dec 12 18:58 /bin/busybox
335628 Dec 12 18:58 /lib/libuClibc-0.9.30.3.so

> - top:
> Currently 'top' is configured to show integer values on columns %MEM and
> %CPU (rounding up to the next integer value). I've changed this behaviour
> so it would show values with one decimal digit.(i.e. shows values like
> 0.8% instead of rounding up to 1%)

hmmm...

> - OHCI:
> I noticed the stock D-link software does have it enabled (but Alt-F
> apparently doesn't). I'm not sure if OHCI is actually required, but since
> I've been fiddling and testing USB-related things, seemed a good idea to
> have it enabled.

-For how much does the kernel size increases?
-Can it be build as a module? Modules are in /usr, which is lzma compressed.
-Can you refer a specific hardware or "use case" where it is needed?
I can attach usb printers/pens/disks without problems using the standard Alt-F
kernel.

In my mind, in the future there will be a disk-instalable kernel modules
package, containing modules that are not necessary to the base system and to
most users, but that nevertheless some users might need.

As it is usual with me, too many questions ;-), please do your best

Thanks,
João

BTW, did you have any problem building B5? apart the mconf/qconf issue?

Augusto Bott

unread,
Dec 13, 2010, 1:20:28 PM12/13/10
to al...@googlegroups.com
About 'copyright': please feel free to do whatever works best for you and/or the project (IMHO, I wrote these patches/hacks without any expectations... to be released as GPL, LGPL, PD, whatever ;-)

About remote syslogging + shutdown: short answer would be 'sure!'. Long answer would be 'sure! as long as syslogd is running'. The shutdown procedure calls /etc/init.d/rcE, which begins by calling 'rcall stop' early on... so we can see only a few messages before it's stopped/killed. But that's the thing: first we learn/master the FW compilation/building/tweaking procedures (done), then we enable remote logging (done) and down the road... we can play around and write custom/experimental shutdown procedures and do some hacking/testing to see what's really going on ;-)

If you're wondering if this actually works... here's a small syslog fragment/example registered/recorded (remotely) to another machine on my LAN:

mestre@nove:~$ hostname
nove
mestre@nove:~$ uname -a
Linux nove 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux
mestre@nove:~$ cat /var/log/syslog|grep fido | tail
Dec 13 12:20:06 fido.baia sysctrl: temp=44.8#011 fan=400
Dec 13 12:31:09 fido.baia sysctrl: temp=45.1#011 fan=400
Dec 13 12:34:46 fido.baia smartd[3400]: Device: /dev/sda, SMART Usage Attribute: 194 Temperature_Celsius changed from 64 to 63
Dec 13 12:34:46 fido.baia smartd[3400]: Device: /dev/sdb, SMART Usage Attribute: 7 Seek_Error_Rate changed from 100 to 200
Dec 13 12:34:46 fido.baia smartd[3400]: Device: /dev/sdb, SMART Usage Attribute: 194 Temperature_Celsius changed from 106 to 105
Dec 13 12:46:13 fido.baia smartd[3400]: smartd received signal 15: Terminated
Dec 13 12:46:13 fido.baia smartd[3400]: smartd is exiting (exit status 0)
Dec 13 13:22:57 fido.baia sysctrl: temp=45.6#011 fan=400
Dec 13 13:24:28 fido.baia sysctrl: temp=45.8#011 fan=400
Dec 13 15:36:20 fido.baia sysctrl: temp=45.4#011 fan=400
mestre@nove:~$ 

I'll do further testing with remote syslog and the startup/shutdown sequences and post any findings later on ;-)

About OHCI/EHCI built-in or as modules: according to "make O=$BLDDIR linux26-menuconfig", both OHCI and EHCI can be built as modules (but I've been compiling both 'built-in' at the moment on my tests). As I said before, I'm not quite sure OHCI is actually needed/required on these boxes (but the output of 'dmesg' indicates both EHCI and OHCI are enabled on the D-link FW v1.09). 

The main reason behind enabling/fiddling/testing OHCI (and EHCI options, see below) is actually related to:
- the amount of time it takes to run a simple command such as 'lsusb' on the unit (seems to run faster with stock FW, to be confirmed)
- the number of devices being detected/listed with 'lsusb'

Stock D-link FW v1.09, right after boot (FFP for telnet access), no USB devices plugged in, no modules manually loaded (or unloaded):
/ # lsusb
Bus 002 Device 001: ID 0000:0000  
Bus 001 Device 001: ID 0000:0000  
/ # 

Alt-F v0.1b5, right after boot, no USB devices plugged in, no modules manually loaded (or unloaded):
# lsusb 
Bus 001 Device 001: ID 1d6b:0002  

I'll let you know if this actually means anything relevant and/or if it's related to anything HCI-related after further testing.

About the 'top' decimals thing/feature: I agree it's not really necessary... but it's neat and adds only a few bytes the busybox binary (see below).

About image sizes ('testing' = OHCI + remote syslog + top with decimals):

v0.1b6 = 335628 bytes (from your last reply)
testing = 335732 bytes
difference = 104 bytes (!!!)

/bin/busybox
v0.1b6 = 629596 bytes (from your last reply)
testing = 629600 bytes
difference = 4 bytes (!!!)

rootfs.arm.cpio-sq.lzma
v0.1b5 = 6448640 bytes (how big is v0.1b6, BTW?)
testing = 6465956 bytes
difference = around 16k

zImage
v0.1b5 = 1521204 bytes
testing = 1529284 bytes
difference = 8080 bytes (not quite sure how much this means once the kernel image is uncompressed)

As a curiosity: I just finished compiling another test kernel with OHCI + deadline IO sched + sr module (support for USB cd/dvd optical drives) + enhanced EHCI scheduler (let's see if I get any performance improvements over USB :-). zImage = 1531600 bytes (only 10k bigger than 'stable', above).

About building v0.1b5 with these patches/hacks: the sequence of commands posted previously was repeated 3 times and all 3 runs completed/delivered successful builds (aka: not a single issue/problem besides that mconf/qconf "known" issue) :-)

Cheers!


--
Augusto Bott



--
You received this message because you are subscribed to the Google Groups "Alt-F" group.
To post to this group, send email to al...@googlegroups.com.
To unsubscribe from this group, send email to alt-f+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/alt-f?hl=en.


Augusto Bott

unread,
Dec 13, 2010, 1:59:40 PM12/13/10
to al...@googlegroups.com
And as requested... here's a small example of what can be seen when 'poweroff' is executed from a telnet session (with the current/standard v0.1b5 shutdown procedure):

Dec 13 16:56:13 fido.baia init: starting pid 2837, tty '/dev/null': '/etc/init.d/rcE'
Dec 13 16:56:13 fido.baia root: Stopping user: OK.
Dec 13 16:56:13 fido.baia root: Stopping ffp: Stopping telnetd#012OK.
Dec 13 16:56:13 fido.baia root: Stopping vsftpd: OK.
Dec 13 16:56:13 fido.baia root: Stopping dropbear: OK.
Dec 13 16:56:13 fido.baia root: Shutting down SMB services: OK.#012Shutting down NMB services: OK.
Dec 13 16:56:14 fido.baia root: Stopping nfsd: OK.#012Stopping rpc.statd: OK.#012Stopping rpc.mountd: OK.#012Stopping portmap: OK.
Dec 13 16:56:14 fido.baia root: Stopping inadyn: OK.
Dec 13 16:56:14 fido.baia ntpd[3041]: ntpd exiting on signal 15
Dec 13 16:56:14 fido.baia root: Stopping ntpd: OK.
Dec 13 16:56:14 fido.baia root: Stopping dnsmasq: OK.
Dec 13 16:56:14 fido.baia root: Stopping mdadm: OK.
Dec 13 16:56:14 fido.baia root: Stopping smartd: OK.
Dec 13 16:56:14 fido.baia root: Stopping atd: OK.
Dec 13 16:56:14 fido.baia root: Stopping crond: OK.
Dec 13 16:56:14 fido.baia root: Starting urandom: OK.
(syslogd and/or network stop around this moment)

Cheers!

--
Augusto Bott

Joao Cardoso

unread,
Dec 13, 2010, 2:42:32 PM12/13/10
to al...@googlegroups.com
On Monday, December 13, 2010 18:20:28 Augusto Bott wrote:
> About 'copyright': please feel free to do whatever works best for you
> and/or the project (IMHO, I wrote these patches/hacks without any
> expectations... to be released as GPL, LGPL, PD, whatever ;-)

I understand your atitude, but you have to say something... I still have to do
the same for myself.

Does the following fits? Give me the e-mail address of your desire.

Copyright (c) 2010 Augusto Bott <your e-mail, even if in disguise>
Can be freely distributed and used under the terms of the GNU GPL, see the
/COPYING file for details

You can also put the files in the public domain, if you desire.

> About remote syslogging + shutdown: short answer would be 'sure!'. Long
> answer would be 'sure! as long as syslogd is running'. The shutdown
> procedure calls /etc/init.d/rcE, which begins by calling 'rcall stop' early
> on...

"rcall" already has two exceptions: sysctrl and inetd, just add syslog. But
you have also to comment the "ifconfig eth0 down" line in rcE

> If you're wondering if this actually works...

I know it works :-)

But the real advantage has to do with poweroff/shutdown loggging. And only for
those who can do it, most users won't, even if we write an wiki entry.

Alt-F was not made for experts -- for those we already have Debian.
Alt-F intends to be an *alternative*, and thus has to be usable by the average
user. But not so average as Gnome developpers use to think that users are :-)

> About OHCI/EHCI built-in or as modules: according to "make O=$BLDDIR
> linux26-menuconfig", both OHCI and EHCI can be built as modules (but I've
> been compiling both 'built-in' at the moment on my tests). As I said
> before, I'm not quite sure OHCI is actually needed/required on these boxes
> (but the output of 'dmesg' indicates both EHCI and OHCI are enabled on the
> D-link FW v1.09).
>
> The main reason behind enabling/fiddling/testing OHCI (and EHCI options,
> see below) is actually related to:
> - the amount of time it takes to run a simple command such as 'lsusb' on
>
> the unit (seems to run faster with stock FW, to be confirmed)

From a certain point in its history, usbutils started to be very slow, I have
even downgraded the Alt-F package version. Try version 0.72

> - the number of devices being detected/listed with 'lsusb'
>
> Stock D-link FW v1.09, right after boot (FFP for telnet access), no USB
> devices plugged in, no modules manually loaded (or unloaded):
> / # lsusb
> Bus 002 Device 001: ID 0000:0000
> Bus 001 Device 001: ID 0000:0000
> / #
>
> Alt-F v0.1b5, right after boot, no USB devices plugged in, no modules
> manually loaded (or unloaded):
> # lsusb
> Bus 001 Device 001: ID 1d6b:0002
> #

The unity has two USB devices, but as only one is available from the outside
(without soldering) the kernel only initializes one of them.

I have compiled and run pciutils, to see what does it reports. Nothing. The
SoC does not uses PCI (except rev-A1, for the external sata chip)



> About image sizes ('testing' = OHCI + remote syslog + top with decimals):
>
> /lib/libuClibc-0.9.30.3.so
> v0.1b6 = 335628 bytes (from your last reply)
> testing = 335732 bytes
> difference = 104 bytes (!!!)
>
> /bin/busybox
> v0.1b6 = 629596 bytes (from your last reply)
> testing = 629600 bytes
> difference = 4 bytes (!!!)
>
> rootfs.arm.cpio-sq.lzma
> v0.1b5 = 6448640 bytes (how big is v0.1b6, BTW?)

currently 6428648


> testing = 6465956 bytes
> difference = around 16k
>
> zImage
> v0.1b5 = 1521204 bytes

currently 1438632


> testing = 1529284 bytes
> difference = 8080 bytes (not quite sure how much this means once the kernel
> image is uncompressed)
>
> As a curiosity: I just finished compiling another test kernel with OHCI +
> deadline IO sched + sr module (support for USB cd/dvd optical drives) +
> enhanced EHCI scheduler (let's see if I get any performance improvements
> over USB :-). zImage = 1531600 bytes (only 10k bigger than 'stable',
> above).

The problem in embedded systems is that, as a portuguese saying says: "grain
by grain does the birdie fills the craw" :)

Bye,

Augusto Bott

unread,
Dec 13, 2010, 3:49:51 PM12/13/10
to al...@googlegroups.com
> Does the following fits? Give me the e-mail address of your desire.
Yes, that would be fine <augusto at bott com br>

I'll check rcall and the networking as soon one of my arrays finishes rebuilding.

>> If you're wondering if this actually works...
> I know it works :-)
Not you! That example was meant to the other readers!

> those who can do it, most users won't, even if we write an wiki entry.
Right, right... logging remotely will indeed help us understanding what's going wrong at shutdown/reboot on C1 HW, but the whole point of is about the option/alternative to centralize logs from all your devices in one place - helps tremendously when/if you have a lot of devices generating log files: 15+, in my case :-) 

> even downgraded the Alt-F package version. Try version 0.72
Nah. Just completed brewing a version with both OHCI and EHCI compiled as modules instead of built-in. So I'll just try some permutations and let you know if any of this makes any sense. On the other hand... we're on kernel 2.6.35.something... whereas stock FW v1.09 is on 2.6.12.something (who knows!?)

> (without soldering) the kernel only initializes one of them.
Is this behaviour (initializing only one of them) specified anywhere in the code of Alt-F or... does this happen 'automagically' due to some kind of kernel patch/update/etc..?

'later


--
Augusto Bott




--

Joao Cardoso

unread,
Dec 14, 2010, 4:11:50 AM12/14/10
to al...@googlegroups.com
On Monday, December 13, 2010 20:49:51 Augusto Bott wrote:

> Is this behaviour (initializing only one of them [ internal USB]) specified

anywhere in the
> code of Alt-F or... does this happen 'automagically' due to some kind of
> kernel patch/update/etc..?

all kernel DNS-323 specific handling is at arch/arm/mach-orion5x/dns323-
setup.c which only inits one of the two usb devices: orion5x_ehci0_init();

> 'later
>
>

Reply all
Reply to author
Forward
0 new messages