国产精品免费无遮挡无码永久视频-国产高潮视频在线观看-精品久久国产字幕高潮-国产精品99精品无码视亚

電子工程網(wǎng)

標(biāo)題: 明遠(yuǎn)智睿MY-IMX28 Linux-3.14.54 編譯手冊(cè)(3) [打印本頁]

作者: myzr123    時(shí)間: 2019-3-11 17:13
標(biāo)題: 明遠(yuǎn)智睿MY-IMX28 Linux-3.14.54 編譯手冊(cè)(3)
【接上一章節(jié)明遠(yuǎn)智睿MY-IMX28 Linux-3.14.54 編譯手冊(cè)(2)】

7  應(yīng)用程序編譯
7.1  Linux應(yīng)用程序編譯
7.1.1  編寫應(yīng)用程序
進(jìn)入工作目錄
$ cd ~/my-imx28/01_application/

編寫源代碼
$ vim hello.c 
寫入以下代碼并保存 
include  
int main(int argc, char **argv) 

  printf("Hello, MYZR!\n"); 
  return; 

查看代碼 
$ cat hello.c 


7.1.2  編譯應(yīng)用程序
配置環(huán)境變量
$ source ~/my-imx28/03_tools/gcc-4.4.4-glibc-2.11.1-multilib-env

編譯 
$ ${CROSS_COMPILE}gcc hello.c -o hello.out 

注意:上面的命令有包含“$”號(hào),即“${CROSS_COMPILE}gcc”,是引用我們source時(shí)產(chǎn)生的環(huán)境變量。 
目標(biāo)文件 
$ file hello.out 

可以看到目標(biāo)文件 hello.out 的屬性。

8  文件系統(tǒng)
8.1  文件系統(tǒng)rootfs.tar.bz2
用以下的方式增加自己的應(yīng)用:(把MY-IMX28_Born_Tool\Profiles\MX28 Linux Update\OS Firmware\files\image-linux-31454/rootfs.tar.bz2復(fù)制到“~/my-imx28/04_image/”目錄下)。


8.2  文件系統(tǒng)filesystem.ubifs
復(fù)制mkfs.ubifs,ubinize到電腦的“/usr/bin”目錄下(如果電腦有這兩個(gè)應(yīng)用就不需要復(fù)制了);復(fù)制build_rootfs和ubinize.cfg到“~/my-imx28/04_image/”目錄。


9  燒寫方式
至此,我們?cè)凇皛/my-imx28/02_source/”得到了除文件系統(tǒng)以外的一套燒錄文件。包括“u-boot.sb”、“imx28-evk.dtb”、“zImage”、“rootfs.tar.bz2”。

9.1  使用MFGTOOL燒寫
把文件“u-boot.sb”、“imx28-evk.dtb”、“zImage”、“rootfs.tar.bz2復(fù)制到“MY-IMX28_Born_Tool\Profiles\MX28 Linux Update\OS Firmware\files\image-linux-31454”目錄下。按住REC按鍵,插上MINI USB線和電源線,接著打開MfgTool.exe,點(diǎn)擊“掃描設(shè)備”,檢測(cè)到HID設(shè)備時(shí),松開REC按鍵,如下所示:


點(diǎn)擊菜單的“Options”,然后在選項(xiàng)“Profiles”選擇“MY-IMX28-3.14.54 NAND with uboot”,接著點(diǎn)擊“確定”,最后點(diǎn)擊“開始”。

燒寫成功后,點(diǎn)擊“停止”就OK了。
注意:如果你用的文件系統(tǒng)是rootfs-qt.tar.bz2,請(qǐng)選擇“QT-MY-IMX28-3.14.54 NAND with uboot”燒寫鏡像。

9.2  使用網(wǎng)絡(luò)燒寫
9.2.1  搭建TFTP (ubuntu系統(tǒng))
(1) Setup tftp server files (下載并安裝tftp)
  $ sudo apt-get install tftpd tftp openbsd-inetd
(2) make a tftp directory (新建tftp目錄和改變其屬性)
Here we make /home/myzr/tftpt be a tftp directory.
  $ mkdir /home/myzr/tftp
  $ chmod 777 /home/myzr/tftp
(3) Open /etc/inetd.conf and edit it (修改配置文件的tftp目錄)
  $ sudo gedit /etc/inetd.conf
Coment this line :
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /srv/tftp
Add new line:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /home/myzr/tftp
(4)Restarting tftp service (重啟tftp)
  $ sudo /etc/init.d/openbsd-inetd restart

9.2.2  搭建NFS (網(wǎng)絡(luò)燒寫不需要用到nfs)
(1) Install NFS server package (下載并安裝nfs)
  $ sudo apt-get install nfs-kernel-server
(2) Create NFS directory:/home/myzr/nfsroot (新建nfs目錄)
  $ mkdir /home/myzr/nfsroot
(3) Configure mounted directory and authority (修改配置文件的nfs目錄)
  $ sudo gedit /etc/exports
Add the following line at the end of the file:
/home/myzr/nfsroot *(rw,sync,no_root_squash)
(4) Restart the NFS service (重啟nfs)
  $ sudo /etc/init.d/portmap restart
  $ sudo /etc/init.d/nfs-kernel-server restart

9.2.3  tftp下載
(1) 把“u-boot.sb”、“imx28-evk.dtb”、“zImage”、“filesystem.ubifs”復(fù)制到“/home/myzr/tftp”目錄下。
(2) 設(shè)置環(huán)境變量(板子和電腦網(wǎng)線直連)
$ setenv ipaddr 192.168.3.104 (板子IP)
$ setenv serverip 192.168.3.110 (電腦IP)
(3) 燒寫
$ run update_nand_kernel (燒寫zImage)


$ run update_nand_fdt (燒寫fdt)


$ run update_nand_filesystem (燒寫文件系統(tǒng))


10  登錄方式
10.1  串口登錄
插上USB轉(zhuǎn)串口線和電源,開機(jī)后,差不多10秒后,在終端上敲回車鍵可以進(jìn)入系統(tǒng)。


【下章節(jié)為明遠(yuǎn)智睿MY-IMX28 Linux-3.14.54 編譯手冊(cè)(4)】




歡迎光臨 電子工程網(wǎng) (http://m.4huy16.com/) Powered by Discuz! X3.4