国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費(fèi)電子書(shū)等14項(xiàng)超值服

開(kāi)通VIP
Ubuntu下arm交叉編譯環(huán)境的創(chuàng)建及基于s3c2410的linux2.6.22移植
Ubuntu下arm交叉編譯環(huán)境的創(chuàng)建及基于s3c2410的linux2.6.22移植(一)
 
經(jīng)歷近2周的時(shí)間,查閱大量的參考資料和貼子,終于成功將linux2.6.22移植到ARM2410上。中間走了不少?gòu)澛?,不過(guò)走彎路也是一種收獲,因?yàn)榭梢耘龅胶徒鉀Q許多問(wèn)題,增長(zhǎng)知識(shí)。因?yàn)閘inux版本問(wèn)題以及開(kāi)發(fā)平臺(tái)的不同,網(wǎng)上的很多文章并不完全適合自己的板子,需要自己摸索和修改。寫(xiě)這點(diǎn)東西算是對(duì)前一階段工作的總結(jié),以免將來(lái)忘記。
移植大體的步驟主要有:
<!--[if !supportLists]-->(1)       <!--[endif]-->交叉編譯環(huán)境的建立(我的主機(jī)系統(tǒng)是ubuntu7.04);
<!--[if !supportLists]-->(2)       <!--[endif]-->開(kāi)發(fā)板(我用的是博創(chuàng)的2410)NAND flash 分區(qū)管理;
<!--[if !supportLists]-->(3)       <!--[endif]-->LCD、網(wǎng)卡驅(qū)動(dòng)的移植;
<!--[if !supportLists]-->(4)       <!--[endif]-->linux內(nèi)核配置和編譯;
<!--[if !supportLists]-->(5)       <!--[endif]-->rootfs的制作;
<!--[if !supportLists]-->(6)       <!--[endif]-->完成linux的啟動(dòng)和文件系統(tǒng)的掛載。
下面我會(huì)按照步驟逐一介紹。
<!--[if !supportLists]-->一、   <!--[endif]-->交叉編譯環(huán)境的建立
建立交叉編譯環(huán)境就是在宿主機(jī)(也就是pc機(jī))的系統(tǒng)上建立一個(gè)模擬ARM的工作環(huán)境,使得在這個(gè)環(huán)境下編譯產(chǎn)生的程序能夠順利的在ARM上的系統(tǒng)內(nèi)運(yùn)行。主要工作包括binutils、gcc以及glibc的編譯生成,還有一些環(huán)境變量的設(shè)置。
<!--[if !supportLists]-->(1)      <!--[endif]-->準(zhǔn)備工作:
下載源代碼包:    binutils-2.18.tar.bz2,gcc-4.2.1.tar.bz2,glibc-2.6.1.tar.bz2,glibc-ports-2.6.1.tar.gz,linux-2.6.22.tar.bz2
補(bǔ)丁包:              binutils-2.18-genscripts_multilib-1.patch
                            binutils-2.18-posix-1.patch
                            gcc-4.2.1-cross_search_paths-1.patch
                            gcc-4.2.1-posix-1.patch
                            gcc-4.2.1-specs-1.patch
                            glibc-2.6.1-cross_hacks-1.patch
                            glibc-2.6.1-hppa_nptl-1.patch
