Hi3515支持NFS-ROOT启动
http://www.non-pancaker.com/%E9%A1%B9%E7%9B%AE/hi3515%E6%94%AF%E6%8C%81nfs-root%E5%90%AF%E5%8A%A8/
目前在做Hi3515平臺監(jiān)控項目,前期開發(fā)一直使用SDK里推薦的mount nfs方式來調試代碼,雖然也算方便,但是我一直覺得用法NFS-ROOT才是最省事的方法,而且最接近最終用戶使用環(huán)境,因為如果NFS-ROOT調試完成后,就直接可以出firmware了.
由于SDK幾乎將所有用到的驅動都獨立編譯成了ko文件,所以為了將驅動編譯到內核中,還是需要做一番工作的,由于初次接觸內核和驅動,所以很多東西都是剛了解的。通過不斷的試錯和調試,終于搞定了網卡驅動和NFS-ROOT的支持。
若想內核支持NFS-ROOT,主要是兩個方面的功能配置,一是ethernet,讓網卡在內核運行時驅動自動加載,這樣才不會導致eth0找不到的情況,而是nfs內核中的相關配置選項。
step 0.?復制使用到的config配置文件
cp arch/arm/configs/hi3515v100_full_release_defconfig .config
step 1.在內核代碼中增加網卡驅動
? ???step 1.0 在驅動目錄下增加hiether文件夾,用來存放hi3515的網卡驅動
? ? ? ? ? ? ? ? ? mkdir?linux-2.6.24/drivers/net/hiether
? ???step 1.1 復制已有的網卡驅動到新添加的文件夾中
? ? ? ? ? ? ? ? ? cp Hi3515_SDK_V1.0.5.0.c1/source/drv/hi3515v100-sfv300?linux-2.6.24/drivers/net/hiether
? ???step 1.2 修改驅動文件夾中的代碼
? ? ? ? ? ? ? ? ? 由于原有驅動是用來編譯為獨立的ko文件的,所以里面的部分函數使用了__exit標志,用來表示只用來作為模塊退出使用的函數,如果不將次函數的__exit標志去掉,在編譯內核的時候會打印
? ? ? ? ? ? ? “ `.exit.text’ referenced in section `.init.text’ of drivers/built-in.o: defined in discarded section `.exit.text’ of drivers/built-in.o`.exit.text’ referenced in section `.data’ of drivers/built-in.o: defined in discarded section `.exit.text’ of drivers/built-in.o`.exit.text’ referenced in section `.data’ of drivers/built-in.o: defined in discarded section `.exit.text’ of drivers/built-in.omake: *** [.tmp_vmlinux1] 錯誤 1”
? ? ? ? ? ? ? ? ? 簡單的將__exit標志去掉,就能順利通過編譯了。
? ???step 1.3 增加菜單選項
? ? ? ? ? ? ? ? ? 要想通過menuconfig來選擇是否選擇hiether驅動,要做一下修改:
? ? ? ? ? ? ? ? ????step 1.3.0 修改Kconfig文件
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 在net/Kconfig中config DM9000下面的位置增加下面內容
config DM9000
? ? tristate “DM9000 support”
??? depends on ARM || BLACKFIN || MIPS
??? select CRC32
??? select MII
??? —help—
????? Support for DM9000 chipset.
????? To compile this driver as a module, choose M here.? The module
????? will be called dm9000.
config HIETHER
??? tristate “HIETHER support”
??? —help—
? ? ? ????step 1.3.1 修改net/Makefile,增加需要編譯的文件夾
? ? ? ? ? ? ? ? ? ? ? ? ? obj-$(CONFIG_HIETHER) += hiether/
? ? ??? ??step 1.3.2 在hiether文件夾中增加Makefile文件,內容如下
? ? ? ? ? ? ? ? ? ? ? ? ? obj-$(CONFIG_HIETHER) += hiether.o
hiether-objs := mdio.o mii-drv.o mac.o ctrl.o glb.o net-drv.o mm.o sys.o proc.o
? ? ? ? ??step 1.3.3 make menuconfig 選擇新增加的驅動
? ? ?????????????????????[*] Network device support? —> ?[*]?? Ethernet (10 or 100Mbit)? —> <*>?? hiether support
step 2.?內核增加對NFS-ROOT的支持
? ? ? ? ?Networking? —>Networking options? —>[*]?? IP: kernel level autoconfiguration
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [*]???? IP: DHCP support
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [*]???? IP: BOOTP support
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [*]???? IP: RARP support
? ? ???? File systems? —> [*] Network File Systems? —>?<*>?? NFS file system support
? ? ???????????????????????????????????????????????????????????????????????????? [*]???? Allow direct I/O on NFS files
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[*]?? Root file system on NFS
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?[*]?? Support for rpcbind versions 3 & 4 (EXPERIMENTAL)
step 3.重新編譯內核
? ? ? ? ? make; make uImage
step4.?測試
? ? ? ? ? 宿主機要安裝nfs,tftp,這些網上教程很多,這里就不羅嗦了
? ? ? ? ? 啟動參數setenv bootargs busclk=220000000 mem=64M console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=192.168.6.141:/tftpboot/hi3515.filesys, nolock eth=00:1e:9a:04:5c:4d ip=192.168.6.143:192.168.6.100:192.168.6.254:255.255.255.0:tocore:eth0:off pcimod=host pciclksel=1
? ? ? ? ? 下載最新內核并運行
? ? ? ? ? ??tftp 0xc1000000 uImage; bootm 0xc1000000
—————————啟動打印信息————————————————–
IP-Config: Complete:
device=eth0, addr=192.168.6.143, mask=255.255.255.0, gw=192.168.6.254,
host=tocore, domain=, nis-domain=(none),
bootserver=192.168.6.100, rootserver=192.168.6.141, rootpath=
Looking up port of RPC 100003/2 on 192.168.6.141
PHY: 0:01 – Link is Up – 100/Full
Looking up port of RPC 100005/1 on 192.168.6.141
VFS: Mounted root (nfs filesystem).
Freeing init memory: 112K
總結
以上是生活随笔為你收集整理的Hi3515支持NFS-ROOT启动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Uboot中start.S源码的指令级的
- 下一篇: 海思108M 4D1模式含义