Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3190

[How To] Use U-Boot SNTP (no replies)

$
0
0
As requested by a forum member, here is the instruction how to setup SNTP using the new U-Boot.

The envs can be setup either in u-boot console or in Linux . In this example, my router local IP is 192.168.0.1, and the NTP server is montpelier.caltech.edu.

1. Setup network variables
setenv dnsip 192.168.0.1
setenv gatewayip 192.168.0.1
setenv netmask 255.255.255.0

2. Test the internet connection using Google IP address:
ping 8.8.8.8
Using egiga0 device
host 8.8.8.8 is alive

3. Lookup Caltech IP. If you already know other NTP server IP address to use then use that IP.
dns montpelier.caltech.edu
192.12.19.20

4. Get date time from Caltech
sntp 192.12.19.20
Date: 2014-02-09 Time: 7:37:35


The boot time can then be stored in u-boot env variable and used in Linux with fw_printenv. Or it could also be passed to Linux kernel with a custom param:
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params

Viewing all articles
Browse latest Browse all 3190

Trending Articles