Posts Tagged ‘install’

Installing the Xilinx Cable Drivers under Ubuntu

Sunday, January 29th, 2012

Each time I install Xilinx ISE under Ubuntu – and that happened a few times in the last months – I wonder how to get the Cable Drivers working so I can program my Spartan3E Starter Board. Although there seems to be an official Linux support, Cable Drivers do not work per default after installation. There’s a very useful link describing the process, and it works really fine for me. I bookmarked it lately and want to share, so other people can find this recipe more easily:

http://www.george-smart.co.uk/wiki/Xilinx_JTAG_Linux

It worked fine with ISE 13.1 and Ubuntu 10.10 for me.

Good luck!

 

How to turn a T-Online S100 Settop Box into a Server

Tuesday, December 1st, 2009

Over at my other posts here and here i described how to turn an IBM Netvista 2200 Netclient into a lowpower server and the problems i had with its “intresting” hardware (no bootloader, usb1.1, …).

After my server was down for a couple of weeks i started to look for a replacement system that consumes little power, is cheap and can run linux nicely. My search brought me to the T-Online S100 Settopbox. It was developed as a PayTV receiver but the program was discontinued so people are getting rid of their boxes. Little do they know that it makes a great server.

Where to get it? Look at Ebay, i got mine for 25Eur which is a good price for this piece of hardware.

The box features:

* 733 Mhz Mobile Celeron CPU
* 128MB Ram
* USB 2.0
* 100Mbit Network
* Power Supply built-in

Since it was used as a TV Box it also features a remote control, cinch sound-out, and various tv (scart, av) outs but no vga out.

So in order to install and configure the server a little hardware modification is useful. If you have a working distribution and know for sure that you can ssh into it once the machine booted, you can change the bios setting to boot from the external usb drive blindly. but since i built my distribution myself thats not part of this posting.

In order to use a monitor you need to build a special VGA cable. The pinlayout is mentioned over at the very useful page zenega-user.de. It states to connect some pins on the vga side, those are GROUND and according to this post you can connect 2,4,6 on the S100 side and 5, 6, 7, 8, 10 on the VGA side.

I soldered the cable and drilled a hole for the connector into the top of the box. Works like a charm. While you have your box open, remove the DOM (Disk on module) from the IDE-Slot.

Next step is to properly set the BIOS. On bootup you can enter the BIOS by pressing the DEL key. Its advised to update the BIOS to the latest (109 means 1.09) version. A local copy of the 109-Rom can be found here, it contains the actual .rom, a dos622 bootdisk image and the amibios updatetool. Password for the archive is: update. This post explains how to update the bios. I used the preinstalled version (107 i think) and updated it later through my linux with flashrom, see below.

When in your BIOS settings, use your keyboard (USB i might add) and cursor over to bootup settings, set “boot into Windows CE” to “no” and select your usbstick (which is attached in the back) as boot device. After saving your settings, the S100 should try to boot from your usbstick.

Now lets prepare the usbstick with a nice operating system. The following steps where executed on an IBM X31 laptop running Ubuntu 9.04 32Bit. You could run a virtual image (Virtualbox/VMWare) on Windows/Mac if you dont have a linux around.

We are going to prepare a Gentoo system for the S100 but until its ready to use we need to work on our buildsystem/hostsystem. If you never worked with Gentoo or a Gentoo install have the Gentoo Handbook open somewhere on the side.

First of all, we will need to download a decent stage3 tarball. So lets create a working directory and go for it. All lines starting with # are executed on your commandline/shell. I would work as superuser (Ubuntu: #sudo su) but its up to you to decide which steps need superrights and which ones can do without.

# mkdir -p /opt/s100gentoo && cd /opt/s100gentoo

Now we are getting the stage3 tarball, select a Mirror from here and look for a recent i686 stage 3 tarball.

# wget -c ftp://gentoo.inode.at/source/releases/x86/autobuilds/current-stage3/stage3-i686-20091124.tar.bz2

After the download finished we need to extract the tarball

# tar xjvpf stage3-i686-*.tar.bz2

Now we have the base of our system in /opt/s100gentoo. In order to install and configure it apropriatly for the S100 we will use an chroot environment. I created a little script which mounts the necessary devices into the environment and cleans up after usage. Edit the file “startGentoo.sh” and put the following contents into it:

#!/bin/bash
cp -L /etc/resolv.conf /opt/s100gentoo/etc/
mount -t proc none /opt/s100gentoo/proc
mount -o bind /dev /opt/s100gentoo/dev
chroot /opt/s100gentoo /bin/bash
umount /opt/s100gentoo/proc
umount /opt/s100gentoo/dev
echo "done"

