【TINY4412】U-BOOT移植笔记:(17)BOOTP更新固件
宿主机 : 虚拟机 Ubuntu 16.04 LTS / X64
目标板[底板]: Tiny4412SDK - 1506
目标板[核心板]: Tiny4412 - 1412
U-BOOT版本: 2017.03
交叉编译器: gcc-arm-none-eabi-5_4-2016q3
日期: 2017-6-18 12:08:19
作者: SY
移植
diff --git a/include/configs/tiny4412.h b/include/configs/tiny4412.h
index 4848180..d4881da 100644
--- a/include/configs/tiny4412.h
+++ b/include/configs/tiny4412.h
@@ -47,6 +47,9 @@
#define CONFIG_USB_HOST_ETHER 1
#define CONFIG_USB_ETHER_DM9621 1
+/* BOOTP */
+#define CONFIG_BOOTP_SERVERIP 1
+
#define CONFIG_SYS_DCACHE_OFF 1
/* ORIGEN has 4 bank of DRAM */
diff --git a/net/tftp.c b/net/tftp.c
index ced45ec..da1102b 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -733,7 +733,6 @@ void tftp_start(enum proto_t protocol)
debug("TFTP blocksize = %i, timeout = %ld ms\n",
tftp_block_size_option, timeout_ms);
-
tftp_remote_ip = net_server_ip;
if (net_boot_file_name[0] == '\0') {
sprintf(default_filename, "%02X%02X%02X%02X.img",
diff --git a/tiny4412_config b/tiny4412_config
index ddd0df3..c16a46b 100644
--- a/tiny4412_config
+++ b/tiny4412_config
@@ -433,7 +433,7 @@ CONFIG_CMD_DHCP=y
# CONFIG_CMD_PXE is not set
# CONFIG_CMD_NFS is not set
CONFIG_CMD_MII=y
-# CONFIG_CMD_PING is not set
+CONFIG_CMD_PING=y
# CONFIG_CMD_CDP is not set
# CONFIG_CMD_SNTP is not set
# CONFIG_CMD_DNS is not set
(END)
环境变量
TINY4412 # setenv bootfile /opt/linux-4.12/arch/arm/boot/uImage TINY4412 # setenv kerneladdr 0x40008000 TINY4412 # setenv loadaddr 0x43E00000 TINY4412 # setenv serverip 192.168.2.40 TINY4412 # setenv ipaddr 192.168.2.39 TINY4412 # setenv updatefile u-boot.bin TINY4412 # saveenv
总结
- 必须设置
#define CONFIG_BOOTP_SERVERIP 1
否则,服务器IP将被修改为不是我们在环境变量里设置的值。
测试
TINY4412 # usb start
starting USB...
USB0: USB EHCI 1.00
scanning bus 0 for devices... 4 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices... 1 Ethernet Device(s) found
TINY4412 #
TINY4412 # bootp
BOOTP broadcast 1
DHCP client bound to address 192.168.2.105 (4 ms)
Using DM9621A0 device
TFTP from server 192.168.2.195; our IP address is 192.168.2.105
Filename 'u-boot.bin'.
Load address: 0x43e00000
Loading: #################################
229.5 KiB/s
done
Bytes transferred = 483482 (7609a hex)
TINY4412 #