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 information:
Make sure that /srv/homes exist, if no than create it. After editing nfs
configuration file we have to restart NFS server:
1
sudo service nfs-kernel-server restart
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:
VersatilePB # setenv autload no
VersatilePB # dhcp
MC91111: PHY auto-negotiate timed out
SMC91111: MAC 52:54:00:12:34:56
BOOTP broadcast 1
DHCP client bound to address 192.168.1.13
VersatilePB # setenv serverip 192.168.1.24
VersatilePB # setenv bootfile uImage
VersatilePB # tftp
Note that 192.168.1.24 should be replaced with correct address of TFTP server.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
VersatilePB # tftp
SMC91111: PHY auto-negotiate timed out
SMC91111: MAC 52:54:00:12:34:56
Using SMC91111-0 device
TFTP from server 192.168.1.20; our IP address is 192.168.1.13
Filename 'uImage'.
Load address: 0x7fc0
Loading: #######################################################################################################################################################################################################################################################################################################################################################################################252 KiB/s
done
Bytes transferred=1917944(1d43f8 hex)
Right now we will set boot arguments for our kernel:
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:
1
bootm
As you can see that’s not all, our current configuration end with:
(...)
Sending DHCP requests .input: AT Raw Set 2 keyboard as
/devices/fpga:06/serio0/input/input0
, OK
IP-Config: Got DHCP answer from 192.168.1.1, my address is 192.168.1.13
IP-Config: Complete:
device=eth0, hwaddr=52:54:00:12:34:56, ipaddr=192.168.1.13, mask=255.255.255.0, gw=192.168.1.1
host=192.168.1.13, domain=, nis-domain=(none)bootserver=0.0.0.0, rootserver=192.168.1.20, rootpath=nameserver0=192.168.1.1
input: ImExPS/2 Generic Explorer Mouse as
/devices/fpga:07/serio1/input/input1
VFS: Mounted root (nfs filesystem) on device 0:9.
Freeing unused kernel memory: 112K (c034e000 - c036a000)
nfs: server 192.168.1.20 not responding, still trying
nfs: server 192.168.1.20 OK
can't run '/etc/init.d/rcS': No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
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:
1
2
3
cd /srv/homes/rootfs
mkdir etc
vim etc/inittab
Our inittab is very simple:
1
2
3
4
5
6
::sysinit:/etc/init.d/rcS
::askfirst:/bin/ash
::ctrlaltdel:/sbin/reboot
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
::restart:/sbin/init
If you want to learn more about inittab - man inittab .We need improve out
filesystem with few directories:
1
mkdir sys proc etc/init.d
In /etc/init.d/rcS we will mount sysfs and procfs:
1
2
3
#! /bin/sh
mount -t proc proc /proc
mount -t sysfs sysfs /sys
Give executable permission to rcS script:
1
chmod +x etc/init.d/rcS
We also have to create dev directory with ttyAMA0 block device:
1
2
3
4
mkdir dev
sudo mknod dev/ttyAMA0 c 20464
sudo mknod dev/null c 13
sudo mknod dev/console c 51
Right now we should be able to boot our Virtual Development Board. Let’s try
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.
Founder of 3mdeb, a passionate advocate for open-source firmware solutions, driven by a belief in transparency, innovation, and trustworthiness. Every day is a new opportunity to embody the company's vision, emphasizing user liberty, simplicity, and privacy. Beyond business, a casual chess and bridge player, finding peace in nature and nourishment in theology, philosophy, and psychology. A person striving to foster a healthy community, grounded in collaboration and shared growth, while nurturing a lifelong curiosity and a desire to deeply understand the world.