Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
89be2973
Commit
89be2973
authored
Apr 01, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: set up logging for daemons from Kconfig values
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
28b0dbe1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
5 deletions
+62
-5
Kconfig
Kconfig
+27
-0
wrs_build_wraprootfs
build/scripts/wrs_build_wraprootfs
+8
-0
start-daemons.sh
userspace/rootfs_override/wr/sbin/start-daemons.sh
+27
-5
No files found.
Kconfig
View file @
89be2973
...
...
@@ -109,6 +109,33 @@ config SNMP_RW_COMMUNITY
for production. Please note, however, that the switch processes
SNMP only on the CPU Ethernet port (the copper "management" port).
config WRS_LOG_HAL
string "Logging directions for the WR hal"
default "daemon.info"
help
The string can be a pathname (e.g. /dev/kmsg) or a <facility>.<level>
spefification like "daemon.debug". An empty strings is used
to represent no logging (like /dev/null). Please note that
unknown facility names will generate a runtime error on the switch.
config WRS_LOG_RTU
string "Logging directions for the RTU daemon"
default "daemon.info"
help
The string can be a pathname (e.g. /dev/kmsg) or a <facility>.<level>
spefification like "daemon.debug". An empty strings is used
to represent no logging (like /dev/null). Please note that
unknown facility names will generate a runtime error on the switch.
config WRS_LOG_PTP
string "Logging directions for the PTP server (ptpd or ppsi)"
default "daemon.info"
help
The string can be a pathname (e.g. /dev/kmsg) or a <facility>.<level>
spefification like "daemon.debug". An empty strings is used
to represent no logging (like /dev/null). Please note that
unknown facility names will generate a runtime error on the switch.
config KEEP_ROOTFS
bool "Keep generated filesystem and related script"
help
...
...
build/scripts/wrs_build_wraprootfs
View file @
89be2973
...
...
@@ -70,6 +70,14 @@ set | grep CONFIG_SNMP | sed 's/=/ /' | while read varname value; do
sed -i "/\
$varname
/ s/\
$varname
/\
$value
/" \
$cfgfile
done
# Fix log values
cfgfile="
$TMPFS
/wr/sbin/start-daemons.sh"
set | grep CONFIG_WRS_LOG | sed 's/=/ /' | while read varname value; do
if [ -z "\
$value
" ]; then continue; fi
sed -i "/\
$varname
/ s,\
$varname
,\
$value
," \
$cfgfile
done
mkdir -p
$TMPFS
/root/.ssh
#cat
$HOME
/.ssh/id_?sa.pub >>
$TMPFS
/root/.ssh/authorized_keys
if [ -f
$WRS_BASE_DIR
/authorized_keys ]; then
...
...
userspace/rootfs_override/wr/sbin/start-daemons.sh
View file @
89be2973
#!/bin/ash
echo
"Starting up WR daemons..."
# The following variables are modified at build time, with Kconfig values
LOG_HAL
=
CONFIG_WRS_LOG_HAL
LOG_RTU
=
CONFIG_WRS_LOG_RTU
LOG_PTP
=
CONFIG_WRS_LOG_PTP
# The loop below is a little intricate because of the eval, but I need it this
# to have pipe and file as both supported.
# Also, to have both stdout and stderr, we need "2>&1" before the pipe, but
# after the file redirection (why????)
for
n
in
HAL RTU PTP
;
do
# if empty turn it to /dev/null
if
eval test
-z
"
\$
LOG_
$n
"
;
then
LOG_
$n
=
"/dev/null"
;
fi
# if a pathname, use it
eval
value
=
"
\$
LOG_
$n
"
if
echo
"
$value
"
|
grep
/
>
/dev/null
;
then
eval
LOGPIPE_
$n
=
\"
\>
$value
2
\>\&
1
\"
;
continue
;
fi
# not a pathname: use verbatim
eval
LOGPIPE_
$n
=
\"
2
\>\&
1
\|
logger
-t
wr-switch
-p
$value
\"
done
export
WR_HOME
=
"/wr"
$WR_HOME
/bin/wrsw_hal
-c
$WR_HOME
/etc/wrsw_hal.conf &> /dev/kmsg
&
$WR_HOME
/bin/wrsw_rtud
>
& /dev/kmsg
&
eval
$WR_HOME
/bin/wrsw_hal
-c
$WR_HOME
/etc/wrsw_hal.conf
$LOGPIPE_HAL
\
&
eval
$WR_HOME
/bin/wrsw_rtud
$LOGPIPE_RTU
\
&
# run ptp-noposix or ppsi, whatever is installed
if
[
-x
$WR_HOME
/bin/ptpd
]
;
then
$WR_HOME
/bin/ptpd
-A
-c
>
& /dev/null
&
eval
$WR_HOME
/bin/ptpd
-A
-c
$LOGPIPE_PTP
\
&
exit
0
fi
if
[
!
-x
$WR_HOME
/bin/ppsi
]
;
then
...
...
@@ -24,6 +46,6 @@ for i in $(seq 1 10); do
if
[
-S
/tmp/.minipc/wrsw_hal
]
;
then
break
;
fi
sleep
1
done
$WR_HOME
/bin/ppsi
>
& /dev/kmsg
&
eval
$WR_HOME
/bin/ppsi
$LOGPIPE_PTP
\
&
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment