LINUX開發環境構建過程(很詳細)

轉載地址http://blog.163.com/yuan_xihua/blog/static/3074054420087144615482/


一,準備VMWARE+LINUX安裝軟件包

1,在http://www.ubuntu.com/getubuntu/download
    下載Ubuntu 8.04 LTS 的X86的Desktop版本的ISO
    http://mirror.lupaworld.com/ubuntu/releases/hardy/ubuntu-8.04.1-desktop-i386.iso
2,在http://www.3ddown.com/soft/33308.htm
    下載虛擬機(VMware Workstation) v6.5.0.118166 完整註冊版
 VMware.Workstation.v6.5.0.118166.exe
 Flashget://W0ZMQVNIR0VUXWh0dHA6Ly93d3cuM2Rkb3duLmNvbS9kb3dubG9hZC5hc3A/aWQ9MzMzMDgmZHA9MSZmaWQ9MzJbRkxBU0hHRVRd&1029&1225512051
 注意:記得抄下注冊碼:JU04H-A8Q82-T3J18-4WF67 
 或者下載註冊機VMware.Workstation.v6.5.0.118166-Keygen.rar
3,在http://www.tuola.net/soft/view-1441.html
 下載VanDyke SecureCRT v6.0.3 build 311 破解版
 http://dl.tuola.net/s/SecureCRT.v6.0.3.rar
4,在ftp://ftp.denx.de/pub/eldk/4.1/arm-linux-x86/iso/
    下載arm-2007-01-21.iso
    ftp://ftp.denx.de/pub/eldk/4.1/arm-linux-x86/iso/arm-2007-01-21.iso
5, 在http://www.crsky.com/soft/2975.html
    下載Beyond_Compare_2.5.3.253_SC-special.exe
    http://3.scdx1.crsky.com/200807/Beyond_Compare_2.5.3.253_SC-special.exe
    
二,準備ARM+LINUX開發包

1,在http://www.kernel.org/pub/linux/kernel/v2.6/
    下載linux-2.6.26.tar.bz2
    http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.26.tar.bz2
2,在ftp://ftp.denx.de/pub/u-boot/
    下載u-boot-1.3.4.tar.bz2
 ftp://ftp.denx.de/pub/u-boot/u-boot-1.3.4.tar.bz2
3,在http://busybox.net/
    下載BusyBox 1.11.1. (svn, patches, how to add a patch)
 http://busybox.net/downloads/busybox-1.11.1.tar.bz2
4,在http://www.arm9.net/download.asp
    下載Jflash2440 ,一個Linux下Jtag燒寫工具(含源代碼)
 http://www.arm9.com.cn/download/sbc2440v3/Jflash_linux.tgz
5,在http://blog.chinaunix.net/u/24474/showart_227846.html
 下載Jflash-s3c2410_linux.tar.bz2
 http://blogimg.chinaunix.net/blog/upfile/070107195410.bz2
 注意:下載後把文件名改回Jflash-s3c2410_linux.tar.bz2
 
  可參考http://blog.chinaunix.net/u/23070/showart.php?id=157735
 Jflash-s3c2410源碼分析(linux).pdf
 
 可參考http://www.datasheetcatalog.org/datasheet2/5/0wd8ohcf4gti5jzkwhd33lhka1ky.pdf
 Installation Manual for S3C2440 (linux) 
 
三,安裝VMWARE+LINUX開發平臺

1,在XP系統上安裝VMware-workstation-6.5.0-118166.exe
    A,雙擊VMware-workstation-6.5.0-118166.exe 啓動安裝,點擊NEXT,選擇Typical;再NEXT,安裝文件夾選擇
        默認;再NEXT,快捷方式產生用默認;再NEXT,按install;進入安裝過程,輸入使用者,公司和序列號
        JU04H-A8Q82-T3J18-4WF67 ,最後點擊finish完成安裝,重啓動電腦;
    B,雙擊桌面VMware Workstation啓動虛擬機程序,選擇接受版權許可後點擊OK後即可進入虛擬機界面使用;   

    注意:XP系統需要512MB以上內存,15GB以上硬盤空間。
     
