免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: liang1132
打印 上一主题 下一主题

Linux 移植1 [复制链接]

论坛徽章:
0
11 [报告]
发表于 2011-11-09 17:22 |只看该作者
性能问题。一次IPC,两次系统调用,两次数据copy
共享内存方案
消息接收过程
        消息分为
        消息数据
        消息通知
        发送方
        从共享内存区分配内存,并填写数据
        通过socket通知接收方
        接收方
        接收方在接收socket上阻塞
        消息到达,解除阻塞,并通过通知消息中偏置,找到消息数据
共享内存缺点
        需要维护多个实例访问的并发/同步
        共享数据区将隔离的进程建立了联系,一旦共享内存管理出现问题,所有与之相关的进程都将受到影响
        共享内存区需在系统初始化时申请,动态性较差
        通讯app崩溃,共享内存区管理者需要回收资源,否则会有资源泄漏甚至挂死

Read me
#if(VOS_OS_VER == VOS_VXWORKS) //SMP_LINUX_TMP

编译步骤

1.平铺平台(rosarb)对外头文件
cd RB27C01/script/makeexe
./linux_rbpre.sh

Pre命令就是把平台对外头文件平铺,所谓“平铺”就是把platform\rosarb\module各个组件的include目录下的对外头文件统一拷贝到platform\rosarb\target\include目录下,无组件子目录,所有头文件都在一个目录下。这样做是为了减少编译过程中的搜索路

论坛徽章:
0
12 [报告]
发表于 2011-11-09 17:24 |只看该作者
径数以减少命令行buffer的占用,winxp下限制为1K。另外对外头文件发布也不区分组件,也减少产品工程的命令行buffer负担。

2. 编译平台和产品库
./linux_comprbom.sh
OUTPUT:
RB库:platform/rosarb/target/lib
产品库:nodeb/makelib/lib




3. 做RosaTailor
主CPU:   linux_rosatailor.bat mptg
从CPU:   linux_rosatailor.bat mptg_c10

由于RosaTailor是用C#写的工具,没有linux下的版本,这一步要先在windows下做。
可以通过在windows下映射驱动器的方式。
RosaTailor 的INPUT是platfrom\rosarb\target\config\, 源头是ROSA和NODEB的CONFIG目录下的文件,
OUTPUT是platform\dopra\target\config
这一步的输出是platform\dopra\target\config\rosa\下3个文件rosa.ini,rosa_symbols.c,v_configrosa.c

4.做vos.o
主CPU: ./linux_makeconfig.sh mptg
从CPU: ./linux_makeconfig.sh mptg_c10

