这一节目标有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
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
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)
如果上面的步骤成功了,那就基本完成了本次的工作,下面在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
启动画面如下:
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 ]#