歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux技術

基於FS4412嵌入式系統移植(2) NFS文件系統啟動linux體驗

這一節目標有3個:
1、將uboot拷貝到emmc中,並在emmc中啟動uboot
2、調試tftp,能夠通過uboot使用tftp從linux的tftp共享文件夾中拷貝數據到開發板內存中。
3、設置uboot啟動配置,達到能夠從服務器中加載內核和設備樹,並掛載nfs文件系統。
1、將uboot拷貝到emmc中
連接串口和板子,運行串口通信程序,這裡如何配置就不在多講了。
關閉開發板電源,將撥碼開關 SW1 調至(1000)(SD 啟動模式)後將剛才做好的 SD 啟動盤插入 SD 卡插槽,打開電源。
這是沒有意外會看到uboot啟動,並在倒計時,這時候按鍵盤的按鍵,停止uboot倒計時。
將SD卡上的u-boot-fs4412.bin文件燒寫到eMMC中
在串口終端上執行
sdfuse flashall
等待終端無輸出是表示燒寫結束
關閉開發板電源,將撥碼開關 SW1 調至 0110(EMMC 啟動模式)後打開電源可以看到如下界面表示燒寫成功
U-Boot 2013.01 (Aug 24 2014 - 12:01:19) for FS4412

CPU:    Exynos4412@1000MHz

Board: FS4412
DRAM:  1 GiB
WARNING: Caches not enabled
MMC:   MMC0:    3728 MB
In:    serial
Out:   serial
Err:   serial

MMC read: dev # 0, block # 48, count 16 ...16 blocks read: OK
eMMC CLOSE Success.!!

Checking Boot Mode ... EMMC4.41
Net:   dm9000
Hit any key to stop autoboot:  4

這樣就將sd卡中的bin文件拷貝到了eMMC中,以後就可以在emmc中的uboot啟動,而不需要使用sd卡了。
2、調試tftp
目前為止我們已經可以在開發板上啟動uboot,但是還沒有辦法運行linux,因為鏡像文件還在我們的虛擬機中,我們需要將虛擬機中的鏡像文件拷貝到開發板的對應位置才行,下面就使用tftp將虛擬機中的鏡像文件拷貝到開發板的內存中。
先要准備內核鏡像文件和設備樹文件:
將鏡像文件uImage 拷貝到 ubuntu 的 /tftpboot目錄下,uImage 文件下載地址:uImage
將exynos4412-fs4412.dtb 拷貝到 ubuntu 的 /tftpboot目錄下,exynos4412-fs4412.dtb文件下載地址:exynos4412-fs4412.dtb
放入文件夾後需要注意下文件的權限,必須要擁有讀寫權限。
在串口終端中進入uboot的命令行模式,就是在倒計時時按鍵,打斷倒計時。
首先需要使用網線將開發板與電腦連接,只要保證開發板和電腦在同一個局域網中就可以。
然後在串口終端中輸入ping 192.168.1.120,其中的ip地址是虛擬機的IP,根據實際情況修改。
串口會返回如下,表示網絡可以連接:
dm9000 i/o: 0x5000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
host 192.168.1.133 is alive
如果返回如下表示網絡不通:
dm9000 i/o: 0x5000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
ping failed; host 192.168.1.133 is not alive

網絡不通有很多原因,說一下幾種最有可能的原因:ip錯了,網線沒有接好,防火牆,可能的原因各種各樣,需要自己查找,但是ping通是必須的。
ping通之後在串口終端中輸入下面指令
tftp 41000000 uImage
這個命令是使用tftp將uImage文件從虛擬機中拷貝到內存41000000中。
這個正確的結果應該是:
dm9000 i/o: 0x5000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.217; our IP address is 192.168.1.78
Filename 'uImage'.
Load address: 0x41000000
Loading: #################################################################
         #################################################################
         #################################################################
         ############
         995.1 KiB/s