2,在VMware Workstation上安裝ubuntu-8.04.1-desktop的X86版本 
    A,雙擊桌面VMware Workstation圖標進入虛擬機,點擊“New Virtual Machine”啓動建立嚮導;選擇Typical;再NEXT;
      選擇“Install disc image file(iso)”,點擊“Browse”找到存儲在硬盤上的“ubuntu-8.04.1-desktop-i386.iso”文件;
      點擊NEXT,在“Virtual Machine name”下面輸入虛擬機文件名,在“Location”下面選擇虛擬機文件夾安裝位置;
      點擊NEXT,在“Maxinum disk size”上增加到15GB以上,下面選擇“Split Virtual disk to 2GB files”;點擊NEXT,顯示
      虛擬機配置信息,確認無誤後點擊“finish”即可進入安裝過程;
    B,進入虛擬機的操作系統安裝過程中,在“ubuntu-8.04.1-desktop-i386.iso”的安裝界面中按F2功能鍵,用上下箭頭選擇
        “中文(簡體)”再按“回車”;用上下箭頭選擇高亮“安裝UBUNTU”時按回車;進入
        ubuntu-8.04.1-desktop 的X86版本的LiveCD界面,出現一個7步的“安裝”嚮導;
    C,在安裝嚮導上點擊“前進”,地點用默認“上海”;點擊“前進”,鍵盤佈局用默認“China”;點擊“前進”硬盤分區
        用默認“嚮導”,點擊“前進”,輸入安裝用戶名和密碼;點擊“前進”,在“準備安裝”中,點擊“安裝";安裝完成
        後,點擊“現在重啓”;並把虛擬機“VM”“Settings”中的“CD/DVD”改回“Use physical drive”;
        
    注意:XP系統需在DHCP的局域網內,要獨立分配IP給虛擬機;安裝的用戶名和密碼區別於ROOT用戶,每次登陸系統及修改
        系統配置都要用到,需要牢記。
 
四,配置並更新ubuntu桌面系統

1,啓動根用戶和配置網絡
 A,進入系統後在啓動菜單“應用程序”->“附件”->“終端”拉到桌面上;把啓動菜單“位置”中的“計算機”也
        拉到桌面上;雙擊桌面“終端”中打開命令行終端
 B,啓用root用戶並修改密碼
        yuanxh@yuanxh-desktop:~$ sudo passwd root
 C,進入root用戶操作
        yuanxh@yuanxh-desktop:~$ su
 D,查看本機IP配置信息
        root@yuanxh-desktop:/home/yuanxh# ifconfig -a
 E,在啓動菜單“系統”->“系統管理”->“網絡”中
  填入IP,子域掩碼,網關,DNS等網絡參數;
 F,修改.bashrc啓用ll la l等到命令轉義
  root@yuanxh-desktop:/home/yuanxh# vi /root/.bashrc
  root@yuanxh-desktop:/home/yuanxh# source /root/.bashrc
  
2,安裝虛擬驅動Vmware tools
 A,進入系統後在虛擬機菜單“VM”中點擊“Install Vmware tools”後桌面會彈出一個CD-ROM內容的文件夾,裏面有兩個
  rpm和tar.gz壓縮文件包;
 B,雙擊桌面“終端”打開命令行終端,用命令模式安裝虛擬驅動:
  切換到root用戶
            yuanxh@yuanxh-desktop:~$ su
        建立文件夾
            root@yuanxh-desktop:/home/yuanxh# mkdir vm-tools
        修改文件夾權限
            root@yuanxh-desktop:/home/yuanxh# chmod 777 vm-tools/
        進入文件夾
            root@yuanxh-desktop:/home/yuanxh# cd vm-tools/
        複製虛擬驅動軟件包
            root@yuanxh-desktop:/home/yuanxh/vm-tools# cp /media/cdrom0/VMwareTools-6.5.0-118166.tar.gz .
        解壓虛擬驅動文件包
            root@yuanxh-desktop:/home/yuanxh/vm-tools# tar xzvf VMwareTools-6.5.0-118166.tar.gz
        進入虛擬驅動文件夾
            root@yuanxh-desktop:/home/yuanxh/vm-tools# cd vmware-tools-distrib/
        運行虛擬驅動安裝腳本
            root@yuanxh-desktop:/home/yuanxh/vm-tools/vmware-tools-distrib# ./vmware-install.pl 
 C,一路按回車鍵,中間如果有一個編譯跳不過,就輸入N,再回車,直到最後能選擇屏幕分辨率大小[15] 1152 X 864,
   並且鼠標能自由進入虛擬機和XP之間;
 D,給vmtools升級
  如果VMware要更新版本的VMware Tools,先卸載舊的vmware tools 
    root@yuanxh-desktop:/home/yuanxh/vm-tools/vmware-tools-distrib# ./bin/vmware-uninstall-tools.pl
  再重新安裝新的vmware tools
   root@yuanxh-desktop:/home/yuanxh/vm-tools/vmware-tools-distrib# ./vmware-install.pl

