Hi Foks.! Welcome to my blog.
Locate the 6-pin header on BBB, written as "J1" below the first pin on the PCB as show in the below picture.
Connect J4 (RXD) to TXD line of CP2102 USB2.0 to TTL UART serial converter
Connect J5 (TXD) to RXD line of CP2102 USB2.0 to TTL UART serial converter
Connect J1 (GND) to GND line of CP2102 USB2.0 to TTL UART serial converter
This makes the serial console setup ready.
Initialize Build Environment :
Install all the mentioned packages for making build smooth.
Download Kernel Source :
Download Buildroot Source :
Download the buildroot config from the below link, it is built for ARM-little endian-cortex-A8 choosing 3.8.13 kernel version headers, and build the cross compiler toolchain by itself, copy nfs_defconfing file to buildroot/configs folder
From buildroot disable the udhcp network utility of the busy-box, other wise while booting it tries to get a dynamic IP address causing the nfs failure. below are the steps to disable.
$ cd src/buildroot
$ make busybox-menuconfig
Goto "Networking Utilities --->" & disable the following
$ make busybox-update-config
Building kernel & buildroot from source:
Assuming build environment is successfully done, we now start building the kernel & buildroot root file-system from source.
This completes the kernel & build root building, important files we need here are uImage-dtb.am335x-boneblack & rootfs.tar.gz
I assume that you have booted to u-boot prompt on BBB, the boot media can be either uSD or eMMC or UART. For booting from UART, check the link BBB booting from UART
Here we download the kernel image from tftp & rootfs is over the network.
Installing TFTP server on u-buntu:
To install the tftpd package, run the following:
Run the following to create the TFTP server's base directory and allow anyone to access it:
copy the uImage-dtb.am335x-boneblack to /tftpboot
Restart xinetd deamon to enable the server:
Installing NFS services & Tools:
On Ubuntu, Debian, and similar systems, the services and tools required by an NFS server can be installed with the following command:
setup the network file system
Add the below line to /etc/exports file, assuming BBB is having a static IP say 192.168.19.112
export the NFS directories and restart the service
for more details about tftp, nfs check these links LINK1 LINK2 LINK3
Assuming you are at the u-boot prompt.
IP address of the Ubuntu host machine running tftp & nfs is 192.168.19.144
Hit any key to stop autoboot: 0
U-Boot#
U-Boot# setenv ipaddr 192.168.19.112
U-Boot# ping 192.168.19.144
link up on port 0, speed 100, full duplex
Using cpsw device
host 192.168.19.144 is alive
U-Boot# setenv serverip 192.168.19.144
U-Boot# tftpboot ${kloadaddr} uImage-dtb.am335x-boneblack
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 192.168.19.144; our IP address is 192.168.19.112
Filename 'uImage-dtb.'.
Load address: 0x82000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###########
911.1 KiB/s
done
Bytes transferred = 4382407 (42dec7 hex)
U-Boot# setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=192.168.19.144:/srv/nfs/bbb/,nolock, wsize=1024, rsize=1024 rootwait init=/linuxrc rootdelay=5 ip=192.168.19.112
U-Boot# bootm ${kloadaddr}
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.8.13-00770-gc0eeacb-dirt
Created: 2015-08-06 6:27:40 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4382343 Bytes = 4.2 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
.
.
.
.
[ 9.742832] Freeing init memory: 216K
Starting logging: OK
Initializing random number generator... done.
Starting network...
ifup: applet not found
Starting dropbear sshd: OK
Welcome to Buildroot over NFS
root login:
Please leave your comments, that will be encouraging :)
To make this happen I have been through many blogs, some where help-full, out of my experimentation here are the steps to boot kernel with NFS. This procedure is applicable to any board that can boot till u-boot prompt. I am using Beagle Bone Black as an example.
To get started we need the following:
- BeagleBoneBlack (BBB) board
- Linux distribution based host machine ( I have Ubuntu 14.04)
- CP2102 USB2.0 to TTL UART serial converter module.
- Ethernet cable
- 100-240V to 5V-1.0 or 2.0A adapter/converter
- TFTP & NFS server
- kernel & buildroot source
- I am using filesystem generated from buildroot
Locate the 6-pin header on BBB, written as "J1" below the first pin on the PCB as show in the below picture.
- J1 = GND (Ground)
- J4 = RXD (Receive Data)
- J5 = TXD (Transmit Data)
CP2102 USB2.0 to TTL UART serial converter
Connect J5 (TXD) to RXD line of CP2102 USB2.0 to TTL UART serial converter
Connect J1 (GND) to GND line of CP2102 USB2.0 to TTL UART serial converter
This makes the serial console setup ready.
Initialize Build Environment :
gvk51@gvk:~$ sudo apt-get install git u-boot-tools g++ gawk lzop texinfo git-core build-essential libncurses5-dev gcc-arm-linux-gnueabi
Install all the mentioned packages for making build smooth.
Download Kernel Source :
gvk51@gvk:~$ cd src gvk51@gvk:~/src$ git clone git://github.com/beagleboard/kernel.git gvk51@gvk:~/src$ cd kernel gvk51@gvk:~/src/kernle$ git checkout 3.8 gvk51@gvk:~/src/kernle$ ./patch.sh gvk51@gvk:~/src/kernle$ cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig gvk51@gvk:~/src/kernle$ wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin
Download Buildroot Source :
gvk51@gvk:~$ cd src gvk51@gvk:~$ git clone git://git.buildroot.net/buildroot
Download the buildroot config from the below link, it is built for ARM-little endian-cortex-A8 choosing 3.8.13 kernel version headers, and build the cross compiler toolchain by itself, copy nfs_defconfing file to buildroot/configs folder
From buildroot disable the udhcp network utility of the busy-box, other wise while booting it tries to get a dynamic IP address causing the nfs failure. below are the steps to disable.
$ cd src/buildroot
$ make busybox-menuconfig
Goto "Networking Utilities --->" & disable the following
- udhcp client for DHCPv6 (udhcpc6)
- udhcp server (udhcpd)
- udhcp client (udhcpc)
$ make busybox-update-config
Building kernel & buildroot from source:
Assuming build environment is successfully done, we now start building the kernel & buildroot root file-system from source.
gvk51@gvk:~/src$ mkdir images gvk51@gvk:~/src$ mkdir logs gvk51@gvk:~/src$ cd kernel/kernel gvk51@gvk:~/src/kernel/kernel$ make beaglebone_defconfig gvk51@gvk:~/src/kernel/kernel$ make -j4 uImage dtbs 2>&1 | tee ~/src/logs/kernel.txt gvk51@gvk:~/src/kernel/kernel$ make -j4 modules gvk51@gvk:~/src/kernel/kernel$ make uImage-dtb.am335x-boneblack gvk51@gvk:~/src/kernel/kernel$ cp ./arch/arm/boot/uImage-dtb.am335x-boneblack ~/src/images gvk51@gvk:~/src/kernel/kernel$ cd ~/src/buildroot gvk51@gvk:~/src/buildroot$ make nfs_defconfig gvk51@gvk:~/src/buildroot$ make 2>&1 | tee ~/src/logs/fs.txt gvk51@gvk:~/src/buildroot$ cp ./output/images/rootfs.tar.gz ~/src/images
This completes the kernel & build root building, important files we need here are uImage-dtb.am335x-boneblack & rootfs.tar.gz
Here we download the kernel image from tftp & rootfs is over the network.
Installing TFTP server on u-buntu:
To install the tftpd package, run the following:
gvk51@gvk:~$ sudo apt-get install tftpd
To configure the TFTP server, create
/etc/xinetd.d/tftp
with the following contents: service tftp { protocol = udp port = 69 socket_type = dgram wait = yes user = nobody server = /usr/sbin/in.tftpd server_args = /tftpboot disable = no }
gvk51@gvk:~# sudo mkdir /tftpboot gvk51@gvk:~# sudo chmod -R 777 tftpboot gvk51@gvk:~# sudo chown -R nobody /tftpboot
copy the uImage-dtb.am335x-boneblack to /tftpboot
gvk51@gvk:~$ cp ~/src/images/uImage-dtb.am335x-boneblack
Restart xinetd deamon to enable the server:
gvk51@gvk:~$ sudo /etc/init.d/xinetd restart
Installing NFS services & Tools:
On Ubuntu, Debian, and similar systems, the services and tools required by an NFS server can be installed with the following command:
gvk51@gvk:~$ sudo apt-get install nfs-kernel-server nfs-common portmap
setup the network file system
gvk51@gvk:~# sudo mkdir /srv/nfs/bbb gvk51@gvk:~# sudo tar -C /srv/nfs/bbb -xzf ~/src/images/rootfs.tar.gz gvk51@gvk:~# cd /srv/nfs/bbb gvk51@gvk:/srv/nfs/bb# sudo ln -s bin/busybox init
Add the below line to /etc/exports file, assuming BBB is having a static IP say 192.168.19.112
/srv/nfs/bbb 192.168.19.112(rw,sync,no_root_squash,no_subtree_check) gvk51@gvk:~# sudo gedit /etc/exports
export the NFS directories and restart the service
gvk51@gvk:~# sudo exportfs -a gvk51@gvk:~# sudo exportfs -rv gvk51@gvk:~# sudo service nfs-kernel-server start
for more details about tftp, nfs check these links LINK1 LINK2 LINK3
Assuming you are at the u-boot prompt.
IP address of the Ubuntu host machine running tftp & nfs is 192.168.19.144
Hit any key to stop autoboot: 0
U-Boot#
U-Boot# setenv ipaddr 192.168.19.112
U-Boot# ping 192.168.19.144
link up on port 0, speed 100, full duplex
Using cpsw device
host 192.168.19.144 is alive
U-Boot# setenv serverip 192.168.19.144
U-Boot# tftpboot ${kloadaddr} uImage-dtb.am335x-boneblack
link up on port 0, speed 100, full duplex
Using cpsw device
TFTP from server 192.168.19.144; our IP address is 192.168.19.112
Filename 'uImage-dtb.'.
Load address: 0x82000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
###########
911.1 KiB/s
done
Bytes transferred = 4382407 (42dec7 hex)
U-Boot# setenv bootargs console=ttyO0,115200n8 root=/dev/nfs rw nfsroot=192.168.19.144:/srv/nfs/bbb/,nolock, wsize=1024, rsize=1024 rootwait init=/linuxrc rootdelay=5 ip=192.168.19.112
U-Boot# bootm ${kloadaddr}
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.8.13-00770-gc0eeacb-dirt
Created: 2015-08-06 6:27:40 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4382343 Bytes = 4.2 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
[ 0.000000] Booting Linux on physical CPU 0x0
.
.
.
.
[ 9.742832] Freeing init memory: 216K
Starting logging: OK
Initializing random number generator... done.
Starting network...
ifup: applet not found
Starting dropbear sshd: OK
Welcome to Buildroot over NFS
root login:
Please leave your comments, that will be encouraging :)
This comment has been removed by the author.
ReplyDeleteHi Irappa, please let me know what exactly you are looking for so that I can give you more details
DeleteHi, GVK51
ReplyDeleteThis article is really helpful!!
I can mount my nfs by following the steps you provided.
Many thanks for your sharing
Welcome Yen-Yu Chen
DeleteHi please share the root login and password
ReplyDeletelogin is "root" & password is "root"
DeleteHello Sir,
ReplyDeleteI want build the TFTP and NFS boot Sitara TI AM335x custom board. Can i follow the same steps.
Hello, You follow the same steps, make sure you use the right bootloaders & kernel provided with SDK of Sitara/Custom board
DeleteHi, great job. what if my BBGW doesn't have ETH. May I use USB for nfs? I did tftp to load kernel but it panic when try nfs. nfs on desktop side is working. Tks!
ReplyDelete[ 116.325365] VFS: Unable to mount root fs via NFS, trying floppy.
[ 116.331941] VFS: Cannot open root device "nfs" or unknown-block(2,0): error -6
[ 116.339271] Please append a correct "root=" boot option; here are the available partitions:
I have not tried USB boot, may be you can try boot from uSD!
ReplyDelete