glibc-2.6.1-libgcc_eh-1.patch
glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch
glibc-2.6.1-sysdep_cancel-1.patch
glibc-csu.patch
注:Binutils 是一組開(kāi)發(fā)工具,包括連接器,匯編器和其他用于目標(biāo)文件和檔案的工具;
GCC是C編譯器,用來(lái)將C代碼編譯成匯編代碼;
Glibc就是gcc編譯時(shí)需要的庫(kù)了,glibc-ports是提供glibc對(duì)ARM的支持;
Linux-2.6.22.tar.bz2是內(nèi)核源代碼包。
需要注意的是gcc和glibc以及l(fā)inux內(nèi)核版本需要保持對(duì)應(yīng)。如果用比較老的編譯器去編譯新的內(nèi)核,或者用新的編譯器編譯老版本的內(nèi)核,會(huì)出現(xiàn)一些莫名其妙的錯(cuò)誤。另外補(bǔ)丁包也是必備的,否則編譯過(guò)程中也會(huì)出錯(cuò)。剛開(kāi)始我就深受其害。
<!--[if !supportLists]-->(2)      <!--[endif]-->工作目錄的建立:
目錄的結(jié)構(gòu)可以參考《Building.Embedded.Linux.Systems》。推薦整個(gè)目錄放到/usr/local下,這樣所有的用戶都有訪問(wèn)權(quán)限。我當(dāng)初沒(méi)經(jīng)驗(yàn),直接放到home下了,后來(lái)會(huì)有些用戶權(quán)限的小麻煩。這里給出我的目錄結(jié)構(gòu):
arm  host
其中host是我的普通登陸用戶賬號(hào)目錄,arm就是工作目錄了。為了方便,我平時(shí)用root登陸。
$root@host:/home/arm# mkdir build-tools kernel rootfs tmp tools
其中編譯交叉工具時(shí)的主要工作都在build-tools目錄下完成,kernel目錄用來(lái)存放內(nèi)核源代碼,rootfs目錄是用來(lái)建立啟動(dòng)根文件系統(tǒng)的(后面會(huì)詳細(xì)介紹),tmp是臨時(shí)文件存放目錄,tools目錄就是最終生成的編譯器gcc和glibc存放的地方。
<!--[if !supportLists]-->(3)      <!--[endif]-->設(shè)置環(huán)境變量:
$root@host:/home/arm# export PRJROOT=/home/arm
$root@host:/home/arm# TARGET=arm-linux
$root@host:/home/arm# PREFIX=${PRJROOT}/tools
$root@host:/home/arm# TARGET_PREFIX=${PREFIX}/${TARGET}
$root@host:/home/arm# PATH=${PREFIX}/bin:${PATH}
其中TARGET定義了交叉工具的工作平臺(tái)類(lèi)型,PREFIX指定交叉工具的最終安裝目錄,PATH指定系統(tǒng)尋找交叉工具可執(zhí)行文件所在的路徑。
<!--[if !supportLists]-->(4)      <!--[endif]-->編譯前的準(zhǔn)備:
$root@host:/home/arm# cd ${PRJROOT}/build-tools
$root@host:/home/arm/build-tools# mkdir build-binutils build-boot-gcc build-glibc build-gcc build-glibc-headers patch
將源碼包放到這個(gè)目錄下
build-boot-gcc   build-glibc      build-binutils   build-gcc build-glibc-headers patch
binutils-2.18.tar.bz2   gcc-4.2.1.tar.bz2    glibc-2.6.1.tar.bz2  glibc-ports-2.6.1.tar.gz
將補(bǔ)丁放到patch目錄下:
binutils-2.18-genscripts_multilib-1.patch      binutils-2.18-posix-1.patch
              gcc-4.2.1-cross_search_paths-1.patch        gcc-4.2.1-posix-1.patch
                  glibc-2.6.1-cross_hacks-1.patch
glibc-2.6.1-hppa_nptl-1.patch                            glibc-2.6.1-libgcc_eh-1.patch
glibc-2.6.1-RTLD_SINGLE_THREAD_P-1.patch
glibc-2.6.1-sysdep_cancel-1.patch                     glibc-csu.patch
將內(nèi)核源碼包放到${PRJROOT}/kernel目錄下
linux-2.6.22.tar.bz2
<!--[if !supportLists]-->(5)      <!--[endif]-->開(kāi)始編譯
編譯的過(guò)程主要有6個(gè)步驟;
<!--[if !supportLists]-->a.       <!--[endif]-->內(nèi)核頭文件的生成
<!--[if !supportLists]-->b.       <!--[endif]-->Binary utilties的生成
<!--[if !supportLists]-->c.       <!--[endif]-->Glibc頭文件的生成
<!--[if !supportLists]-->d.       <!--[endif]-->第一階段gcc的生成
<!--[if !supportLists]-->e.       <!--[endif]-->glibc庫(kù)文件的生成
<!--[if !supportLists]-->f.        <!--[endif]-->完整編譯工具的生成
  注:生成第一階段gcc主要是用來(lái)生成glibc庫(kù)文件。
