Difference between revisions of "Step-by-step NFS-mounted Root File System"
Line 1: | Line 1: | ||
THIS TOPIC ACTIVELY BEING EDITED. IT IS NOT COMPLETE | THIS TOPIC ACTIVELY BEING EDITED. IT IS NOT COMPLETE | ||
− | This tutorial is for Developers | + | This tutorial is for Developers. It is written to work with the odroidu2-ubuntu or odroidu2-debian SD-Card images [is this specific enough?] |
+ | |||
+ | It is not for Android developers. | ||
=== Introduction === | === Introduction === | ||
Line 12: | Line 14: | ||
=== Prerequisites === | === Prerequisites === | ||
+ | <li> You MUST have access to the serial console -- use the USB/Serial adapter [check actual Hardkernel name] | ||
<li> You need to be able to edit files on the odroid, or how to move them to a host and back for editing | <li> You need to be able to edit files on the odroid, or how to move them to a host and back for editing | ||
<li> You need to know how to build a kernel. There are many ways to do it. This tutorial walks through a native kernel build: [[Kernel Compiling]] | <li> You need to know how to build a kernel. There are many ways to do it. This tutorial walks through a native kernel build: [[Kernel Compiling]] | ||
Line 28: | Line 31: | ||
<li>Test the NFS server | <li>Test the NFS server | ||
<li>reboot and see that we actually are running from files living on the host | <li>reboot and see that we actually are running from files living on the host | ||
+ | |||
+ | === Steps === | ||
+ | |||
+ | Power-up the odroid and abort the boot at u-boot console | ||
+ | <pre> | ||
+ | Exynos4412 # | ||
+ | </pre> | ||
+ | |||
+ | Copy/paste the following text to a text editor. You need to make changes. See the comments for an explaination | ||
+ | <pre> | ||
+ | # replace the ip address below with the ip address of the host you want to NFS-mount | ||
+ | # This address must be on the same subnet as your odroid -- no routes are in place | ||
+ | # so early in the boot, and neither is DNS. | ||
+ | set nfsserverip 10.4.124.93 | ||
+ | |||
+ | # replace home/karlo/targetrfs with the host absolute path of the directory you mean to | ||
+ | # use for the odroid root file system. This can be a symlink, but it must NFS must be | ||
+ | # able to resolve it (it must be on the same filesystem) | ||
+ | set rfspath home/karlo/targetrfs | ||
+ | |||
+ | # We will use this macro as 'run setnfs' at the u-boot prompt to turn on NFS mounting | ||
+ | set setnfs 'set bootdev root=/dev/nfs rw nfsroot=${nfsserverip}:/${rfspath}; saveenv;' | ||
+ | |||
+ | # We will use this macro as 'run unsetnfs' at the u-boot prompt to turn off NFS mounting | ||
+ | set unsetnfs 'set bootdev;' | ||
+ | |||
+ | # this step saves the u-boot environment variables we just set | ||
+ | saveenv | ||
+ | </pre> | ||
+ | |||
+ | Now boot the odroid, nothing we did so far is going to change the boot. | ||
+ | <pre> | ||
+ | run bootcmd | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | Mount the boot partition read-write, if it is not already mounted. The Debian images do not mount the boot partition (at this time) | ||
+ | <pre> | ||
+ | mount /dev/mmcblkp1 /boot | ||
+ | cd /boot | ||
+ | <pre> | ||
+ | |||
+ | This is the current boot.scr (yours may be different): | ||
+ | <pre> | ||
+ | setenv initrd_high "0xffffffff" | ||
+ | setenv fdt_high "0xffffffff" | ||
+ | setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000 0x42000000" | ||
+ | setenv bootargs "console=tty1 console=ttySAC1,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro mem=2047M" | ||
+ | boot | ||
+ | </pre> | ||
+ | |||
+ | Copy the existing boot script: | ||
+ | <pre> | ||
+ | cp boot.scr boot-nfs.scr | ||
+ | </pre> | ||
+ | |||
+ | Edit boot-nfs.scr. Insert ${bootdev} text to give the following: | ||
+ | <pre> | ||
+ | setenv initrd_high "0xffffffff" | ||
+ | setenv fdt_high "0xffffffff" | ||
+ | setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000 0x42000000" | ||
+ | setenv bootargs "${bootdev} console=tty1 console=ttySAC1,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro mem=2047M" | ||
+ | boot | ||
+ | </pre> | ||
+ | |||
+ | Compile to a u-boot script like this: | ||
+ | <pre> | ||
+ | mkimage -T script -A arm -C none -n 'odroid-u2.Boot NFS-mounted RFS' -d boot-nfs.txt boot-nfs.scr | ||
+ | </pre> | ||
+ | |||
+ | If that works, replace your existing script with the one just made. If not, you do not have the prerequisites to build a kernel. mkimage comes from a u-boot package, listed in prerequisites for kernel building. | ||
+ | <pre> | ||
+ | mv boot.scr boot.scr.orig | ||
+ | cp boot-nfs.scr boot.scr | ||
+ | </pre> |
Revision as of 21:47, 17 January 2013
THIS TOPIC ACTIVELY BEING EDITED. IT IS NOT COMPLETE
This tutorial is for Developers. It is written to work with the odroidu2-ubuntu or odroidu2-debian SD-Card images [is this specific enough?]
It is not for Android developers.
Contents
Introduction
A common technique for embedded development is to NFS-mount your root file system. This means that all files are actually on a host. The host is configured to export the filesystem. The target (odroid) mounts the filesystem at boot time and uses it as its own. All files are visible on the host.
As targets have increased in storage capacity and speed, the need for NFS-mounting root file systems will decrease. The technique is still useful when bringing up a new port or you have a lot of files that need to change together.
It is common to check in a whole root file system into a source control system for quality control.
Prerequisites
Overview
We are going to:
Steps
Power-up the odroid and abort the boot at u-boot console
Exynos4412 #
Copy/paste the following text to a text editor. You need to make changes. See the comments for an explaination
# replace the ip address below with the ip address of the host you want to NFS-mount # This address must be on the same subnet as your odroid -- no routes are in place # so early in the boot, and neither is DNS. set nfsserverip 10.4.124.93 # replace home/karlo/targetrfs with the host absolute path of the directory you mean to # use for the odroid root file system. This can be a symlink, but it must NFS must be # able to resolve it (it must be on the same filesystem) set rfspath home/karlo/targetrfs # We will use this macro as 'run setnfs' at the u-boot prompt to turn on NFS mounting set setnfs 'set bootdev root=/dev/nfs rw nfsroot=${nfsserverip}:/${rfspath}; saveenv;' # We will use this macro as 'run unsetnfs' at the u-boot prompt to turn off NFS mounting set unsetnfs 'set bootdev;' # this step saves the u-boot environment variables we just set saveenv
Now boot the odroid, nothing we did so far is going to change the boot.
run bootcmd
Mount the boot partition read-write, if it is not already mounted. The Debian images do not mount the boot partition (at this time)
mount /dev/mmcblkp1 /boot cd /boot <pre> This is the current boot.scr (yours may be different): <pre> setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000 0x42000000" setenv bootargs "console=tty1 console=ttySAC1,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro mem=2047M" boot
Copy the existing boot script:
cp boot.scr boot-nfs.scr
Edit boot-nfs.scr. Insert ${bootdev} text to give the following:
setenv initrd_high "0xffffffff" setenv fdt_high "0xffffffff" setenv bootcmd "fatload mmc 0:1 0x40008000 zImage; fatload mmc 0:1 0x42000000 uInitrd; bootm 0x40008000 0x42000000" setenv bootargs "${bootdev} console=tty1 console=ttySAC1,115200n8 root=UUID=e139ce78-9841-40fe-8823-96a304a09859 rootwait ro mem=2047M" boot
Compile to a u-boot script like this:
mkimage -T script -A arm -C none -n 'odroid-u2.Boot NFS-mounted RFS' -d boot-nfs.txt boot-nfs.scr
If that works, replace your existing script with the one just made. If not, you do not have the prerequisites to build a kernel. mkimage comes from a u-boot package, listed in prerequisites for kernel building.
mv boot.scr boot.scr.orig cp boot-nfs.scr boot.scr