a20编译
㈠ 编译a20 lunch后面应该选择哪个
Android的优势就在于其开源,手机和平板生产商可以根据自己的硬件进行个性定制自己的手机产品,
如小米,LePhone,M9等,因此,在我们在对Android的源码进行定制的时候,很有必要了解下,Android的编译过程。
如果你从来没有做过Android代码的编译,那么最官方的编译过程就是查看Android的官方网站:
http://source.android.com/source/building.html
但是,这儿只是告诉你了如何去编译一个通用的系统,并没有详细告诉你细节,我们跟着编译过程来了解下
+-------------------------------------------------------------------------------------------------------------+
 本文使用Android版本为2.1,采用开发板为华清远见研发的FS_S5PC100 A8开发板。
+-------------------------------------------------------------------------------------------------------------+
按照google给出的编译步骤如下:
1> source build/envsetup.sh:加载命令
   2> lunch:选择平台编译选项
   3> make:执行编译
我们按照编译步骤来分析编译过程的细节,最终添加自己的平台编译选项。
1. source build/envsetup.sh     
这个命令是用来将envsetup.sh里的所有用到的命令加载到环境变量里去,我们来分析下它。
envsetup.sh里的主要命令如下:
 
function help() # 显示帮助信息
function get_abs_build_var()# 获取绝对变量
function get_build_var()# 获取绝对变量
function check_proct()# 检查proct
function check_variant()# 检查变量
function setpaths() # 设置文件路径
function printconfig()# 打印配置
function set_stuff_for_environment()  # 设置环境变量
function set_sequence_number()    # 设置序号
function settitle() # 设置标题
function choosetype() # 设置type
function chooseproct()  # 设置proct
function choosevariant()  # 设置variant
function tapas()  # 功能同choosecombo
function choosecombo()  # 设置编译参数
function add_lunch_combo()  # 添加lunch项目
function print_lunch_menu() # 打印lunch列表
function lunch()# 配置lunch
function m()# make from top
function findmakefile() # 查找makefile
function mm() # make from current directory
function mmm()  # make the supplied directories
function croot()# 回到根目录
function cproj()
function pid()
function systemstack()
function gdbclient()
function jgrep()# 查找java文件
function cgrep()  # 查找c/cpp文件
function resgrep()
function tracedmmp()
function runhat()
function getbugreports()
function startviewserver()
function stopviewserver()
function isviewserverstarted()
function smoketest()
function runtest()
function godir () # 跳到指定目录 405
# add_lunch_combo函数被多次调用,就是它来添加Android编译选项
 # Clear this variable.  It will be built up again when the vendorsetup.sh
 406 # files are included at the end of this file.
 # 清空LUNCH_MENU_CHOICES变量,用来存在编译选项
 407 unset LUNCH_MENU_CHOICES
 408 function add_lunch_combo()  
 409 {
 410     local new_combo=$1         # 获得add_lunch_combo被调用时的参数
 411     local c  # 依次遍历LUNCH_MENU_CHOICES里的值,其实该函数第一次调用时,该值为空
 412     for c in ${LUNCH_MENU_CHOICES[@]} ; do
 413         if [ "$new_combo" = "$c" ] ; then    # 如果参数里的值已经存在于LUNCH_MENU_CHOICES变量里,则返回
 414             return
 415         fi
 416     done  # 如果参数的值不存在,则添加到LUNCH_MENU_CHOICES变量里
 417     LUNCH_MENU_CHOICES=(${LUNCH_MENU_CHOICES[@]} $new_combo)
 418 }
# 这是系统自动增加了一个默认的编译项 generic-eng
 420 # add the default one here
 421 add_lunch_combo generic-eng    # 调用上面的add_lunch_combo函数,将generic-eng作为参数传递过去
 422
 423 # if we're on linux, add the simulator.  There is a special case
 424 # in lunch to deal with the simulator
 425 if [ "$(uname)" = "Linux" ] ; then
 426     add_lunch_combo simulator
 427 fi
