fl2440移植linux-3.0内核

搭建交叉编译环境

郭工今年重新编写了交叉编译环境的安装包,采用crosstool-ng而没有使用以往的buildroot,整个编译过程在腾讯云2核2G上耗时20min

sudo yum install glibc-static ncurses-devel
wget https://gitee.com/sfantree/oss3/raw/master/arm_tools/crosstool-ng/crosstool-ng-centos-LingYun-v1.0.0.bin
sed -i -e "s|^sup_arch=.*|sup_arch=(\"\", \"arm920t\")|g" crosstool-ng-centos-LingYun-v1.0.0.bin
chmod a+x crosstool-ng-centos-LingYun-v1.0.0.bin
sudo sh crosstool-ng-centos-LingYun-v1.0.0.bin

默认安装路径为/opt/xtools/arm920t/bin/arm-linux-gcc

export CROSS=/opt/xtools/arm920t/bin/arm-linux-

修改内核

smdk2440板载晶振频率为16M,而fl2440板载晶振为12M

cat arch/arm/mach-s3c2440/mach-smdk2440.c

static void __init smdk2440_map_io(void)
{
        s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
        //s3c24xx_init_clocks(16934400);
        s3c24xx_init_clocks(12000000);
        s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
}

修改机器ID,uboot给内核传递参数中的机器ID数值为1999

cat 

#smdk2410                ARCH_SMDK2410           SMDK2410                193
#mini2440                MACH_MINI2440           MINI2440                1999
smdk2410                ARCH_SMDK2410           SMDK2410            1999
mini2440                MACH_MINI2440           MINI2440                      193

修改串口调试输出的默认端口

cat drivers/tty/serial/samsung.c

//#define S3C24XX_SERIAL_NAME   "ttySAC"
#define S3C24XX_SERIAL_NAME     "ttyS"

修改makefile的交叉编译器路径

cat Makefile

#ARCH           ?= $(SUBARCH)
#CROSS_COMPILE  ?= $(CONFIG_CROSS_COMPILE:"%"=%)
ARCH=arm
CROSS_COMPILE=/opt/xtools/arm920t/bin/arm-linux-

修改内核编译配置选项

make s3c2410_defconfig
make menuconfiug

System Type --->
    S3C2400 Machines ---> #里面全部不选
    S3C2410 Machines ---> #里面全部不选
    S3C2412 Machines ---> #里面全部不选
    S3C2416 Machines ---> #里面全部不选
   S3C2440 and S3C2442 Machines --->
        [*] SMDK2440
        [*] SMDK2440 with S3C2440 CPU module
        #其它全部不选
    S3C2443 Machines ---> #里面全部不选
... ...
#我们的交叉编译器使用的是EABI接口,所以这里一定要修改配置,否则跑不起来。
Kernel Features --->
    [*] Use the ARM EABI to compile the kernel
    [*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL) (NEW)

mkimage所在的rpm包为uboot-tools,这个rpm包只包含在centos的EPEL源里

yum install uboot-tools -y
make
mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008040 -n "Linux Kernel" -d arch/arm/boot/zImage linuxroms3c2440.bin
chmod a+x linuxrom-s3c2440.bin

生成的linuxrom-s3c2440.bin即为内核镜像文件

发表评论

电子邮件地址不会被公开。 必填项已用*标注