Piv Klit

NFS Boot from SPI

Recommended Posts

Looking in the forums for a few days and reading up on a lot of stuff, I got the zero to boot from spi and USB, fairly easy once you got the right commands, and replacing "linux-u-boot-next-orangepipc2_5.34_arm64" with the version on the image for the board. 


The procedure didn't really change, you need to activate the spi-jedec-nor overlay in /boot/armbianEnv.txt :



Then, after reboot, you should get from "cat /proc/mtd", something like that :
dev: size erasesize name

mtd0: 00200000 00001000 "spi0.0"

cat /usr/lib/linux-u-boot-next-orangepipc2_5.34_arm64/sunxi-spl.bin /usr/lib/linux-u-boot-next-orangepipc2_5.34_arm64/u-boot.itb > /usr/lib/linux-u-boot-next-orangepipc2_5.34_arm64/u-boot-sunxi-with-spl.bin

and flash with

flashcp /usr/lib/linux-u-boot-next-orangepipc2_5.34_arm64/u-boot-sunxi-with-spl.bin /dev/mtd0

The I tried NFS shares and that worked fine to, but now I want to boot directly from another server, providing different folders for each board that I have and use spi for the boot. 
The reading the forum again to find out more about NFS booting, and mostly found this "hurray I got it to work" then kind of leaving the rest of us hanging there thinking HOW??? :D

I was then reading about uboot and found out that it have ethernet enabled, so guess it´s prepared for this kind of booting.
So I need to change something in uboot so it will know what ip and folder to look after, since I'm looking into booting different boards?

Oh and heres a picture of my crazy project. 


Share this post

Link to post
Share on other sites

Nearly a year later, and other people asking me in my inbox if I got it to work. 

No I didn't, I'm still on SPI + USB, but if anybody got it to work, please post it here so me and others can get this to work :)

Share this post

Link to post
Share on other sites

## set this to NFS root path (ip:path)
## or else provide dhcp option 17 (root-path)

#setenv nfs_root

# for DHCP
setenv net_setup "ip=dhcp"

# for static configuration see documentation
# https://github.com/torvalds/linux/blob/master/Documentation/filesystems/nfs/nfsroot.txt
# setenv net_setup "ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>"

# you may need to add extra kernel arguments specific to your device
setenv bootargs "console=tty1 console=ttyS0,115200 root=/dev/nfs ${net_setup} rw rootflags=noatime,nodiratime disp.screen0_output_mode=1920x1080p60 panic=10 consoleblank=0 enforcing=0 logle

if test -n ${nfs_root}; then
     setenv bootargs "${bootargs} nfsroot=${nfs_root}"

tftp ${kernel_addr_r} ${serverip}:vmlinuz-4.14.91-sunxi
tftp ${ramdisk_addr_r} ${serverip}:uInitrd-4.14.91-sunxi
tftp ${fdt_addr_r} ${serverip}:sun8i-h2-plus-orangepi-zero.dtb
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}

save and do mkimage -C none -A arm -T script -d boot.cmd boot.scr.uimg

copy boot.scr.uimg, vmlinuz,uInitrd, *.dtb to tftp folder and boot.

Working for me

Share this post

Link to post
Share on other sites

For building nfs image and vmlinuz,uInitrd, *.dtb 

On ubuntu 18.04 

apt -y install git

git clone https://github.com/armbian/build

cd build

./compile.sh ROOTFS_TYPE=nfs


cd output/images





.....nfsboot-rootfs.tgz tar -xzf to nfs export dir

fdisk -l .....nfsboot.img

         ........Orangepizero_Ubuntu_bionic_next_......._nfsboot.img1               8192 131071  122880    60M            83 Linux

8192 * 512 = 4194304

mount -o loop,offset=4194304  .....nfsboot.img /mnt

copy vmlinuz,uInitrd, and dtb  for you platform to tftp dir



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now