Dobrica Pavlinušić's random unstructured stuff
u-boot: Revision 6

How to setup netboot for u-boot easily...

To make this work, you need supported usb network card:

root@tegra20:/home/dpavlin# lsusb -d 0b95:7720
Bus 003 Device 002: ID 0b95:7720 ASIX Electronics Corp. AX88772



network setup

root@x200:/export/tegra20# cat /etc/network/interfaces.d/enp0s25 
#auto enp0s25
#iface enp0s25 inet dhcp

auto enp0s25
iface enp0s25 inet static
        address 192.168.4.1
        netmask 255.255.255.0
        post-up iptables -t nat -A POSTROUTING -s 192.168.4.0/24 -o wls1 -j MASQUERADE


root@x200:/export/tegra20# grep tegra20 /etc/hosts
192.168.4.100   tegra20

dnsmasq (dhcp, tftp)

dpavlin@x200:~$ cat /etc/dnsmasq.d/dhcp.conf 

#interface=enp0s25

dhcp-range=192.168.4.50,192.168.4.150,12h

# this should be mac address of usb network adapter for target device
dhcp-host=00:14:d1:b0:63:1c,192.168.4.100


enable-tftp
#tftp-root=/srv/tftp

# Set the boot filename for netboot/PXE. You will only need
# this is you want to boot machines over the network and you will need
# a TFTP server; either dnsmasq's built in TFTP server or an
# external one. (See below for how to enable the TFTP server.)
#dhcp-boot=pxelinux.0

tftp-root=/export/tegra20
dhcp-boot=boot/boot.scr

log-queries
log-dhcp

nfs

apt-get install nfs-kernel-server

dpavlin@x200:~$ grep tegra20 /etc/exports 
/export/tegra20        192.168.4.0/24(rw,sync,no_root_squash,no_subtree_check,fsid=1)

u-boot

Name of u-boot script file was found by looking into dnsmasq log and deducing which files u-boot requests as
boot name, hence symlink.

dpavlin@x200:/export/tegra20$ ls -al boot.scr.uimg 
lrwxrwxrwx 1 dpavlin dpavlin 13 Jan 13 11:51 boot.scr.uimg -> boot/boot.scr


dpavlin@x200:/export/tegra20$ cat boot/boot.cmd

tftpboot ${kernel_addr_r} /boot/zImage
tftpboot ${fdt_addr_r} /boot/tegra20-ventana.dtb
tftpboot ${ramdisk_addr_r} /boot/uInitrd

setenv bootargs root=/dev/nfs nfsroot=192.168.4.1:/export/tegra20 ip=192.168.4.100:192.168.4.1:192.168.4.1:255.255.255.0:tegra20:eth0 panic=10 nfsrootdebug

#setenv bootargs ip=bootp root=/dev/nfs nfsroot=192.168.4.1:/export/tegra20 panic=10 nfsrootdebug init=/bin/sh

bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

# mkimage -C none -A arm -T script -d boot.cmd boot.scr


ip=dhcp should work here, but doesn't for me, mostly because kernel tries to init dummy0 and wifi network first instead of eth0, so we never get successfully mounted nfsroot :-(

kernel setup

To make this work, kernel for target device also has to have usb network drivers built in (I did try with modules but in combination with Debian's initrd it will never boot).

I have following usb network configuration enabled:

dpavlin@klin:/klin/Tegra/linux$ grep USB_NET .config | grep -v ^#
CONFIG_USB_NET_DRIVERS=y
CONFIG_USB_NET_AX8817X=y
CONFIG_USB_NET_AX88179_178A=y
CONFIG_USB_NET_CDCETHER=y
CONFIG_USB_NET_CDC_NCM=y
CONFIG_USB_NET_SMSC75XX=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB_NET_NET1080=y
CONFIG_USB_NET_CDC_SUBSET_ENABLE=y
CONFIG_USB_NET_CDC_SUBSET=y
CONFIG_USB_NET_ZAURUS=y

links