3,啓用XP與虛擬機系統間的共享文件夾功能
 A,在虛擬機菜單“VM”->“settings”中,切換到“options”頁;選擇到“Shared Folders” 設置,選擇“Always enabled”;
   點擊“Folders”的“Add” 進入“add Shared Folder wizard”;再點擊 NEXT,選擇共享文件夾的“Host path”和“name”;點擊“NEXT”配置好
  共享文件夾屬性後,點擊“Finish”;退出嚮導,點擊“OK”退出設置;
 B,在設置好共享文件夾後,並且安裝好虛擬驅動後啓動虛擬機,便可以在虛擬機中看到共享文件夾的內容;
     root@yuanxh-desktop:/home/yuanxh# ls -l  /mnt/hgfs
4,爲虛擬機增加並口
 A,雙擊桌面VMware Workstation圖標進入虛擬機,先不要啓動虛擬系統的電源,在虛擬機菜單“VM”->“settings”中,在“Hardware”頁;
  點擊窗口下面的“Add...” 進入“add Hardware wizard”;在Hardware Type 中選擇“Parallel Port”;再點擊 NEXT,在Parallel Port Type
  中選擇默認的“Use physicial parallel port on the host”;再點擊 NEXT,在physicial parallel port 中選擇“LPT1”或者用“Auto detect”,
  在Device status 中選擇上“Connect at power on”;最後點擊“Finish”完成配置,點擊“OK”退出添加硬件嚮導。
 B,然後打開虛擬機電源,進入虛擬Linux系統,就可以使用並口了。其它串口中,USB口增加方式類似。
       
4,更新軟件包服務器源後更新升級系統並安裝SSH和ZMODEM協議
 A,切換到root用戶後執行以下命令更新升級系統:
  網絡更新系統
        root@yuanxh-desktop:/home/yuanxh# apt-get update
        網絡升級系統
        root@yuanxh-desktop:/home/yuanxh# apt-get upgrade
    B,網絡安裝SSH客戶端和服務器端
        root@yuanxh-desktop:/home/yuanxh# apt-get install ssh openssh-server 
        只有安裝了這個才能用SecureCRT遠程終端SSH訪問系統
    C,用以下命令查找並安裝ZMMODEM協議支持軟件包:
        查找rzsz相關軟件包
        root@yuanxh-desktop:~# apt-cache search rzsz
        顯示lrzsz軟件包詳細情況
     root@yuanxh-desktop:~# apt-cache show lrzsz        
        網絡安裝zmodem傳輸協議
        root@yuanxh-desktop:/home/yuanxh# apt-get install lrzsz
        查看網絡下載軟件包存放目錄
        root@yuanxh-desktop:/home/yuanxh# ll /var/cache/apt/archives/
 D,安裝開發必需軟件包
  root@yuanxh-desktop:/usr/local/arm# apt-get install patch libncurses5-dev make rpm

5,安裝SecureCRT遠程終端SSH訪問虛擬機和啓用SFTP文件傳輸功能
 A,雙擊SecureCRT.v6.0.3.rar裏的scrt603.exe,點擊“NEXT”;選擇“接受協議”,再點擊“NEXT”;用默認配置文件,點擊“NEXT”
    後選擇“Complete”;點擊“NEXT”後產生快捷方式用默認;點擊“Install”後進行安裝,點擊“Finish”完成安裝;
 B,把SecureCRT.v6.0.3.rar裏的scrt603-tbe.exe解壓到安裝目錄並運行,點擊“patch”,然後對“SecureCRT.exe”破解30天限制使用
   權限;
 C,利用SecureCRT的嚮導建立一個SSH會話到虛擬機;“下一步”後輸入虛擬機IP地址和登陸用戶名,建立好後雙擊會話SSH登陸LINUX,
  在會話屬性中可配置終端類型,字體,滾屏行數,字符編碼,XMODEM和SFTP默認路徑等;
 D,建立了到LINUX的SSH會話後,在Version 6.0.3 界面的菜單“File”->“Connect SFTP Tab”可啓動到相應的LINUX的SFTP連接,
  在SFTP標籤中輸入“help”可以查看相關的SFTP命令。

