HowToSetupLTSPDevelEnvironment

Differences between revisions 7 and 8
Revision 7 as of 2007-09-01 19:51:47
Size: 4825
Editor: 198
Comment: adding information about how to boot a virtual terminal
Revision 8 as of 2007-09-01 19:54:23
Size: 4827
Editor: 198
Comment: typo in script
Deletions are marked like this. Additions are marked like this.
Line 93: Line 93:
{{{#!/bin/bash {{{
#!/bin/bash

Introduction

This page is about the procedure to setup a developement environment for LTSP under Ubuntu.

Getting the software

Install the latest release of Ubuntu. Change the file /etc/apt/sources.list to use the development version.

Install software for general developement in Ubuntu :

sudo apt-get install dpkg-dev build-essential patch dh-make debhelper devscripts fakeroot gnupg lintian linda pbuilder debian-policy developers-reference

Then, install build dependencies for ltsp-server :

sudo apt-get build-dep ltsp-server

Build the base client root with the following command :

ltsp-build-client

Manage dev and test environment

To work efficiently, then you can keep two (or more) copies of the client root. The first for the development, and the other for testing purpose.

cp -a /opt/ltsp/i386 /opt/ltsp/i386-dev
cp -a /opt/ltsp/i386 /opt/ltsp/i386-test

Edit the file /etc/ltsp/ltsp-update-image to define the current used root :

CHROOT=i386-dev

Each time something is changed in the client root, squashfs image must be rebuilt. To do it, use the ltsp-update-image command.

Regenerate the initramfs

The initramfs is built from inside the client root. You can build the initramfs with the standard command. Then, initramfs have to be updated on the server.

chroot /opt/ltsp/i386-dev
mkinitramfs -o /boot/initrd.img-2.6.22-8-386 2.6.22-8-386
exit
ltsp-update-kernels

In order to use the dev and test environment when thin-client are booted, the root-path option must be changed, and the dhcp server restarted.

# from /etc/ltsp/dhcpd.conf
  filename "/ltsp/i386-dev/pxelinux.0";
  option root-path "/opt/ltsp/i386-dev";

If you are using vmware under Linux, options are the same, then change the following file (depending on the vmnet number) : /etc/vmware/vmnet8/dhcpd/dhcpd.conf and restart vmware.

Also, notice that a new port is reserved for each client root available in the file /etc/inetd.conf . The port number should be specified manualy in the file pxelinux.cfg/default with the option NBDPORT. Here is an example of the whole line :

DEFAULT vmlinuz ro initrd=initrd.img quiet splash NBDPORT=2001

Using NFS in replacement of NBD

With NBD, every time you change the client root, the squashfs image must be rebuild to apply changes, and the thin-client needs to be rebooted. To speed up development, you can enable NFS root, then changes will be applied immediately. Follow the instructions at the bottom of this page : https://help.ubuntu.com/community/UbuntuLTSP/LTSPWithoutNFS

As of this writing, the configuration file for the boot parameter for nbd is held in the file /usr/share/initramfs-tools/conf.d/ltsp. You can overwride the default configuration by creating a "ltsp" file in /etc/initramfs-tools/conf.d directory.

The order of variable sourcing is as follow :

  1. - /etc/initramfs-tools/initramfs.conf
  2. - /etc/initramfs-tools/conf.d
  3. - /proc/cmdline

Also, by default "most" modules are added into the initramfs. "Most" includes all other categories, including network card drivers, nfs, nbd, unionfs, squashfs, usb and many others.

Setting up virtual terminal with qemu

Say that you are on the road and you want to hack LTSP on the airplane, then you need a virtual terminal. Here is how to do it with qemu, that is able to boot the thin-client kernel and initrd directly.

First, install qemu:  sudo apt-get install qemu 

Then, launch your virtual terminal with this script:

if [ ! -f terminal.img ]; then
qemu-img create terminal.img 10M
fi

sudo qemu -hda terminal.img \
-kernel /var/lib/tftpboot/ltsp/i386/vmlinuz \
-initrd /var/lib/tftpboot/ltsp/i386/initrd.img \
-append "quiet nfsroot=172.20.0.1:/opt/ltsp/i386 ip=172.20.0.2::172.20.0.1:255.255.255.0" \
-net nic,vlan=0 -net tap,vlan=0,ifname=tap0

This script will start a new virtual terminal instance, with defaults parameters. To change IP address, then you will need to adjust this script, and the script /etc/qemu-ifup.

Also, append parameter should be changed if you want to boot with NBD root device.

See the content of the initramfs

To debug initramfs, you may want to see files that it contains. First, copy the initrd.img file to a temp directory. Then, run this command :

zcat initrd.img | cpio -div

Getting the source

Branches are hosted in launchpad : https://code.launchpad.net/ltsp/

In order to create a new branch, create an account on launchpad and upload your ssh public key. Then, you will be able to connect to the bazaar server and create your new branch.


CategoryDocumentation

HowToSetupLTSPDevelEnvironment (last edited 2008-08-06 17:01:32 by localhost)