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

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 MASQUERADEroot@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

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

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.new
setenv bootargs ip=192.168.4.100:192.168.4.1:192.168.4.1:255.255.255.0:tegra20: root=/dev/nfs rw nfsroot=192.168.4.1:/export/tegra20
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.