<!--[if !supportLists]-->1、 <!--[endif]-->生成內(nèi)核頭文件
$root@host:/home/arm/kernel# tar xvjf linux-2.6.22.tar.bz2
make ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
其中menuconfig指定了配置界面,可用的還有config(全字符界面) xconfig(xwindow下的圖形界面)。Ubuntu需要安裝tk8.4以支持xconfig。另外需要將mawk卸載,安裝gawk。(mawk有bug)
linux2.6的內(nèi)核提供了對(duì)s3c2410的支持。在system中選上s3c2410系列就可以了。配置完畢退出保存。
version.h autoconf.h
這2個(gè)文件在后面的編譯中會(huì)用到。如果沒(méi)有,退到內(nèi)目錄下make version.h就可以了。
下面建立鏈接:
$root@host:/home/arm/kernel/linux-2.6.22/include# ln -s asm/arch-s3c2410 asm/arch
將內(nèi)核頭文件拷貝到最終安裝目錄下:
$root@host:/home/arm/kernel/linux-2.6.22/include# mkdir –p ${TARGET_PREFIX}/include
cp –r asm- ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include# cp –r linux ${TARGET_PREFIX}/include
$root@host:/home/arm/kernel/linux-2.6.22/include# cp –d asm ${TARGET_PREFIX}/include

至此內(nèi)核頭文件建立完畢。
<!--[if !supportLists]-->2、 <!--[endif]-->建立Binary utilities:
binutils是一些二進(jìn)制工具的集合,其中常用的是as ,ar和ld。
$root@host:/home/arm/kernel/include# cd ${PRJROOT}/build-tools
$root@host:/home/arm/build-tools# tar xvjf binutils-2.18.tar.bz2
patch –Np1 –i /home/arm/build-tools/patch/binutils-2.18*
../binutils-2.18/configure --target=${TARGET} –prefix=${PREFIX}
${PREFIX}/bin下應(yīng)該生成一些以arm-linux開(kāi)頭的文件
<!--[if !supportLists]-->3、 <!--[endif]-->生成glibc頭文件:
$root@host:/home/arm/build-tools/# tar xvjf glibc-2.6.1.tar.bz2
tar xvzf glibc-ports-2.6.1.tar.gz --directory ./glibc-2.6.1/
$root@host:/home/arm/build-tools/glibc-2.6.1# mv glibc-ports-2.6.1 ports –v
打上補(bǔ)丁:
patch –Np1 –i /home/arm/build-tools/patch/glibc-2.6.1-*patch
$root@host:/home/arm/build-tools/# cd build-glibc-headers
這里需要添加對(duì)NPTL線程庫(kù)的支持:
echo “libc_cv_forced_unwind=yes”>>config.cache
echo “libc_cv_c_cleanup=yes”>>config.cache
echo “libc_cv_arm_tls=yes”>>config.cache
注:如果編譯中出現(xiàn)”cannot compute long double size”,添加:
echo “ac_cv_sizeof_long_double=12”>>config.cache
../glibc-2.6.1/configure --host=${TARGET} --prefix=”/usr” --enable-add-ons
--with-headers=${TARGET_PREFIX}/include --cache-file=config.cache
make cross-compiling=yes install_root=${TARGET_PREFIX} prefix=””
install-headers
mkdir –p ${TARGET_PREFIX}/include/gnu
touch ${TARGET_PREFIX}/include/gnu/stubs.h
注:如果編譯過(guò)程中出現(xiàn)找不到頭文件的錯(cuò)誤,可以根據(jù)錯(cuò)誤提示的文件名用touch命令在相應(yīng)目錄下建立一個(gè)空文件,一般就可以編譯通過(guò)了。
<!--[if !supportLists]-->4、 <!--[endif]-->生成第一階段gcc:
$root@host:/home/arm/build-tools/# tar xvjf gcc-4.2.1.tar.bz2
打補(bǔ)丁:
patch –Np1 –i /home/arm/build-tools/patch/gcc-4.2.1-*
../gcc-4.2.1/configure --target=${TARGET} --prefix=${PREFIX}  --with-headers=${TARGET_PREFIX}/include
--with-newlib --enable-languages=c --disable-threads --disable-shared
在${PREFIX}/bin下會(huì)生成 arm-linux-開(kāi)頭的文件:
<!--[if !supportLists]-->5、 <!--[endif]-->生成glibc庫(kù)文件:
$root@host:/home/arm/build-tools/build-glibc# CC=arm-linux-gcc ../glibc-2.6.1/configure --host=$TARGET --prefix=”/usr”
      --enable-add-ons --with-headers=${TARGET_PREFIX}/include
