现在的位置: 首页 > 综合 > 正文

linux — LTIB添加新平台

2013年06月13日 ⁄ 综合 ⁄ 共 5525字 ⁄ 字号 评论关闭

2.6.32内核整合到LTIB
在LTIB里添加一个新平台是很容易的事情。
首先打包内核源码,由于是修改过后可以正常使用的内核,所以没有补丁,在SPEC文件里

就不用加上补丁的操作了。
进入LTIB的安装目录下
cd <INSTALL_PATH>/config/platform
cp imx27ads imx21ads -rf
cd imx21ads
vim main.lkc
修改平台名,工具链,内核等,这里给出我的例子,工具链没改(因为这个LTIB里有我能用

的工具链),注意修改内核的地方

config CONFIG_TITLE
    string
    default "LTIB: Freescale IMX21 ADS reference board"

config CPU
    string
    default "MX21"

config PLATFORM_COMMENT
    string
    default "Freescale IMX21 ADS reference board"

config VENDOR
    string
    default "Freescale"

config PLATFORM
    string
    default "imx21ads"

config GNUTARCH
    string
    default arm

config LINTARCH
    string
    default arm

config CFGHOST
    string
    default arm-linux
source http://www.cnblogs.com/userspace/endian.lkc
source http://www.cnblogs.com/userspace/libc_type.lkc

comment "Choose your toolchain"
choice
    prompt "Toolchain"
    default TOOLCHAIN1
    help
        Choose the cross toolchain for building your packages. If you
        choose none, you can enter the path to your toolchain by hand.

    config TOOLCHAIN1
        bool "ARMv5te gcc-4.1.2,Multi-lib,gnueabi/glibc-2.5-nptl-3" if

GLIBC || LIBC_NONE || LIBC_HACKING
    config TOOLCHAIN2
        bool "ARM926 gcc-4.1.1/glibc-2.4-nptl-1" if GLIBC || LIBC_NONE ||

LIBC_HACKING
    config TOOLCHAIN_CUSTOM
        bool "custom"
endchoice

config TOOLCHAIN
    string
    default tc-fsl-x86lnx-armeabi-nptl-4.1.2-3.i386.rpm if TOOLCHAIN1
    default tc-fsl-x86lnx-arm-926ejs-nptl-sf-4.1.1-1.i386.rpm if TOOLCHAIN2

config TOOLCHAIN_PATH
    string
    default "/opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-

linux-gnueabi" if TOOLCHAIN1
    default "/opt/freescale/usr/local/gcc-4.1.1-glibc-2.4-nptl-sf-1/arm-

926ejs-linux" if TOOLCHAIN2
    string "Supply your toolchain path" if TOOLCHAIN_CUSTOM

config CUSTOM_TOOLCHAIN_PREFIX
    depends TOOLCHAIN_CUSTOM
    string "Enter your cross tools prefix"

config TOOLCHAIN_PREFIX
    string
    default "arm-none-linux-gnueabi-" if TOOLCHAIN1
    default "arm-926ejs-linux-" if TOOLCHAIN2
    default CUSTOM_TOOLCHAIN_PREFIX if TOOLCHAIN_CUSTOM

config TOOLCHAIN_CFLAGS
    string
    default "-O2 -fsigned-char -msoft-float" if TOOLCHAIN1
    default "-O2 -fsigned-char" if TOOLCHAIN2
    string "Enter any CFLAGS for gcc/g++"
    help
        This option lets you set flags that will be passed to gcc/g++
        These will be injected by the spoofing mechanism, so they
        only work if you reference the compiler as gcc/g++ in your
        rpm spec files (you cannot say for instance powerpc-linux-gcc)

comment "Choose your Kernel"
choice
    prompt "kernel"
    default KERNEL2
    help
        This menu will let you choose the kernel to use with your board.
        If you don't want to build a kernel, unselect this option.

    config KERNEL1
        bool "Linux 2.6.22-mx"
        help
            This is the kernel for the imx21ads platform
    config KERNEL2
        bool "linux 2.6.32"
        help
            This is the kernel for the imx21ads platform
    config KERNEL_DIR_BUILD
        bool "Local Linux directory build"
        help
            Build using a local copy of the kernel sources
    config KERNEL_NONE
        bool "Do not build the Linux kernel"
        help
            Select this if you dont want to build the kernel