Now make it executable and start it (root needed)

# chmod +x startGentoo.sh && sudo ./startGentoo.sh

And taadaa, the terminal should have changed to something like

hostname / #

. To distinguish between inputs IN the chroot environment and the hostsystem i will use

c #

for chroot commands and

#

(as used before) for the host system.

First lets configure the chroot system then update the components and finally install userspace applications. Check if you can connect to the internet (ping or something) and if not consult the handbook for tipps.

c # env-update && source /etc/profile

You might want to set a password for the root user, too

c # passwd

Next edit your

/etc/make.conf

according to your needs using your favourite editor (like nano or vim). My make.conf is attached at the end of the post.
Next we will update the portage tree, select a profile (10.0 hardened), update the system and install some useful apps.

c # emerge --sync --quiet
c # emerge -av portage
c # eselect profile set 5
c # emerge -Dav world
c # rc-update add sshd default
c # rc-update add net.eth0 default

The last step will take longer but i happened to come across some Illegal Instructions so recompiling the whole system with the new -march settings is a good idea.
Now its time to install some useful applications. Its up to you what to install, you can look for programs by using

c # emerge --search foo

The following apps are installed on my machine (from the top of my head):

c # emerge -av dhcpcd screen rtorrent lighttpd pciutils usbutils \
libftdi irssi openssh openvpn sudo ccache grub sqlite git subversion \
gentoolkit gitosis php zlib

Some packages might depend on each other so you have to install them seperatly (one first, then the other, play with the USE variable or mask other packages. See handbook).
You need to configure all the packages accordingly, since every system differs this is not part of my tutorial. Configuring /etc/fstab and /etc/conf.d/net is mandatory for the system to boot later.
Next big todo is building a kernel. I attached my 2.6.31 config at the end, it works but might not be the most optimized. In order to build your own kernel you need to get the kernel sources copy my .config there, create a symlink and make it.

c # emerge -av gentoo-sources
c # cd /usr/src/linux-2.6.3*
c # wget https://blog.chris007.de/wp-content/uploads/2009/12/config.txt
c # mv config.txt .config
c # make -j2

I attached my kernel at the end. I tried to build everything necessary into the kernel since im not a big fan of modules. Once the kernel built correctly you need to copy it to your boot directory.

c # cp arch/x86/boot/bzImage /boot/kernel-2.6.31

If you want to use AuFS (like for /usr/portage) to safe some space you need to patch your kernel sources.

c # cd /usr/src/
c # git clone http://git.c3sl.ufpr.br/pub/scm/aufs/aufs2-standalone.git aufs2-standalone.git
c # cd aufs-standalone.git
c # git checkout origin/aufs2-31

Now follow “3. Configuration and Compilation” (apply two patches, copy files to linuxsource, build it with approriate .config) on the official AuFS page. See my /etc/fstab on how to use AuFS.

Another important change is related with the frontpanel leds. To tell them to stop blinking after bootup edit the file /etc/conf.d/local.start which will get executed after bootup and before the userprompt. Put the follwing into it:

# stop the frontleds from blinking
echo "disabling LED blinking"
/bin/stty 38400 cs8 -parenb -cstopb -F /dev/ttyS1
echo -e '\xa2\xb2\xa2\xb2\xa2\xb2' > /dev/ttyS1

If you plan to update the bios from within linux you can install flashrom already via svn:

c # cd /root
c # svn co svn://coreboot.org/flashrom/trunk flashrom
c # cd flashrom
c # make

Later (beeing on your S100 running linux nicely) you can update your BIOS with the following command (assuming you downloaded the BIOS.bin to the current folder):

# flashrom -w BIOS_109.ROM

Make sure it verified ok, if you have questions visit the official page here or ask the nice guys in #flashrom@freenode.

After this step we are ready to prepare the usbstick with our fresh system and test everything. Leave the chroot (exit) and become root (if not already happened). Put the desired usb stick in a free usb port (im using a 4GB usb2.0 stick, costs about 10Eur), see which device it gets mapped to (dmesg and look for /dev/sd*1) and unmount the device if your system automatically mounts it (umount /dev/sdc1). In my case im referring to /dev/sdc as the usb stick and /dev/sdc1 as the first partition on the stick.
CAREFUL ATTENTION DANGER. If you use a wrong device, you might end up with an empty harddrive. Just wanted to mention that all operations are at your own risk
Next we will format the stick using fdisk

# fdisk /dev/sdc