五,建立FTP,NFS和交叉編譯環境

1,用命令配置TFTP服務
    A, 建立TFTP系統根目錄並修改權限
        root@yuanxh-desktop:/home/yuanxh/at91_works# mkdir  /tftpboot
        root@yuanxh-desktop:/home/yuanxh/at91_works# chmod 777  /tftpboot
    B,安裝TFTP服務器端和客戶端
        root@yuanxh-desktop:/# sudo apt-get install tftp tftpd openbsd-inetd
    C,修改配置文件使用TFTP根目錄 
        root@yuanxh-desktop:/home/yuanxh/at91_works# vi  /etc/inetd.conf
        在/etc/inetd.conf如下行中,後面路徑改成/tftpboot
        tftp    dgram   udp     wait    nobody  /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot
    D,啓動服務
        root@yuanxh-desktop:/home/yuanxh/at91_works#  /etc/init.d/openbsd-inetd  restart
    E,測試服務
        root@yuanxh-desktop:/home/yuanxh# touch /tftpboot/aaa
        root@yuanxh-desktop:/home/yuanxh# vi /tftpboot/aaa 
        root@yuanxh-desktop:/home/yuanxh# tftp 192.168.1.100
        tftp> get aaa
        tftp> quit
        root@yuanxh-desktop:/home/yuanxh# cat aaa

2,用命令配置NFS服務
    A,安裝NFS服務器端
        root@yuanxh-desktop:/home/yuanxh# apt-get install nfs-kernel-server  nfs-common  portmap
    B,配置訪問目錄及權限
        root@yuanxh-desktop:/home/yuanxh/at91_works# mkdir  /nfsboot
        root@yuanxh-desktop:/home/yuanxh/at91_works# chmod 777  /nfsboot
        root@yuanxh-desktop:/home/yuanxh/at91_works# touch  /nfsboot/yuanxh
        root@yuanxh-desktop:/# vi /etc/exports
        在/etc/exports新行中填入以下內容
        /nfsboot  *(rw,sync)
    C,啓動服務
        root@yuanxh-desktop:/# exportfs -ra
        root@yuanxh-desktop:/# /etc/init.d/portmap restart
        root@yuanxh-desktop:/# /etc/init.d/nfs-common restart
        root@yuanxh-desktop:/# /etc/init.d/nfs-kernel-server restart
    D,測試服務
        root@yuanxh-desktop:/# mount 192.168.1.100:/nfsboot  /mnt
        root@yuanxh-desktop:/home/yuanxh# ll /mnt
        root@yuanxh-desktop:/home/yuanxh# rm -rf /mnt/yuanxh
        root@yuanxh-desktop:/home/yuanxh# showmount
        root@yuanxh-desktop:/home/yuanxh# df
        root@yuanxh-desktop:/home/yuanxh# umount /mnt
        root@yuanxh-desktop:/home/yuanxh# ll /nfsboot
        