用dopra/target/config/*/v_config*.c生成dopra/target/project/wrlinux_40_armarch6/v_config*.o
然后 ar rc libdoprasrc.a  v_config*.o
cp libdoprasrc.a ../vos.o

OUTPUT:
nodeb\rosarb2pdt\wrlinux\mptg\vos.o
nodeb\rosarb2pdt\wrlinux\mptg_c10\vos.o

5.做libdopra.a
主CPU: ./linux_makedopralib.sh mptg
从CPU: ./linux_makedopralib.sh mptg_c10

OUTPUT:
nodeb\rosarb2pdt\wrlinux\mptg\libdopra.a
nodeb\rosarb2pdt\wrlinux\mptg_c10\libdopra.a

6.做librosa.a和rosa.o
主CPU: ./linux_makerosalib.sh mptg
从CPU: ./linux_makerosalib.sh mptg_c10

OUTPUT:
nodeb\rosarb2pdt\wrlinux\mptg\librosa.a
nodeb\rosarb2pdt\wrlinux\mptg\rosa.o
nodeb\rosarb2pdt\wrlinux\mptg_c10\librosa.a
nodeb\rosarb2pdt\wrlinux\mptg_c10\rosa.o

7.做app.out
主CPU: ./linux_makeapplib.sh mptg
从CPU: ./linux_makeapplib.sh mptg_c10

OUTPUT:
nodeb\rosarb2pdt\wrlinux\mptg\app.out
nodeb\rosarb2pdt\wrlinux\mptg_c10\app.out


linux_rbpre.sh
# Description   : copy all module's config and include files to rosarb\target\
echo =============  rbpre.sh start ... =============

PLATFORM_BASE=$WORK_BASE/platform

ROSA_BASE=$PLATFORM_BASE/rosarb
THIRDPART_BASE=$PLATFORM/thirdpart       

ROSA_ALL_LIBS="fcm swmrb devrb clkrb adarb bin cfg dbg efd evt expt flt idcs log pfm ml mm mml mtn ncm rre sec trc utl lcnrb trrb time tst q922 hdlc cpricbb ha ald bbutop"

if [[ -e $ROSA_BASE/target/include ]]
then
    rm -f $ROSA_BASE/target/include/*
fi

for a in $ROSA_ALL_LIBS
do
    cp -dpr  $ROSA_BASE/module/$a/include/* $ROSA_BASE/target/include/
done

论坛徽章:
0
13 [报告]
发表于 2011-11-09 17:24 |只看该作者
cp -f $ROSA_BASE/module/clkrb/include/ext/std_stub.h  $ROSA_BASE/target/include/std_stub.h
cp -f $ROSA_BASE/module/utl/include/memzip/*  $ROSA_BASE/target/include/
cp -f $ROSA_BASE/module/lcnrb/include/alm/dopra_adapter.h  $ROSA_BASE/target/include/dopra_adapter.h  
rm -rf $ROSA_BASE/target/include/ext
rm -rf $ROSA_BASE/target/include/memzip
rm -rf $ROSA_BASE/target/include/alm

echo "rb pre succ `date` `time`"
echo =============  rbpre.sh end ... =============


linux_comprbom.sh
# !/bin/bash
#*****************************************************************************
#
# Copyright (C), 2004-2011, Huawei Tech. Co., Ltd.
#
#****************************************************************************
# File Name     : linux_comprbom.sh
# Version       : Initial Draft
# Author        : baichaofeng 00164952
# Created       : 2011/06/30
# Last Modified :
# Description   : Compiler ROSA-RB and UOM library
# Modify History:
# 1.Date        :
#   Author      :
#   Modification:
#
##############################################################################       
echo =============  comprbom.sh start ... =============

COMPILER_WORK_ROOT=$WORK_BASE
COMPILER_RB_ROOT=$COMPILER_WORK_ROOT/platform/rosarb/target
COMPILER_RB_LIBPROJECT=$COMPILER_RB_ROOT/libproject/wrlinux_40_armarch6
COMPILER_RB_LIB=$COMPILER_RB_ROOT/lib/wrlinux_40_armarch6

COMPILER_NODEB_ROOT=$COMPILER_WORK_ROOT/nodeb/makelib
COMPILER_NODEB_LIBPROJECT=$COMPILER_NODEB_ROOT/libproject/mptg
COMPILER_NODEB_LIB=$COMPILER_NODEB_ROOT/lib/mptg

rm -f $COMPILER_RB_LIBPROJECT/release/*.o
rm -f $COMPILER_NODEB_LIBPROJECT/release/*.o

rm -f $COMPILER_RB_LIB/*.a
rm -f $COMPILER_NODEB_LIB/*.a

# begin to compiler RB Lib
cd $COMPILER_RB_LIBPROJECT

./makelib release gnu fcm
./makelib release gnu swmrb
./makelib release gnu devrb
./makelib release gnu clkrb
./makelib release gnu adarb
./makelib release gnu bin
./makelib release gnu cfg
./makelib release gnu dbg
./makelib release gnu efd
./makelib release gnu evt
./makelib release gnu expt
./makelib release gnu flt
./makelib release gnu idcs
./makelib release gnu log
./makelib release gnu pfm
./makelib release gnu ml
./makelib release gnu mml
./makelib release gnu mtn
./makelib release gnu ncm
./makelib release gnu rre
./makelib release gnu sec
./makelib release gnu trc
./makelib release gnu utl
./makelib release gnu lcnrb
./makelib release gnu trrb
./makelib release gnu time
./makelib release gnu tst
./makelib release gnu q922
./makelib release gnu ha
./makelib release gnu ald
./makelib release gnu cpricbb
./makelib release gnu hdlc
./makelib release gnu bbutop
./makelib release gnu mm

论坛徽章:
0
14 [报告]
发表于 2011-11-09 17:25 |只看该作者
# begin to compile nodeb lib
cd $COMPILER_NODEB_LIBPROJECT

./makelib release gnu uom
./makelib release gnu utr
./makelib release gnu utst

echo "\n"
echo "\n"
echo "\n"
echo "\n"
echo "*******WARNING: The following lib was compiler error\n"
if [[ ! -e "$COMPILER_RB_LIB/adarbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***adarb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/aldwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***ald*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/bbutopwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***bbutop*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/binwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***bin*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/cfgwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***cfg*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/clkrbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***clkrb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/cpricbbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***cpricbb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/dbgwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***dbg*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/devrbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***devrb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/efdwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***cfd*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/evtwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***evt*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/exptwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***expt*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/fcmwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***fcm*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/fltwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***flt*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/hawrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***ha*** compiler error\n"
fi

论坛徽章:
0
15 [报告]
发表于 2011-11-09 17:26 |只看该作者
if [[ ! -e "$COMPILER_RB_LIB/hdlcwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***hdlc*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/idcswrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***idcs*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/logwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***log*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/lcnrbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***lcnrb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/mlwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***ml*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/mmlwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***mml*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/mmwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***mm*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/mtnwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***mtn*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/ncmwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***ncm*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/pfmwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***pfm*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/q922wrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***q922*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/rrewrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***rre*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/secwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***sec*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/swmrbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***swm*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/timewrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***time*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/trcwrlinuxarmarch6gnur.a" ]]

then
    echo "RB module ***trc*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/trrbwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***trrb*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/tstwrlinuxarmarch6gnur.a" ]]
then

论坛徽章:
0
16 [报告]
发表于 2011-11-09 17:27 |只看该作者
echo "RB module ***tst*** compiler error\n"
fi

if [[ ! -e "$COMPILER_RB_LIB/utlwrlinuxarmarch6gnur.a" ]]
then
    echo "RB module ***utl*** compiler error\n"
fi


if [[ ! -e "$COMPILER_NODEB_LIB/uommptgwrlinux40.a" ]]
then
    echo "NODEB module ***uom*** compiler error\n"
fi

if [[ ! -e "$COMPILER_NODEB_LIB/utrmptgwrlinux40.a" ]]
then
    echo "NODEB module ***utr*** compiler error\n"
fi
if [[ ! -e "$COMPILER_NODEB_LIB/utstmptgwrlinux40.a" ]]
then
    echo "NODEB module ***utst*** compiler error\n"
fi



#        -copy /y $(PRODUCT_BASE)\makelib\module\pfm_$(PRODUCT)\pfm_mtdef.h $(PRODUCT_BASE)\makelib\module\uom\include\pfm_mtdef.h
#        -copy /y $(PRODUCT_BASE)\makelib\module\pfm_$(PRODUCT)\ULpfm_BaseMapTable.c $(PRODUCT_BASE)\makelib\module\uom\src\pfm\src\lpfm\ULpfm_BaseMapTable.c
#        -copy /y $(PRODUCT_BASE)\makelib\module\pfm_$(PRODUCT)\ULpfm_BeforeStatMapTable.c $(PRODUCT_BASE)\makelib\module\uom\src\pfm\src\lpfm\ULpfm_BeforeStatMapTable.c
#        -copy /y $(DOPRA_BASE)\target\config\v_id.compile  $(DOPRA_BASE)\target\config\v_id.h
#        -copy /y $(DOPRA_BASE)\target\config\v_iddef.compile  $(DOPRA_BASE)\target\config\v_iddef.h
#        -del /q $(PRODUCT_BASE)\makelib\lib\$(board)\$(module)*.a
#        call $(PRODUCT_BASE)\makelib\libproject\$(board)\makelib.bat release gnu $(module) $(dbflag)               


makelib.sh
# !/bin/bash
#*****************************************************************************
#
# Copyright (C), 2004-2011, Huawei Tech. Co., Ltd.
#
#****************************************************************************
# File Name     : makelib
# Version       : Initial Draft
# Author        :
# Created       : 2005/09/09
# Last Modified :
# Description   : build package for DOPRA
# History       :
# 1.Date        : 2005/09/09
#   Author      :
#   Modification:
#
# 2.Date        : 2011/06/13
#   Author      : baichaofeng
#   Modification: modified to support linux on MPTG
#
##############################################################################

usage() {
    echo "------------------------------------------------------------------------"
    echo "-                  Rosarb library(s) building script                   -"
    echo "------------------------------------------------------------------------"
    echo "   Usage: makelib for different platforms                               "
    echo "  Format: makelib version compiler [target] [option]                    "
    echo " version: debug, release, mini, all, cleanall, cleanxxx, cleanlibxxx    "
    echo "                 clean: cleans obj files in all versions                "
    echo "            cleanlibs : cleans lib files in all versions                "
    echo "             cleanall : cleans obj and lib files in all versions        "
    echo "             cleanxxx : cleans all objs in xxx version                  "
    echo "          cleanlibxxx : cleans all libs in xxx version                  "
    echo " compiler: gnu,diab

论坛徽章:
0
17 [报告]
发表于 2011-11-09 17:28 |只看该作者
echo " target: ssp,individual libs                                            "
    echo "         individual libs :  fcm swmrb devrb etc..                       "
    echo "         ssp : compiles all ssp libs.                                   "
    echo "                                                                        "
    echo "  Note  :                                                               "
    echo "    1. If no value is entered for "target", default option will compile "
    echo "             complete ssp libs                                          "  
    echo "------------------------------------------------------------------------"
}

#rem variable setting:
#rem SUPPORT_COMPILE_VERSION for compile version of ROSARB
#rem ROSA_LIBS for all lib's names of ROSA

#set SUPPORT_COMPILE_VERSION=debug release mini all
#set ROSA_LIBS=fcm swmrb devrb clkrb adarb bin cfg dbg efd evt expt flt idcs log pfm ml mm mml mtn ncm rre sec trc utl lcnrb trrb time tst q922 ha ald cpricbb hdlc bbutop
#set CLEAN_VERSION=cleandebug cleanrelease cleanmini cleanall cleanlibdebug cleanlibrelease cleanlibmini clean
#set COMPILER_TOOL=gnu

export LD_LIBRARY_PATH=/usr/local/libLD_LIBRARY_PATH
export PATH=$PATH:/usgp/mptg/toolchain-be8/bin

declare -a SUPPORT_COMPILE_VERSION=("debug" "release" "mini" "all"
declare -a CLEAN_VERSION=("cleandebug" "cleanrelease" "cleanmini" "cleanall" "cleanlibdebug" "cleanlibrelease" "cleanlibmini" "clean"
declare -a ROSA_LIBS=("fcm" "swmrb" "devrb" "clkrb" "adarb" "bin" "cfg" "dbg" "efd" "evt" "expt" "flt" "idcs" "log" "pfm" "ml" "mm" "mml" "mtn" "ncm" "rre" "sec" "trc" "utl" "lcnrb" "trrb" "time" "tst" "q922" "ha" "ald" "cpricbb" "hdlc" "bbutop"
declare -a COMPILER_TOOL="gnu"
declare -a SELECTED_VERSION=""
COMPILE_LIBS=""

#
# If the user input not enough parameters, print usage message and
# exit immediately
#
if [ $# -lt 1 -o $# -gt 4 ] ; then
    usage
    exit 1
fi

#
# validating version parameter
#
for (( i = 0; i < ${#SUPPORT_COMPILE_VERSION[@]}; i++ )); do
    if [ "$1" = ${SUPPORT_COMPILE_VERSION[i]} ] ; then
        if [ "$1" = "all" ] ; then
            SELECTED_VERSION=("debug" "release" "mini"
        else
            SELECTED_VERSION=("$1"
        fi
    fi  
done

if [ "$SELECTED_VERSION"  = "" ] ; then
   for (( i = 0; i < ${#CLEAN_VERSION[@]}; i++ )); do
       if [ "$1" = ${CLEAN_VERSION[i]} ] ; then
           SELECTED_VERSION=("$1"
       fi
   done
fi

if [ "$SELECTED_VERSION"  = "" ] ; then
    echo "ERROR:  invalid patameter - first Para"
    usage
    exit 1
fi

if [ $# -gt 2 -o $# -lt 4  ] ; then
    if [ "$2" = "gnu" ] ; then
        COMPILER_TOOL="gnu"
    else
        if [ "$2" = "diab" ] ; then
            COMPILER_TOOL="diab"
        else
            echo "Warning: second para invaild,please select gnu or diab as compiler tool .."
            echo "         use gnu as the default compiler tool..."
            COMPILER_TOOL="gnu"
        fi
    fi

论坛徽章:
0
18 [报告]
发表于 2011-11-09 17:28 |只看该作者
fi

if [ $# -gt 3 -o $# -lt 4  ] ; then
    if [ "$3" = "all" ] ; then
                COMPILE_LIBS=$ROSA_LIBS
        else       
                for (( i = 0; i < ${#ROSA_LIBS[@]}; i++ )); do
            if [ "$3" = ${ROSA_LIBS[i]} ] ; then
                COMPILE_LIBS=("$3")
            fi  
        done
    fi
    if [ $COMPILE_LIBS  = "" ] ; then
        echo "ERROR:  invalid patameter-second Para"
        usage
        exit 1
    fi
else
    echo Warning: third para invaild,please select gnu or diab as compiler tool ..
    echo          use all rosa libs as the default target compiler libs...   
    COMPILE_LIBS=$ROSA_LIBS
fi


echo "Set all environment variable ok!"
echo "-----------------------Begin Compile ROSA LIBS----------------------"
#echo.
#echo Compile ROSARB OS Version: linux
#echo Compile ROSARB Version(s): %SELECTED_VERSION%
#echo   Compile ROSARB CPU Type: armarch6
#echo Compile ROSARB components: %COMPILE_LIBS%
#echo.

#
# Loop all version(s) and all package(s) to build specified library(s)
#
for((j = 0; j < ${#COMPILE_LIBS[@]}; j++ )) ; do
   
    for((i = 0; i < ${#SELECTED_VERSION[@]}; i++ )); do
        echo "Compilation of ${SELECTED_VERSION[i]} ${COMPILE_LIBS[i]} lib started------------------------"
        make -f ./makefile COMPILER_CURRENTLIB=${COMPILE_LIBS[j]} ${SELECTED_VERSION[i]} MAKEAPP_TOOL_FAMLIY=$COMPILER_TOOL
#        make COMPILER_CURRENTLIB) ${SELECTED_VERSION[i]}
        echo "Compilation of ${SELECTED_VERSION[i]} ${COMPILE_LIBS[i]} lib done---------------------------"
    done
done   

echo "-----------------------Ended Compile ROSARB LIBS----------------------"

#                                  - End Of File-

论坛徽章:
1
15-16赛季CBA联赛之深圳
日期:2018-12-11 08:52:00
19 [报告]
发表于 2011-11-16 22:18 |只看该作者
赞!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP