<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.yoctoproject.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Poky_NFS_Root</id>
	<title>Poky NFS Root - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.yoctoproject.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Poky_NFS_Root"/>
	<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=Poky_NFS_Root&amp;action=history"/>
	<updated>2026-04-18T23:54:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://wiki.yoctoproject.org/wiki/index.php?title=Poky_NFS_Root&amp;diff=115&amp;oldid=prev</id>
		<title>Scottrif: Created page with &#039;= HOWTO: Booting poky images on hardware from network =  == Overview == Booting from network is a common practice when developing embedded system on real hardware. It avoids the …&#039;</title>
		<link rel="alternate" type="text/html" href="https://wiki.yoctoproject.org/wiki/index.php?title=Poky_NFS_Root&amp;diff=115&amp;oldid=prev"/>
		<updated>2010-10-22T22:25:18Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;= HOWTO: Booting poky images on hardware from network =  == Overview == Booting from network is a common practice when developing embedded system on real hardware. It avoids the …&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= HOWTO: Booting poky images on hardware from network =&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
Booting from network is a common practice when developing&lt;br /&gt;
embedded system on real hardware. It avoids the time consuming&lt;br /&gt;
process of downloading the kernel and root filesystem to a hard&lt;br /&gt;
drive or flash to make developer&amp;#039;s life easier.&lt;br /&gt;
&lt;br /&gt;
The general idea is to use a bootloader to get the kernel&lt;br /&gt;
image (using TFTP, mostly) and specifying nfsroot in the kernel&lt;br /&gt;
command line to mount rootfs via a remote NFS server. In the&lt;br /&gt;
case of x86 systems, the bootloader is usually PXE (Preboot&lt;br /&gt;
Execution Environment), either provided by BIOS or other PXE&lt;br /&gt;
implementations like gPXE.&lt;br /&gt;
&lt;br /&gt;
This HOWTO walks through the process of setting everything&lt;br /&gt;
for eMenlow, with NFS-root, you can:&lt;br /&gt;
* boot a diskless and flashless target&lt;br /&gt;
* avoid downloading kernel/rootfs after a rebuild&lt;br /&gt;
* change files on the fly even on read-only fs (jffs2, squashfs, etc.)&lt;br /&gt;
* boot on different boards or boxen&lt;br /&gt;
&lt;br /&gt;
== Target bootloading with gPXE ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; TODO: integrate gPXE into yocto &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The traditional method of bootloading is the PXE stack provided in BIOS.&lt;br /&gt;
However, that often requires DHCP cooperation, which is not viable in many&lt;br /&gt;
circumstances. Here we use gPXE, an open-source PXE implementation, to get&lt;br /&gt;
around this DHCP restriction.&lt;br /&gt;
&lt;br /&gt;
It can function as a standalone bootloader or be chainloaded by grub. Since&lt;br /&gt;
it&amp;#039;s less than 500kB in size, it can fit in a small USB flash drive very well.&lt;br /&gt;
&lt;br /&gt;
First, build it from source. Suppose your development machine has the hostname&lt;br /&gt;
of &amp;#039;&amp;#039;&amp;#039;&amp;lt;hostname&amp;gt;&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
&lt;br /&gt;
 $ git clone git://git.etherboot.org/scm/gpxe.git&lt;br /&gt;
 $ cd gpxe&lt;br /&gt;
 $ cat &amp;gt; chainload.gpxe &amp;lt;&amp;lt;EOF&lt;br /&gt;
 #!gpxe&lt;br /&gt;
 dhcp net0&lt;br /&gt;
 kernel tftp://&amp;lt;hostname&amp;gt;/boot.gpxe&lt;br /&gt;
 boot&lt;br /&gt;
 EOF&lt;br /&gt;
 $ cd src&lt;br /&gt;
 $ EMBEDDED_IMAGE=../chainload.gpxe make bin/gpxe.usb&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;EMBEDDED_IMAGE&amp;#039;&amp;#039;&amp;#039; is the builtin script as gPXE starts. The script above&lt;br /&gt;