In case there was a partition on the stick, delete it (d, 1) and create a new primary one (n, p, 1,enter, enter, t, 83, enter) and check (p) that the stick contains a partition using the whole space of type linux. Make it bootable (a,1) and write the changes to the stick (w).
Next we will create an ext2 filesystem on the device using an high number of inodes and a small blocksize (because we will be having lots of little files). This step might take a while

# mke2fs -b 1024 -I 128 -L "root" -i 1024 /dev/sdc1

After the filesystem was created we mount the stick to /mnt and copy the filesystem over. You might want to edit your /opt/s100gentoo/boot/grub/menu.lst, mine is attached at the end. The delayroot wait is essential so the kernel can detect the usbstick.

# mount /dev/sdc1 /mnt
# cd /opt/s100gentoo
# rsync -a . /mnt/
# echo '(hd0)  /dev/sdc' > /mnt/boot/grub/device.map
# grub-install --root-directory=/mnt /dev/sdc

Now you should have a bootable usbstick loaded with your own gentoo system and grub installed. Plug it into your S100 and boot it up. Hopefully it will work like a charm and ask you for a username and password. If not, happy debugging.

Because the box only features 128Mb of ram and some buildoperations (like glibc) need a bit more (will throw weird error messages otherwise) i grabbed an old 2GB usbstick (allthough like 256MB would probably suffice) and turned it into swap. I know it will eventually brake because of the limitted amount of write cycles but then again, its like 2eur. Format the stick with fdisk like above but use the type 82 (Linux swap), write changes with “w”. Then use mkswap to make the partition into a swappartition and swapon to actually use it. Change your /etc/fstab accordingly and you should be all set.

Below you will find some links which were useful for me and the output of some commands directly from my server. Also you will find some essential configs.

In case you run into any problems feel free to comment here or contact me directly.

Links:
s100 Linux modification
Flashrom
Zenega Community
AuFS
German site

Files:
/etc/fstab
/boot/kernel-2.6.31
/usr/src/linux/.config
/boot/grub/menu.lst
/etc/make.conf
lspci
top
uname -a
cat /proc/cpuinfo

Using Opentracker – a free, small, fast and powerful tool

Sunday, February 22nd, 2009

What is a tracker in this context? In order to expain that, i need to explain the bittorrent protocoll a little.

Bittorrent as a great and fully legal concept to exchange data. The bad things you hear in the media are cases where people used this concept to exchange data which has copyright on itself.

The principle is quite easy. You install a bittorrent client, download a small file which contains all the necessary data (ending normally .torrent), tell your client to process that information and it will start to transfer files with other people who want or have that file. So if you made your own movie and want to share it, but are short on bandwidth and/or transferlimit you could make a torrent and in the best case have to share the movie once. Then after taking it down, other peers (people who take part in the sharing) will exchange the parts they have and need. So with higher distribution of your file, new leechers (people who download stuff) will face higher availibilty and probably more downspeed.

But how do peers know which others peers have and offer parts? Thats where the tracker joins the game. The tracker is a central point of communcation (its adress is located in the .torrent file, mentioned above) where all clients connect to (via http) and receive information about other clients. There are some so called “open trackers” that allow everybody to announce their files but this article is about the software “opentracker” which allows you to run your own tracker.

In order to get your own tracker you need to download, configure, compile and run the software. All ressources and steps can be found here: opentracker homepage. In short: check out from cvs, edit the Makefile to enable/disable features (for example whitelisting), make, run. You need the libowfat library in order to build opentracker.

Now to run your tracker you need to call the binary. Along can be passed some arguments, that will change its behavior. To tell the tracker to listen on the port 4321 (instead of 6969 by default) and use whitelist.txt as whitelist run:

./opentracker -p 4321 -P 4321 -w whitelist.txt

The file “whitelist.txt” contains the hash of each torrent you want to allow, seperated by a newline.

If you are running your tracker behind a router of firewall, be sure to forward/allow the port you have your tracker listening to.

Opentracker also supports some stats. The URL for stats is

http://trackerdomain:port/stats?mode=

followed by the mode you want to know. It could be: peer, conn, scrp, udp4, busy, torr, fscr, herr, top10, renew, syncs, version, startstop, toraddrem.

This information is taken from ot_http.c at about line 160, look for “static ssize_t http_handle_stats(“. If you want to restrict access to your stats, remove the comment (#) in the Makefile in front of “FEATURES+=-DWANT_RESTRICT_STATS”. Opentracker also supports mrtg for visualisation of statistic data.

To quit opentracker, just kill it (ctrl+c or kill -9 <pid>).

Too bad there is only little to no documentation about this great piece of software. But its so efficient with ressources that even The Pirate Bay uses it for their trackers, and they are the “worlds biggest tracker”.