# 下面的代码很重要,它要从vendor目录下查找vendorsetup.sh文件,如果查到了,就加载它
1037 # Execute the contents of any vendorsetup.sh files we can find.
1038 for f in `/bin/ls vendorbuild/vendorsetup.sh 2> /dev/null`
1039 do
1040     echo "including $f"
1041    . $f       # 执行找到的脚本,其实里面就是厂商自己定义的编译选项
1042 done
1043 unset f
envsetup.sh其主要作用如下:
1. 加载了编译时使用到的函数命令,如:help,lunch,m,mm,mmm等
2. 添加了两个编译选项:generic-eng和simulator,这两个选项是系统默认选项
3. 查找vendor/<-厂商目录>/和vendor/<厂商目录>/build/目录下的vendorsetup.sh,如果存在的话,加载执行它,添加厂商自己定义产品的编译选项
其实,上述第3条是向编译系统添加了厂商自己定义产品的编译选项,里面的代码就是:add_lunch_combo xxx-xxx。
根据上面的内容,可以推测出,如果要想定义自己的产品编译项,简单的办法是直接在envsetup.sh最后,
添加上add_lunch_combo myProct-eng,当然这么做,不太符合上面代码最后的本意,
我们还是老实的在vendor目录下创建自己公司名字,然后在公司目录下创建一个新的vendorsetup.sh,在里面添加上自己的产品编译项
#mkdir vendor/farsight/
#touch vendor/farsight/vendorsetup.sh
#echo "add_lunch_combo fs100-eng" > vendor/farsight/vendorsetup.sh
这样,当我们在执行source build/envsetup.sh命令的时候,可以在shell上看到下面的信息:
including vendor/farsight/vendorsetup.sh
2. 按照android官网的步骤,开始执行lunch full-eng
当然如果你按上述命令执行,它编译的还是通用的eng版本系统,不是我们个性系统,我们可以执行lunch命令,它会打印出一个选择菜单,列出可用的编译选项
如果你按照第一步中添加了vendorsetup.sh那么,你的选项中会出现:
You're building on Linux
 
generic-eng simulator fs100-eng
Lunch menu... pick a combo:
     1. generic-eng
     2. simulator
     3. fs100-eng
其中第3项是我们自己添加的编译项。
lunch命令是envsetup.sh里定义的一个命令,用来让用户选择编译项,来定义Proct和编译过程中用到的全局变量。
我们一直没有说明前面的fs100-eng是什么意思,现在来说明下,fs100是我定义的产品的名字,eng是产品的编译类型,除了eng外,还有user, userdebug,分别表示:
eng: 工程机,
user:最终用户机
userdebug:调试测试机
tests:测试机
由此可见,除了eng和user外,另外两个一般不能交给最终用户的,记得m8出来的时候,先放出了一部分eng工程机,然后出来了user机之后,可以用工程机换。
那么这四个类型是干什么用的呢?其实,在main.mk里有说明,在Android的源码里,每一个目标(也可以看成工程)目录都有一个Android.mk的makefile,每个目标的Android.mk中有一个类型声明:
LOCAL_MODULE_TAGS,这个TAGS就是用来指定,当前的目标编译完了属于哪个分类里。
 PS:Android.mk和Linux里的makefile不太一样,它是Android编译系统自己定义的一个makefile来方便编译成:c,c++的动态、静态库或可执行程序,或java库或android的程序,好了,我们来分析下lunch命令干了什么?