chainloads another gPXE script on the remote tftp server (your development machine)&lt;br /&gt;
to get actual kernel and rootfs image location.&lt;br /&gt;
&lt;br /&gt;
After that, bin/gpxe.usb can be written to an empty USB stick to bootload the&lt;br /&gt;
image on any box that has a network connection:&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;warning: the content of the usb device will be wiped out!&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
 # dd if=bin/gpxe.usb of=&amp;lt;/dev/sdX&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, there are also other targets available, for example, bin/gpxe.lkrn&lt;br /&gt;
can be built to be chainloaded by grub, please refer to gPXE docs.&lt;br /&gt;
&lt;br /&gt;
== Development box preparation ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;TODO: integrate nfs server and tftpd into yocto&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
To set up tftp and nfs server on debian/ubuntu, simply:&lt;br /&gt;
&lt;br /&gt;
 # apt-get install nfs-kernel-server atftpd&lt;br /&gt;
&lt;br /&gt;
tftpd-hpa can be used as well instead of atftpd.&lt;br /&gt;
&lt;br /&gt;
== Target system changes ==&lt;br /&gt;
There are two additional requirements for the target system, however:&lt;br /&gt;
# the kernel needs to have the network driver built in, not as a module&lt;br /&gt;
# the network init scripts needs to be disabled or patched to avoid collision with nfsroot&lt;br /&gt;
&lt;br /&gt;
For 1, just change the config file of the target kernel, i.e for&lt;br /&gt;
qemux86 on eMenlow, change meta/packages/linux/linux-rp-2.6.29/defconfig-qemux86&lt;br /&gt;
to add &amp;#039;&amp;#039;&amp;#039;CONFIG_E1000E=y&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;(note: status of initramfs is unknown at the moment)&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
For 2, there are many possible solutions, a relative generic patch can be found here:&lt;br /&gt;
&lt;br /&gt;
http://git.pokylinux.org/cgit.cgi/poky-contrib/commit/?h=qhe/nfsroot&amp;amp;id=95c6536d33677f177a3aec14f61589702b96cbb7&lt;br /&gt;
&lt;br /&gt;
Besides, you may also:&lt;br /&gt;
* remove /etc/init.d/networking altogether&lt;br /&gt;
* remove &amp;quot;auto eth0&amp;quot; in /etc/network/interfaces&lt;br /&gt;
&lt;br /&gt;
== Setting up after image build ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;TODO: avoid using sudo&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
The following patch provides a script to automatically set up&lt;br /&gt;
tftp and nfsroot after image build completes.&lt;br /&gt;
&lt;br /&gt;
http://git.pokylinux.org/cgit.cgi/poky-contrib/commit/?h=qhe/nfsroot&amp;amp;id=fd51f44f07e1f07d0891082d488a969844bccb2f&lt;br /&gt;
&lt;br /&gt;
Simply run the&lt;br /&gt;
following in the poky build directory, assuming your machine type&lt;br /&gt;
is qemux86:&lt;br /&gt;
&lt;br /&gt;
 $ prepare-nfsroot qemux86 -g&lt;br /&gt;
&lt;br /&gt;
And everything is done. Now just insert the USB stick into the&lt;br /&gt;
target machine, power it on, and see if the target image is&lt;br /&gt;
booting.&lt;br /&gt;
&lt;br /&gt;
== External references ==&lt;br /&gt;
* [http://etherboot.org/wiki/index.php etherboot.org - The Etherboot/gPXE Wiki]&lt;br /&gt;
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/filesystems/nfs/nfsroot.txt;hb=HEAD nfsroot reference in kernel/Documentation]&lt;br /&gt;
* [http://tldp.org/HOWTO/NFS-Root.html NFS-Root mini-HOWOTO (not maintained)]&lt;/div&gt;</summary>
		<author><name>Scottrif</name></author>
	</entry>
</feed>