歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux內核 >> S3C6410 Linux內核移植

S3C6410 Linux內核移植

日期:2017/3/1 10:27:21   编辑:Linux內核
一、 下載內核及交叉編譯工具

(1)http://git.kernel.org/?p=linux/kernel/git/kki_ap/linux-2.6-samsung.git;a=summary到以上地址下載linux內核的三星分支,這裡選取“2.6.28-samsung”版本。

(2) 安裝4.3.1-eabi-armv6編譯器.
http://cs.sch.ac.kr/~choicjy/entry/MV6410-Samsung-Arm-linux-toolchain 4.3.1-eabi-armv6是三星官方為其armv6架構處理器維護的一套編譯器,不過我 裝起來遇到不少麻煩
首先是執行arm-linux-gcc報錯
[www.linuxidc.com@linuxidc bin]$ arm-linux-gcc
arm-linux-gcc: no such files or directory
[www.linuxidc.com@linuxidc bin]$
解決方法:必須將該編譯器解壓到/usr/local/arm/目錄,因為裡面有很多地方指明了絕對路徑
其次是make提示mpfr庫找不到
[www.linuxidc.com@linuxidc m8-Android-kernel]$ make
CHK include/linux/version.h
make[1]: “include/asm-arm/mach-types.h”是最新的。
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
/usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../libexec/gcc/arm-samsung-linux-gnueabi/4.3.1/cc1: error while loading shared libraries: libmpfr.so.1: cannot open shared object file: No such file or directory
make[1]: *** [kernel/bounds.s] 錯誤 1
make: *** [prepare0] 錯誤 2
解決方法:其實是有這個庫的,就在/usr/local/arm/4.3.1-eabi-armv6/mpfr/lib
在.bashrc中添加一個環境變量
export LD_LIBRARY_PATH=/usr/local/arm/4.3.1-eabi-armv6/mpfr/lib
然後在source .bashrc即可
最後來看這個編譯器有啥好處:
[www.linuxidc.com@linuxidc ~]$ arm-linux-gcc -v
Using built-in specs.
Target: arm-samsung-linux-gnueabi
Configured with: /home/scsuh/workplace/final/toolchain-script/toolchain_build_arm/gcc-4.3.1/configure --prefix=/usr --build=i386-pc-linux-gnu --host=i386-pc-linux-gnu --target=arm-samsung-linux-gnueabi --enable-languages=c,c++ --with-sysroot=/usr/local/arm/4.3.1-eabi-armv6 --with-build-time-tools=/usr/local/arm/4.3.1-eabi-armv6/usr/arm-samsung-linux-gnueabi/bin --enable-__cxa_atexit --enable-target-optspace --with-gnu-ld --with-pkgversion='for S3C64XX Samsung Electronics AP Development Team' --enable-shared --with-gmp=/usr/local/arm/4.3.1-eabi-armv6/gmp --with-mpfr=/usr/local/arm/4.3.1-eabi-armv6/mpfr --disable-nls --enable-threads --disable-multilib --disable-decimal-float --with-arch=armv6 --with-float=softfp --with-fpu=vfp --enable-symvers=gnu
Thread model: posix
gcc version 4.3.1 (for S3C64XX Samsung Electronics AP Development Team)
a編譯時默認使用硬件浮點單元--with-float=softfp --with-fpu=vfp
b默認架構armv6 --with-arch=armv6
c有自己的mpfr庫,等等.

另外可到http://www.codesourcery.com/sgpp/lite/arm/portal/subscription?@template=lite 網址下載最新的交叉編譯器當前版本是“gcc version 4.4.1 (Sourcery G++ Lite 2010q1-202”。

(3)修改Makefle文件,把arch 改為arm 把CROSS_COMPILE改為arm-none-linux-gnueabi-gcc,當然最簡單的方法是從開發板廠商那裡獲取內核和交叉編譯器。


二、 配置

這裡推薦一方法,調用arch/arm/configs 目錄下的默認配置單smdk6410mtd_defconfig為基礎進行配置,同時可以參考現有的文檔和配置單進行配置,注意點:

(1)要添加ubifs文件系統支持時應先配置device driver->memory technology device下的ubi項。

(2)device drivers->character device->serial drivers: 選中samsung soc serial support取消8250……(否則會出現錯誤:arch/arm/plat-s3c/init.c:94: error: 'CONFIG_SERIAL_SAMSUNG_UARTS' undeclared here (not in a function));

(3)system type->os timer support: 選中fixed tick timer(否則會出現錯誤:arch/arm/plat-s3c/time.c error)

(4)cpu power management:cpu frequency scaling項取消選中(否則會出現錯誤:arch/arm/plat-s3c/clock.c error)

配置好後要備份配置文件,保存為ctop6410_defconfig。
Copyright © Linux教程網 All Rights Reserved