done
Bytes transferred = 3028040 (2e3448 hex)

如果沒有出現#############,而是TTTTTTTTTTTTTTTTT,說明傳輸不成功,可能的原因是虛擬機中tftp服務器沒有啟動,需要使用sudo service tftpd-hpa restart指令重新啟動tftp服務器。
如果上面的步驟成功了,那就基本完成了本次的工作,下面在uboot中,輸入一下命令,其中serverip是虛擬機ip,ipaddr是你想給開發板設置的ip,nfsroot=192.168.1.120:/source/rootfs路徑是虛擬機中nfs的你、共享路徑。
set serverip 192.168.1.120
set ipaddr 192.168.1.233
set bootcmd tftp 41000000 uImage\;tftp 42000000 exynos4412-fs4412.dtb\;bootm 41000000 - 42000000
set bootargs root=/dev/nfs nfsroot=192.168.1.120:/source/rootfs rw console=ttySAC2,115200 init=/linuxrc ip=192.168.1.233
saveenv

然後重新給開發板上電就可以自動的從虛擬機中讀取內核鏡像和設備樹,並自動掛載到虛擬機的nfs共享目錄上,如果在啟動內核完成後,沒有繼續掛載nfs,可以查看一下虛擬機的nfs服務是否開啟。
啟動畫面如下:
U-Boot 2013.01 (Aug 24 2014 - 12:01:19) for FS4412

CPU:    Exynos4412@1000MHz

Board: FS4412
DRAM:  1 GiB
WARNING: Caches not enabled
MMC:   MMC0:    3728 MB
In:    serial
Out:   serial
Err:   serial

MMC read: dev # 0, block # 48, count 16 ...16 blocks read: OK
eMMC CLOSE Success.!!

Checking Boot Mode ... EMMC4.41
Net:   dm9000
Hit any key to stop autoboot:  0 
dm9000 i/o: 0x5000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.217; our IP address is 192.168.1.78
Filename 'uImage'.
Load address: 0x41000000
Loading: T #################################################################
         #################################################################
         #################################################################
         ############
         375 KiB/s
done
Bytes transferred = 3028040 (2e3448 hex)
dm9000 i/o: 0x5000000, id: 0x90000a46 
DM9000: running in 16 bit mode
MAC: 11:22:33:44:55:66
operating at 100M full duplex mode
Using dm9000 device
TFTP from server 192.168.1.217; our IP address is 192.168.1.78
Filename 'exynos4412-fs4412.dtb'.
Load address: 0x42000000
Loading: T ###
         5.9 KiB/s
done
Bytes transferred = 34358 (8636 hex)
## Booting kernel from Legacy Image at 41000000 ...
   Image Name:   Linux-3.14.0
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3027976 Bytes = 2.9 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 42000000
   Booting using the fdt blob at 0x42000000
   Loading Kernel Image ... OK
OK
   Loading Device Tree to 4fff4000, end 4ffff635 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0xa00