3,安裝交叉編譯工具鏈
    A,利用SecureCRT.v6.0.3登陸,傳送文件到系統
        root@yuanxh-desktop:/home/yuanxh# mkdir /usr/local/arm
        root@yuanxh-desktop:/home/yuanxh# chmod 777 /usr/local/arm/
        root@yuanxh-desktop:/home/yuanxh# cd /usr/local/arm/
        root@yuanxh-desktop:/usr/local/arm# rz
        在SecureCRT彈出的窗口中選擇交叉編譯工具安裝包arm-2007-01-21.iso
    B,安裝ELDK交叉編譯工具
     root@yuanxh-desktop:/usr/local/arm# cd /usr/local/
     root@yuanxh-desktop:/usr/local# mkdir eldk-4.1
        root@yuanxh-desktop:/usr/local# mount –o loop –t iso9660 arm-2007-01-21.iso /mnt/cdrom
        root@yuanxh-desktop:/usr/local# cp -av /mnt/cdrom/* eldk-4.1/
        root@yuanxh-desktop:/usr/local# cd eldk-4.1
        root@yuanxh-desktop:/usr/local/eldk-4.1# chmod 777 install 
        root@yuanxh-desktop:/usr/local/eldk-4.1# ./install -d /usr/local/arm/eldk-4.1
  注意:eldk-4.1在ubuntu-8.04安裝的rpm工具版本有問題,處理方法請查看
  http://lists.denx.de/pipermail/eldk/2008-July/000280.html
  在http://mirror.oss.lzu.edu.cn/software/embedded/eldk/4.2/ppc-linux-x86/distribution/RPMS/
  中下載rpm-4.4.2-46.i386.rpm ,rpm-build-4.4.2-46.i386.rpm,rpm-devel-4.4.2-46.i386.rpm
  在RPMS中增加rpm-4.4.2-46.i386.rpm ,rpm-build-4.4.2-46.i386.rpm,並在etc/rpm_cross.list 前兩行中修改啓用再安裝。
      
    D,把編譯器路徑添加到系統路徑中
        root@yuanxh-desktop:/usr/local/arm#  vi /root/.bashrc 
        在alias l='ls -CF'後的空白處填上:
  PATH=$PATH:/usr/local/arm/eldk-4.1/usr/bin:/usr/local/arm/eldk-4.1/bin
  export PATH
  啓動新系統路徑
  root@yuanxh-desktop:/usr/local/arm# source /root/.bashrc
  顯示新系統路徑
  root@yuanxh-desktop:/usr/local/arm# echo $PATH
  查看版本號
  root@yuanxh-desktop:/usr/local/arm# arm-linux-gcc -v

六,編譯U-BOOT啓動代碼

1,傳送文件包到LINUX系統並解壓
    A,利用SecureCRT.v6.0.3登陸,傳送文件到系統
        root@yuanxh-desktop:/home/yuanxh# mkdir s3c2410
        root@yuanxh-desktop:/home/yuanxh# chmod 777 s3c2410/
        root@yuanxh-desktop:/home/yuanxh# cd s3c2410/
        root@yuanxh-desktop:/home/yuanxh/s3c2410# rz
        在SecureCRT彈出的窗口中選擇u-boot-1.3.4.tar.bz2軟件包
    B,解壓軟件包
        root@yuanxh-desktop:/home/yuanxh/s3c2410# tar xjvf u-boot-1.3.4.tar.bz2
        
2,編譯生成U-BOOT啓動目標碼
    A,進入U-BOOT源碼樹
        root@yuanxh-desktop:/home/yuanxh/s3c2410# cd u-boot-1.3.4
    B,指定編譯器
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# vi Makefile
        把CROSS_COMPILE = arm-linux- 改成 CROSS_COMPILE=/usr/local/arm/eldk-4.1/usr/bin/arm-linux-
    C,配置並編譯
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make clean
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make mrproper
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make smdk2410_config
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# mv u-boot.bin u-boot-smdk2410.bin
 D,發送目標碼
        root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# sz u-boot-smdk2410.bin
        
3,編譯生成Jflash工具
    A,利用SecureCRT.v6.0.3登陸,傳送文件到系統
     root@yuanxh-desktop:/home/yuanxh/s3c2410# rz
     在SecureCRT彈出的窗口中選擇Jflash-s3c2410_linux.tar.bz2軟件包
     root@yuanxh-desktop:/home/yuanxh/s3c2410# mkdir Jflash-9gs3c2410
     root@yuanxh-desktop:/home/yuanxh/s3c2410# cd Jflash-9gs3c2410
 B,解壓軟件包
  root@yuanxh-desktop:/home/yuanxh/s3c2410/Jflash-9gs3c2410# tar xvjf ../Jflash-s3c2410_linux.tar.bz2 
 C,在系統內指定內核頭文件和體系結構頭文件
  root@yuanxh-desktop:/home/yuanxh/s3c2410/Jflash-9gs3c2410# cd /usr/src
  root@yuanxh-desktop:/usr/src# ln -s linux-headers-2.6.24-19/ linux
  root@yuanxh-desktop:/usr/src# cd linux/include
  root@yuanxh-desktop:/usr/src/linux/include# ln -s asm-x86/ asm
 D,在Makefile指定內核頭文件和體系結構頭文件路徑
  root@yuanxh-desktop:/usr/src/linux/include# cd /home/yuanxh/s3c2410/Jflash-9gs3c2410/
  root@yuanxh-desktop:/home/yuanxh/s3c2410/Jflash-9gs3c2410# vi Makefile 
  在 Makefile 的CFLAGS = -O2 -s -D__LINUX__ 後面添加上 -I/usr/src/linux/include/ 並保存退出
 E,編譯SJF生成目標碼Jflash-s3c2410並執行
  root@yuanxh-desktop:/home/yuanxh/s3c2410/Jflash-9gs3c2410# make
  root@yuanxh-desktop:/home/yuanxh/s3c2410/Jflash-9gs3c2410# ./Jflash-s3c2410
 F,同樣的原理,用Jflash_linux.tgz,生成 Jflash-s3c2440 工具
  