endchoice

config PKG_KERNEL
    string
    default "kernel-2.6.22-mx" if KERNEL1
    default "kernel-2.6.32"    if KERNEL2
    default "kernel26-dir-build" if KERNEL_DIR_BUILD

source http://www.cnblogs.com/userspace/kernel_dir_build.lkc

config PKG_KERNEL_PRECONFIG
    string "kernel preconfig"
    default "linux-2.6.22-mx27ads.config" if KERNEL1
    default "linux-2.6.32-mx21ads.config" if KERNEL2 //这个文件是默认配置文

config PKG_KERNEL_WANT_HEADERS
    depends ! KERNEL_NONE
    bool "Include kernel headers"
    help
        Selecting this will copy kernel headers to

rootfs/usr/src/linux/include

config PKG_KERNEL_WANT_CF
    depends ! KERNEL_NONE
    bool "Configure the kernel"
    default n

config PKG_KERNEL_LEAVESRC
    depends ! KERNEL_NONE
    bool "Leave the sources after building"
    default n
    help
        This is a one shot option that can be used to build the kernel and
        leave the build source tree in rpm/BUILD in place

config DEPLOYMENT_ERASE_BLOCK_SIZE
    string
    default 128

source http://www.cnblogs.com/userspace/distro.lkc
source http://www.cnblogs.com/userspace/packages.lkc
source http://www.cnblogs.com/userspace/sysconfig.lkc
source http://www.cnblogs.com/userspace/deployment.lkc
source http://www.cnblogs.com/userspace/defaults.lkc

修改完成后,将2.6.32默认配置选项文件拷贝到当前目录(imx21ads)下,名字变成
kernel-2.6.32-imx21ads.config(名字可以随便取,但要保证和main.lkc里的文件名相

同)

cp defconfig kernel-2.6.32-imx21ads.config (defconfig是我原来在2.6.32下编译

内核的默认配置文件,一般是内核目录下的.config文件)

接下来到
cd <INSTALL_PATH>/config
vim main.lkc
这里加上平台的相关信息
第一处为
    config PLATFORM_imx21ads
        bool "Freescale IMX21 ADS reference board"

    config PLATFORM_imx27ads
        bool "Freescale IMX27 ADS reference board"
第二处为
config PLATFORM_DIR
    string
    default "config/platform/imx21ads" if PLATFORM_imx21ads (这里的路径名和

创建的文件夹相同)
    default "config/platform/imx32ads" if PLATFORM_imx32ads
接下来到
cd <INSTALL_PATH>/dist/lfs-5.1/kernel
cp <任意一个spec.in文件> kernel-2.6.32.spec.in
vim kernel-2.6.32.spec.in

%define pfx /opt/freescale/rootfs/%{_target_cpu}
%define pversion 2.6.32
%define bld_dir_name    kernel (注意这个地方名字要改成内核压缩包解压缩后的文

件夹的名字,如果你的kernel.tar.bz2解压缩后文件名为kernel-2.6.32那么这里也要改

成此名称)
%define kernel arch/arm/boot/zImage
%define pkg_name linux

Summary         : Linux kernel (core of the Linux operating system)
Name            : kernel
Version         : 2.6.32
Release         : 1
License         : GPL
Vendor          : Freescale Semiconductor
Packager        : Ross Wille
Group           : System Environment/Kernel
Source          : linux-2.6.32.tar.bz2

BuildRoot       : %{_tmppath}/%{name}
Prefix          : %{pfx}

%Description
%{summary}

%Prep
%setup -n %{bld_dir_name}

接下来
cp kernel-2.6.32.tar.bz2(内核压缩包) rpm/SOURCE 或者
cp kernel-2.6.32.tar.bz2 /opt/freescale/pkgs/

然后就./ltib -m config ./ltib了
这里最好先做 ./ltib -m prep -p kernel-2.6.32.spec将内核先预先放置在rpm/BUILD

 

====

http://www.cnblogs.com/zym0805/archive/2012/03/29/2424342.html

抱歉!评论已关闭.