--cache-file=config.cache
這里的config.cache與前面編譯glibc頭文件時(shí)的config.cache完全相同。
make install_root=${TARGET_PREFIX} prefix=”” install
對(duì)libc.so作出修改:
/* GNU ld script
   Use the shared library, but some functions are only in
   the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libc.so.6 /lib/libc_nonshared.a  AS_NEEDED ( /lib/ld-linux.so.2 ) )
將GROUP這一行的內(nèi)容改為:
GROUP ( libc.so.6 libc_nonshared.a  AS_NEEDED ( ld-linux.so.2 ) )
              $root@host:/home/arm/tools/arm-linux/lib#  cat libpthread.so
              /* GNU ld script
            Use the shared library, but some functions are only in
            the static library, so try that secondarily.  */
OUTPUT_FORMAT(elf32-littlearm)
GROUP ( /lib/libpthread.so.0 /lib/libpthread_nonshared.a )
              將GROUP這一行的內(nèi)容改為:
              GROUP (libpthread.so.0  libpthread_nonshared.a )
<!--[if !supportLists]-->6、 <!--[endif]-->生成完整的編譯工具:
$root@host:/home/arm/tools/arm-linux/lib# cd ${PRJROOT}/build-tools/build-gcc
../gcc-4.2.1/configure --target=$TARGET --prefix=${PREFIX}  --enable-shared
--enable-languages=c,c++ --with-threads=posix
              $root@host:/home/arm/build-tools/build-glibc# make all
              $root@host:/home/arm/build-tools/build-glibc# make install
       (待續(xù)....)
 
本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/templarzq/archive/2007/10/12/1821594.aspx
 
Ubuntu下arm交叉編譯環(huán)境的創(chuàng)建及基于s3c2410的linux2.6.22移植(二)
 
<!--[if !supportEmptyParas]--> (續(xù))<!--[endif]-->
<!--[if !supportLists]-->二、 <!--[endif]-->NAND flash 分區(qū)管理
這塊2410板自帶了vivi,啟動(dòng)之后可以進(jìn)到vivi的提示符下:
vivi>
查看分區(qū)情況:
vivi> part show
mtdpart info. (6 partitions)
<!--[if !supportEmptyParas]--> <!--[endif]-->
name                            offset                           size                       flag 
vivi                              :0x00000000                 0x00020000           0            128k
param                       :0x00020000                 0x00010000           0            64k
kernel                        :0x00030000                 0x00200000           0            2M
root                            :0x00230000                 0x00300000           4            3M
yaffs                           :0x00530000                 0x03a00000           8            58M
使用part命令可以添加、刪除各個(gè)mtd分區(qū)。
另外還有一種分區(qū)格式:BON,具體用法參照bon命令幫助即可。2.6內(nèi)核對(duì)mtd分區(qū)格式支持的很好,所以這里采用了mtd分區(qū)方式。
       其中vivi是bootloader區(qū),param是存放啟動(dòng)參數(shù)設(shè)置區(qū),kernel是內(nèi)核鏡像文件區(qū),root是啟動(dòng)文件系統(tǒng)區(qū),yaffs是文件系統(tǒng)區(qū),可以視情況修改這些區(qū)域的大小。
