zoukankan      html  css  js  c++  java
  • 那些年,交叉编译那些事

    编译 python2.7.11 arm64

     1 先编译个x86版本。
     2 mkdir build.pc
     3 cd build.pc 
     4 ../configure --disable-ipv6 --enable-shared 
     5 make 
     6 
     7 编译arm64版本之前,先在configure文件前面添加
     8 ac_cv_file__dev_ptmx=yes
     9 ac_cv_file__dev_ptc=no
    10 
    11 mkdir build.arm64
    12 cd build.arm64
    13 ../configure --host=aarch64-linux-gnu --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu --disable-ipv6 --enable-shared --build=aarch64
    14 
    15 遇到错误1:
    16 Parser/pgen ../Grammar/Grammar Include/graminit.h Python/graminit.c
    17 Parser/pgen: Parser/pgen: cannot execute binary file
    18 make: *** [Include/graminit.h] Error 126
    19 拷贝build.pc的pgen即可解决。
    20 cp /home/trait/v8le/Python-2.7.11/build.pc/Parser/pgen ./Parser/
    21 
    22 make && make install
    23 在make install的需要修改Makefile里PYTHONPATH,添加x86的lib目录,如:PYTHONPATH=/home/trait/v8le/Python-2.7.11/build.pc/build/lib.linux-i686-2.7:(shell ..)

    编译 libffi-3.2.1 arm64

    1 mkdir build.arm64
    2 cd build.arm64
    3 ../configure --host=aarch64-linux-gnu --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu --enable-shared 
    4 make && make install 

    编译 zlib-1.2.8 arm64

    1 ./configure --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu
    2 修改Makefile
    3 修改gcc为aarch64-linux-gnu-gcc 
    4 修改ar为aarch64-linux-gnu-ar 
    5 修改ranlib为aarch64-linux-gnu-ranlib
    6 make && make install

    编译 glib-2.46.2 arm64

     1 mkdir build.arm64
     2 cd build.arm64
     3 
     4 echo ac_cv_type_long_long=yes>aarch64.cache
     5 echo glib_cv_stack_grows=no>>aarch64.cache
     6 echo glib_cv_uscore=no>>aarch64.cache
     7 echo ac_cv_func_posix_getpwuid_r=yes>>aarch64.cache
     8 echo ac_cv_func_posix_getgrgid_r=yes>>aarch64.cache
     9 
    10 ../configure --host=aarch64-linux-gnu --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu --cache-file=aarch64.cache LIBFFI_CFLAGS=-I/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/include LIBFFI_LIBS=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/lib64/libffi.la
    11 
    12 遇到错误1:
    13 ../../gobject/gclosure.c:28:17: fatal error: ffi.h: No such file or directory
    14  #include <ffi.h>
    15 这是libffi安装的时候将它的头文件安装在lib目录下,如下解决:
    16 cd /home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/include
    17 ln -s ../lib/libffi-3.2.1/include/ffi.h ffi.h
    18 ln -s ../lib/libffi-3.2.1/include/ffitarget.h ffitarget.h
    19 
    20 遇到错误2:
    21 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_void'
    22 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_double'
    23 ./.libs/libgobject-2.0.so: undefined reference to `ffi_prep_cif'
    24 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint32'
    25 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_float'
    26 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint64'
    27 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_sint64'
    28 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_pointer'
    29 ./.libs/libgobject-2.0.so: undefined reference to `ffi_type_uint32'
    30 ./.libs/libgobject-2.0.so: undefined reference to `ffi_call'
    31 同样是libffi的安装问题,如下解决:
    32 cd /home/trait/v8le/linaro-aarch64/aarch64-linux-gnu
    33 cp ./lib64/* ./lib

    编译 libaio-0.3.110 arm64

    1 make prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu CC=aarch64-linux-gnu-gcc 
    2 make prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu CC=aarch64-linux-gnu-gcc install

    编译 openssl-1.0.1s arm4

    1 CC=aarch64-linux-gnu-gcc ./config no-asm shared --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu
    2 make && make install

    编译 ncurses-6.0 arm64 && 编译libuuid arm64

    1 mkdir build.arm64
    2 cd build.arm64
    3 ../configure --host=aarch64-linux-gnu --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu --enable-shared 
    4 make && make install 

    编译 libfdt(device-tree-compiler_1.4.0)

    1 make CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar RANLIB=aarch64-linux-gnu-ranlib PREFIX=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu
    2 make CC=aarch64-linux-gnu-gcc AR=aarch64-linux-gnu-ar RANLIB=aarch64-linux-gnu-ranlib PREFIX=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu install

    编译 yajl_1.0.12 arm64

     1 需先安装cmake
     2 第一步,修改CMakelist SET (YAJL_MAJOR 12)后面 添加: 
     3 SET (CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
     4 第二步,注释掉下面3行:
     5 #ADD_CUSTOM_TARGET(test
     6 #                  ./run_tests.sh ${CMAKE_CURRENT_BINARY_DIR}/test/yajl_test
     7 #                  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test)
     8 
     9 ./configure --prefix=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu
    10 make && make install

    编译 xen4.4.1 arm64

    1 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=fastmodel
    2 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=xgene-storm debug=y 
    3 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=xgene-storm debug=y MAX_PHYS_CPUS=8
    4 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=xgene-storm debug=y HAS_GICV3=y 
    5 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=vexpress debug=y HAS_GICV3=y 
    6                                                                      
    7 带dtb编译:
    8 make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINT=fastmodel CONFIG_DTB_FILE=/home/trait/workspace/linux-3.14.65/arch/arm64/boot/dts/foundation-v8.dtb

    编译 xen tools arm64

    1 ./configure --host=aarch64-linux-gnu --build=aarch64 glib_CFLAGS=-I/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/include/glib-2.0 glib_LIBS=/home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/lib/libglib-2.0.la
    2 
    3 遇到错误1:
    4 configure: error: ./configure failed for tools
    5 这是ncurses的目录问题,如下解决:
    6 cd /home/trait/v8le/linaro-aarch64/aarch64-linux-gnu/include
    7 ln -s ./ncurses/curses.h ncurses.h
    8 
    9 make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINT=fastmodel 

    编译 linux-3.14 + xen支持的

     1 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
     2 sed -e 's/.*CONFIG_XEN is not set/CONFIG_XEN=y/g' -i .config
     3 sed -e 's/.*CONFIG_BLK_DEV_LOOP is not set/CONFIG_BLK_DEV_LOOP=y/g' -i .config
     4 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- oldconfig
     5 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image
     6 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
     7 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules
     8 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install INSTALL_MOD_PATH=/home/trait/modules_install
     9 
    10 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- menuconfig
    11 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image
    12 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- arm64_fr_defconfig
    13 -------------------------------------------------------------------------------------------------------------------------
    14 
    15 mkimage -T multi -C gzip -a 0 -e 0 -n xen-uImage -d Image.gz:foundation-v8.dtb.gz xen-uImage.gzip
    16 
    17 #mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d /home/trait/workspace/xen/xen/xen xen-uImage
    18 
    19 mkimage -A arm64 -T kernel -a 0x80800000 -e 0x80800000 -C none -d xen uXen
    20 mkimage -A arm64 -T kernel -a 0x80200000 -e 0x80200000 -C none -d xen uXen
    21 --------------------------------------------------------------------------------------------------------------------------
    22 make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- xgene_xen_defconfig
    23 make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm vexpress_defconfig
    24 make CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm zImage
    25 qemu-system-arm -M vexpress-a9 -m 512M -kernel /home/trait/qemu-linux/linux-3.14.65/arch/arm/boot/zImage -nographic -append "root=/dev/mmcblk0  console=ttyAMA0" -sd a9rootfs.ext3

    编译uboot 2013-10

    1 先安装arm-linux-gnu-gcc,网上下载
    2 
    3 # make ARCH=arm CROSS_COMPILE=arm-linux-gnu- smdk2410_config 与下面的效果相同
    4 make smdk2410_config
    5 make all

    xen u-boot

    1 setenv ipaddr 10.60.15.53;setenv serverip 10.60.40.11;setenv xen_addr_r 0x90000000;setenv netmask 255.255.0.0;setenv kern_addr_r 0x98000000;setenv fdt_addr_r 0x99000000 
    2 setenv xen_load 'tftp ${xen_addr_r} uXen';setenv xen_dtb 'tftp ${fdt_addr_r} u-boot.dtb;fdt addr  ${fdt_addr_r};fdt resize;'
    3 setenv xen_boot 'setenv bootargs ${bootargs_xen};bootm ${xen_addr_r} - ${fdt_addr_r}' 
    4 setenv dom0_node 'fdt set /chosen/module@0 compatible xen,linux-zimage xen,multiboot-module'
    5 setenv xen_dom0 'tftp ${kern_addr_r} Image; run dom0_node;fdt set /chosen/module@0 reg < 0x0 ${kern_addr_r} 0x${filesize} >'
    6 setenv xen_run 'run xen_dtb xen_dom0 xen_load;fdt print /chosen;run xen_boot'
    7 setenv bootargs_xen 'conswitch=x sync_console dom0_mem=1G dom0_max_vcpus=1 console=dtuart dtuart=/smb/motherboard/amba/uart@28001000'
    8 
    9 # setenv bootargs_xen 'conswitch=x sync_console dom0_mem=1G dom0_max_vcpus=1 console=dtuart dtuart=/smb/uart@28001000'

    编译gdbserver aarch64

     1 --------------------主机-----------------------------
     2 mkdir build.pc 
     3 cd build.pc
     4 ../configure --target=aarch64-linux-gnu
     5 
     6 make 
     7 ---------------------目标机--------------------------
     8 mkdir build.arm64 
     9 cd build.arm64
    10 ../configure --prefix=/home/trait/gnu-tools/install --target=aarch64-linux-gnu --host=aarch64-linux-gnu
    11 make CC=/home/trait/v8le/linaro-aarch64/bin/aarch64-linux-gnu-gcc
  • 相关阅读:
    JS截取字符串方法实例
    Adobe Flash Builder 4.6 打开时提示Failed to create the Java Virtual Machine
    ionic 上拉菜单(ActionSheet)安装和iOS样式不一样
    Echarts柱状图百分比显示
    js替换数组中字符串实例
    jQuery获取json数据
    ionic左滑删除
    JavaScript修改日期格式
    ionic之angular1.X缓存问题解决
    angularjs1.X获取前一天日期
  • 原文地址:https://www.cnblogs.com/danxi/p/6382631.html
Copyright © 2011-2022 走看看