function lunch()
{
    local answer
if [ "$1" ] ; then
       # lunch后面直接带参数
        answer=$1
    else
       # lunch后面不带参数,则打印处所有的target proct和variant菜单提供用户选择
        print_lunch_menu  
        echo -n "Which would you like? [generic-eng] "
        read answer
    fi
local selection=
    if [ -z "$answer" ]
    then
           # 如果用户在菜单中没有选择,直接回车,则为系统缺省的generic-eng
        selection=generic-eng
    elif [ "$answer" = "simulator" ]
    then
        # 如果是模拟器
        selection=simulator
    elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
    then
        # 如果answer是选择菜单的数字,则获取该数字对应的字符串
        if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
        then
            selection=${LUNCH_MENU_CHOICES[$(($answer-$_arrayoffset))]}
        fi
        # 如果 answer字符串匹配 *-*模式(*的开头不能为-)
    elif (echo -n $answer | grep -q -e "^[^\-][^\-]*-[^\-][^\-]*$")
    then
        selection=$answer
    fi
if [ -z "$selection" ]
    then
        echo
        echo "Invalid lunch combo: $answer"
        return 1
    fi
# special case the simulator
    if [ "$selection" = "simulator" ]
    then
        # 模拟器模式
        export TARGET_PRODUCT=sim
        export TARGET_BUILD_VARIANT=eng
        export TARGET_SIMULATOR=true
        export TARGET_BUILD_TYPE=debug
    else
# 将 proct-variant模式中的proct分离出来
        local proct=$(echo -n $selection | sed -e "s/-.*$//")
        # 检查之,调用关系 check_proct()->get_build_var()->build/core/config.mk比较罗嗦,不展开了
        check_proct $proct
        if [ $? -ne 0 ]
        then
            echo
            echo "** Don't have a proct spec for: '$proct'"
            echo "** Do you have the right repo manifest?"
            proct=
        fi
        # 将 proct-variant模式中的variant分离出来
        local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
# 检查之,看看是否在 (user userdebug eng) 范围内
        check_variant $variant
        if [ $? -ne 0 ]
        then
            echo
            echo "** Invalid variant: '$variant'"
            echo "** Must be one of ${VARIANT_CHOICES[@]}"
            variant=
        fi
if [ -z "$proct" -o -z "$variant" ]
        then
            echo
            return 1
        fi
 #  导出环境变量,这里很重要,因为后面的编译系统都是依赖于这里定义的几个变量的
        export TARGET_PRODUCT=$proct
        export TARGET_BUILD_VARIANT=$variant
        export TARGET_SIMULATOR=false
        export TARGET_BUILD_TYPE=release
    fi # !simulator
echo
# 设置到环境变量,比较多,不再一一列出,最简单的方法 set >env.txt 可获得
    set_stuff_for_environment
    # 打印一些主要的变量, 调用关系 printconfig()->get_build_var()->build/core/config.mk-
>build/core/envsetup.mk 比较罗嗦,不展开了
    printconfig
}
由上面分析可知,lunch命令可以带参数和不带参数,最终导出一些重要的环境变量,从而影响编译系统的编译结果。导出的变量如下(以实际运行情况为例)
TARGET_PRODUCT=fs100
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=false
TARGET_BUILD_TYPE=release
执行完上述两个步骤,就该执行:make命令了
㈡ ftd232H驱动在linux平台(CPU全志A20)上的安装问题
一、编译过程是不需要动态库文件参与的。
二、试着放到同目录下运行一次,如果还是同样的错误,说明库文件的版本不兼容。虽然名字是对的。
㈢ 全志A20 怎么单独编译boot
索了一下fastboot,但是烧录失败,提示找不到分区。于是就想到用TF卡烧录boot.img,因为只修改了内核,不想打包全部烧录一遍。
     启动到uboot命令行,输入mmcinfo初始化mmc,不过提示:No MMC avaliable什么的,查找uboot源代码,发现,