[    0.000000] Linux version 3.14.0 (david@ubuntu) (gcc version 4.6.4 (crosstool-NG hg+default-2685dfa9de14 - tc0002) ) #23 SMP PREEMPT Fri Aug 15 11:30:16 CST 2014
[    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine model: Insignal Origen evaluation board based on Exynos4412
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] CPU EXYNOS4412 (id 0xe4412011)
[    0.000000] Running under secure firmware.
[    0.000000] PERCPU: Embedded 7 pages/cpu @eefb6000 s7424 r8192 d13056 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 256528
[    0.000000] Kernel command line: root=/dev/nfs nfsroot=192.168.1.217:/nfs/rootfs rw console=ttySAC2,115200 init=/linuxrc ip=192.168.1.78
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 1016852K/1032192K available (3956K kernel code, 237K rwdata, 1320K rodata, 231K init, 276K bss, 15340K reserved, 270336K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
[    0.000000]     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc052f41c   (5278 kB)
[    0.000000]       .init : 0xc0530000 - 0xc0569d00   ( 232 kB)
[    0.000000]       .data : 0xc056a000 - 0xc05a5540   ( 238 kB)
[    0.000000]        .bss : 0xc05a554c - 0xc05ea584   ( 277 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] Exynos4x12 clocks: sclk_apll = 500000000, sclk_mpll = 800000000
[    0.000000]  sclk_epll = 96000000, sclk_vpll = 350000000, arm_clk = 1000000000
[    0.000000] sched_clock: 32 bits at 200 Hz, resolution 5000000ns, wraps every 10737418240000000ns
[    0.000000] Console: colour dummy device 80x30
[    0.045000] Calibrating delay loop... 1992.29 BogoMIPS (lpj=4980736)
[    0.045000] pid_max: default: 32768 minimum: 301
[    0.045000] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.045000] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.050000] CPU: Testing write buffer coherency: ok
[    0.050000] missing device node for CPU 0
[    0.050000] missing device node for CPU 1
[    0.050000] missing device node for CPU 2
[    0.050000] missing device node for CPU 3
[    0.050000] CPU0: thread -1, cpu 0, socket 10, mpidr 80000a00
[    0.050000] Setting up static identity map for 0x403c0e10 - 0x403c0e68
[    0.070000] CPU1: Booted secondary processor
[    0.090000] CPU1: thread -1, cpu 1, socket 10, mpidr 80000a01
[    0.100000] CPU2: Booted secondary processor
[    0.120000] CPU2: thread -1, cpu 2, socket 10, mpidr 80000a02
[    0.130000] CPU3: Booted secondary processor
[    0.150000] CPU3: thread -1, cpu 3, socket 10, mpidr 80000a03
[    0.150000] Brought up 4 CPUs
[    0.150000] SMP: Total of 4 processors activated.
[    0.150000] CPU: All CPU(s) started in SVC mode.
[    0.150000] devtmpfs: initialized
[    0.150000] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
[    0.155000] pinctrl core: initialized pinctrl subsystem
[    0.155000] regulator-dummy: no parameters
[    0.155000] NET: Registered protocol family 16
[    0.155000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.175000] S3C Power Management, Copyright 2004 Simtec Electronics
[    0.175000] EXYNOS4x12 PMU Initialize
[    0.175000] EXYNOS: Initializing architecture
[    0.210000] bio: create slab <bio-0> at 0
[    0.210000] VMEM_VDD_2.8V: 2800 mV 
[    0.215000] SCSI subsystem initialized
[    0.215000] usbcore: registered new interface driver usbfs
[    0.215000] usbcore: registered new interface driver hub
[    0.215000] usbcore: registered new device driver usb
[    0.215000] s3c-i2c 13860000.i2c: slave address 0x00
[    0.215000] s3c-i2c 13860000.i2c: bus frequency set to 19 KHz
[    0.220000] sec_pmic 0-0066: No interrupt specified, no interrupts
[    0.245000] VDD_ALIVE: failed to apply 1100000uV constraint
[    0.245000] s5m8767-pmic s5m8767-pmic: regulator init failed for 0
[    0.245000] s3c-i2c 13860000.i2c: i2c-0: S3C I2C adapter
[    0.245000] Switched to clocksource mct-frc
[    0.275000] NET: Registered protocol family 2
[    0.275000] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.275000] TCP bind hash table entries: 8192 (order: 5, 163840 bytes)
[    0.275000] TCP: Hash tables configured (established 8192 bind 8192)
[    0.275000] TCP: reno registered
[    0.275000] UDP hash table entries: 512 (order: 2, 24576 bytes)
[    0.275000] UDP-Lite hash table entries: 512 (order: 2, 24576 bytes)
[    0.275000] NET: Registered protocol family 1
[    0.280000] RPC: Registered named UNIX socket transport module.
[    0.280000] RPC: Registered udp transport module.
[    0.280000] RPC: Registered tcp transport module.
[    0.280000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.280000] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.280000] bounce pool size: 64 pages
[    0.305000] ROMFS MTD (C) 2007 Red Hat, Inc.
[    0.305000] msgmni has been set to 1458
[    0.305000] io scheduler noop registered
[    0.305000] io scheduler deadline registered
[    0.310000] io scheduler cfq registered (default)
[    0.325000] dma-pl330 12680000.pdma: Loaded driver for PL330 DMAC-1315632
[    0.325000] dma-pl330 12680000.pdma:         DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
[    0.335000] dma-pl330 12690000.pdma: Loaded driver for PL330 DMAC-1315632
[    0.335000] dma-pl330 12690000.pdma:         DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
[    0.335000] dma-pl330 12850000.mdma: Loaded driver for PL330 DMAC-1315632
[    0.335000] dma-pl330 12850000.mdma:         DBUFF-64x8bytes Num_Chans-8 Num_Peri-1 Num_Events-32
[    0.530000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.535000] 13800000.serial: ttySAC0 at MMIO 0x13800000 (irq = 84, base_baud = 0) is a S3C6400/10
[    0.535000] 13810000.serial: ttySAC1 at MMIO 0x13810000 (irq = 85, base_baud = 0) is a S3C6400/10
[    0.535000] 13820000.serial: ttySAC2 at MMIO 0x13820000 (irq = 86, base_baud = 0) is a S3C6400/10
[    1.150000] console [ttySAC2] enabled
[    1.155000] 13830000.serial: ttySAC3 at MMIO 0x13830000 (irq = 87, base_baud = 0) is a S3C6400/10
[    1.180000] brd: module loaded
[    1.190000] loop: module loaded
[    1.195000] dm9000 5000000.ethernet: read wrong id 0x01010101
[    1.200000] eth0: dm9000a at f0076000,f0078004 IRQ 167 MAC: 00:0a:2d:a6:55:a2 (platform data)
[    1.205000] usbcore: registered new interface driver asix
[    1.210000] usbcore: registered new interface driver ax88179_178a
[    1.220000] usbcore: registered new interface driver cdc_ether
[    1.225000] usbcore: registered new interface driver smsc75xx
[    1.230000] usbcore: registered new interface driver smsc95xx
[    1.235000] usbcore: registered new interface driver net1080
[    1.240000] usbcore: registered new interface driver cdc_subset
[    1.245000] usbcore: registered new interface driver zaurus
[    1.250000] usbcore: registered new interface driver cdc_ncm
[    1.260000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.265000] ehci-exynos: EHCI EXYNOS driver
[    1.270000] exynos-ehci 12580000.ehci: no platform data or transceiver defined
[    1.275000] platform 12580000.ehci: Driver exynos-ehci requests probe deferral
[    1.285000] usbcore: registered new interface driver usb-storage
[    1.300000] usb3503 8.usb3503: switched to HUB mode
[    1.300000] usb3503 8.usb3503: usb3503_probe: probed in hub mode
[    1.310000] mousedev: PS/2 mouse device common for all mice
[    1.315000] input: 100a0000.keypad as /devices/100a0000.keypad/input/input0
[    1.325000] device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised: [email protected]
[    1.330000] sdhci: Secure Digital Host Controller Interface driver
[    1.335000] sdhci: Copyright(c) Pierre Ossman
[    1.340000] s3c-sdhci 12530000.sdhci: clock source 2: mmc_busclk.2 (40000000 Hz)
[    1.350000] mmc0: no vqmmc regulator found
[    1.355000] mmc0: no vmmc regulator found
[    1.390000] mmc0: SDHCI controller on samsung-hsmmc [12530000.sdhci] using ADMA
[    1.395000] Synopsys Designware Multimedia Card Interface Driver
[    1.400000] dwmmc_exynos 12550000.mmc: no vmmc regulator found: -19
[    1.405000] dwmmc_exynos 12550000.mmc: Using internal DMA controller.
[    1.410000] dwmmc_exynos 12550000.mmc: Version ID is 240a
[    1.420000] dwmmc_exynos 12550000.mmc: DW MMC controller at irq 109, 32 bit host data width, 128 deep fifo
[    1.460000] dwmmc_exynos 12550000.mmc: 1 slots initialized
[    1.465000] usbcore: registered new interface driver usbhid
[    1.470000] usbhid: USB HID core driver
[    1.475000] TCP: cubic registered
[    1.475000] NET: Registered protocol family 17
[    1.480000] NET: Registered protocol family 15
[    1.485000] Registering SWP/SWPB emulation handler
[    1.490000] VMEM_VDD_2.8V: disabling
[    1.495000] regulator-dummy: disabling
[    1.500000] exynos-ehci 12580000.ehci: EHCI Host Controller
[    1.500000] mmc1: BKOPS_EN bit is not set
[    1.500000] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 52000000Hz, actual 50000000HZ div = 0)
[    1.505000] mmc_host mmc1: Bus speed (slot 0) = 100000000Hz (slot req 52000000Hz, actual 50000000HZ div = 1)
[    1.505000] mmc1: new high speed DDR MMC card at address 0001
[    1.535000] exynos-ehci 12580000.ehci: new USB bus registered, assigned bus number 1
[    1.540000] exynos-ehci 12580000.ehci: irq 102, io mem 0x12580000
[    1.540000] mmcblk0: mmc1:0001 4YMD3R 3.64 GiB 
[    1.540000] mmcblk0boot0: mmc1:0001 4YMD3R partition 1 4.00 MiB
[    1.540000] mmcblk0boot1: mmc1:0001 4YMD3R partition 2 4.00 MiB
[    1.540000] mmcblk0rpmb: mmc1:0001 4YMD3R partition 3 512 KiB
[    1.570000]  mmcblk0: p1 p2 p3 p4
[    1.575000]  mmcblk0boot1: unknown partition table
[    1.580000] exynos-ehci 12580000.ehci: USB 2.0 started, EHCI 1.00
[    1.585000] hub 1-0:1.0: USB hub found
[    1.590000]  mmcblk0boot0: unknown partition table
[    1.595000] hub 1-0:1.0: 3 ports detected
[    1.600000] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
[    1.625000] dm9000 5000000.ethernet eth0: link down
[    1.765000] mmc0: new high speed SDHC card at address 0001
[    1.770000] mmcblk1: mmc0:0001 SD8GB 7.35 GiB 
[    1.775000]  mmcblk1: p1
[    1.910000] usb 1-3: new high-speed USB device number 2 using exynos-ehci
[    2.045000] dm9000 5000000.ethernet eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
[    2.050000] IP-Config: Guessing netmask 255.255.255.0
[    2.050000] hub 1-3:1.0: USB hub found
[    2.050000] hub 1-3:1.0: 3 ports detected
[    2.060000] IP-Config: Complete:
[    2.065000]      device=eth0, hwaddr=00:0a:2d:a6:55:a2, ipaddr=192.168.1.78, mask=255.255.255.0, gw=255.255.255.255
[    2.075000]      host=192.168.1.78, domain=, nis-domain=(none)
[    2.080000]      bootserver=255.255.255.255, rootserver=192.168.1.217, rootpath=
[    2.090000] clk: Not disabling unused clocks
[    3.320000] VFS: Mounted root (nfs filesystem) on device 0:10.
[    3.325000] devtmpfs: mounted
[    3.330000] Freeing unused kernel memory: 228K (c0530000 - c0569000)
[root@farsight ]# ls
bin      etc      linuxrc  proc     sbin     tmp      var
dev      lib      mnt      root     sys      usr
[root@farsight ]#
Copyright © Linux教程網 All Rights Reserved