Table of contents

Introduction

To make our embedded linux work as virtual development platform we need some environment after booting. There is many approaches to get working root file system but I will use the easiest one as an exercise. I don’t want to create full embedded distribution (this is good plan for future works). Right now I will be happy with simple initramfs based on BusyBox.

For all interested in creating own root filesystem there are few places where you can find informations:

Get and build BusyBox

Clone git repository:

Fast and simple

Of course make sure to use correct toolchain. I made few notes about Ubuntu/Linaro toolchain in previous post

Mark Busybox Settings -> Build Options -> Build BusyBox as a static binary (no shared libs) option. Exit and save.

Setting up kernel through NFS

Previously we prepared U-Boot kenernel image with DHCP and rootfs which we want to expose over NFS. First lets start with NFS configuration:

I use simple /etc/exports configuration:

Make sure that /srv/homes exist, if no than create it. After editing nfs configuration file we have to restart NFS server:

Verify configuration

I assume that you go through all previous articles in this series. To verify configuration we have to copy whole BusyBox _install directory to known nfs location:

Now we can try our Virtual Development Board:

After U-Boot booting:

Note that 192.168.1.24 should be replaced with correct address of TFTP server.

Right now we will set boot arguments for our kernel:

What does it mean:

  • root=/dev/nfs – following kernel.org: {% blockquote %} This is necessary to enable the pseudo-NFS-device. Note that it’s not a real device but just a synonym to tell the kernel to use NFS instead of a real device. {% endblockquote %}
  • mem=128M ip=dhcp – self-explaining
  • netdev=25,0,0xf1010000,0xf1010010,eth0 – network device configuration (Format: <irq>,<io>,<mem_start>,<mem_end>,<name>), this was provided by default U-Boot bootargs
  • nfsroot=192.168.1.20:/srv/homes/rootfs – NFS server ip and path to rootfs
  • console=ttyAMA0 – very importanat if you want to see anything in -nographic mode

After setting bootargs we can boot our Virtual Development Board:

As you can see that’s not all, our current configuration end with:

try to open ttys loop. This is because of default behavior of BusyBox when inittab was not found.

Embedded filesystem tuning

To override above behavior we have to create /etc/inittab file:

Our inittab is very simple:

If you want to learn more about inittab – man inittab .We need improve out filesystem with few directories:

In /etc/init.d/rcS we will mount sysfs and procfs:

Give executable permission to rcS script:

We also have to create dev directory with ttyAMA0 block device:

Right now we should be able to boot our Virtual Development Board. Let’s try again: {% raw %}

{% endraw %}

Summary

This setup need few minor tweaks like adding U-Boot environment variables storage to not enter it every time or removing annoying message can't access tty(...). I’m done for now, its time to take care about other challenges. I hope that I will back to this issues in near future. If you like this series please share it, if somethings wrong please comment I will try to help if can.

How to set up a NFS root filesystem for embedded Linux development