u-boot/arch/arm/lib/board.c里面,
    if(!storage_type){
        puts("NAND:  ");
        nand_init();        /* Go init the NAND */
    }
    else{
        puts("MMC:   ");
        mmc_initialize(bd);
    }
     红色代码地方表明,uboot命令行只支持NAND或者MMC中的一种,这没有道理啊。于是去掉else,无论什么情况下都初始化MMC。也就是修改为:
    if(!storage_type){
        puts("NAND:  ");
        nand_init();        /* go init the NAND */
㈣ 汇编:这几句代码怎么不能编译
INLCUDE Irvine32.inc
:
INCLUDE Irvine32.inc
㈤ android编译求助
1、安装 JDK
2、安装编译所需包
$sudo apt-get update
$sudo apt-get upgrade
$sudo apt-get install build-essential u-boot-tools uboot-mkimage binutils-arm-linux-gnueabihf
$sudo apt-get install gcc g++ gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf g++-multilib
$sudo apt-get install cpp-arm-linux-gnueabihf libusb-1.0-0 libusb-1.0-0-dev wget fakeroot 
$sudo apt-get install kernel-package zlib1g-dev libncurses5-dev build-essential
$sudo apt-get install texinfo texlive ccache zlib1g-dev gawk bison flex gettext uuid-dev
$sudo apt-get install ia32-libs git gnupg flex bison gperf build-essential zip
$sudo apt-get install curl libc6-dev x11proto-core-dev libx11-dev:i386 lib32ncurses5-dev
$sudo apt-get install libreadline6-dev:i386 mingw32 tofrodos python-markdown 
$sudo apt-get install libxml2-utils xsltproc zlib1g-dev:i386  libgl1-mesa-dev
3、下载 Android 源码包并解压,两个文件:
a20-android4.2_lichee.tar.gz
a20-android4.2_android.tar.gz
4、编译:
lichee编译通过,在编译android时:
source build/envsetup.sh 
lunch  
选择的是 sugar_cubietruck-eng
extract-bsp
make -j8
㈥ 全志R18开发板是安卓手机的接口吗
全志R18开发板这个不清楚,之前订货时听佩特电子科技说是安卓手机接口。
㈦ 嵌入式开发,选择编译器问题。
linux嵌入式系统的开发的应用资料,交叉编译器等等,这方面的资料, 到“工搜网资料文库”索取吧。那里有详细的资料
㈧ 灵动a20启动器怎么启动
,boot1,u-boot,boot0与boot1源码在lichee/boot/目录下,   机器上电执行boot0,boot0
A20启动代码流程分析:
1:全志的启动包括boot0,boot1,u-boot,boot0与boot1源码在lichee/boot/目录下,
   机器上电执行boot0,boot0就会引导boot1,boot1再引导u-boot。
2:在lichee/boot/目录下的Makefile文件指定了boot1的编译目录,例如
        make -f make_sdmmc  -C boot1/core -j8命令就是调用lichee/boot/boot1/core目录下make_sdmmc脚本编译,
        make_sdmmc最终又调用make.cfg脚本编译,所以lichee/boot/目录下的Makefile文件指定的编译路径最终都会
        调用各自目录下的make.cfg来编译。
3:使用make_nand与make_sdmmc脚本是core目录生成的boot1_nand.bin与boot1_sdcard.bin,同时在
        lichee/boot/workspace/egon/与lichee/tools/pack/chips/sun7i/eGon/目录生成,他们分别调用
        lichee/boot/boot1/driver/drv_nand/与lichee/boot/boot1/driver/drv_sd/目录下的文件;
        boot1_nand.bin与boot1_sdcard.bin分别对应启动模式:nandflash与inand启动,配置文件是在
        lichee/boot/pack/chips/sun7i/configs/android/目录下相应的文件指定,其中storage_type字段指定,
        2为inand启动,—1为nandflash启动;Boot_Android是正常启动模式,Boot_Burn是调试模式,Card_Android
        是升级模式,他们分别生成boot.axf,prvt.axf与sprite.axf镜像,同时在
        lichee/boot/workspace/wboot/bootfs/与lichee/tools/pack/chips/sun7i/wboot/bootfs/目录生成;
        lichee/boot/boot1/driver/drv_de/目录是多媒体库源码,是Lcd与HDMI等显示源码,同时在
        lichee/boot/workspace/wboot/bootfs/与lichee/tools/pack/chips/sun7i/wboot/bootfs/目录生成
        drv_de.drv镜像。
4:arm_start.S(boot1/core/arm_board)->eGon2_swi_handler->eGon2_swi_handler_entry->eGon2_init->
         eGon2_start->eGon2_storage_type_set(判断启动模式,加载boot.axf或者sprite.axf),eGon2_run_app->
         FS_fread(加载.axf文件),elf_loader[*entry = (__u32)priv->main;],func(argc, argv)[该函数就是
         BootMain()的指针]->BootMain。
         (1)正常启动模式:
                 BootMain->BoardInit_Display[加载drv_de.drv,判断显示模式,LCD,TV,HDMI等],check_power_status[
                 检测电压与电池状态,判断是否开机],BootOS_detect_os_type[加载u-boot.bin,PreBootOS->
                 boot_dsipatch_kernal[设置u-boot的物理地址是*kernal_addr = 0x4a000000]->wBoot_fopen("c:\\linux\\u-boot.bin", "rb")],
                 BootOS[wBoot_jump_to_linux->EGON2_SWI_JUMP_TO_LINUX->eGon2_jump_to_android_linux直接进入u-boot
                 接口]。
         (2)升级模式:
           BootMain->boot_ui_init[加载drv_de.drv,判断显示模式,LCD,TV,HDMI等],card_sprite->
           update_flash_hardware_scan[扫描当前存储设备是nand还是inand,update_boot0,update_boot1,
           根据sprite_type判断升级nand还是inand]。
5:(1)lichee/tools/pack/pack脚本打包镜像文件。
         (2)编译kernel的时候首调用./build.sh -p sun7i_android->buildroot/scripts/common.sh->
                         lichee/linux-3.3/build.sh->lichee/buildroot/scripts/build_sun7i_android.sh编译。
                         在编译kernel的时候也编译也u-boot,调用./build.sh -p sun7i_android->buildroot/scripts/common.sh->
                         lichee/u-boot/build.sh编译。
6:lichee/boot/pack/chips/sun7i/wboot/bootfs.ini或lichee/tools/pack/chips/sun7i/wboot/bootfs.ini
                把文件系统盘符映射成C盘,就是代码中使用的c:\\boot.ini","c:\\sprite.axf"等。
                lichee/tools/pack/chips/sun7i/configs/android/default/下有env.cfg与image.cfg配置文件,
                env.cfg是u-boot使用的配置文件,包括nand_root,mmc_root,loglevel,bootcmd等参数;
                image.cfg是boot使用的文件列表与ITEM_ROOTFSFAT32等重要符号。
7:sys_partition.fex文件中各个分区与下载对应的文件如下:
        bootloader分区保存bootloader.fex,bootloader.fex就是由boot.axf u-boot.bin等组成。
        env分区保存env.fex,env.fex就是lichee/tools/pack/chips/sun4i/configs/crane/default/env.cfg文件,它是u-boot的基本配置。
        boot分区保存boot.fex,boot.fex是boot.img的链接,它由kernel与ramdisk组成,使用fastboot下载的时候就是下载boot.img。
        system分区保存system.fex,system.fex是system.img的链接,它是android系统,使用fastboot下载的时候就是下载system.img。
        recovery分区保存recovery.fex,recovery.fex是recovery.img的链接,它也是由kernel与ramdisk组成,用于系统恢复,使用fastboot下载的时候就是下载recovery.img。
        misc分区用于恢复系统设置的时候在uboot中保存一些变量与命令的值。
        *.fex文件在lichee/tools/pack/out/目录,*.img在anroid/out/...下。
        
8:A20的分区如下:
        --------fastboot partitions--------
        -total partitions:11-
        -name-        -start-       -size-      
        bootloader  : 8000          8000        
        env         : 10000         8000        
        boot        : 18000         8000        
        system      : 20000         100000      
        data        : 120000        100000      
        misc        : 220000        8000        
        recovery    : 228000        10000       
        cache       : 238000        80000       
        private     : 2b8000        8000        
        databk      : 2c0000        80000       
        UDISK       : 340000        3e0000      
        -----------------------------------
        其中UDISK就是作为SDCARD分区,bootloader是从16MB开始,在bootloader的前面是
        16KB的MBR_SIZE与16KB的DL_SIZE。
        
9:各个镜像的对应的内存地址:
        在read_boot_img()或者do_boota()都可以打印这些信息。
        u-boot的地址为0x4a000000,在boot_dsipatch_kernal函数里强制赋值,也在该函数里
        使用wBoot_fopen("c:\\linux\\u-boot.bin", "rb")与wBoot_fread((void *)(*kernal_addr), 1, file_length, hd_file)
        把u-boot.bin从存储设备加载到0x4a000000内存地址,之后boot1从BootOS(para_addr, kernal_addr)
        跳转到u-boot。
        *kernal_addr = 0x4a000000。
        kernel地址为0x40008000,ramdisk地址为0x41000000,在CONFIG_EXTRA_ENV_SETTINGS
        中的boota 40007800其实是把boot.img下载到内存中的地址,由于boot.img中包含了
        kernel与ramdisk,也包含了这两个镜像在内存中的地址,还有检查boot.img的magic
        是不是ANDROID,从存储设备加载这个两个镜像到内存的操作是在read_boot_img函数里,
        在u-boot是do_boota函数里再次检查boot.img的合法性。
㈨ 最近刚买了一个开发板,全志A20,编译时遇到如下错误。请大虾解答,多谢。
'gcc-linaro/arm-linux-gnueabi/bin/ranlib' 这个目录下找不到这个文件,不能硬链到这个文件 看你这个地址是个相对路径,是不是环境变量没配全
㈩ 全志A20怎么 单独编译Linux驱动模块
linux下编译运行驱动 嵌入式linux下设备驱动的运行和linux x86 pc下运行设备驱动是类似的,由于手头没有嵌入式linux设备,先在vmware上的linux上学习驱动开发。 按照如下方法就可以成功编译出hello world模块驱动