4,用SJF工具燒啓動代碼到GEC2440開發板
 A,按前面所說添加並口給虛擬機用,並把GEC2410_jtag V1.1 板的JP1並口與電腦並口接上,JP2的JTAG_2410口連接到GEC2440核心板
  開發板的J10的腳的標準JTAG口上,並打開開發板電源;
 B,在Linux上運行:
  ./Jflash-s3c2440  u-boot-smdk2410.bin /t=5 /d=10
  如果連接上了會顯示 S3C2440X(ID=0x0032409d) is detected.
 C,在[K9S1208 NAND Flash JTAG Programmer]界面,K9S1208 is detected. ID=0xec76 會檢測顯示出來,
  在Select the function to test : 後輸入0 並回車,確定0:K9S1208 Program 的功能;
 D,在[SMC(K9S1208V0M) NAND Flash Writing Program]界面,Available target block number: 0~4095 會顯示出來,
  在Input target block number: 後輸入0 並回車,確定寫入FLASH的首地址;
 E,最後會在STATUS:後顯示燒寫過程Epppppppppppppppppppppppppppppppp好幾行,基本是15秒種一個P,直到燒寫完畢;
 F,燒寫完畢後顯示0:K9S1208 Program      1:K9S1208 Pr BlkPage   2:Exit 時在 Select the function to test :
  後輸入2並回車退出燒錄工具。
  
5,移植u-boot-1.3.4到GEC2440開發板
 A,修改Makefile
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board# vi Makefile
  在Makefile中的EXTRAVERSION = 後添加 -gec2440 
  在Makefile中的smdk2410_config後增加如下兩行:
   gec2440_config : unconfig
    @$(MKCONFIG) $(@:_config=) arm arm920t gec2440 NULL s3c24x0
 B,在/board中添加GEC2440板定義
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# cd board/
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board# cp -av smdk2410/ gec2440
  修改源文件和Makefile
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board# cd gec2440/
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board/gec2440# mv smdk2410.c gec2440.c
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board/gec2440# vi Makefile 
  把COBJS   := smdk2410.o flash.o 改成 COBJS   := gec2440.o flash.o
 C,在include/configs/中建立配置頭文件
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/board/gec2440# cd ../../include/configs/
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/include/configs# cp smdk2410.h gec2440.h
 D,試編譯GEC2440開發板的U-BOOT目標碼
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4/include/configs# cd ../../
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make mrproper
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make clean
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make distclean
  root@yuanxh-desktop:/home/yuanxh/s3c2410/u-boot-1.3.4# make gec2440_config
 E,修改壓縮成u-boot-1.3.4-gev2440.tar.gz
  root@yuanxh-desktop:/home/yuanxh/s3c2410# mv u-boot-1.3.4 u-boot-1.3.4-gev2440
  root@yuanxh-desktop:/home/yuanxh/s3c2410# tar czvf u-boot-1.3.4-gev2440.tar.gz u-boot-1.3.4-gev2440/
  root@yuanxh-desktop:/home/yuanxh/s3c2410# sz u-boot-1.3.4-gev2440.tar.gz 