<!--[if !supportLists]-->三、  <!--[endif]-->網(wǎng)卡和LCD驅(qū)動(dòng)的移植
<!--[if !supportLists]-->1.  <!--[endif]-->網(wǎng)卡驅(qū)動(dòng)移植:
這塊板使用的是DM9000的網(wǎng)卡芯片,驅(qū)動(dòng)的源代碼在內(nèi)核源代碼的目錄中可以找到:
$root@host:/home/arm/#  cd kernel/linux-2.6.22
dm9000.c              dm9000.h
修改dm9000.c:
      找到函數(shù):
static int dm9000_probe(struct platform_device *pdev)
{
       ……….
       int ret=0;
       int iosize;
       int i;
       u32 idval
//添加下面數(shù)組,前6個(gè)數(shù)作為網(wǎng)卡的mac地址,注意不能和現(xiàn)有的網(wǎng)卡沖突
       unsigned char ne_defethadder[]={0x08,0x08,0x08,0x08,0x12,0x27,0}
       ………………………….
       ………………………….
       /* Set Node Address */
       for (i = 0; i < 6; i++)
              ndev->dev_addr[i] = db->srom[i];
<!--[if !supportEmptyParas]--> <!--[endif]-->
       if (!is_valid_ether_addr(ndev->dev_addr)) {
              /* try reading from mac */
<!--[if !supportEmptyParas]--> <!--[endif]-->
              for (i = 0; i < 6; i++)
              //修改mac地址
              //     ndev->dev_addr[i] = ior(db, i+DM9000_PAR);
                     ndev->dev_addr[i]=ne_defethaddr[i];
              ………………………
              ……………………….
       }
退出保存。
修改smdk2410.c:
vi mach-smdk2410.c
在mach-smdk2410.c中添加如下內(nèi)容:
…………
#include <asm/plat-s3c24xx/common-smdk.h>
//添加:
#include <linux/dm9000.h>
…………
………….
#define UCON S3C2410_UCON_DEFAULT
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
//添加:
<!--[if !supportEmptyParas]--> <!--[endif]-->
static struct resource s3c_d9k_resource[]=
{
       [0]={
              .start      =0x10000000,
              .end =0x10000000,
              .flags=IORESOURCE_MEM
       },
       [1]={
              .start      =0x10000000+0x2,
              .end =0x10000000+0x2,      
              .flags=IORESOURCE_MEM
       },
       [2]={
              .start      =IRQ_EINT2,             
              .end =IRQ_EINT2,
              .flags     =IORESOURCE_IRQ
       }
};
static struct dm9000_plat_data s3c_device_d9k_platdata = {
        .flags= DM9000_PLATF_16BITONLY
};
<!--[if !supportEmptyParas]--> <!--[endif]-->
struct platform_device s3c_device_d9k = {
        .name= "dm9000",
        .id= 0,
        .num_resources= ARRAY_SIZE(s3c_d9k_resource),
        .resource= s3c_d9k_resource,
        .dev= {
                .platform_data = &s3c_device_d9k_platdata,
        }
};
………………….
………………….
static struct platform_device *smdk2410_devices[] __initdata = {
       &s3c_device_usb,
       //啟動(dòng)lcd
       &s3c_device_lcd,
       &s3c_device_wdt,
       &s3c_device_i2c,
       &s3c_device_iis,
       //添加
       &s3c_device_d9k
       //&s3c_device_ts,
};
需要注意的是起始地址和中斷號(hào)的選擇。這塊板上DM9000芯片的INT引腳接的是EINT2,CMD引腳接的是A1,CS引腳接的是nGCS2,所以DM9000的index端口地址是0x10000000,data端口地址是0x10000000+0x00000002,據(jù)此設(shè)置結(jié)構(gòu)resource s3c_d9k_resource中的參數(shù)。最后在內(nèi)核編譯時(shí)加上對(duì)DM9000驅(qū)動(dòng)的支持就可以了,具體見(jiàn)內(nèi)核配置和編譯。
<!--[if !supportLists]-->2.  <!--[endif]-->LCD驅(qū)動(dòng)移植:
繼續(xù)在mach-smdk2410.c中添加如下內(nèi)容:
………….
#include <asm/arch/fb.h>
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-lcd.h>
………….
………….
static struct s3c2410fb_mach_info smdk2410_lcdcfg __initdata={
       .type=S3C2410_LCDCON1_TFT,
       .fixed_syncs= 0,
       .regs={
              .lcdcon1=       S3C2410_LCDCON1_TFT16BPP|
                            S3C2410_LCDCON1_TFT |
                            S3C2410_LCDCON1_CLKVAL(0X01),     /*HCLK/4*/
              .lcdcon2=       S3C2410_LCDCON2_VBPD(18)|       /*19*/
                            S3C2410_LCDCON2_LINEVAL(479)|
                            S3C2410_LCDCON2_VFPD(10)|       /*11*/
                            S3C2410_LCDCON2_VSPW(14),      /*15*/
              .lcdcon3=       S3C2410_LCDCON3_HBPD(43)|
                            S3C2410_LCDCON3_HOZVAL(639)|       /*640*/
                            S3C2410_LCDCON3_HFPD(115),     /*116*/
              .lcdcon4=       S3C2410_LCDCON4_MVAL(0)  |
                            S3C2410_LCDCON4_HSPW(95),      /*96*/
              .lcdcon5=       S3C2410_LCDCON5_FRM565   |
                            S3C2410_LCDCON5_INVVLINE|
                            S3C2410_LCDCON5_INVVFRAME|
                            S3C2410_LCDCON5_PWREN|
                            S3C2410_LCDCON5_HWSWP,
       },
       .lpcsel=   ((0XCE6)&~7)|1<<4,//0x0,
       .gpccon= 0xAA8002A8,//0xaaaaaaaa,
       .gpccon_mask=     0xFFC003FC,//0xffffffff,
       .gpcup=         0xF81E,//0xffffffff,
       .gpcup_mask=      0xF81E,//0xffffffff,
       .gpdcon= 0xAA80AAA0,//0xaaaaaaaa,
       .gpdcon_mask=    0xFFC0FFF0,//0x0,
       .gpcup=         0xF8FC,//0xffffffff,
       .gpcup_mask=      0xF8FC,//0xffffffff,
      
       .width=          640,//240,
       .height= 480,//320,
       .xres=            {640,640,640},//{240,240,240}, .min .max .defval
       .yres=            {480,480,480},//{320,320,320},
       .bpp=             {16,16,16},   //{16,16,16}, 
};
……………
……………
static void __init smdk2410_init(void)
{
       s3c24xx_fb_set_platdata(&smdk2410_lcdcfg);
       platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));
       smdk_machine_init();
}
………………..
注:注釋掉drivers\char\vt.c的blank_screen_t(unsigned long dummy)的函數(shù)內(nèi)容,否則lcd會(huì)在10分鐘左右關(guān)掉顯示。“
最后在內(nèi)核編譯時(shí)需要選中對(duì)LCD的支持,具體見(jiàn)內(nèi)核配置和編譯。
  (待續(xù).....)
本文來(lái)自CSDN博客,轉(zhuǎn)載請(qǐng)標(biāo)明出處:http://blog.csdn.net/templarzq/archive/2007/11/07/1871783.aspx
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
如何為嵌入式開(kāi)發(fā)建立交叉編譯環(huán)境
建立針對(duì)arm
ARM cross Linux-PAM-0.75
Cross Toolchain-交叉編譯工具鏈
交叉編譯模擬環(huán)境sbox2的使用
建立ARM交叉編譯環(huán)境 (arm
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服