2014年8月14日 星期四

TQ210 Android 4.0.4 NFS設定

使用v2版本的file system即天嵌科技之修改版,檔案只有u-boot,kernel,rootfs_dir三個
有獨立的filesystem系統檔案 PATH: /android_4.0.4_tq210/out/target/product/tq210/rootfs_dir
因此方便將rootfs_dir掛載成NFS


編譯檔案系統(從頭開始約70分鐘)


a. 設定防火牆 (使用ufw)(可不作)
Ubuntu 12.04 LTS請先關閉防火牆
啟用
#sudo ufw enable
關閉
#sudo ufw disable
查看防火牆狀態/規則
  sudo ufw status


b. 安裝掛載程式(Install NFS)


b-1 安裝程式
#sudo apt-get install nfs-common nfs-kernel-server


b-2 修改Config NFS
#sudo vim /etc/exports
  增加這行=>
/home/cadtc/v2_Android_BSP_Porting/android_4.0.4_tq210/out/target/product/tq210/rootfs_dir_1  *(rw,sync,no_root_squash)
/media/android_mnt/rootfs_dir_1  *(rw,sync,no_root_squash)


b-3 Restart NFS Server
#sudo /etc/init.d/nfs-kernel-server restart


b-4 Test NFS (First)
#sudo mount -t nfs -o nolock -o tcp 127.0.0.1:/home/cadtc/v2_Android_BSP_Porting/android_4.0.4_tq210/out/target/product/tq210/rootfs_dir_1 /mnt
# df    //查看掛載的裝置
#sudo umount /mnt   //卸載裝置


c. Kernel設定NFS


以下問題需要修改kernel的NFS相關的配置
[    4.336555] IP-Config: Complete:
[    4.336586]      device=eth0, addr=192.168.0.20, mask=255.255.255.0, gw=192.168.0.1,
[    4.336657]      host=hello, domain=, nis-domain=com.tw,
[    4.336701]      bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
[    4.340467] VFS: Cannot open root device "nfs" or unknown-block(0,255)
[    4.346383] Please append a correct "root=" boot option; here are the available partitions:
[    4.354727] 1f00            1024 mtdblock0  (driver?)
[    4.359706] 1f01            5120 mtdblock1  (driver?)
[    4.364728] 1f02            5120 mtdblock2  (driver?)
[    4.369754] 1f03            3072 mtdblock3  (driver?)
[    4.374780] 1f04          253952 mtdblock4  (driver?)
[    4.379806] 1f05           81920 mtdblock5  (driver?)
[    4.384833] 1f06          698368 mtdblock6  (driver?)
[    4.389857] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,255)
[   15.211409] eth0: no IPv6 routers present


#cd linux_3.0.8_tq210
#make menuconfig
如下所示,注意,NFS的配置選項必須在TCP/IP選擇之後才可以看到。
[*] Networking support  --->
     Networking options  --->
      [*] TCP/IP networking
      [*]   IP: kernel level autoconfiguration
      [*]     IP: BOOTP support

  Device Drivers  --->
      [*] Network device support  --->
             <*>   PHY Device support and infrastructure  --->
             [*]   Ethernet (10 or 100Mbit)  --->
                    <*>   DM9000 support

  File systems  --->
      [*] Network File Systems  --->
             <*>   NFS client support
             [*]     NFS client support for NFS version 3
             [ ]       NFS client support for the NFSv3 ACL protocol extension
             [*]     NFS client support for NFS version 4
             [ ]       NFS client support for NFSv4.1
             [*]   Root file system on NFS\


d. u-boot設定setenv


u-boot開機設定不對產生以下訊息,提示找不到init檔案
[    4.342677] IP-Config: Complete:                                             
[    4.342707]      device=eth0, addr=192.168.0.20, mask=255.255.255.0, gw=192.,
[    4.342778]      host=hello, domain=, nis-domain=com.tw,                     
[    4.343078]      bootserver=255.255.255.255, rootserver=192.168.0.1, rootpat=
[    5.450910] VFS: Mounted root (nfs filesystem) on device 0:13.               
[    5.451017] Freeing init memory: 176K                                        
[    5.452843] Kernel panic - not syncing: No init found.  Try passing init= op.
[   15.132446] eth0: no IPv6 routers present          


請在u-boot設定setenv
#setenv   bootargs    noinitrd     console=ttySAC0,115200    init=/init    root=/dev/nfs rw nfsroot=192.168.0.1:/home/cadtc/v2_Android_BSP_Porting/android_4.0.4_tq210/out/target/product/tq210/rootfs_dir,rsize=1024,wsize=1024   rw    ip=192.168.0.20:192.168.0.1:255:255.255.0:linux_by_zsy:eth0:off
#save
#re
#boot


註解:
將rootfs_dir改名為rootfs_dir_1 區別編譯版本


#setenv   bootargs    noinitrd     console=ttySAC0,115200    init=/init    root=/dev/nfs rw nfsroot=192.168.0.1:/media/android_mnt/rootfs_dir_1,rsize=1024,wsize=1024   rw    ip=192.168.0.20:192.168.0.1:255:255.255.0:linux_by_zsy:eth0:off


setenv   bootargs    noinitrd     console=ttySAC0,115200    init=/init    root=/dev/nfs rw nfsroot=192.168.0.1:/media/android_mnt/rootfs_addLED_0807,rsize=1024,wsize=1024   rw    ip=192.168.0.20:192.168.0.1:255:255.255.0:linux_by_zsy:eth0:off


v2版本的磁碟分割
ptn 0 name='bootloader' start=0x0 len=0x200000(~2048KB)                         
ptn 1 name='kernel' start=0x200000 len=0x800000(~8192KB)                        
ptn 2 name='rootfs' start=0xA00000 len=N/A (Yaffs)


還原回預設值
#bootargs=noinitrd root=/dev/mtdblock2 rootfstype=yaffs2 init=/init console=ttyS0
#bootcmd=nand read 0xc0008000 200000 800000;bootm c0008000


e. 編譯 Build Busybox


[Host]
       1. wget http://busybox.net/downloads/busybox-1.21.1.tar.bz2
       2. tar -jxvf busybox-1.21.1.tar.bz2
       3. cd busybox-1.21.1/
       4. sudo apt-get install libncurses5-dev
       5. make menuconfig
               Busybox Settings  --->
                       General Configuration  --->
                               [*] Don't use /usr
               Busybox Settings  --->
                       Build Options  --->
                               [*] Build BusyBox as a static binary (no shared libs)
                               (arm-linux-) Cross Compiler prefix


       6. make -j8
       7. make install
       8. adb push _install/ /system/busybox/


備註:
       vim ~/Android_BSP_Porting/android_4.0.4_tq210/device/embedsky/tq210/init.rc
       export PATH /system/busybox/bin:/system/busybox/sbin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin


沒有busybox文字只有黑白,但可以使用reboot
有busybox文字會變色,但不能使用reboot
no_busybox.png
have_busybox.png

沒有留言:

張貼留言