6,修改u-boot-1.3.4-gev2440.tar.gz源碼
 A,修改include/configs/gec2440.h 文件
  root@yuanxh-desktop:/home/yuanxh/s3c2410# cd u-boot-1.3.4-gev2440/include/configs/
  把
  #define CONFIG_S3C2410          1       /* in a SAMSUNG S3C2410 SoC     */
  #define CONFIG_SMDK2410          1       /* on a SAMSUNG SMDK2410 Board  */
  修改
  #define CONFIG_S3C2440          1       /* in a SAMSUNG S3C2440 SoC     */
  #define CONFIG_GEC2440          1       /* on a SAMSUNG GEC2440 Board  */
 
  
 (調試完畢,但筆記尚未整理完成)
  
   
        
七,爲S3C2410編譯ARM-LINUX內核

1,傳送文件包到LINUX系統並解壓
    利用SecureCRT 登陸,傳送文件到系統
        root@yuanxh-desktop:/home/yuanxh# cd s3c2410/
        root@yuanxh-desktop:/home/yuanxh/s3c2410# rz
        在SecureCRT彈出的窗口中選擇linux-2.6.26.tar.bz2包;
2,解壓內核
        root@yuanxh-desktop:/home/yuanxh/s3c2410# tar xjvf linux-2.6.26.tar.bz2
        root@yuanxh-desktop:/home/yuanxh/s3c2410# cd linux-2.6.26
3,爲內核指定編譯器
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# vi Makefile
        把 EXTRAVERSION = -9gs3c2410 寫上自己版本標識,指定體系結構和編譯器
        ARCH           ?= arm
        CROSS_COMPILE  ?= /usr/local/arm/eldk-4.1/usr/bin/arm-linux-
        添加可加載模塊安裝路徑
        INSTALL_MOD_PATH = $(TOPDIR)/modules-$(KERNELRELEASE)
4,編譯內核及發佈目標碼
    A,查看內核支持的開發板
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make help
    B,配置爲S3C2410板默認設置
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make s3c2410_defconfig
    C,編譯生成全部目標碼
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make
    D,也可分步依次生成zImage,可加載modules和安裝可加載模擬到默認目錄
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make zImage
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make modules
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make modules_install
    E,發送內核目標碼和可加載模塊
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# cp arch/arm/boot/zImage .
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# mv zImage zImage-2.6.26-gec2440.bin
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# sz zImage-2.6.26-gec2440.bin 
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# tar czvf modules-2.6.26-gec2440.tar.gz modules-2.6.26-gec2440/
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# sz modules-2.6.26-gec2440.tar.gz
 F,個性化配置內核
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make menuconfig
  .config中內核啓動命令行參數CONFIG_CMDLINE改爲:
  mem=64M console=ttySAC0,115200 initrd=0x32000000,8388608 root=/dev/ram0 rw init=/linuxrc
 G,編譯生成U-BOOT可識別目標碼uImage
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make uImage
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# cp arch/arm/boot/uImage .
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# mv uImage uImage-2.6.26-gec2440.bin
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# sz uImage-2.6.26-gec2440.bin
5,清除內核目標碼恢復未配置狀態
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make clean
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make distclean
        root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# make mrproper
6,修改linux-2.6.26代碼適合GEC2440開發板
 A,修改初時鐘始化
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# vi arch/arm/mach-s3c2440/mach-smdk2440.c
  註釋掉原來的時鐘初始化函數:
  //      s3c24xx_init_clocks(16934400);  // charge by [email protected]
  增加上新的時鐘初始化定義:
        s3c24xx_init_clocks(12000000);
    B,重新編譯內核
     root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26# ./mkall
     執行的腳本內容如下: 
     #!/bin/sh
  #make by [email protected]  for GEC2440 
  #make s3c2410_defconfig
  make 
  make uImage
  cp arch/arm/boot/uImage uImage-2.6.26-9g24x0.bin
  cp uImage-2.6.26-9g24x0.bin /tftpboot
  make modules_install INSTALL_MOD_PATH=./modules-2.6.26-9g24x0
  tar czvf modules-2.6.26-9g24x0.tar.gz ./modules-2.6.26-9g24x0
  cp modules-2.6.26-9g24x0.tar.gz  /tftpboot
 C,修改網絡CS8900問題
  修改Kconfig
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26-9g24x0# cd drivers/net/
  root@yuanxh-desktop:/home/yuanxh/s3c2410/linux-2.6.26-9g24x0/drivers/net# vi Kconfig

 

 (調試完畢,但筆記尚未整理完成)

  D,修改LCD驅動問題

發佈了30 篇原創文章 · 獲贊 21 · 訪問量 23萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章