4.7.4到JZ2440开发板(2)

    17. 使用交叉编译器的时候一般是采用arm-tonghuix-linux-gnueabi这样的命令的,但是很多标准Makefile需要实用标准的交叉编译器的名称,一般这个名称是arm-linux-gcc这样的。

      那么我们在生成交叉编译器的目录下写一个link.sh脚本,新建一些软链接。

      >link.sh

#!/bin/sh PREFIX=arm-tonghuix-linux-gnueabi- AFTFIX=arm-linux- ln -s ${PREFIX}gcc ${AFTFIX}gcc ln -s ${PREFIX}addr2line ${AFTFIX}addr2line ln -s ${PREFIX}gdbtui ${AFTFIX}gdbtui ln -s ${PREFIX}ar ${AFTFIX}ar ln -s ${PREFIX}as ${AFTFIX}as ln -s ${PREFIX}c++ ${AFTFIX}c++ ln -s ${PREFIX}c++filt ${AFTFIX}c++filt ln -s ${PREFIX}cpp ${AFTFIX}cpp ln -s ${PREFIX}g++ ${AFTFIX}g++ ln -s ${PREFIX}gccbug ${AFTFIX}gccbug ln -s ${PREFIX}gcj ${AFTFIX}gcj ln -s ${PREFIX}gcov ${AFTFIX}gcov ln -s ${PREFIX}gdb ${AFTFIX}gdb ln -s ${PREFIX}gfortran ${AFTFIX}gfortran ln -s ${PREFIX}gprof ${AFTFIX}gprof ln -s ${PREFIX}jcf-dump ${AFTFIX}jcf-dump ln -s ${PREFIX}ld ${AFTFIX}ld ln -s ${PREFIX}ldd ${AFTFIX}ldd ln -s ${PREFIX}nm ${AFTFIX}nm ln -s ${PREFIX}objcopy ${AFTFIX}objcopy ln -s ${PREFIX}objdump ${AFTFIX}objdump ln -s ${PREFIX}populate ${AFTFIX}populate ln -s ${PREFIX}ranlib ${AFTFIX}ranlib ln -s ${PREFIX}readelf ${AFTFIX}readelf ln -s ${PREFIX}run ${AFTFIX}run ln -s ${PREFIX}size ${AFTFIX}size ln -s ${PREFIX}strings ${AFTFIX}strings ln -s ${PREFIX}strip ${AFTFIX}strip

      写完这个link.sh文件以后执行一下:

      sh link.sh

       得到标准名称的交叉编译工具链,可以在makefile中使用类似arm-linux-gcc这样的名称了。

    18. 把你的工具链目录设置到$PATH 环境变量:

      sudo vi /etc/environment 修改PATH的值

      PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sheldon/x-tools/arm-unknown-linux-gnueabi/bin/"

      . /etc/environment 使生效环境变量

二.编译linux内核:
  
①清除一下之前的配置:make mrproper
   ②使用默认配置: make s3c2410_defconfig
   ③再配置自己的需求:make menuconfig

      进入【Device Drivers】--->        Memory Technology Device (MTD) support --->        <*>Enable UBI       进入 【File System】--->        Miscellaneous filesustems --->        <*>UBIFS file system       进入 【Kernel Features】--->           [*] Use the ARM EABI to compile the kernel           [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)

      修改./arch/arm/mach-s3c24xx/common-smdk.c中的smdk_default_nand_part[]结构体数组

      static struct mtd_partition smdk_default_nand_part[] = {        [0] = {        .name = "bootloader",        .size = SZ_256K,        .offset = 0,        },        [1] = {        .name = "params",        .offset = MTDPART_OFS_APPEND,        .size = SZ_128K,        },        [2] = {        .name = "kernel",        .offset = MTDPART_OFS_APPEND,        .size = SZ_8M,        },        [3] = {        .name = "rootfs",        .offset = MTDPART_OFS_APPEND,        .size = MTDPART_SIZ_FULL,        }       };

      修改./arch/arm/mach-s3c24xx/mach-smdk2440.c中的smdk2440_init_time(void)函数

      static void __init smdk2440_init_time(void) ���     {        s3c2440_init_clocks(12000000);//板子的晶振是12M        samsung_timer_init();       }

      修改makeflie的第255和256行

      ARCH ?= arm       CROSS_COMPILE ?= arm-linux-       最后make uImage,在/arch/arm/boot下生成uImage

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14932.html