Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
dba6a80b
Commit
dba6a80b
authored
Apr 29, 2010
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of pwrcvs:/data1/git/pwr
parents
dc4cdcd8
745a9609
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
968 additions
and
46 deletions
+968
-46
otherio/exp/rt/src/os_linux/hw_arm/makefile
otherio/exp/rt/src/os_linux/hw_arm/makefile
+50
-0
otherio/lib/rt/src/os_linux/hw_arm/makefile
otherio/lib/rt/src/os_linux/hw_arm/makefile
+15
-0
otherio/lib/rt/src/os_linux/rt_io_m_gpio.c
otherio/lib/rt/src/os_linux/rt_io_m_gpio.c
+93
-0
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
+15
-0
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
+215
-0
otherio/lib/rt/src/rt_io_otherio.meth
otherio/lib/rt/src/rt_io_otherio.meth
+2
-0
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+143
-2
src/exp/com/src/os_linux/pwr_pkg.sh
src/exp/com/src/os_linux/pwr_pkg.sh
+8
-8
src/lib/rt/src/rt_load.x
src/lib/rt/src/rt_load.x
+1
-0
src/wbl/pwrb/src/pwrb_c_custombuild.wb_load
src/wbl/pwrb/src/pwrb_c_custombuild.wb_load
+102
-0
src/wbl/pwrs/src/pwrs_td_opsysenum.wb_load
src/wbl/pwrs/src/pwrs_td_opsysenum.wb_load
+10
-0
src/wbl/pwrs/src/pwrs_td_opsysmask.wb_load
src/wbl/pwrs/src/pwrs_td_opsysmask.wb_load
+10
-0
wb/exp/wb/src/pwr_wb_palette.cnf
wb/exp/wb/src/pwr_wb_palette.cnf
+1
-0
wb/lib/wb/src/wb_lfu.cpp
wb/lib/wb/src/wb_lfu.cpp
+212
-3
wb/lib/wb/src/wb_pkg.cpp
wb/lib/wb/src/wb_pkg.cpp
+52
-29
wb/lib/wb/src/wb_pkg.h
wb/lib/wb/src/wb_pkg.h
+39
-4
No files found.
otherio/exp/rt/src/os_linux/hw_arm/makefile
0 → 100644
View file @
dba6a80b
include
$(pwre_dir_symbols)
ifndef
variables_mk
-include
$(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef
variables_mk
include
$(pwre_croot)/src/tools/bld/src/$(os_name)/variables.mk
endif
ifndef
rules_mk
-include
$(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef
rules_mk
include
$(pwre_croot)/src/tools/bld/src/$(os_name)/rules.mk
endif
.PHONY
:
all init copy lib exe clean realclean
\
$(clean_c)
all
:
init copy lib
init
:
copy
:
$(inc_dir)/libusbio.h
lib
:
exe
:
clean
:
realclean
:
clean $(clean_obj)
.SUFFIXES
:
#$(lib_dir)/libusbio.a : ../libusbio.a
# @ echo "Copying libusbio.a"
# @ $(cp) $(cpflags) $(source) $(target)
$(inc_dir)/libusbio.h
:
../libusbio.h
@
echo
"Copying libusbio.h"
@
$(cp)
$(cpflags)
$(source)
$(target)
otherio/lib/rt/src/os_linux/hw_arm/makefile
0 → 100644
View file @
dba6a80b
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
otherio/lib/rt/src/os_linux/rt_io_m_gpio.c
0 → 100644
View file @
dba6a80b
/*
* Proview $Id$
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* rt_io_m_gpio.c -- I/O methods for class GPIO. */
#include <stdio.h>
#include <stdlib.h>
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
#include "rt_io_msg.h"
#include "rt_io_m_gpio.h"
static
pwr_tStatus
IoRackInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sCard
*
cp
;
pwr_sClass_GPIO
*
op
=
(
pwr_sClass_GPIO
*
)
rp
->
op
;
FILE
*
fp
;
pwr_tStatus
sts
;
int
i
;
fp
=
fopen
(
"/sys/class/gpio/export"
,
"w"
);
if
(
!
fp
)
{
errh_Error
(
"GPIO unable to open
\"
/sys/class/gpio/export
\"
, %s"
,
rp
->
Name
);
sts
=
IO__INITFAIL
;
op
->
Status
=
sts
;
return
sts
;
}
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
case
pwr_cClass_ChanDi
:
fprintf
(
fp
,
"%u"
,
((
pwr_sClass_ChanDi
*
)
cp
->
chanlist
[
i
].
cop
)
->
Number
);
fflush
(
fp
);
break
;
case
pwr_cClass_ChanDo
:
fprintf
(
fp
,
"%u"
,
((
pwr_sClass_ChanDo
*
)
cp
->
chanlist
[
i
].
cop
)
->
Number
);
fflush
(
fp
);
break
;
default:
;
}
}
}
}
fclose
(
fp
);
errh_Info
(
"Init of GPIO '%s'"
,
rp
->
Name
);
op
->
Status
=
IO__SUCCESS
;
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoRackClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
pwr_sClass_GPIO
*
op
=
(
pwr_sClass_GPIO
*
)
rp
->
op
;
op
->
Status
=
0
;
return
IO__SUCCESS
;
}
/* Every method should be registred here. */
pwr_dExport
pwr_BindIoMethods
(
GPIO
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
otherio/lib/rt/src/os_linux/rt_io_m_gpio.h
0 → 100644
View file @
dba6a80b
/* ra_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
#ifndef ra_io_m_gpio_h
#define ra_io_m_gpio_h
#define GPIO_MAX_CHANNELS 32
typedef
struct
{
FILE
*
value_fp
[
GPIO_MAX_CHANNELS
];
unsigned
int
number
[
GPIO_MAX_CHANNELS
];
int
interval_cnt
;
int
has_read_method
;
}
io_sLocalGPIO_Module
;
#endif
otherio/lib/rt/src/os_linux/rt_io_m_gpio_module.c
0 → 100644
View file @
dba6a80b
/*
* Proview $Id: rt_io_m_motioncontrol_usbio.c,v 1.1 2007-11-22 13:28:59 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* rt_io_m_motioncontrol_usbio.c -- I/O methods for class MotionControl_USBIO. */
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
#include "rt_io_card_read.h"
#include "rt_io_card_write.h"
#include "rt_io_msg.h"
#include "rt_io_m_gpio.h"
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
int
i
;
pwr_sClass_GPIO_Module
*
op
=
(
pwr_sClass_GPIO_Module
*
)
cp
->
op
;
FILE
*
fp
;
char
str
[
80
];
io_sLocalGPIO_Module
*
local
;
char
direction
[
20
];
char
access
[
20
];
pwr_tStatus
sts
;
local
=
(
io_sLocalGPIO_Module
*
)
calloc
(
1
,
sizeof
(
io_sLocalGPIO_Module
));
cp
->
Local
=
local
;
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
case
pwr_cClass_ChanDi
:
local
->
number
[
i
]
=
((
pwr_sClass_ChanDi
*
)
cp
->
chanlist
[
i
].
cop
)
->
Number
;
strcpy
(
direction
,
"in"
);
strcpy
(
access
,
"r+"
);
break
;
case
pwr_cClass_ChanDo
:
local
->
number
[
i
]
=
((
pwr_sClass_ChanDo
*
)
cp
->
chanlist
[
i
].
cop
)
->
Number
;
strcpy
(
direction
,
"out"
);
strcpy
(
access
,
"w"
);
break
;
default:
;
}
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
case
pwr_cClass_ChanDi
:
case
pwr_cClass_ChanDo
:
sprintf
(
str
,
"/sys/class/gpio/gpio%u/direction"
,
local
->
number
[
i
]);
fp
=
fopen
(
str
,
"w"
);
if
(
!
fp
)
{
errh_Error
(
"GPIO uable to open %s, %s, Id: %d"
,
str
,
cp
->
Name
,
local
->
number
[
i
]);
sts
=
IO__INITFAIL
;
op
->
Status
=
sts
;
return
sts
;
}
fprintf
(
fp
,
"%s"
,
direction
);
fclose
(
fp
);
sprintf
(
str
,
"/sys/class/gpio/gpio%u/value"
,
local
->
number
[
i
]);
local
->
value_fp
[
i
]
=
fopen
(
str
,
access
);
if
(
!
local
->
value_fp
[
i
])
{
errh_Error
(
"GPIO Unable op open %s, '%s' Id: %d"
,
str
,
cp
->
Name
,
local
->
number
[
i
]);
sts
=
IO__INITFAIL
;
op
->
Status
=
sts
;
return
sts
;
}
break
;
default:
;
}
}
}
errh_Info
(
"Init of GPIO Module '%s'"
,
cp
->
Name
);
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
int
i
;
io_sLocalGPIO_Module
*
local
=
(
io_sLocalGPIO_Module
*
)
cp
->
Local
;
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
){
case
pwr_cClass_ChanDi
:
case
pwr_cClass_ChanDo
:
if
(
local
->
value_fp
[
i
])
fclose
(
local
->
value_fp
[
i
]);
break
;
default:
;
}
}
}
free
(
cp
->
Local
);
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sLocalGPIO_Module
*
local
=
(
io_sLocalGPIO_Module
*
)
cp
->
Local
;
pwr_sClass_GPIO_Module
*
op
=
(
pwr_sClass_GPIO_Module
*
)
cp
->
op
;
int
i
;
char
str
[
20
];
if
(
op
->
ScanInterval
>
1
)
{
local
->
has_read_method
=
1
;
if
(
local
->
interval_cnt
!=
0
)
{
local
->
interval_cnt
++
;
if
(
local
->
interval_cnt
>=
op
->
ScanInterval
)
local
->
interval_cnt
=
0
;
return
IO__SUCCESS
;
}
local
->
interval_cnt
++
;
}
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
case
pwr_cClass_ChanDi
:
fflush
(
local
->
value_fp
[
i
]);
fgets
(
str
,
sizeof
(
str
),
local
->
value_fp
[
i
]);
rewind
(
local
->
value_fp
[
i
]);
if
(
str
[
0
]
==
'0'
)
*
(
pwr_tBoolean
*
)
cp
->
chanlist
[
i
].
vbp
=
0
;
else
*
(
pwr_tBoolean
*
)
cp
->
chanlist
[
i
].
vbp
=
1
;
break
;
default:
;
}
}
}
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sLocalGPIO_Module
*
local
=
(
io_sLocalGPIO_Module
*
)
cp
->
Local
;
pwr_sClass_GPIO_Module
*
op
=
(
pwr_sClass_GPIO_Module
*
)
cp
->
op
;
int
i
;
if
(
op
->
ScanInterval
>
1
)
{
if
(
!
local
->
has_read_method
)
{
if
(
local
->
interval_cnt
!=
0
)
{
local
->
interval_cnt
++
;
if
(
local
->
interval_cnt
>=
op
->
ScanInterval
)
local
->
interval_cnt
=
0
;
return
IO__SUCCESS
;
}
local
->
interval_cnt
++
;
}
else
if
(
local
->
interval_cnt
!=
1
)
return
IO__SUCCESS
;
}
for
(
i
=
0
;
i
<
GPIO_MAX_CHANNELS
;
i
++
)
{
if
(
cp
->
chanlist
[
i
].
cop
)
{
switch
(
cp
->
chanlist
[
i
].
ChanClass
)
{
case
pwr_cClass_ChanDo
:
if
(
*
(
pwr_tBoolean
*
)
cp
->
chanlist
[
i
].
vbp
)
fprintf
(
local
->
value_fp
[
i
],
"1"
);
else
fprintf
(
local
->
value_fp
[
i
],
"0"
);
fflush
(
local
->
value_fp
[
i
]);
// printf( "Write %d %d\n", local->number[i], *(pwr_tBoolean *)cp->chanlist[i].vbp);
break
;
default:
;
}
}
}
return
IO__SUCCESS
;
}
/* Every method should be registred here. */
pwr_dExport
pwr_BindIoMethods
(
GPIO_Module
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_NullMethod
};
otherio/lib/rt/src/rt_io_otherio.meth
View file @
dba6a80b
...
...
@@ -5,3 +5,5 @@ Modbus_Module
Modbus_Master
Modbus_TCP_Server
Modbus_TCP_ServerModule
GPIO
GPIO_Module
otherio/wbl/mcomp/src/otherio.wb_load
View file @
dba6a80b
Volume OtherIO $ClassVolume 0.0.250.10
Body SysBody 01-JAN-1970 01:00:00.00
Attr NextOix = "_X
77
"
Attr NextCix = "_X
8
"
Attr NextOix = "_X
91
"
Attr NextCix = "_X
10
"
Attr NextTix[0] = "_X5"
EndBody
Object Type $TypeHier 1 15-NOV-2007 14:35:37.90
...
...
@@ -1452,5 +1452,146 @@ Volume OtherIO $ClassVolume 0.0.250.10
EndBody
EndObject
EndObject
Object GPIO $ClassDef 8 15-APR-2010 21:46:30.11
Body SysBody 15-APR-2010 21:46:16.74
Attr Editor = 0
Attr Method = 0
Attr Flags = 10320
EndBody
Object RtBody $ObjBodyDef 1 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:46:39.64
Attr StructName = "GPIO"
Attr NextAix = "_X17"
EndBody
Object Description $Attribute 13 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:46:16.74
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Process $Attribute 14 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:54:44.41
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
Object ThreadObject $Attribute 15 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:46:16.74
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
Object Status $Attribute 16 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:55:29.27
Attr PgmName = "Status"
Attr Flags = 1040
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
EndObject
Object ConfiguratorPoson $Menu 78 15-APR-2010 21:46:16.74
Object Pointed $Menu 79 15-APR-2010 21:46:16.74
Object Connect $MenuButton 80 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:46:16.74
Attr ButtonName = "Connect PlcThread"
Attr MethodName = "$Objid-Connect"
Attr MethodArguments[0] = "ThreadObject"
Attr MethodArguments[1] = "PlcThread"
Attr FilterName = "$Objid-IsOkConnect"
Attr FilterArguments[0] = "ThreadObject"
Attr FilterArguments[1] = "PlcThread"
EndBody
EndObject
EndObject
EndObject
Object IoMethods $RtMethod 89 15-APR-2010 21:52:17.62
Object IoRackInit $Method 90 15-APR-2010 21:52:17.62
Body SysBody 15-APR-2010 21:52:28.10
Attr MethodName = "GPIO-IoRackInit"
EndBody
EndObject
Object IoRackClose $Method 91 15-APR-2010 21:52:17.62
Body SysBody 15-APR-2010 21:52:39.12
Attr MethodName = "GPIO-IoRackClose"
EndBody
EndObject
EndObject
Object Template GPIO 2149810176 01-JAN-1970 01:00:00.00
Body RtBody 15-APR-2010 21:57:21.82
Attr Process = 1
EndBody
EndObject
EndObject
Object GPIO_Module $ClassDef 9 15-APR-2010 21:49:47.13
Body SysBody 15-APR-2010 21:46:16.74
Attr Editor = 0
Attr Method = 0
Attr Flags = 18512
EndBody
Object RtBody $ObjBodyDef 1 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:52:59.99
Attr StructName = "GPIO_Module"
Attr NextAix = "_X15"
EndBody
Object Description $Attribute 10 15-APR-2010 21:53:54.03
Body SysBody 15-APR-2010 21:54:16.96
Attr PgmName = "Description"
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
Object Process $Attribute 11 15-APR-2010 21:54:37.62
Body SysBody 15-APR-2010 21:54:53.56
Attr PgmName = "Process"
Attr TypeRef = "pwrb:Type-IoProcessMask"
EndBody
EndObject
Object ThreadObject $Attribute 13 15-APR-2010 21:55:05.81
Body SysBody 15-APR-2010 21:55:05.81
Attr PgmName = "ThreadObject"
Attr TypeRef = "pwrs:Type-$Objid"
EndBody
EndObject
Object Status $Attribute 12 15-APR-2010 21:55:37.33
Body SysBody 15-APR-2010 21:55:45.30
Attr PgmName = "Status"
Attr TypeRef = "pwrs:Type-$Status"
EndBody
EndObject
Object ScanInterval $Attribute 14 16-APR-2010 16:09:01.24
Body SysBody 16-APR-2010 16:09:02.20
Attr PgmName = "ScanInterval"
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
EndObject
Object IoMethods $RtMethod 84 15-APR-2010 21:46:16.74
Object IoCardInit $Method 85 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:55:58.78
Attr MethodName = "GPIO_Module-IoCardInit"
EndBody
EndObject
Object IoCardClose $Method 86 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:56:07.31
Attr MethodName = "GPIO_Module-IoCardClose"
EndBody
EndObject
Object IoCardRead $Method 87 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:56:12.67
Attr MethodName = "GPIO_Module-IoCardRead"
EndBody
EndObject
Object IoCardWrite $Method 88 15-APR-2010 21:46:16.74
Body SysBody 15-APR-2010 21:56:18.19
Attr MethodName = "GPIO_Module-IoCardWrite"
EndBody
EndObject
EndObject
Object Template GPIO_Module 2150072320 01-JAN-1970 01:00:00.00
Body RtBody 15-APR-2010 21:57:34.91
Attr Process = 1
Attr Status = 286
EndBody
EndObject
EndObject
EndObject
EndVolume
src/exp/com/src/os_linux/pwr_pkg.sh
View file @
dba6a80b
...
...
@@ -24,7 +24,7 @@ pkg_install_func ()
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -61,7 +61,7 @@ pkg_list_func ()
# Extract datfile from package
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -114,7 +114,7 @@ pkg_listfiles_func ()
# Extract datfile from package
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$1
"
pkg
=
"
$HOME
/
$1
"
else
pkg
=
$1
fi
...
...
@@ -185,7 +185,7 @@ pkg_brief_func ()
do
if
[
$file
==
${
file
##*/
}
]
;
then
# Add path
pkg
=
"
/home/pwrp
/
$file
"
pkg
=
"
$HOME
/
$file
"
else
pkg
=
$file
fi
...
...
@@ -229,11 +229,11 @@ pkg_brief_func ()
pkg_dir_func
()
{
if
[
-z
$1
]
;
then
allpkg
=
`
ls
/home/pwrp
/pwrp_pkg_
*
.tgz
`
allpkg
=
`
ls
$HOME
/pwrp_pkg_
*
.tgz
`
else
if
[
$1
==
${
1
##*/
}
]
;
then
# Add path
pattern
=
"
/home/pwrp
/*
$1
*"
pattern
=
"
$HOME
/*
$1
*"
elif
[
${
1
:0:1
}
==
"/"
]
;
then
pattern
=
$1
*
else
...
...
@@ -252,11 +252,11 @@ pkg_dir_func()
pkg_dirbrief_func
()
{
if
[
-z
"
$1
"
]
;
then
allpkg
=
`
ls
/home/pwrp
/pwrp_pkg_
*
.tgz
`
allpkg
=
`
ls
$HOME
/pwrp_pkg_
*
.tgz
`
else
if
[
"
$1
"
==
"
${
1
##*/
}
"
]
;
then
# Add path
pattern
=
"
/home/pwrp
/*
$1
*"
pattern
=
"
$HOME
/*
$1
*"
elif
[
${
1
:0:1
}
==
"/"
]
;
then
pattern
=
$1
*
else
...
...
src/lib/rt/src/rt_load.x
View file @
dba6a80b
...
...
@@ -68,6 +68,7 @@
%# define load_cNameRttCrrCode "rtt_crrc_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNameRttPlc "rtt_plc_%3.3d_%3.3d_%3.3d_%3.3d.dat"
%# define load_cNamePkg "pwrp_pkg_%s_%04d.tgz"
%# define load_cNameCustomBuild "$pwrp_exe/custom_build.sh"
%#endif
%
%
...
...
src/wbl/pwrb/src/pwrb_c_custombuild.wb_load
0 → 100644
View file @
dba6a80b
!
! Proview $Id$
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with the program, if not, write to the Free Software
! Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
!
! pwrb_c_distribute.wb_load -- Defines the class Distribute.
!
SObject pwrb:Class
!/**
! @Version 1.0
! @Group ProjectConfiguration
! @Summary Configures cumstomized build.
! Configures custumized build for embedded systems with cross compilation.
!
! @b See also
! @classlink NodeConfig pwrb_nodeconfig.html
! @classlink ApplDistribute pwrb_appldistribute.html
!*/
Object CustomBuild $ClassDef 542
Body SysBody
Attr Editor = pwr_eEditor_AttrEd
Attr Method = pwr_eMethod_RtAndDevBodies
EndBody
Object DevBody $ObjBodyDef 2
!/**
! c compiler, e.g arm-linux-gnueabi-gcc.
!*/
Object cc $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! c++ compiler, e.g arm-linux-gnueabi-g++.
!*/
Object cxx $Attribute 2
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! archiver, e.g arm-linux-gnueabi-ar.
!*/
Object ar $Attribute 3
Body SysBody
Attr TypeRef = "pwrs:Type-$String80"
EndBody
EndObject
!/**
! Operating system.
!*/
Object OperatingSystem $Attribute 4
Body SysBody
Attr TypeRef = "pwrs:Type-$OpSysEnum"
EndBody
EndObject
!/**
! Build directories.
!*/
Object Platform $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
!/**
! Release.
!*/
Object Release $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$String40"
EndBody
EndObject
EndObject
Object Template CustomBuild
EndObject
EndObject
EndSObject
src/wbl/pwrs/src/pwrs_td_opsysenum.wb_load
View file @
dba6a80b
...
...
@@ -120,5 +120,15 @@ SObject pwrs:Type
Attr Value = 256
EndBody
EndObject
!/**
! Operating system is Linux on ARM
!*/
Object ARM_LINUX $Value
Body SysBody
Attr PgmName = "ARM_LINUX"
Attr Text = "Linux on ARM"
Attr Value = 512
EndBody
EndObject
EndObject
EndSObject
src/wbl/pwrs/src/pwrs_td_opsysmask.wb_load
View file @
dba6a80b
...
...
@@ -123,5 +123,15 @@ SObject pwrs:Type
Attr Value = 256
EndBody
EndObject
!/**
! Operating system is Mac OS X on x86_64
!*/
Object ARM_LINUX $Bit
Body SysBody
Attr PgmName = "ARM_X86"
Attr Text = "Linux on ARM"
Attr Value = 512
EndBody
EndObject
EndObject
EndSObject
wb/exp/wb/src/pwr_wb_palette.cnf
View file @
dba6a80b
...
...
@@ -464,6 +464,7 @@ palette ProjectNavigatorPalette
class ApplDistribute
class BusConfig
class ClassVolumeLoad
class CustomBuild
class Distribute
class DetachedClassVolumeLoad
class FriendNodeConfig
...
...
wb/lib/wb/src/wb_lfu.cpp
View file @
dba6a80b
...
...
@@ -667,6 +667,7 @@ pwr_tStatus lfu_SaveDirectoryVolume(
char
fname
[
200
];
char
path
[
80
];
int
path_file_created
=
0
;
pwr_tString80
custom_platform
;
syntax_error
=
0
;
strcpy
(
null_nodename
,
"-"
);
...
...
@@ -2056,17 +2057,65 @@ pwr_tStatus lfu_SaveDirectoryVolume(
if
(
!
found
)
distr_options
=
(
lfu_mDistrOpt
)((
int
)
distr_options
|
lfu_mDistrOpt_NoRootVolume
);
fprintf
(
file
,
"node %s %s %d %d %s
\n
"
,
strcpy
(
custom_platform
,
"-"
);
/* Find any CustomBuild for this node */
class_vect
[
0
]
=
pwr_cClass_CustomBuild
;
class_vect
[
1
]
=
0
;
objcount
=
0
;
objlist
=
0
;
sts
=
trv_create_ctx
(
&
trvctx
,
ldhses
,
nodeobjid
,
class_vect
,
NULL
,
NULL
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
trv_object_search
(
trvctx
,
&
utl_objidlist_insert
,
&
objlist
,
&
objcount
,
0
,
0
,
0
);
if
(
EVEN
(
sts
))
return
sts
;
sts
=
trv_delete_ctx
(
trvctx
);
for
(
obj_ptr
=
objlist
;
obj_ptr
;
obj_ptr
=
obj_ptr
->
next
)
{
applobjid
=
obj_ptr
->
objid
;
sts
=
ldh_GetObjectClass
(
ldhses
,
applobjid
,
&
ccid
);
if
(
EVEN
(
sts
))
return
sts
;
switch
(
ccid
)
{
case
pwr_cClass_CustomBuild
:
{
char
*
platform_p
;
sts
=
ldh_ObjidToName
(
ldhses
,
applobjid
,
ldh_eName_Object
,
appl_name
,
sizeof
(
appl_name
),
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
/* Check Source attribute */
sts
=
ldh_GetObjectPar
(
ldhses
,
applobjid
,
"DevBody"
,
"Platform"
,
&
platform_p
,
&
size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
strcmp
(
platform_p
,
""
)
!=
0
)
strncpy
(
custom_platform
,
platform_p
,
sizeof
(
custom_platform
));
free
(
platform_p
);
break
;
}
default:
;
}
}
fprintf
(
file
,
"node %s %s %d %d %s %s
\n
"
,
nodename_ptr
,
os_str
,
*
bus_number_ptr
,
distr_options
,
bootnode_ptr
);
bootnode_ptr
,
custom_platform
);
/* Find the applications for this node */
class_vect
[
0
]
=
pwr_cClass_Distribute
;
class_vect
[
1
]
=
pwr_cClass_ApplDistribute
;
class_vect
[
3
]
=
0
;
class_vect
[
2
]
=
0
;
objcount
=
0
;
objlist
=
0
;
...
...
@@ -2276,7 +2325,167 @@ pwr_tStatus lfu_SaveDirectoryVolume(
system
(
"purge/nolog "
load_cNameDistribute
);
#endif
// Generate custom_build files
for
(
wb_object
buso
=
sp
->
object
();
buso
;
buso
=
buso
.
after
())
{
if
(
buso
.
cid
()
!=
pwr_cClass_BusConfig
)
continue
;
// Get all nodeconfig and friendnodes for this bus
for
(
wb_object
nodeo
=
buso
.
first
();
nodeo
;
nodeo
=
nodeo
.
after
())
{
if
(
nodeo
.
cid
()
!=
pwr_cClass_NodeConfig
)
continue
;
for
(
wb_object
customo
=
nodeo
.
first
();
customo
;
customo
=
customo
.
after
())
{
if
(
customo
.
cid
()
!=
pwr_cClass_CustomBuild
)
continue
;
pwr_tString80
nodename
;
pwr_tString80
cc
;
pwr_tString80
cxx
;
pwr_tString80
ar
;
pwr_tOpSysEnum
opsys
;
pwr_tString40
platform
;
pwr_tString40
release
;
FILE
*
fp
;
// Get NodeName
wb_attribute
a
=
sp
->
attribute
(
nodeo
.
oid
(),
"RtBody"
,
"NodeName"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
nodename
);
if
(
!
a
)
return
sts
;
// Get attribute cc
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"cc"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
cc
);
if
(
!
a
)
return
sts
;
// Get attribute cxx
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"cxx"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
cxx
);
if
(
!
a
)
return
sts
;
// Get attribute ar
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"ar"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
ar
);
if
(
!
a
)
return
sts
;
// Get attribute OperatingSystem
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"OperatingSystem"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
(
void
*
)
&
opsys
);
if
(
!
a
)
return
sts
;
// Get attribute Platform
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"Platform"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
platform
);
if
(
!
a
)
return
sts
;
// Get attribute Release
a
=
sp
->
attribute
(
customo
.
oid
(),
"DevBody"
,
"Release"
);
if
(
!
a
)
return
a
.
sts
();
a
.
value
(
release
);
if
(
!
a
)
return
sts
;
if
(
!
strcmp
(
nodename
,
""
))
{
char
msg
[
200
];
sprintf
(
msg
,
"Error in NodeConfig object '%s', NodeName is missing
\n
"
,
nodeo
.
longName
().
c_str
());
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
syntax_error
=
1
;
}
if
(
!
(
(
strcmp
(
cc
,
""
)
!=
0
&&
strcmp
(
cxx
,
""
)
!=
0
&&
strcmp
(
ar
,
""
)
!=
0
)
||
(
strcmp
(
cc
,
""
)
==
0
&&
strcmp
(
cxx
,
""
)
==
0
&&
strcmp
(
ar
,
""
)
==
0
)))
{
char
msg
[
200
];
sprintf
(
msg
,
"Error in CustomBuild object '%s', all or none of cc, cxx and ar has to be supplied
\n
"
,
customo
.
longName
().
c_str
());
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
syntax_error
=
1
;
}
// Print custom build file
if
(
!
(
opsys
==
pwr_mOpSys_PPC_LINUX
||
opsys
==
pwr_mOpSys_X86_LINUX
||
opsys
==
pwr_mOpSys_ARM_LINUX
))
continue
;
sprintf
(
fname
,
load_cNameCustomBuild
);
dcli_translate_filename
(
fname
,
fname
);
fp
=
fopen
(
fname
,
"w"
);
if
(
file
==
0
)
{
char
msg
[
200
];
sprintf
(
msg
,
"Error, Unable to open file %s"
,
fname
);
MsgWindow
::
message
(
'E'
,
msg
,
msgw_ePop_Default
);
return
LFU__NOFILE
;
}
fprintf
(
fp
,
"#!/bin/bash
\n\n
"
);
fprintf
(
fp
,
"let OpSys_PPC_LINUX=32
\n
"
);
fprintf
(
fp
,
"let OpSys_X86_LINUX=64
\n
"
);
fprintf
(
fp
,
"let OpSys_ARM_LINUX=256
\n\n
"
);
if
(
strcmp
(
release
,
""
)
!=
0
)
fprintf
(
fp
,
"source $pwra_db/pwra_env.sh set base %s
\n\n
"
,
release
);
if
(
strcmp
(
cc
,
""
)
!=
0
)
{
fprintf
(
fp
,
"export pwre_cc=%s
\n
"
,
cc
);
fprintf
(
fp
,
"export pwre_cxx=%s
\n
"
,
cxx
);
fprintf
(
fp
,
"export pwre_ar=%s
\n\n
"
,
ar
);
}
if
(
strcmp
(
platform
,
""
)
!=
0
)
{
fprintf
(
fp
,
"if [ ! -e $pwrp_root/bld/%s ]; then
\n
"
,
platform
);
fprintf
(
fp
,
" mkdir $pwrp_root/bld/%s
\n
"
,
platform
);
fprintf
(
fp
,
"fi
\n
"
);
fprintf
(
fp
,
"if [ ! -e $pwrp_root/bld/%s/obj ]; then
\n
"
,
platform
);
fprintf
(
fp
,
" mkdir $pwrp_root/bld/%s/obj
\n
"
,
platform
);
fprintf
(
fp
,
"fi
\n
"
);
fprintf
(
fp
,
"if [ ! -e $pwrp_root/bld/%s/lib ]; then
\n
"
,
platform
);
fprintf
(
fp
,
" mkdir $pwrp_root/bld/%s/lib
\n
"
,
platform
);
fprintf
(
fp
,
"fi
\n
"
);
fprintf
(
fp
,
"if [ ! -e $pwrp_root/bld/%s/lis ]; then
\n
"
,
platform
);
fprintf
(
fp
,
" mkdir $pwrp_root/bld/%s/lis
\n
"
,
platform
);
fprintf
(
fp
,
"fi
\n
"
);
fprintf
(
fp
,
"if [ ! -e $pwrp_root/bld/%s/exe ]; then
\n
"
,
platform
);
fprintf
(
fp
,
" mkdir $pwrp_root/bld/%s/exe
\n
"
,
platform
);
fprintf
(
fp
,
"fi
\n
"
);
fprintf
(
fp
,
"export pwrp_obj=$pwrp_root/bld/%s/obj
\n
"
,
platform
);
fprintf
(
fp
,
"export pwrp_lib=$pwrp_root/bld/%s/lib
\n
"
,
platform
);
fprintf
(
fp
,
"export pwrp_lis=$pwrp_root/bld/%s/lis
\n
"
,
platform
);
fprintf
(
fp
,
"export pwrp_exe=$pwrp_root/bld/%s/exe
\n\n
"
,
platform
);
}
switch
(
opsys
)
{
case
pwr_mOpSys_PPC_LINUX
:
fprintf
(
fp
,
"$pwrb_root/os_linux/hw_ppc/exp/exe/wb_gcg.sh
\"
$1
\"
\"
$2
\"
\"
$3
\"
\"
$OpSys_PPC_LINUX
\"
\"
$5
\"
\"
$6
\"
\"
$7
\"
\"
$8
\"\n
"
);
break
;
case
pwr_mOpSys_X86_LINUX
:
fprintf
(
fp
,
"$pwrb_root/os_linux/hw_x86/exp/exe/wb_gcg.sh
\"
$1
\"
\"
$2
\"
\"
$3
\"
\"
$OpSys_X86_LINUX
\"
\"
$5
\"
\"
$6
\"
\"
$7
\"
\"
$8
\"\n
"
);
break
;
case
pwr_mOpSys_ARM_LINUX
:
fprintf
(
fp
,
"$pwrb_root/os_linux/hw_arm/exp/exe/wb_gcg.sh
\"
$1
\"
\"
$2
\"
\"
$3
\"
\"
$OpSys_ARM_LINUX
\"
\"
$5
\"
\"
$6
\"
\"
$7
\"
\"
$8
\"\n
"
);
break
;
default:
;
}
fclose
(
fp
);
pwr_tCmd
cmd
;
sprintf
(
cmd
,
"chmod a+x %s
\n
"
,
fname
);
system
(
cmd
);
}
}
}
if
(
volumecount
>
0
)
free
(
(
char
*
)
volumelist
);
...
...
wb/lib/wb/src/wb_pkg.cpp
View file @
dba6a80b
...
...
@@ -62,7 +62,7 @@ void wb_pkg::readConfig()
{
char
fname
[
200
];
char
line
[
200
];
char
line_item
[
6
][
80
];
char
line_item
[
7
][
80
];
int
num
;
int
sts
;
...
...
@@ -85,8 +85,9 @@ void wb_pkg::readConfig()
int
bus
;
pwr_tMask
dstatus
;
char
bootnode
[
80
];
pwr_tString80
custom_platform
;
if
(
!
(
num
==
5
||
num
==
6
)
)
if
(
num
!=
7
)
throw
wb_error_str
(
"File corrupt "
load_cNameDistribute
);
sts
=
sscanf
(
line_item
[
2
],
"%d"
,
(
int
*
)
&
opsys
);
...
...
@@ -101,13 +102,11 @@ void wb_pkg::readConfig()
if
(
sts
!=
1
)
throw
wb_error_str
(
"File corrupt "
load_cNameDistribute
);
if
(
num
==
6
)
strcpy
(
bootnode
,
line_item
[
5
]);
else
strcpy
(
bootnode
,
"-"
);
strcpy
(
bootnode
,
line_item
[
5
]);
strcpy
(
custom_platform
,
line_item
[
6
]);
if
(
m_allnodes
)
{
pkg_node
node
(
line_item
[
1
],
opsys
,
bus
,
dstatus
,
bootnode
);
pkg_node
node
(
line_item
[
1
],
opsys
,
bus
,
dstatus
,
bootnode
,
custom_platform
);
m_nodelist
.
push_back
(
node
);
}
else
{
...
...
@@ -119,6 +118,7 @@ void wb_pkg::readConfig()
m_nodelist
[
i
].
setBus
(
bus
);
m_nodelist
[
i
].
setDStatus
(
dstatus
);
m_nodelist
[
i
].
setBootnode
(
bootnode
);
m_nodelist
[
i
].
setCustomPlatform
(
custom_platform
);
m_nodelist
[
i
].
setValid
();
break
;
}
...
...
@@ -179,9 +179,13 @@ void wb_pkg::readConfig()
if
(
plcname
[
0
]
!=
0
)
{
pwr_tFileName
dir
;
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
cdh_OpSysToStr
(
n
.
opsys
()));
if
(
n
.
opsys
()
==
pwr_mOpSys_CustomBuild
&&
strcmp
(
n
.
customPlatform
(),
"-"
)
!=
0
)
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
n
.
customPlatform
());
else
sprintf
(
dir
,
"$pwrp_root/bld/%s/exe/"
,
cdh_OpSysToStr
(
n
.
opsys
()));
sprintf
(
fname
,
"%s%s"
,
dir
,
plcname
);
sprintf
(
dir
,
"$pwrp_
root/%s/exe/"
,
cdh_OpSysToStr
(
n
.
opsys
())
);
sprintf
(
dir
,
"$pwrp_
exe/"
);
pkg_pattern
pplc
(
fname
,
dir
,
'W'
);
n
.
push_back
(
pplc
);
}
...
...
@@ -469,7 +473,7 @@ void pkg_node::fetchFiles( bool distribute)
of <<
"cd $pwrp_load" << endl <<
"ftp -vin " << m_name << " << EOF &>$pwrp_tmp/ftp_" << m_name << ".log" << endl <<
"user
pwrp
pwrp" << endl <<
"user
" << m_user << "
pwrp" << endl <<
"binary" << endl <<
"put " << pkg_name << endl <<
"quit" << endl <<
...
...
@@ -485,12 +489,13 @@ void pkg_node::fetchFiles( bool distribute)
throw
wb_error_str
(
"Unable to open file"
);
ofu
<<
"dir=$HOME"
<<
endl
<<
"cd /tmp"
<<
endl
<<
"echo
\"
-- Unpack package "
<<
pkg_name
<<
"
\"
"
<<
endl
<<
"tar -xzf
/home/pwrp
/"
<<
pkg_name
<<
endl
<<
"tar -xzf
$dir
/"
<<
pkg_name
<<
endl
<<
"echo
\"
-- Move files to target directories
\"
"
<<
endl
<<
"if [ ! -e
/home/pwrp
/.ssh ]; then"
<<
endl
<<
" mkdir
/home/pwrp
/.ssh"
<<
endl
<<
"if [ ! -e
$dir
/.ssh ]; then"
<<
endl
<<
" mkdir
$dir
/.ssh"
<<
endl
<<
"fi"
<<
endl
;
for
(
int
i
=
0
;
i
<
(
int
)
m_filelist
.
size
();
i
++
)
...
...
@@ -504,23 +509,41 @@ void pkg_node::fetchFiles( bool distribute)
// Change owner to root of plc, to make modification of thread prio possible
ofu
<<
"nname=`eval uname -n`"
<<
endl
<<
"tst=`eval sudo -l | grep
\"
ALL
\"
`"
<<
endl
<<
"if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
"if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
"else"
<<
endl
<<
" tst=`eval sudo -l | grep
\"
ALL
\"
`"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown root $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod g+w $pwrp_exe/plc_$nname_*"
<<
endl
<<
" sudo chmod u+s $pwrp_exe/plc_$nname_*"
<<
endl
<<
" fi"
<<
endl
<<
"fi"
<<
endl
;
// Group should not have write access to .rhosts file
ofu
<<
"if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" if [ -e /home/pwrp/.rhosts ]; then"
<<
endl
<<
" sudo chown pwrp /home/pwrp/.rhosts"
<<
endl
<<
" sudo chmod g-w /home/pwrp/.rhosts"
<<
endl
<<
"if [ -e $dir/.rhosts ]; then"
<<
endl
<<
" if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown "
<<
m_user
<<
" $dir/.rhosts"
<<
endl
<<
" chmod g-w $dir/.rhosts"
<<
endl
<<
" else"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown "
<<
m_user
<<
" $dir/.rhosts"
<<
endl
<<
" sudo chmod g-w $dir/.rhosts"
<<
endl
<<
" fi"
<<
endl
<<
" fi"
<<
endl
<<
" if [ -e /home/pwrp/.ssh/authorized_keys ]; then"
<<
endl
<<
" sudo chown pwrp /home/pwrp/.ssh/authorized_keys"
<<
endl
<<
" sudo chmod g-w /home/pwrp/.ssh/authorized_keys"
<<
endl
<<
"fi"
<<
endl
<<
"if [ -e $dir/.ssh/authorized_keys ]; then"
<<
endl
<<
" if [
\"
$USER
\"
==
\"
root
\"
]; then"
<<
endl
<<
" chown "
<<
m_user
<<
" $dir/.ssh/authorized_keys"
<<
endl
<<
" chmod g-w $dir/.ssh/authorized_keys"
<<
endl
<<
" else"
<<
endl
<<
" if [
\"
$tst
\"
!=
\"\"
]; then"
<<
endl
<<
" sudo chown "
<<
m_user
<<
" $dir/.ssh/authorized_keys"
<<
endl
<<
" sudo chmod g-w $dir/.ssh/authorized_keys"
<<
endl
<<
" fi"
<<
endl
<<
" fi"
<<
endl
<<
"fi"
<<
endl
;
...
...
@@ -604,19 +627,19 @@ void pkg_node::copyPackage( char *pkg_name)
of
<<
"cd $pwrp_load"
<<
endl
<<
"ftp -vin "
<<
bootnodes
[
i
]
<<
" << EOF &>$pwrp_tmp/ftp_"
<<
bootnodes
[
i
]
<<
".log"
<<
endl
<<
"user
pwrp
pwrp"
<<
endl
<<
"user
"
<<
m_user
<<
"
pwrp"
<<
endl
<<
"binary"
<<
endl
<<
"put "
<<
pkg_name
<<
endl
<<
"quit"
<<
endl
<<
"EOF"
<<
endl
<<
"rsh -l
pwrp
"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
"rsh -l
"
<<
m_user
<<
"
"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
}
else
{
// Use scp and SSH
of
<<
"cd $pwrp_load"
<<
endl
<<
"scp "
<<
pkg_name
<<
"
pwrp
@"
<<
bootnodes
[
i
]
<<
":"
<<
endl
<<
"ssh
pwrp
@"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
"scp "
<<
pkg_name
<<
"
"
<<
m_user
<<
"
@"
<<
bootnodes
[
i
]
<<
":"
<<
endl
<<
"ssh
"
<<
m_user
<<
"
@"
<<
bootnodes
[
i
]
<<
"
\\
$pwr_exe/pwr_pkg.sh -i "
<<
pkg_name
<<
endl
;
}
of
.
close
();
...
...
wb/lib/wb/src/wb_pkg.h
View file @
dba6a80b
...
...
@@ -115,26 +115,61 @@ class pkg_node {
bool
m_valid
;
int
m_errors
;
int
m_warnings
;
char
m_user
[
80
];
char
m_custom_platform
[
80
];
public:
pkg_node
(
char
*
name
)
:
m_opsys
(
pwr_mOpSys__
),
m_bus
(
0
),
m_dstatus
(
0
),
m_valid
(
false
),
m_errors
(
0
),
m_warnings
(
0
)
{
strcpy
(
m_name
,
name
);
strcpy
(
m_bootnode
,
"-"
);}
{
strncpy
(
m_name
,
name
,
sizeof
(
m_name
));
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
"-"
);
strcpy
(
m_custom_platform
,
"-"
);
}
pkg_node
(
char
*
name
,
pwr_mOpSys
opsys
,
int
bus
,
pwr_tMask
dstatus
,
char
*
bootnode
)
:
pwr_tMask
dstatus
,
char
*
bootnode
,
char
*
custom_platform
)
:
m_opsys
(
opsys
),
m_bus
(
bus
),
m_dstatus
(
dstatus
),
m_valid
(
true
),
m_errors
(
0
),
m_warnings
(
0
)
{
strcpy
(
m_name
,
name
);
strcpy
(
m_bootnode
,
bootnode
);}
{
char
*
s
;
strncpy
(
m_user
,
bootnode
,
sizeof
(
m_user
));
if
(
(
s
=
strchr
(
m_user
,
'@'
)))
{
*
s
=
0
;
strncpy
(
m_bootnode
,
s
+
1
,
sizeof
(
m_bootnode
));
}
else
{
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
bootnode
);
}
strncpy
(
m_name
,
name
,
sizeof
(
m_name
));
strncpy
(
m_custom_platform
,
custom_platform
,
sizeof
(
m_custom_platform
));
}
char
*
name
()
{
return
m_name
;}
pwr_mOpSys
opsys
()
{
return
m_opsys
;}
int
bus
()
{
return
m_bus
;}
pwr_tMask
dstatus
()
{
return
m_dstatus
;}
char
*
bootnode
()
{
return
m_bootnode
;}
char
*
customPlatform
()
{
return
m_custom_platform
;}
bool
valid
()
{
return
m_valid
;}
void
setOpsys
(
pwr_mOpSys
opsys
)
{
m_opsys
=
opsys
;}
void
setBus
(
int
bus
)
{
m_bus
=
bus
;}
void
setDStatus
(
pwr_tMask
dstatus
)
{
m_dstatus
=
dstatus
;}
void
setBootnode
(
char
*
bootnode
)
{
strcpy
(
m_bootnode
,
bootnode
);}
void
setBootnode
(
char
*
bootnode
)
{
char
*
s
;
strncpy
(
m_user
,
bootnode
,
sizeof
(
m_user
));
if
(
(
s
=
strchr
(
m_user
,
'@'
)))
{
*
s
=
0
;
strncpy
(
m_bootnode
,
s
+
1
,
sizeof
(
m_bootnode
));
}
else
{
strcpy
(
m_user
,
"pwrp"
);
strcpy
(
m_bootnode
,
bootnode
);
}
}
void
setCustomPlatform
(
char
*
custom_platform
)
{
strncpy
(
m_custom_platform
,
custom_platform
,
sizeof
(
m_custom_platform
));
}
void
setValid
()
{
m_valid
=
true
;}
void
push_back
(
pkg_pattern
&
pattern
)
{
pattern
.
node
(
this
);
...
...
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