Home Desktop (Advanced • Use the HP t5325 with rootfs over NFS

Use the HP t5325 with rootfs over NFS

 - 

t5325The HP t5325 has an internal flash disk of roughly 500MB, but that is not enough to run a complete OS on. Since a thin client is meant to be used in a network, why not letting it boot the kernel from flash and have it’s root filesystem on NFS!

In this post I will explain how to accomplish this type of setup on the t5325.

Requirements:
This technique requires modification to the uBoot environment, so serial access is required to apply these settings.
Also a NFS server must be available, I will explain how to create the export and what to place in the exports file, but I assume you already have the NFS server working and running, therefore this will be an extra export to be added.
To load the kernel I have used a tftp server for the initial setup, so having a TFTP server ready is a must.

Setup details:
In this setup I assume that the t5325 has IP address 192.168.0.80 and the server has IP address 192.168.0.76 (as with my own setup). The thin client will be running Debian unstable, to make sure the latest software is used. Also a custom kernel will be used (a 3.8.4 kernel) to boot the thin client with.

Preparation on the server:
I’ve created a tarball with the root filesystem in it, along with the kernelmodules and the kernel (uImage) itself, you can download it here (117MB).

On the server, create the directory for the rootfs, I’ve placed my exports in /exports, so I’ve created the directory /exports/t5325/.
Copy the downloaded tarball to the just created exports directory and extract its contents within the t5325 folder.

Mostly the TFTP server files can be placed in /srv/tftp/, in order to boot the t5325, copy the uImage to that directory:
cp uImage /srv/tftp/t5325

Now we can add the new export in the /etc/exports file, add the following line:
/exports/t5325 192.168.0.80(rw,no_root_squash,no_subtree_check,async)

And restart the NFS kernel service:
/etc/init.d/nfs-kernel-server restart

That’s it for now regarding the server side, we now start with the t5325 itself!

Preparation on the t5325:
Hook up the serial console to the device and power it on, make sure to interrupt the autoboot process within time!

We have to set the bootargs so that it will notice that it’s rootfs is on a NFS share, therefore the following arguments have to be set:
setenv bootargs console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.76:/exports/t5325,rsize=32768,wsize=32768 tcp init=/bin/bash video=xgifb ip=192.168.0.80:192.168.0.76:192.168.0.1:255.255.255.0:t5325::off
Note that this is one line!

We also have to set several IP addresses within uBoot for this setup to work:
setenv serverip 192.168.0.76
setenv gatewayip 192.168.0.1
setenv ipaddr 192.168.0.80

Now we want to save the variables so that these changes are permanent:
saveenv

Initial boot on the t5325 to finish installation:
The rootfs that is placed on the server is a debootstrapped system, so the second stage where it installs the base system has yet to be performed, we now start the thin client to perform this step.

First, we need to load the kernel:
tftp 00800000 t5325

And execute the loaded kernel:
bootm

If the kernel successfully loads and there are no errors, you should be left at this prompt:
I have no name!@t5325:/

Now we first set some environment details for the debootstrap:
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/debootstrap

And we can finish the installation of the base system:
cd /debootstrap
./debootstrap --second-stage

This will take a couple of minutes to complete and when finished, we have a working Debian base system!

Configuring the newly installed system:
Now that the base installation is finished, we need to configure stuff like fstab and the network config.

Note that I use vi for editing the config, it’s the only editor available at this point, navigation is:
dd, remove 1 line where the cursor is placed
I, insert mode, same as pressing insert on the keyboard if present
To save files, press and type :wq followed by .

We start with the network config, edit the interfaces file:
vi /etc/network/interfaces
And place the following content in the file (lo is already there) and save the settings:
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.0.80
gateway 192.168.0.1
netmask 255.255.255.0
network 192.168.0.0

Next is the fstab file, we will only be placing 5 lines here for now, more will be added later for swap and kernel:
vi /etc/fstab
And place the following content in the file:
# Proc
proc /proc proc nodev,noexec,nosuid 0 0
#
# NFS Root filesystem
/dev/nfs / rootfs defaults 0 0

Now we set the hostname for the device, which I’ve left at t5325:
vi /etc/hostname
Remove anything inside the file and place this in the file and save it:
t5325

We also have to create a line for the serial line to be able to use it:
vi /etc/inittab
Add the following line to the inittab file:
S0:23:respawn:/sbin/getty -L ttyS0 115200 vt102

Set up the APT sources list as well:
vi /etc/apt/sources.list
Add the following 2 lines to the sources.list file:
deb http://ftp.nl.debian.org/debian unstable main contrib non-free
deb-src http://ftp.nl.debian.org/debian unstable main contrib non-free

And at last we set the new root password for the system:
passwd root
Enter the required password 2 times to confirm.

The initial setup stage is now finished, we will now continue to the next step where we set the final uBoot settings and can continue the setup process.

Boot the newly installed system
Now that the initial setup is finished, we want to reboot the newly installed system and set the final uBoot parameters for our NFS share.

Reboot the system with:
reboot -f

And interrupt the automatic uBoot boot process when the timer shows up.

We now set the definitive root device for the device, which is:
setenv bootargs console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.76:/exports/t5325,rsize=32768,wsize=32768 tcp init=/sbin/init video=xgifb ip=192.168.0.80:192.168.0.76:192.168.0.1:255.255.255.0:t5325::off
And save the settings:
saveenv

Now load the kernel again:
tftp 0080000 t5325

When the system has finished booting, you should be greeted as follows:

Debian GNU/Linux 7.0 t5325 ttyS0

t5325 login:

You should now be able to login as root with the password that you have set earlier and get a prompt.

Now we will set up the internal flash disk which will be used to store the kernel image and swap space on.

Start the fdisk utility:
fdisk /dev/sda
And delete all partitions on disk:
d1
d2
d3
d4

It may throw up an error about non-existent partitions, these can be ignored!

And create a new partition for the kernel:
n
p
1
[enter]
+32M

Create a partition for the swap space:
n
p
2
[enter]
[enter]

Save the settings with:
w

Now we have to create an ext3 filesystem on the first partition:
mkfs.ext3 /dev/sda1

Mount the partition:
mount /dev/sda1 /boot/

And copy the kernel image to the disk:
cp /uImage /boot/uImage

Make sure everything is synced and unmount the partition:
sync
umount /dev/sda1

Now create some swap space on the 2nd partition:
mkswap /dev/sda2

Now we have to add the following 2 lines to /etc/fstab to use the swap space and kernel partition:
# Mount /boot partition
/dev/sda1 /boot ext3 defaults 0 0
# Swap space on internal flash
/dev/sda2 none swap sw 0 0

Assuming that you want remote access as well, we also install the openssh service, but also update the system:
apt-get update
apt-get upgrade
apt-get install openssh-server

Now SSH is possible as well, leaving the serial console obsolete, in the next steps we will redirect the console output to the screen and can login on the device itself via keyboard on the screen that’s attached to the thin client.

Final uBoot settings:
We now have to set some variables to make sure uBoot loads the kernel from the flash storage and boot the kernel.

setenv run_disk ide reset\; ext2load ide 0:1 00800000 /uImage\; bootm
setenv bootcmd run run_disk

Also, we want the console to be displayed on the attached screen instead of the serial line:
setenv bootargs console=tty1 root=/dev/nfs rw nfsroot=192.168.0.76:/exports/t5325,rsize=32768,wsize=32768 tcp init=/sbin/init video=xgifb ip=192.168.0.80:192.168.0.76:192.168.0.1:255.255.255.0:t5325::off

And save the settings:
saveenv

And reset the device, so it will boot with the new parameters:
reset

Final words:
You now have a working t5325 with it’s root filesystem running on a NFS share, I have tested the optimal settings for NFS as you can see in the rsize/wsize buffers and the use of TCP instead of UDP. The speed that you will get on the machine is fair and a simple write test showed me around 10.8Mb/sec (~90-95Mbits) throughput over the 100Mbit line the t5325 offers.

When the device boots, you will be left with a login prompt from where you can install the rest of the necessary software you need on the system.

Author:Jeffrey Langerak

2 responses to “Use the HP t5325 with rootfs over NFS”

  • Victor 26-04-2014 at 03:30 Reply 

    Hello! Nice post.
    I was playing with a t5325 a while but since I don’t really know Linux booting process and especially Uboot I wasn’t able to customize this thin client to fit my needs.
    Basically I’d like to have a stripped version of Debian with an Xserver installed and no GDM at all and have a rdesktop with given parameters which could start at boot.
    Is this possible to realize on that HP thin client.
    Can you please give me any suggestions or any steps how to do this.

    Thanks in advance

    Vik


  • Ivan D 09-12-2019 at 19:02 Reply 

    upd.: rootfs tarball is now here: https://www.arm-blog.com/downloads/

    Thanks for sharing!


Leave a Reply

Your email address will not be published. Required fields are marked*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.